@bomjan133/react-crud-ui 1.2.21 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-C3of7-QD.cjs → index-CYvgvnp2.cjs} +8 -8
- package/dist/{index-C3of7-QD.cjs.map → index-CYvgvnp2.cjs.map} +1 -1
- package/dist/{index-n6TutDaB.js → index-DITcuqUz.js} +1163 -1155
- package/dist/{index-n6TutDaB.js.map → index-DITcuqUz.js.map} +1 -1
- package/dist/{index-CbD6Ry7P.js → index-FiUFSHk7.js} +2 -2
- package/dist/{index-CbD6Ry7P.js.map → index-FiUFSHk7.js.map} +1 -1
- package/dist/{index-gZlYD4yT.cjs → index-uKpclwqW.cjs} +2 -2
- package/dist/{index-gZlYD4yT.cjs.map → index-uKpclwqW.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -323,7 +323,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
|
|
|
323
323
|
*
|
|
324
324
|
* This source code is licensed under the MIT license found in the
|
|
325
325
|
* LICENSE file in the root directory of this source tree.
|
|
326
|
-
*/var Tf;function oC(){return Tf||(Tf=1,process.env.NODE_ENV!=="production"&&function(){function t(_,S){return _===S&&(_!==0||1/_===1/S)||_!==_&&S!==S}function n(_,S){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var E=S();if(!m){var d=S();o(E,d)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),m=!0)}d=l({inst:{value:E,getSnapshot:S}});var h=d[0].inst,v=d[1];return a(function(){h.value=E,h.getSnapshot=S,r(h)&&v({inst:h})},[_,E,S]),c(function(){return r(h)&&v({inst:h}),_(function(){r(h)&&v({inst:h})})},[_]),f(E),E}function r(_){var S=_.getSnapshot;_=_.value;try{var E=S();return!o(_,E)}catch{return!0}}function i(_,S){return S()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=V,o=typeof Object.is=="function"?Object.is:t,l=s.useState,c=s.useEffect,a=s.useLayoutEffect,f=s.useDebugValue,u=!1,m=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?i:n;ec.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ec}process.env.NODE_ENV==="production"?qc.exports=sC():qc.exports=oC();var aC=qc.exports;function lC(){return aC.useSyncExternalStore(cC,()=>!0,()=>!1)}function cC(){return()=>{}}var iu="Avatar",[uC]=rC(iu),[dC,_g]=uC(iu),Sg=C.forwardRef((t,n)=>{const{__scopeAvatar:r,...i}=t,[s,o]=C.useState("idle");return p.jsx(dC,{scope:r,imageLoadingStatus:s,onImageLoadingStatusChange:o,children:p.jsx(Qs.span,{...i,ref:n})})});Sg.displayName=iu;var kg="AvatarImage",Eg=C.forwardRef((t,n)=>{const{__scopeAvatar:r,src:i,onLoadingStatusChange:s=()=>{},...o}=t,l=_g(kg,r),c=fC(i,o),a=Qt(f=>{s(f),l.onImageLoadingStatusChange(f)});return qt(()=>{c!=="idle"&&a(c)},[c,a]),c==="loaded"?p.jsx(Qs.img,{...o,ref:n,src:i}):null});Eg.displayName=kg;var Tg="AvatarFallback",Ng=C.forwardRef((t,n)=>{const{__scopeAvatar:r,delayMs:i,...s}=t,o=_g(Tg,r),[l,c]=C.useState(i===void 0);return C.useEffect(()=>{if(i!==void 0){const a=window.setTimeout(()=>c(!0),i);return()=>window.clearTimeout(a)}},[i]),l&&o.imageLoadingStatus!=="loaded"?p.jsx(Qs.span,{...s,ref:n}):null});Ng.displayName=Tg;function Nf(t,n){return t?n?(t.src!==n&&(t.src=n),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function fC(t,{referrerPolicy:n,crossOrigin:r}){const i=lC(),s=C.useRef(null),o=i?(s.current||(s.current=new window.Image),s.current):null,[l,c]=C.useState(()=>Nf(o,t));return qt(()=>{c(Nf(o,t))},[o,t]),qt(()=>{const a=m=>()=>{c(m)};if(!o)return;const f=a("loaded"),u=a("error");return o.addEventListener("load",f),o.addEventListener("error",u),n&&(o.referrerPolicy=n),typeof r=="string"&&(o.crossOrigin=r),()=>{o.removeEventListener("load",f),o.removeEventListener("error",u)}},[o,r,n]),l}var Mg=Sg,Ag=Eg,Dg=Ng;const su=C.forwardRef(({className:t,...n},r)=>p.jsx(Mg,{ref:r,className:Q("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...n}));su.displayName=Mg.displayName;const ou=C.forwardRef(({className:t,...n},r)=>p.jsx(Ag,{ref:r,className:Q("aspect-square h-full w-full",t),...n}));ou.displayName=Ag.displayName;const au=C.forwardRef(({className:t,...n},r)=>p.jsx(Dg,{ref:r,className:Q("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...n}));au.displayName=Dg.displayName;function hC(t,n=[]){let r=[];function i(o,l){const c=C.createContext(l),a=r.length;r=[...r,l];const f=m=>{var h;const{scope:y,children:_,...S}=m,E=((h=y==null?void 0:y[t])==null?void 0:h[a])||c,d=C.useMemo(()=>S,Object.values(S));return p.jsx(E.Provider,{value:d,children:_})};f.displayName=o+"Provider";function u(m,y){var E;const _=((E=y==null?void 0:y[t])==null?void 0:E[a])||c,S=C.useContext(_);if(S)return S;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[f,u]}const s=()=>{const o=r.map(l=>C.createContext(l));return function(c){const a=(c==null?void 0:c[t])||o;return C.useMemo(()=>({[`__scope${t}`]:{...c,[t]:a}}),[c,a])}};return s.scopeName=t,[i,mC(s,...n)]}function mC(...t){const n=t[0];if(t.length===1)return n;const r=()=>{const i=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const l=i.reduce((c,{useScope:a,scopeName:f})=>{const m=a(o)[`__scope${f}`];return{...c,...m}},{});return C.useMemo(()=>({[`__scope${n.scopeName}`]:l}),[l])}};return r.scopeName=n.scopeName,r}function pC(t){const n=gC(t),r=C.forwardRef((i,s)=>{const{children:o,...l}=i,c=C.Children.toArray(o),a=c.find(bC);if(a){const f=a.props.children,u=c.map(m=>m===a?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:m);return p.jsx(n,{...l,ref:s,children:C.isValidElement(f)?C.cloneElement(f,void 0,u):null})}return p.jsx(n,{...l,ref:s,children:o})});return r.displayName=`${t}.Slot`,r}function gC(t){const n=C.forwardRef((r,i)=>{const{children:s,...o}=r;if(C.isValidElement(s)){const l=xC(s),c=yC(o,s.props);return s.type!==C.Fragment&&(c.ref=i?zt(i,l):l),C.cloneElement(s,c)}return C.Children.count(s)>1?C.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Rg=Symbol("radix.slottable");function vC(t){const n=({children:r})=>p.jsx(p.Fragment,{children:r});return n.displayName=`${t}.Slottable`,n.__radixId=Rg,n}function bC(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Rg}function yC(t,n){const r={...n};for(const i in n){const s=t[i],o=n[i];/^on[A-Z]/.test(i)?s&&o?r[i]=(...c)=>{const a=o(...c);return s(...c),a}:s&&(r[i]=s):i==="style"?r[i]={...s,...o}:i==="className"&&(r[i]=[s,o].filter(Boolean).join(" "))}return{...t,...r}}function xC(t){var i,s;let n=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var wC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],CC=wC.reduce((t,n)=>{const r=pC(`Primitive.${n}`),i=C.forwardRef((s,o)=>{const{asChild:l,...c}=s,a=l?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...c,ref:o})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{}),[nl]=hC("Tooltip",[li]),rl=li(),Pg="TooltipProvider",_C=700,Yc="tooltip.open",[SC,lu]=nl(Pg),Lg=t=>{const{__scopeTooltip:n,delayDuration:r=_C,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:o}=t,l=C.useRef(!0),c=C.useRef(!1),a=C.useRef(0);return C.useEffect(()=>{const f=a.current;return()=>window.clearTimeout(f)},[]),p.jsx(SC,{scope:n,isOpenDelayedRef:l,delayDuration:r,onOpen:C.useCallback(()=>{window.clearTimeout(a.current),l.current=!1},[]),onClose:C.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(()=>l.current=!0,i)},[i]),isPointerInTransitRef:c,onPointerInTransitChange:C.useCallback(f=>{c.current=f},[]),disableHoverableContent:s,children:o})};Lg.displayName=Pg;var Ws="Tooltip",[kC,il]=nl(Ws),Ig=t=>{const{__scopeTooltip:n,children:r,open:i,defaultOpen:s,onOpenChange:o,disableHoverableContent:l,delayDuration:c}=t,a=lu(Ws,t.__scopeTooltip),f=rl(n),[u,m]=C.useState(null),y=un(),_=C.useRef(0),S=l??a.disableHoverableContent,E=c??a.delayDuration,d=C.useRef(!1),[h,v]=zn({prop:i,defaultProp:s??!1,onChange:k=>{k?(a.onOpen(),document.dispatchEvent(new CustomEvent(Yc))):a.onClose(),o==null||o(k)},caller:Ws}),x=C.useMemo(()=>h?d.current?"delayed-open":"instant-open":"closed",[h]),g=C.useCallback(()=>{window.clearTimeout(_.current),_.current=0,d.current=!1,v(!0)},[v]),b=C.useCallback(()=>{window.clearTimeout(_.current),_.current=0,v(!1)},[v]),w=C.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{d.current=!0,v(!0),_.current=0},E)},[E,v]);return C.useEffect(()=>()=>{_.current&&(window.clearTimeout(_.current),_.current=0)},[]),p.jsx(ro,{...f,children:p.jsx(kC,{scope:n,contentId:y,open:h,stateAttribute:x,trigger:u,onTriggerChange:m,onTriggerEnter:C.useCallback(()=>{a.isOpenDelayedRef.current?w():g()},[a.isOpenDelayedRef,w,g]),onTriggerLeave:C.useCallback(()=>{S?b():(window.clearTimeout(_.current),_.current=0)},[b,S]),onOpen:g,onClose:b,disableHoverableContent:S,children:r})})};Ig.displayName=Ws;var Gc="TooltipTrigger",Og=C.forwardRef((t,n)=>{const{__scopeTooltip:r,...i}=t,s=il(Gc,r),o=lu(Gc,r),l=rl(r),c=C.useRef(null),a=st(n,c,s.onTriggerChange),f=C.useRef(!1),u=C.useRef(!1),m=C.useCallback(()=>f.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),p.jsx(io,{asChild:!0,...l,children:p.jsx(CC.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:a,onPointerMove:Me(t.onPointerMove,y=>{y.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:Me(t.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:Me(t.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Me(t.onFocus,()=>{f.current||s.onOpen()}),onBlur:Me(t.onBlur,s.onClose),onClick:Me(t.onClick,s.onClose)})})});Og.displayName=Gc;var EC="TooltipPortal",[rL,TC]=nl(EC,{forceMount:void 0}),as="TooltipContent",Bg=C.forwardRef((t,n)=>{const r=TC(as,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...o}=t,l=il(as,t.__scopeTooltip);return p.jsx(nn,{present:i||l.open,children:l.disableHoverableContent?p.jsx(zg,{side:s,...o,ref:n}):p.jsx(NC,{side:s,...o,ref:n})})}),NC=C.forwardRef((t,n)=>{const r=il(as,t.__scopeTooltip),i=lu(as,t.__scopeTooltip),s=C.useRef(null),o=st(n,s),[l,c]=C.useState(null),{trigger:a,onClose:f}=r,u=s.current,{onPointerInTransitChange:m}=i,y=C.useCallback(()=>{c(null),m(!1)},[m]),_=C.useCallback((S,E)=>{const d=S.currentTarget,h={x:S.clientX,y:S.clientY},v=PC(h,d.getBoundingClientRect()),x=LC(h,v),g=IC(E.getBoundingClientRect()),b=BC([...x,...g]);c(b),m(!0)},[m]);return C.useEffect(()=>()=>y(),[y]),C.useEffect(()=>{if(a&&u){const S=d=>_(d,u),E=d=>_(d,a);return a.addEventListener("pointerleave",S),u.addEventListener("pointerleave",E),()=>{a.removeEventListener("pointerleave",S),u.removeEventListener("pointerleave",E)}}},[a,u,_,y]),C.useEffect(()=>{if(l){const S=E=>{const d=E.target,h={x:E.clientX,y:E.clientY},v=(a==null?void 0:a.contains(d))||(u==null?void 0:u.contains(d)),x=!OC(h,l);v?y():x&&(y(),f())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[a,u,l,f,y]),p.jsx(zg,{...t,ref:o})}),[MC,AC]=nl(Ws,{isInside:!1}),DC=vC("TooltipContent"),zg=C.forwardRef((t,n)=>{const{__scopeTooltip:r,children:i,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:l,...c}=t,a=il(as,r),f=rl(r),{onClose:u}=a;return C.useEffect(()=>(document.addEventListener(Yc,u),()=>document.removeEventListener(Yc,u)),[u]),C.useEffect(()=>{if(a.trigger){const m=y=>{const _=y.target;_!=null&&_.contains(a.trigger)&&u()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[a.trigger,u]),p.jsx(vs,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:m=>m.preventDefault(),onDismiss:u,children:p.jsxs(za,{"data-state":a.stateAttribute,...f,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(DC,{children:i}),p.jsx(MC,{scope:r,isInside:!0,children:p.jsx(V6,{id:a.contentId,role:"tooltip",children:s||i})})]})})});Bg.displayName=as;var jg="TooltipArrow",RC=C.forwardRef((t,n)=>{const{__scopeTooltip:r,...i}=t,s=rl(r);return AC(jg,r).isInside?null:p.jsx(ja,{...s,...i,ref:n})});RC.displayName=jg;function PC(t,n){const r=Math.abs(n.top-t.y),i=Math.abs(n.bottom-t.y),s=Math.abs(n.right-t.x),o=Math.abs(n.left-t.x);switch(Math.min(r,i,s,o)){case o:return"left";case s:return"right";case r:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function LC(t,n,r=5){const i=[];switch(n){case"top":i.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":i.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":i.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":i.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return i}function IC(t){const{top:n,right:r,bottom:i,left:s}=t;return[{x:s,y:n},{x:r,y:n},{x:r,y:i},{x:s,y:i}]}function OC(t,n){const{x:r,y:i}=t;let s=!1;for(let o=0,l=n.length-1;o<n.length;l=o++){const c=n[o],a=n[l],f=c.x,u=c.y,m=a.x,y=a.y;u>i!=y>i&&r<(m-f)*(i-u)/(y-u)+f&&(s=!s)}return s}function BC(t){const n=t.slice();return n.sort((r,i)=>r.x<i.x?-1:r.x>i.x?1:r.y<i.y?-1:r.y>i.y?1:0),zC(n)}function zC(t){if(t.length<=1)return t.slice();const n=[];for(let i=0;i<t.length;i++){const s=t[i];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}n.pop();const r=[];for(let i=t.length-1;i>=0;i--){const s=t[i];for(;r.length>=2;){const o=r[r.length-1],l=r[r.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.y-l.y)*(s.x-l.x))r.pop();else break}r.push(s)}return r.pop(),n.length===1&&r.length===1&&n[0].x===r[0].x&&n[0].y===r[0].y?n:n.concat(r)}var jC=Lg,FC=Ig,HC=Og,Fg=Bg;const cu=jC,sl=FC,ol=HC,uo=C.forwardRef(({className:t,sideOffset:n=4,...r},i)=>p.jsx(Fg,{ref:i,sideOffset:n,className:Q("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));uo.displayName=Fg.displayName;function $C(t,n=[]){let r=[];function i(o,l){const c=C.createContext(l),a=r.length;r=[...r,l];const f=m=>{var h;const{scope:y,children:_,...S}=m,E=((h=y==null?void 0:y[t])==null?void 0:h[a])||c,d=C.useMemo(()=>S,Object.values(S));return p.jsx(E.Provider,{value:d,children:_})};f.displayName=o+"Provider";function u(m,y){var E;const _=((E=y==null?void 0:y[t])==null?void 0:E[a])||c,S=C.useContext(_);if(S)return S;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[f,u]}const s=()=>{const o=r.map(l=>C.createContext(l));return function(c){const a=(c==null?void 0:c[t])||o;return C.useMemo(()=>({[`__scope${t}`]:{...c,[t]:a}}),[c,a])}};return s.scopeName=t,[i,VC(s,...n)]}function VC(...t){const n=t[0];if(t.length===1)return n;const r=()=>{const i=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const l=i.reduce((c,{useScope:a,scopeName:f})=>{const m=a(o)[`__scope${f}`];return{...c,...m}},{});return C.useMemo(()=>({[`__scope${n.scopeName}`]:l}),[l])}};return r.scopeName=n.scopeName,r}function Hg(t){const n=WC(t),r=C.forwardRef((i,s)=>{const{children:o,...l}=i,c=C.Children.toArray(o),a=c.find(qC);if(a){const f=a.props.children,u=c.map(m=>m===a?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:m);return p.jsx(n,{...l,ref:s,children:C.isValidElement(f)?C.cloneElement(f,void 0,u):null})}return p.jsx(n,{...l,ref:s,children:o})});return r.displayName=`${t}.Slot`,r}function WC(t){const n=C.forwardRef((r,i)=>{const{children:s,...o}=r;if(C.isValidElement(s)){const l=GC(s),c=YC(o,s.props);return s.type!==C.Fragment&&(c.ref=i?zt(i,l):l),C.cloneElement(s,c)}return C.Children.count(s)>1?C.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var UC=Symbol("radix.slottable");function qC(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===UC}function YC(t,n){const r={...n};for(const i in n){const s=t[i],o=n[i];/^on[A-Z]/.test(i)?s&&o?r[i]=(...c)=>{const a=o(...c);return s(...c),a}:s&&(r[i]=s):i==="style"?r[i]={...s,...o}:i==="className"&&(r[i]=[s,o].filter(Boolean).join(" "))}return{...t,...r}}function GC(t){var i,s;let n=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var ZC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$g=ZC.reduce((t,n)=>{const r=Hg(`Primitive.${n}`),i=C.forwardRef((s,o)=>{const{asChild:l,...c}=s,a=l?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...c,ref:o})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{}),al="Popover",[Vg]=$C(al,[li]),fo=li(),[XC,di]=Vg(al),Wg=t=>{const{__scopePopover:n,children:r,open:i,defaultOpen:s,onOpenChange:o,modal:l=!1}=t,c=fo(n),a=C.useRef(null),[f,u]=C.useState(!1),[m,y]=zn({prop:i,defaultProp:s??!1,onChange:o,caller:al});return p.jsx(ro,{...c,children:p.jsx(XC,{scope:n,contentId:un(),triggerRef:a,open:m,onOpenChange:y,onOpenToggle:C.useCallback(()=>y(_=>!_),[y]),hasCustomAnchor:f,onCustomAnchorAdd:C.useCallback(()=>u(!0),[]),onCustomAnchorRemove:C.useCallback(()=>u(!1),[]),modal:l,children:r})})};Wg.displayName=al;var Ug="PopoverAnchor",KC=C.forwardRef((t,n)=>{const{__scopePopover:r,...i}=t,s=di(Ug,r),o=fo(r),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return C.useEffect(()=>(l(),()=>c()),[l,c]),p.jsx(io,{...o,...i,ref:n})});KC.displayName=Ug;var qg="PopoverTrigger",Yg=C.forwardRef((t,n)=>{const{__scopePopover:r,...i}=t,s=di(qg,r),o=fo(r),l=st(n,s.triggerRef),c=p.jsx($g.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Qg(s.open),...i,ref:l,onClick:Me(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:p.jsx(io,{asChild:!0,...o,children:c})});Yg.displayName=qg;var uu="PopoverPortal",[QC,JC]=Vg(uu,{forceMount:void 0}),Gg=t=>{const{__scopePopover:n,forceMount:r,children:i,container:s}=t,o=di(uu,n);return p.jsx(QC,{scope:n,forceMount:r,children:p.jsx(nn,{present:r||o.open,children:p.jsx(so,{asChild:!0,container:s,children:i})})})};Gg.displayName=uu;var ls="PopoverContent",Zg=C.forwardRef((t,n)=>{const r=JC(ls,t.__scopePopover),{forceMount:i=r.forceMount,...s}=t,o=di(ls,t.__scopePopover);return p.jsx(nn,{present:i||o.open,children:o.modal?p.jsx(t_,{...s,ref:n}):p.jsx(n_,{...s,ref:n})})});Zg.displayName=ls;var e_=Hg("PopoverContent.RemoveScroll"),t_=C.forwardRef((t,n)=>{const r=di(ls,t.__scopePopover),i=C.useRef(null),s=st(n,i),o=C.useRef(!1);return C.useEffect(()=>{const l=i.current;if(l)return Fa(l)},[]),p.jsx(oo,{as:e_,allowPinchZoom:!0,children:p.jsx(Xg,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Me(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),o.current||(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Me(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,a=c.button===0&&c.ctrlKey===!0,f=c.button===2||a;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Me(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),n_=C.forwardRef((t,n)=>{const r=di(ls,t.__scopePopover),i=C.useRef(!1),s=C.useRef(!1);return p.jsx(Xg,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,c;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(i.current||(c=r.triggerRef.current)==null||c.focus(),o.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:o=>{var a,f;(a=t.onInteractOutside)==null||a.call(t,o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=o.target;((f=r.triggerRef.current)==null?void 0:f.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),Xg=C.forwardRef((t,n)=>{const{__scopePopover:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:a,onFocusOutside:f,onInteractOutside:u,...m}=t,y=di(ls,r),_=fo(r);return Pa(),p.jsx(to,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:o,children:p.jsx(vs,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:a,onFocusOutside:f,onDismiss:()=>y.onOpenChange(!1),children:p.jsx(za,{"data-state":Qg(y.open),role:"dialog",id:y.contentId,..._,...m,ref:n,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Kg="PopoverClose",r_=C.forwardRef((t,n)=>{const{__scopePopover:r,...i}=t,s=di(Kg,r);return p.jsx($g.button,{type:"button",...i,ref:n,onClick:Me(t.onClick,()=>s.onOpenChange(!1))})});r_.displayName=Kg;var i_="PopoverArrow",s_=C.forwardRef((t,n)=>{const{__scopePopover:r,...i}=t,s=fo(r);return p.jsx(ja,{...s,...i,ref:n})});s_.displayName=i_;function Qg(t){return t?"open":"closed"}var o_=Wg,a_=Yg,l_=Gg,Jg=Zg;const du=o_,fu=a_,ll=C.forwardRef(({className:t,align:n="center",sideOffset:r=4,...i},s)=>p.jsx(l_,{children:p.jsx(Jg,{ref:s,align:n,sideOffset:r,className:Q("pointer-events-auto z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...i})}));ll.displayName=Jg.displayName;function c_(t,n,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:r}).format(n).split(/\s/g).slice(2).join(" ")}const tc={},Is={};function wi(t,n){try{const i=(tc[t]||(tc[t]=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format))(n).split("GMT")[1];return i in Is?Is[i]:Mf(i,i.split(":"))}catch{if(t in Is)return Is[t];const r=t==null?void 0:t.match(u_);return r?Mf(t,r.slice(1)):NaN}}const u_=/([+-]\d\d):?(\d\d)?/;function Mf(t,n){const r=+(n[0]||0),i=+(n[1]||0),s=+(n[2]||0)/60;return Is[t]=r*60+i>0?r*60+i+s:r*60-i-s}class pr extends Date{constructor(...n){super(),n.length>1&&typeof n[n.length-1]=="string"&&(this.timeZone=n.pop()),this.internal=new Date,isNaN(wi(this.timeZone,this))?this.setTime(NaN):n.length?typeof n[0]=="number"&&(n.length===1||n.length===2&&typeof n[1]!="number")?this.setTime(n[0]):typeof n[0]=="string"?this.setTime(+new Date(n[0])):n[0]instanceof Date?this.setTime(+n[0]):(this.setTime(+new Date(...n)),e2(this),Zc(this)):this.setTime(Date.now())}static tz(n,...r){return r.length?new pr(...r,n):new pr(Date.now(),n)}withTimeZone(n){return new pr(+this,n)}getTimezoneOffset(){const n=-wi(this.timeZone,this);return n>0?Math.floor(n):Math.ceil(n)}setTime(n){return Date.prototype.setTime.apply(this,arguments),Zc(this),+this}[Symbol.for("constructDateFrom")](n){return new pr(+new Date(n),this.timeZone)}}const Af=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!Af.test(t))return;const n=t.replace(Af,"$1UTC");pr.prototype[n]&&(t.startsWith("get")?pr.prototype[t]=function(){return this.internal[n]()}:(pr.prototype[t]=function(){return Date.prototype[n].apply(this.internal,arguments),d_(this),+this},pr.prototype[n]=function(){return Date.prototype[n].apply(this,arguments),Zc(this),+this}))});function Zc(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-wi(t.timeZone,t)*60))}function d_(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),e2(t)}function e2(t){const n=wi(t.timeZone,t),r=n>0?Math.floor(n):Math.ceil(n),i=new Date(+t);i.setUTCHours(i.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),o=-new Date(+i).getTimezoneOffset(),l=s-o,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const a=s-r;a&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+a);const f=new Date(+t);f.setUTCSeconds(0);const u=s>0?f.getSeconds():(f.getSeconds()-60)%60,m=Math.round(-(wi(t.timeZone,t)*60))%60;(m||u)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+u));const y=wi(t.timeZone,t),_=y>0?Math.floor(y):Math.ceil(y),E=-new Date(+t).getTimezoneOffset()-_,d=_!==r,h=E-a;if(d&&h){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+h);const v=wi(t.timeZone,t),x=v>0?Math.floor(v):Math.ceil(v),g=_-x;g&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+g),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+g))}}class rn extends pr{static tz(n,...r){return r.length?new rn(...r,n):new rn(Date.now(),n)}toISOString(){const[n,r,i]=this.tzComponents(),s=`${n}${r}:${i}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[n,r,i,s]=this.internal.toUTCString().split(" ");return`${n==null?void 0:n.slice(0,-1)} ${i} ${r} ${s}`}toTimeString(){const n=this.internal.toUTCString().split(" ")[4],[r,i,s]=this.tzComponents();return`${n} GMT${r}${i}${s} (${c_(this.timeZone,this)})`}toLocaleString(n,r){return Date.prototype.toLocaleString.call(this,n,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleDateString(n,r){return Date.prototype.toLocaleDateString.call(this,n,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleTimeString(n,r){return Date.prototype.toLocaleTimeString.call(this,n,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}tzComponents(){const n=this.getTimezoneOffset(),r=n>0?"-":"+",i=String(Math.floor(Math.abs(n)/60)).padStart(2,"0"),s=String(Math.abs(n)%60).padStart(2,"0");return[r,i,s]}withTimeZone(n){return new rn(+this,n)}[Symbol.for("constructDateFrom")](n){return new rn(+new Date(n),this.timeZone)}}const t2=6048e5,f_=864e5,h_=6e4,m_=36e5,p_=1e3,Df=Symbol.for("constructDateFrom");function _t(t,n){return typeof t=="function"?t(n):t&&typeof t=="object"&&Df in t?t[Df](n):t instanceof Date?new t.constructor(n):new Date(n)}function dt(t,n){return _t(n||t,t)}function ho(t,n,r){const i=dt(t,r==null?void 0:r.in);return isNaN(n)?_t((r==null?void 0:r.in)||t,NaN):(n&&i.setDate(i.getDate()+n),i)}function Si(t,n,r){const i=dt(t,r==null?void 0:r.in);if(isNaN(n))return _t(t,NaN);if(!n)return i;const s=i.getDate(),o=_t(t,i.getTime());o.setMonth(i.getMonth()+n+1,0);const l=o.getDate();return s>=l?o:(i.setFullYear(o.getFullYear(),o.getMonth(),s),i)}let g_={};function Ri(){return g_}function rr(t,n){var c,a,f,u;const r=Ri(),i=(n==null?void 0:n.weekStartsOn)??((a=(c=n==null?void 0:n.locale)==null?void 0:c.options)==null?void 0:a.weekStartsOn)??r.weekStartsOn??((u=(f=r.locale)==null?void 0:f.options)==null?void 0:u.weekStartsOn)??0,s=dt(t,n==null?void 0:n.in),o=s.getDay(),l=(o<i?7:0)+o-i;return s.setDate(s.getDate()-l),s.setHours(0,0,0,0),s}function Mi(t,n){return rr(t,{...n,weekStartsOn:1})}function n2(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getFullYear(),s=_t(r,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=Mi(s),l=_t(r,0);l.setFullYear(i,0,4),l.setHours(0,0,0,0);const c=Mi(l);return r.getTime()>=o.getTime()?i+1:r.getTime()>=c.getTime()?i:i-1}function ca(t){const n=dt(t),r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return r.setUTCFullYear(n.getFullYear()),+t-+r}function ws(t,...n){const r=_t.bind(null,n.find(i=>typeof i=="object"));return n.map(r)}function Us(t,n){const r=dt(t,n==null?void 0:n.in);return r.setHours(0,0,0,0),r}function hu(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n),o=Us(i),l=Us(s),c=+o-ca(o),a=+l-ca(l);return Math.round((c-a)/f_)}function v_(t,n){const r=n2(t,n),i=_t(t,0);return i.setFullYear(r,0,4),i.setHours(0,0,0,0),Mi(i)}function b_(t,n,r){return Si(t,n*3,r)}function y_(t,n,r){return ho(t,n*7,r)}function r2(t,n,r){return Si(t,n*12,r)}function x_(t,n){let r,i=n==null?void 0:n.in;return t.forEach(s=>{!i&&typeof s=="object"&&(i=_t.bind(null,s));const o=dt(s,i);(!r||r<o||isNaN(+o))&&(r=o)}),_t(i,r||NaN)}function w_(t,n){let r,i=n==null?void 0:n.in;return t.forEach(s=>{!i&&typeof s=="object"&&(i=_t.bind(null,s));const o=dt(s,i);(!r||r>o||isNaN(+o))&&(r=o)}),_t(i,r||NaN)}function C_(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n);return+Us(i)==+Us(s)}function i2(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function s2(t){return!(!i2(t)&&typeof t!="number"||isNaN(+dt(t)))}function o2(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n),o=i.getFullYear()-s.getFullYear(),l=i.getMonth()-s.getMonth();return o*12+l}function Xc(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function a2(t,n){const[r,i]=ws(t,n.start,n.end);return{start:r,end:i}}function __(t,n){const{start:r,end:i}=a2(n==null?void 0:n.in,t);let s=+r>+i;const o=s?+r:+i,l=s?i:r;l.setHours(0,0,0,0),l.setDate(1);let c=1;const a=[];for(;+l<=o;)a.push(_t(r,l)),l.setMonth(l.getMonth()+c);return s?a.reverse():a}function Rf(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getMonth(),s=i-i%3;return r.setMonth(s,1),r.setHours(0,0,0,0),r}function Ui(t,n){const r=dt(t,n==null?void 0:n.in);return r.setDate(1),r.setHours(0,0,0,0),r}function Kc(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getFullYear();return r.setFullYear(i+1,0,0),r.setHours(23,59,59,999),r}function ua(t,n){const r=dt(t,n==null?void 0:n.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function S_(t,n){const{start:r,end:i}=a2(n==null?void 0:n.in,t);let s=+r>+i;const o=s?+r:+i,l=s?i:r;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const a=[];for(;+l<=o;)a.push(_t(r,l)),l.setFullYear(l.getFullYear()+c);return s?a.reverse():a}function da(t,n){var c,a,f,u;const r=Ri(),i=(n==null?void 0:n.weekStartsOn)??((a=(c=n==null?void 0:n.locale)==null?void 0:c.options)==null?void 0:a.weekStartsOn)??r.weekStartsOn??((u=(f=r.locale)==null?void 0:f.options)==null?void 0:u.weekStartsOn)??0,s=dt(t,n==null?void 0:n.in),o=s.getDay(),l=(o<i?-7:0)+6-(o-i);return s.setDate(s.getDate()+l),s.setHours(23,59,59,999),s}function k_(t,n){return da(t,{...n,weekStartsOn:1})}function Pf(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getMonth(),s=i-i%3+3;return r.setMonth(s,0),r.setHours(23,59,59,999),r}const E_={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},T_=(t,n,r)=>{let i;const s=E_[t];return typeof s=="string"?i=s:n===1?i=s.one:i=s.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+i:i+" ago":i};function nc(t){return(n={})=>{const r=n.width?String(n.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const N_={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},M_={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},A_={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},D_={date:nc({formats:N_,defaultWidth:"full"}),time:nc({formats:M_,defaultWidth:"full"}),dateTime:nc({formats:A_,defaultWidth:"full"})},R_={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},P_=(t,n,r,i)=>R_[t];function Ns(t){return(n,r)=>{const i=r!=null&&r.context?String(r.context):"standalone";let s;if(i==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=r!=null&&r.width?String(r.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=r!=null&&r.width?String(r.width):t.defaultWidth;s=t.values[c]||t.values[l]}const o=t.argumentCallback?t.argumentCallback(n):n;return s[o]}}const L_={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},I_={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},O_={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},B_={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},z_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},j_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},F_=(t,n)=>{const r=Number(t),i=r%100;if(i>20||i<10)switch(i%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},H_={ordinalNumber:F_,era:Ns({values:L_,defaultWidth:"wide"}),quarter:Ns({values:I_,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ns({values:O_,defaultWidth:"wide"}),day:Ns({values:B_,defaultWidth:"wide"}),dayPeriod:Ns({values:z_,defaultWidth:"wide",formattingValues:j_,defaultFormattingWidth:"wide"})};function Ms(t){return(n,r={})=>{const i=r.width,s=i&&t.matchPatterns[i]||t.matchPatterns[t.defaultMatchWidth],o=n.match(s);if(!o)return null;const l=o[0],c=i&&t.parsePatterns[i]||t.parsePatterns[t.defaultParseWidth],a=Array.isArray(c)?V_(c,m=>m.test(l)):$_(c,m=>m.test(l));let f;f=t.valueCallback?t.valueCallback(a):a,f=r.valueCallback?r.valueCallback(f):f;const u=n.slice(l.length);return{value:f,rest:u}}}function $_(t,n){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n(t[r]))return r}function V_(t,n){for(let r=0;r<t.length;r++)if(n(t[r]))return r}function W_(t){return(n,r={})=>{const i=n.match(t.matchPattern);if(!i)return null;const s=i[0],o=n.match(t.parsePattern);if(!o)return null;let l=t.valueCallback?t.valueCallback(o[0]):o[0];l=r.valueCallback?r.valueCallback(l):l;const c=n.slice(s.length);return{value:l,rest:c}}}const U_=/^(\d+)(th|st|nd|rd)?/i,q_=/\d+/i,Y_={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},G_={any:[/^b/i,/^(a|c)/i]},Z_={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},X_={any:[/1/i,/2/i,/3/i,/4/i]},K_={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Q_={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},J_={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},eS={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},tS={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},nS={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},rS={ordinalNumber:W_({matchPattern:U_,parsePattern:q_,valueCallback:t=>parseInt(t,10)}),era:Ms({matchPatterns:Y_,defaultMatchWidth:"wide",parsePatterns:G_,defaultParseWidth:"any"}),quarter:Ms({matchPatterns:Z_,defaultMatchWidth:"wide",parsePatterns:X_,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ms({matchPatterns:K_,defaultMatchWidth:"wide",parsePatterns:Q_,defaultParseWidth:"any"}),day:Ms({matchPatterns:J_,defaultMatchWidth:"wide",parsePatterns:eS,defaultParseWidth:"any"}),dayPeriod:Ms({matchPatterns:tS,defaultMatchWidth:"any",parsePatterns:nS,defaultParseWidth:"any"})},xi={code:"en-US",formatDistance:T_,formatLong:D_,formatRelative:P_,localize:H_,match:rS,options:{weekStartsOn:0,firstWeekContainsDate:1}};function iS(t,n){const r=dt(t,n==null?void 0:n.in);return hu(r,ua(r))+1}function cl(t,n){const r=dt(t,n==null?void 0:n.in),i=+Mi(r)-+v_(r);return Math.round(i/t2)+1}function mu(t,n){var u,m,y,_;const r=dt(t,n==null?void 0:n.in),i=r.getFullYear(),s=Ri(),o=(n==null?void 0:n.firstWeekContainsDate)??((m=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??s.firstWeekContainsDate??((_=(y=s.locale)==null?void 0:y.options)==null?void 0:_.firstWeekContainsDate)??1,l=_t((n==null?void 0:n.in)||t,0);l.setFullYear(i+1,0,o),l.setHours(0,0,0,0);const c=rr(l,n),a=_t((n==null?void 0:n.in)||t,0);a.setFullYear(i,0,o),a.setHours(0,0,0,0);const f=rr(a,n);return+r>=+c?i+1:+r>=+f?i:i-1}function sS(t,n){var c,a,f,u;const r=Ri(),i=(n==null?void 0:n.firstWeekContainsDate)??((a=(c=n==null?void 0:n.locale)==null?void 0:c.options)==null?void 0:a.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(f=r.locale)==null?void 0:f.options)==null?void 0:u.firstWeekContainsDate)??1,s=mu(t,n),o=_t((n==null?void 0:n.in)||t,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),rr(o,n)}function ul(t,n){const r=dt(t,n==null?void 0:n.in),i=+rr(r,n)-+sS(r,n);return Math.round(i/t2)+1}function Ct(t,n){const r=t<0?"-":"",i=Math.abs(t).toString().padStart(n,"0");return r+i}const Gr={y(t,n){const r=t.getFullYear(),i=r>0?r:1-r;return Ct(n==="yy"?i%100:i,n.length)},M(t,n){const r=t.getMonth();return n==="M"?String(r+1):Ct(r+1,2)},d(t,n){return Ct(t.getDate(),n.length)},a(t,n){const r=t.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,n){return Ct(t.getHours()%12||12,n.length)},H(t,n){return Ct(t.getHours(),n.length)},m(t,n){return Ct(t.getMinutes(),n.length)},s(t,n){return Ct(t.getSeconds(),n.length)},S(t,n){const r=n.length,i=t.getMilliseconds(),s=Math.trunc(i*Math.pow(10,r-3));return Ct(s,n.length)}},Hi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Lf={G:function(t,n,r){const i=t.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(i,{width:"abbreviated"});case"GGGGG":return r.era(i,{width:"narrow"});case"GGGG":default:return r.era(i,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){const i=t.getFullYear(),s=i>0?i:1-i;return r.ordinalNumber(s,{unit:"year"})}return Gr.y(t,n)},Y:function(t,n,r,i){const s=mu(t,i),o=s>0?s:1-s;if(n==="YY"){const l=o%100;return Ct(l,2)}return n==="Yo"?r.ordinalNumber(o,{unit:"year"}):Ct(o,n.length)},R:function(t,n){const r=n2(t);return Ct(r,n.length)},u:function(t,n){const r=t.getFullYear();return Ct(r,n.length)},Q:function(t,n,r){const i=Math.ceil((t.getMonth()+1)/3);switch(n){case"Q":return String(i);case"QQ":return Ct(i,2);case"Qo":return r.ordinalNumber(i,{unit:"quarter"});case"QQQ":return r.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(i,{width:"wide",context:"formatting"})}},q:function(t,n,r){const i=Math.ceil((t.getMonth()+1)/3);switch(n){case"q":return String(i);case"qq":return Ct(i,2);case"qo":return r.ordinalNumber(i,{unit:"quarter"});case"qqq":return r.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(i,{width:"wide",context:"standalone"})}},M:function(t,n,r){const i=t.getMonth();switch(n){case"M":case"MM":return Gr.M(t,n);case"Mo":return r.ordinalNumber(i+1,{unit:"month"});case"MMM":return r.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(i,{width:"wide",context:"formatting"})}},L:function(t,n,r){const i=t.getMonth();switch(n){case"L":return String(i+1);case"LL":return Ct(i+1,2);case"Lo":return r.ordinalNumber(i+1,{unit:"month"});case"LLL":return r.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(i,{width:"wide",context:"standalone"})}},w:function(t,n,r,i){const s=ul(t,i);return n==="wo"?r.ordinalNumber(s,{unit:"week"}):Ct(s,n.length)},I:function(t,n,r){const i=cl(t);return n==="Io"?r.ordinalNumber(i,{unit:"week"}):Ct(i,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Gr.d(t,n)},D:function(t,n,r){const i=iS(t);return n==="Do"?r.ordinalNumber(i,{unit:"dayOfYear"}):Ct(i,n.length)},E:function(t,n,r){const i=t.getDay();switch(n){case"E":case"EE":case"EEE":return r.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(i,{width:"short",context:"formatting"});case"EEEE":default:return r.day(i,{width:"wide",context:"formatting"})}},e:function(t,n,r,i){const s=t.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(n){case"e":return String(o);case"ee":return Ct(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(t,n,r,i){const s=t.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(n){case"c":return String(o);case"cc":return Ct(o,n.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(t,n,r){const i=t.getDay(),s=i===0?7:i;switch(n){case"i":return String(s);case"ii":return Ct(s,n.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(i,{width:"short",context:"formatting"});case"iiii":default:return r.day(i,{width:"wide",context:"formatting"})}},a:function(t,n,r){const s=t.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,n,r){const i=t.getHours();let s;switch(i===12?s=Hi.noon:i===0?s=Hi.midnight:s=i/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,n,r){const i=t.getHours();let s;switch(i>=17?s=Hi.evening:i>=12?s=Hi.afternoon:i>=4?s=Hi.morning:s=Hi.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){let i=t.getHours()%12;return i===0&&(i=12),r.ordinalNumber(i,{unit:"hour"})}return Gr.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Gr.H(t,n)},K:function(t,n,r){const i=t.getHours()%12;return n==="Ko"?r.ordinalNumber(i,{unit:"hour"}):Ct(i,n.length)},k:function(t,n,r){let i=t.getHours();return i===0&&(i=24),n==="ko"?r.ordinalNumber(i,{unit:"hour"}):Ct(i,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Gr.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Gr.s(t,n)},S:function(t,n){return Gr.S(t,n)},X:function(t,n,r){const i=t.getTimezoneOffset();if(i===0)return"Z";switch(n){case"X":return Of(i);case"XXXX":case"XX":return yi(i);case"XXXXX":case"XXX":default:return yi(i,":")}},x:function(t,n,r){const i=t.getTimezoneOffset();switch(n){case"x":return Of(i);case"xxxx":case"xx":return yi(i);case"xxxxx":case"xxx":default:return yi(i,":")}},O:function(t,n,r){const i=t.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+If(i,":");case"OOOO":default:return"GMT"+yi(i,":")}},z:function(t,n,r){const i=t.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+If(i,":");case"zzzz":default:return"GMT"+yi(i,":")}},t:function(t,n,r){const i=Math.trunc(+t/1e3);return Ct(i,n.length)},T:function(t,n,r){return Ct(+t,n.length)}};function If(t,n=""){const r=t>0?"-":"+",i=Math.abs(t),s=Math.trunc(i/60),o=i%60;return o===0?r+String(s):r+String(s)+n+Ct(o,2)}function Of(t,n){return t%60===0?(t>0?"-":"+")+Ct(Math.abs(t)/60,2):yi(t,n)}function yi(t,n=""){const r=t>0?"-":"+",i=Math.abs(t),s=Ct(Math.trunc(i/60),2),o=Ct(i%60,2);return r+s+n+o}const Bf=(t,n)=>{switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},l2=(t,n)=>{switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},oS=(t,n)=>{const r=t.match(/(P+)(p+)?/)||[],i=r[1],s=r[2];if(!s)return Bf(t,n);let o;switch(i){case"P":o=n.dateTime({width:"short"});break;case"PP":o=n.dateTime({width:"medium"});break;case"PPP":o=n.dateTime({width:"long"});break;case"PPPP":default:o=n.dateTime({width:"full"});break}return o.replace("{{date}}",Bf(i,n)).replace("{{time}}",l2(s,n))},Qc={p:l2,P:oS},aS=/^D+$/,lS=/^Y+$/,cS=["D","DD","YY","YYYY"];function c2(t){return aS.test(t)}function u2(t){return lS.test(t)}function Jc(t,n,r){const i=uS(t,n,r);if(console.warn(i),cS.includes(t))throw new RangeError(i)}function uS(t,n,r){const i=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${n}\`) for formatting ${i} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const dS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,hS=/^'([^]*?)'?$/,mS=/''/g,pS=/[a-zA-Z]/;function Kt(t,n,r){var u,m,y,_,S,E,d,h;const i=Ri(),s=(r==null?void 0:r.locale)??i.locale??xi,o=(r==null?void 0:r.firstWeekContainsDate)??((m=(u=r==null?void 0:r.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??i.firstWeekContainsDate??((_=(y=i.locale)==null?void 0:y.options)==null?void 0:_.firstWeekContainsDate)??1,l=(r==null?void 0:r.weekStartsOn)??((E=(S=r==null?void 0:r.locale)==null?void 0:S.options)==null?void 0:E.weekStartsOn)??i.weekStartsOn??((h=(d=i.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??0,c=dt(t,r==null?void 0:r.in);if(!s2(c))throw new RangeError("Invalid time value");let a=n.match(fS).map(v=>{const x=v[0];if(x==="p"||x==="P"){const g=Qc[x];return g(v,s.formatLong)}return v}).join("").match(dS).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const x=v[0];if(x==="'")return{isToken:!1,value:gS(v)};if(Lf[x])return{isToken:!0,value:v};if(x.match(pS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(a=s.localize.preprocessor(c,a));const f={firstWeekContainsDate:o,weekStartsOn:l,locale:s};return a.map(v=>{if(!v.isToken)return v.value;const x=v.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&u2(x)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&c2(x))&&Jc(x,n,String(t));const g=Lf[x[0]];return g(c,x,s.localize,f)}).join("")}function gS(t){const n=t.match(hS);return n?n[1].replace(mS,"'"):t}function vS(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getFullYear(),s=r.getMonth(),o=_t(r,0);return o.setFullYear(i,s+1,0),o.setHours(0,0,0,0),o.getDate()}function bS(){return Object.assign({},Ri())}function yS(t,n){const r=dt(t,n==null?void 0:n.in).getDay();return r===0?7:r}function xS(t,n){return dt(t,n==null?void 0:n.in).getMonth()}function wS(t,n){return dt(t,n==null?void 0:n.in).getFullYear()}function CS(t,n){return+dt(t)>+dt(n)}function _S(t,n){return+dt(t)<+dt(n)}function SS(t,n){const r=kS(n)?new n(0):_t(n,0);return r.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),r.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),r}function kS(t){var n;return typeof t=="function"&&((n=t.prototype)==null?void 0:n.constructor)===t}const ES=10;class d2{constructor(){ze(this,"subPriority",0)}validate(n,r){return!0}}class TS extends d2{constructor(n,r,i,s,o){super(),this.value=n,this.validateValue=r,this.setValue=i,this.priority=s,o&&(this.subPriority=o)}validate(n,r){return this.validateValue(n,this.value,r)}set(n,r,i){return this.setValue(n,r,this.value,i)}}class NS extends d2{constructor(r,i){super();ze(this,"priority",ES);ze(this,"subPriority",-1);this.context=r||(s=>_t(i,s))}set(r,i){return i.timestampIsSet?r:_t(r,SS(r,this.context))}}let vt=class{run(n,r,i,s){const o=this.parse(n,r,i,s);return o?{setter:new TS(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(n,r,i){return!0}};class MS extends vt{constructor(){super(...arguments);ze(this,"priority",140);ze(this,"incompatibleTokens",["R","u","t","T"])}parse(r,i,s){switch(i){case"G":case"GG":case"GGG":return s.era(r,{width:"abbreviated"})||s.era(r,{width:"narrow"});case"GGGGG":return s.era(r,{width:"narrow"});case"GGGG":default:return s.era(r,{width:"wide"})||s.era(r,{width:"abbreviated"})||s.era(r,{width:"narrow"})}}set(r,i,s){return i.era=s,r.setFullYear(s,0,1),r.setHours(0,0,0,0),r}}const Vt={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},fr={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Wt(t,n){return t&&{value:n(t.value),rest:t.rest}}function Bt(t,n){const r=n.match(t);return r?{value:parseInt(r[0],10),rest:n.slice(r[0].length)}:null}function hr(t,n){const r=n.match(t);if(!r)return null;if(r[0]==="Z")return{value:0,rest:n.slice(1)};const i=r[1]==="+"?1:-1,s=r[2]?parseInt(r[2],10):0,o=r[3]?parseInt(r[3],10):0,l=r[5]?parseInt(r[5],10):0;return{value:i*(s*m_+o*h_+l*p_),rest:n.slice(r[0].length)}}function f2(t){return Bt(Vt.anyDigitsSigned,t)}function Ft(t,n){switch(t){case 1:return Bt(Vt.singleDigit,n);case 2:return Bt(Vt.twoDigits,n);case 3:return Bt(Vt.threeDigits,n);case 4:return Bt(Vt.fourDigits,n);default:return Bt(new RegExp("^\\d{1,"+t+"}"),n)}}function fa(t,n){switch(t){case 1:return Bt(Vt.singleDigitSigned,n);case 2:return Bt(Vt.twoDigitsSigned,n);case 3:return Bt(Vt.threeDigitsSigned,n);case 4:return Bt(Vt.fourDigitsSigned,n);default:return Bt(new RegExp("^-?\\d{1,"+t+"}"),n)}}function pu(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function h2(t,n){const r=n>0,i=r?n:1-n;let s;if(i<=50)s=t||100;else{const o=i+50,l=Math.trunc(o/100)*100,c=t>=o%100;s=t+l-(c?100:0)}return r?s:1-s}function m2(t){return t%400===0||t%4===0&&t%100!==0}class AS extends vt{constructor(){super(...arguments);ze(this,"priority",130);ze(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(r,i,s){const o=l=>({year:l,isTwoDigitYear:i==="yy"});switch(i){case"y":return Wt(Ft(4,r),o);case"yo":return Wt(s.ordinalNumber(r,{unit:"year"}),o);default:return Wt(Ft(i.length,r),o)}}validate(r,i){return i.isTwoDigitYear||i.year>0}set(r,i,s){const o=r.getFullYear();if(s.isTwoDigitYear){const c=h2(s.year,o);return r.setFullYear(c,0,1),r.setHours(0,0,0,0),r}const l=!("era"in i)||i.era===1?s.year:1-s.year;return r.setFullYear(l,0,1),r.setHours(0,0,0,0),r}}class DS extends vt{constructor(){super(...arguments);ze(this,"priority",130);ze(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(r,i,s){const o=l=>({year:l,isTwoDigitYear:i==="YY"});switch(i){case"Y":return Wt(Ft(4,r),o);case"Yo":return Wt(s.ordinalNumber(r,{unit:"year"}),o);default:return Wt(Ft(i.length,r),o)}}validate(r,i){return i.isTwoDigitYear||i.year>0}set(r,i,s,o){const l=mu(r,o);if(s.isTwoDigitYear){const a=h2(s.year,l);return r.setFullYear(a,0,o.firstWeekContainsDate),r.setHours(0,0,0,0),rr(r,o)}const c=!("era"in i)||i.era===1?s.year:1-s.year;return r.setFullYear(c,0,o.firstWeekContainsDate),r.setHours(0,0,0,0),rr(r,o)}}class RS extends vt{constructor(){super(...arguments);ze(this,"priority",130);ze(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(r,i){return fa(i==="R"?4:i.length,r)}set(r,i,s){const o=_t(r,0);return o.setFullYear(s,0,4),o.setHours(0,0,0,0),Mi(o)}}class PS extends vt{constructor(){super(...arguments);ze(this,"priority",130);ze(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(r,i){return fa(i==="u"?4:i.length,r)}set(r,i,s){return r.setFullYear(s,0,1),r.setHours(0,0,0,0),r}}class LS extends vt{constructor(){super(...arguments);ze(this,"priority",120);ze(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(r,i,s){switch(i){case"Q":case"QQ":return Ft(i.length,r);case"Qo":return s.ordinalNumber(r,{unit:"quarter"});case"QQQ":return s.quarter(r,{width:"abbreviated",context:"formatting"})||s.quarter(r,{width:"narrow",context:"formatting"});case"QQQQQ":return s.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(r,{width:"wide",context:"formatting"})||s.quarter(r,{width:"abbreviated",context:"formatting"})||s.quarter(r,{width:"narrow",context:"formatting"})}}validate(r,i){return i>=1&&i<=4}set(r,i,s){return r.setMonth((s-1)*3,1),r.setHours(0,0,0,0),r}}class IS extends vt{constructor(){super(...arguments);ze(this,"priority",120);ze(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(r,i,s){switch(i){case"q":case"qq":return Ft(i.length,r);case"qo":return s.ordinalNumber(r,{unit:"quarter"});case"qqq":return s.quarter(r,{width:"abbreviated",context:"standalone"})||s.quarter(r,{width:"narrow",context:"standalone"});case"qqqqq":return s.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(r,{width:"wide",context:"standalone"})||s.quarter(r,{width:"abbreviated",context:"standalone"})||s.quarter(r,{width:"narrow",context:"standalone"})}}validate(r,i){return i>=1&&i<=4}set(r,i,s){return r.setMonth((s-1)*3,1),r.setHours(0,0,0,0),r}}class OS extends vt{constructor(){super(...arguments);ze(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);ze(this,"priority",110)}parse(r,i,s){const o=l=>l-1;switch(i){case"M":return Wt(Bt(Vt.month,r),o);case"MM":return Wt(Ft(2,r),o);case"Mo":return Wt(s.ordinalNumber(r,{unit:"month"}),o);case"MMM":return s.month(r,{width:"abbreviated",context:"formatting"})||s.month(r,{width:"narrow",context:"formatting"});case"MMMMM":return s.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(r,{width:"wide",context:"formatting"})||s.month(r,{width:"abbreviated",context:"formatting"})||s.month(r,{width:"narrow",context:"formatting"})}}validate(r,i){return i>=0&&i<=11}set(r,i,s){return r.setMonth(s,1),r.setHours(0,0,0,0),r}}class BS extends vt{constructor(){super(...arguments);ze(this,"priority",110);ze(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(r,i,s){const o=l=>l-1;switch(i){case"L":return Wt(Bt(Vt.month,r),o);case"LL":return Wt(Ft(2,r),o);case"Lo":return Wt(s.ordinalNumber(r,{unit:"month"}),o);case"LLL":return s.month(r,{width:"abbreviated",context:"standalone"})||s.month(r,{width:"narrow",context:"standalone"});case"LLLLL":return s.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(r,{width:"wide",context:"standalone"})||s.month(r,{width:"abbreviated",context:"standalone"})||s.month(r,{width:"narrow",context:"standalone"})}}validate(r,i){return i>=0&&i<=11}set(r,i,s){return r.setMonth(s,1),r.setHours(0,0,0,0),r}}function zS(t,n,r){const i=dt(t,r==null?void 0:r.in),s=ul(i,r)-n;return i.setDate(i.getDate()-s*7),dt(i,r==null?void 0:r.in)}class jS extends vt{constructor(){super(...arguments);ze(this,"priority",100);ze(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(r,i,s){switch(i){case"w":return Bt(Vt.week,r);case"wo":return s.ordinalNumber(r,{unit:"week"});default:return Ft(i.length,r)}}validate(r,i){return i>=1&&i<=53}set(r,i,s,o){return rr(zS(r,s,o),o)}}function FS(t,n,r){const i=dt(t,r==null?void 0:r.in),s=cl(i,r)-n;return i.setDate(i.getDate()-s*7),i}class HS extends vt{constructor(){super(...arguments);ze(this,"priority",100);ze(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(r,i,s){switch(i){case"I":return Bt(Vt.week,r);case"Io":return s.ordinalNumber(r,{unit:"week"});default:return Ft(i.length,r)}}validate(r,i){return i>=1&&i<=53}set(r,i,s){return Mi(FS(r,s))}}const $S=[31,28,31,30,31,30,31,31,30,31,30,31],VS=[31,29,31,30,31,30,31,31,30,31,30,31];class WS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"subPriority",1);ze(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(r,i,s){switch(i){case"d":return Bt(Vt.date,r);case"do":return s.ordinalNumber(r,{unit:"date"});default:return Ft(i.length,r)}}validate(r,i){const s=r.getFullYear(),o=m2(s),l=r.getMonth();return o?i>=1&&i<=VS[l]:i>=1&&i<=$S[l]}set(r,i,s){return r.setDate(s),r.setHours(0,0,0,0),r}}class US extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"subpriority",1);ze(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(r,i,s){switch(i){case"D":case"DD":return Bt(Vt.dayOfYear,r);case"Do":return s.ordinalNumber(r,{unit:"date"});default:return Ft(i.length,r)}}validate(r,i){const s=r.getFullYear();return m2(s)?i>=1&&i<=366:i>=1&&i<=365}set(r,i,s){return r.setMonth(0,s),r.setHours(0,0,0,0),r}}function gu(t,n,r){var m,y,_,S;const i=Ri(),s=(r==null?void 0:r.weekStartsOn)??((y=(m=r==null?void 0:r.locale)==null?void 0:m.options)==null?void 0:y.weekStartsOn)??i.weekStartsOn??((S=(_=i.locale)==null?void 0:_.options)==null?void 0:S.weekStartsOn)??0,o=dt(t,r==null?void 0:r.in),l=o.getDay(),a=(n%7+7)%7,f=7-s,u=n<0||n>6?n-(l+f)%7:(a+f)%7-(l+f)%7;return ho(o,u,r)}class qS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(r,i,s){switch(i){case"E":case"EE":case"EEE":return s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"});case"EEEEE":return s.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"});case"EEEE":default:return s.day(r,{width:"wide",context:"formatting"})||s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"})}}validate(r,i){return i>=0&&i<=6}set(r,i,s,o){return r=gu(r,s,o),r.setHours(0,0,0,0),r}}class YS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(r,i,s,o){const l=c=>{const a=Math.floor((c-1)/7)*7;return(c+o.weekStartsOn+6)%7+a};switch(i){case"e":case"ee":return Wt(Ft(i.length,r),l);case"eo":return Wt(s.ordinalNumber(r,{unit:"day"}),l);case"eee":return s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"});case"eeeee":return s.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"});case"eeee":default:return s.day(r,{width:"wide",context:"formatting"})||s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"})}}validate(r,i){return i>=0&&i<=6}set(r,i,s,o){return r=gu(r,s,o),r.setHours(0,0,0,0),r}}class GS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(r,i,s,o){const l=c=>{const a=Math.floor((c-1)/7)*7;return(c+o.weekStartsOn+6)%7+a};switch(i){case"c":case"cc":return Wt(Ft(i.length,r),l);case"co":return Wt(s.ordinalNumber(r,{unit:"day"}),l);case"ccc":return s.day(r,{width:"abbreviated",context:"standalone"})||s.day(r,{width:"short",context:"standalone"})||s.day(r,{width:"narrow",context:"standalone"});case"ccccc":return s.day(r,{width:"narrow",context:"standalone"});case"cccccc":return s.day(r,{width:"short",context:"standalone"})||s.day(r,{width:"narrow",context:"standalone"});case"cccc":default:return s.day(r,{width:"wide",context:"standalone"})||s.day(r,{width:"abbreviated",context:"standalone"})||s.day(r,{width:"short",context:"standalone"})||s.day(r,{width:"narrow",context:"standalone"})}}validate(r,i){return i>=0&&i<=6}set(r,i,s,o){return r=gu(r,s,o),r.setHours(0,0,0,0),r}}function ZS(t,n,r){const i=dt(t,r==null?void 0:r.in),s=yS(i,r),o=n-s;return ho(i,o,r)}class XS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(r,i,s){const o=l=>l===0?7:l;switch(i){case"i":case"ii":return Ft(i.length,r);case"io":return s.ordinalNumber(r,{unit:"day"});case"iii":return Wt(s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"}),o);case"iiiii":return Wt(s.day(r,{width:"narrow",context:"formatting"}),o);case"iiiiii":return Wt(s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"}),o);case"iiii":default:return Wt(s.day(r,{width:"wide",context:"formatting"})||s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"}),o)}}validate(r,i){return i>=1&&i<=7}set(r,i,s){return r=ZS(r,s),r.setHours(0,0,0,0),r}}class KS extends vt{constructor(){super(...arguments);ze(this,"priority",80);ze(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(r,i,s){switch(i){case"a":case"aa":case"aaa":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaaa":return s.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(r,{width:"wide",context:"formatting"})||s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"})}}set(r,i,s){return r.setHours(pu(s),0,0,0),r}}class QS extends vt{constructor(){super(...arguments);ze(this,"priority",80);ze(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(r,i,s){switch(i){case"b":case"bb":case"bbb":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbbb":return s.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(r,{width:"wide",context:"formatting"})||s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"})}}set(r,i,s){return r.setHours(pu(s),0,0,0),r}}class JS extends vt{constructor(){super(...arguments);ze(this,"priority",80);ze(this,"incompatibleTokens",["a","b","t","T"])}parse(r,i,s){switch(i){case"B":case"BB":case"BBB":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBBB":return s.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(r,{width:"wide",context:"formatting"})||s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"})}}set(r,i,s){return r.setHours(pu(s),0,0,0),r}}class ek extends vt{constructor(){super(...arguments);ze(this,"priority",70);ze(this,"incompatibleTokens",["H","K","k","t","T"])}parse(r,i,s){switch(i){case"h":return Bt(Vt.hour12h,r);case"ho":return s.ordinalNumber(r,{unit:"hour"});default:return Ft(i.length,r)}}validate(r,i){return i>=1&&i<=12}set(r,i,s){const o=r.getHours()>=12;return o&&s<12?r.setHours(s+12,0,0,0):!o&&s===12?r.setHours(0,0,0,0):r.setHours(s,0,0,0),r}}class tk extends vt{constructor(){super(...arguments);ze(this,"priority",70);ze(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(r,i,s){switch(i){case"H":return Bt(Vt.hour23h,r);case"Ho":return s.ordinalNumber(r,{unit:"hour"});default:return Ft(i.length,r)}}validate(r,i){return i>=0&&i<=23}set(r,i,s){return r.setHours(s,0,0,0),r}}class nk extends vt{constructor(){super(...arguments);ze(this,"priority",70);ze(this,"incompatibleTokens",["h","H","k","t","T"])}parse(r,i,s){switch(i){case"K":return Bt(Vt.hour11h,r);case"Ko":return s.ordinalNumber(r,{unit:"hour"});default:return Ft(i.length,r)}}validate(r,i){return i>=0&&i<=11}set(r,i,s){return r.getHours()>=12&&s<12?r.setHours(s+12,0,0,0):r.setHours(s,0,0,0),r}}class rk extends vt{constructor(){super(...arguments);ze(this,"priority",70);ze(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(r,i,s){switch(i){case"k":return Bt(Vt.hour24h,r);case"ko":return s.ordinalNumber(r,{unit:"hour"});default:return Ft(i.length,r)}}validate(r,i){return i>=1&&i<=24}set(r,i,s){const o=s<=24?s%24:s;return r.setHours(o,0,0,0),r}}class ik extends vt{constructor(){super(...arguments);ze(this,"priority",60);ze(this,"incompatibleTokens",["t","T"])}parse(r,i,s){switch(i){case"m":return Bt(Vt.minute,r);case"mo":return s.ordinalNumber(r,{unit:"minute"});default:return Ft(i.length,r)}}validate(r,i){return i>=0&&i<=59}set(r,i,s){return r.setMinutes(s,0,0),r}}class sk extends vt{constructor(){super(...arguments);ze(this,"priority",50);ze(this,"incompatibleTokens",["t","T"])}parse(r,i,s){switch(i){case"s":return Bt(Vt.second,r);case"so":return s.ordinalNumber(r,{unit:"second"});default:return Ft(i.length,r)}}validate(r,i){return i>=0&&i<=59}set(r,i,s){return r.setSeconds(s,0),r}}class ok extends vt{constructor(){super(...arguments);ze(this,"priority",30);ze(this,"incompatibleTokens",["t","T"])}parse(r,i){const s=o=>Math.trunc(o*Math.pow(10,-i.length+3));return Wt(Ft(i.length,r),s)}set(r,i,s){return r.setMilliseconds(s),r}}class ak extends vt{constructor(){super(...arguments);ze(this,"priority",10);ze(this,"incompatibleTokens",["t","T","x"])}parse(r,i){switch(i){case"X":return hr(fr.basicOptionalMinutes,r);case"XX":return hr(fr.basic,r);case"XXXX":return hr(fr.basicOptionalSeconds,r);case"XXXXX":return hr(fr.extendedOptionalSeconds,r);case"XXX":default:return hr(fr.extended,r)}}set(r,i,s){return i.timestampIsSet?r:_t(r,r.getTime()-ca(r)-s)}}class lk extends vt{constructor(){super(...arguments);ze(this,"priority",10);ze(this,"incompatibleTokens",["t","T","X"])}parse(r,i){switch(i){case"x":return hr(fr.basicOptionalMinutes,r);case"xx":return hr(fr.basic,r);case"xxxx":return hr(fr.basicOptionalSeconds,r);case"xxxxx":return hr(fr.extendedOptionalSeconds,r);case"xxx":default:return hr(fr.extended,r)}}set(r,i,s){return i.timestampIsSet?r:_t(r,r.getTime()-ca(r)-s)}}class ck extends vt{constructor(){super(...arguments);ze(this,"priority",40);ze(this,"incompatibleTokens","*")}parse(r){return f2(r)}set(r,i,s){return[_t(r,s*1e3),{timestampIsSet:!0}]}}class uk extends vt{constructor(){super(...arguments);ze(this,"priority",20);ze(this,"incompatibleTokens","*")}parse(r){return f2(r)}set(r,i,s){return[_t(r,s),{timestampIsSet:!0}]}}const dk={G:new MS,y:new AS,Y:new DS,R:new RS,u:new PS,Q:new LS,q:new IS,M:new OS,L:new BS,w:new jS,I:new HS,d:new WS,D:new US,E:new qS,e:new YS,c:new GS,i:new XS,a:new KS,b:new QS,B:new JS,h:new ek,H:new tk,K:new nk,k:new rk,m:new ik,s:new sk,S:new ok,X:new ak,x:new lk,t:new ck,T:new uk},fk=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,hk=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,mk=/^'([^]*?)'?$/,pk=/''/g,gk=/\S/,vk=/[a-zA-Z]/;function bk(t,n,r,i){var d,h,v,x;const s=()=>_t(r,NaN),o=bS(),l=o.locale??xi,c=o.firstWeekContainsDate??((h=(d=o.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??1,a=o.weekStartsOn??((x=(v=o.locale)==null?void 0:v.options)==null?void 0:x.weekStartsOn)??0,f={firstWeekContainsDate:c,weekStartsOn:a,locale:l},u=[new NS(i==null?void 0:i.in,r)],m=n.match(hk).map(g=>{const b=g[0];if(b in Qc){const w=Qc[b];return w(g,l.formatLong)}return g}).join("").match(fk),y=[];for(let g of m){u2(g)&&Jc(g,n,t),c2(g)&&Jc(g,n,t);const b=g[0],w=dk[b];if(w){const{incompatibleTokens:k}=w;if(Array.isArray(k)){const T=y.find(D=>k.includes(D.token)||D.token===b);if(T)throw new RangeError(`The format string mustn't contain \`${T.fullToken}\` and \`${g}\` at the same time`)}else if(w.incompatibleTokens==="*"&&y.length>0)throw new RangeError(`The format string mustn't contain \`${g}\` and any other token at the same time`);y.push({token:b,fullToken:g});const N=w.run(t,g,l.match,f);if(!N)return s();u.push(N.setter),t=N.rest}else{if(b.match(vk))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");if(g==="''"?g="'":b==="'"&&(g=yk(g)),t.indexOf(g)===0)t=t.slice(g.length);else return s()}}if(t.length>0&&gk.test(t))return s();const _=u.map(g=>g.priority).sort((g,b)=>b-g).filter((g,b,w)=>w.indexOf(g)===b).map(g=>u.filter(b=>b.priority===g).sort((b,w)=>w.subPriority-b.subPriority)).map(g=>g[0]);let S=dt(r,i==null?void 0:i.in);if(isNaN(+S))return s();const E={};for(const g of _){if(!g.validate(S,f))return s();const b=g.set(S,E,f);Array.isArray(b)?(S=b[0],Object.assign(E,b[1])):S=b}return S}function yk(t){return t.match(mk)[1].replace(pk,"'")}function xk(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n);return i.getFullYear()===s.getFullYear()&&i.getMonth()===s.getMonth()}function wk(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n);return i.getFullYear()===s.getFullYear()}function rc(t,n,r){return ho(t,-n,r)}function Ck(t,n,r){const i=dt(t,r==null?void 0:r.in),s=i.getFullYear(),o=i.getDate(),l=_t(t,0);l.setFullYear(s,n,15),l.setHours(0,0,0,0);const c=vS(l);return i.setMonth(n,Math.min(o,c)),i}function _k(t,n,r){const i=dt(t,r==null?void 0:r.in);return isNaN(+i)?_t(t,NaN):(i.setFullYear(n),i)}function zf(t,n,r){return Si(t,-1,r)}function jf(t,n,r){return b_(t,-1,r)}function Ff(t,n,r){return r2(t,-1,r)}const Hf=5,Sk=4;function kk(t,n){const r=n.startOfMonth(t),i=r.getDay()>0?r.getDay():7,s=n.addDays(t,-i+1),o=n.addDays(s,Hf*7-1);return n.getMonth(t)===n.getMonth(o)?Hf:Sk}function p2(t,n){const r=n.startOfMonth(t),i=r.getDay();return i===1?r:i===0?n.addDays(r,-1*6):n.addDays(r,-1*(i-1))}function Ek(t,n){const r=p2(t,n),i=kk(t,n);return n.addDays(r,i*7-1)}const g2={...xi,labels:{labelDayButton:(t,n,r,i)=>{let s;i&&typeof i.format=="function"?s=i.format.bind(i):s=(l,c)=>Kt(l,c,{locale:xi,...r});let o=s(t,"PPPP");return n.today&&(o=`Today, ${o}`),n.selected&&(o=`${o}, selected`),o},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:t=>`Week ${t}`,labelYearDropdown:"Choose the Year",labelGrid:(t,n,r)=>{let i;return r&&typeof r.format=="function"?i=r.format.bind(r):i=(s,o)=>Kt(s,o,{locale:xi,...n}),i(t,"LLLL yyyy")},labelGridcell:(t,n,r,i)=>{let s;i&&typeof i.format=="function"?s=i.format.bind(i):s=(l,c)=>Kt(l,c,{locale:xi,...r});let o=s(t,"PPPP");return n!=null&&n.today&&(o=`Today, ${o}`),o},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(t,n,r)=>{let i;return r&&typeof r.format=="function"?i=r.format.bind(r):i=(s,o)=>Kt(s,o,{locale:xi,...n}),i(t,"cccc")}}};class Tn{constructor(n,r){this.Date=Date,this.today=()=>{var i;return(i=this.overrides)!=null&&i.today?this.overrides.today():this.options.timeZone?rn.tz(this.options.timeZone):new this.Date},this.newDate=(i,s,o)=>{var l;return(l=this.overrides)!=null&&l.newDate?this.overrides.newDate(i,s,o):this.options.timeZone?new rn(i,s,o,this.options.timeZone):new Date(i,s,o)},this.addDays=(i,s)=>{var o;return(o=this.overrides)!=null&&o.addDays?this.overrides.addDays(i,s):ho(i,s)},this.addMonths=(i,s)=>{var o;return(o=this.overrides)!=null&&o.addMonths?this.overrides.addMonths(i,s):Si(i,s)},this.addWeeks=(i,s)=>{var o;return(o=this.overrides)!=null&&o.addWeeks?this.overrides.addWeeks(i,s):y_(i,s)},this.addYears=(i,s)=>{var o;return(o=this.overrides)!=null&&o.addYears?this.overrides.addYears(i,s):r2(i,s)},this.differenceInCalendarDays=(i,s)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarDays?this.overrides.differenceInCalendarDays(i,s):hu(i,s)},this.differenceInCalendarMonths=(i,s)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(i,s):o2(i,s)},this.eachMonthOfInterval=i=>{var s;return(s=this.overrides)!=null&&s.eachMonthOfInterval?this.overrides.eachMonthOfInterval(i):__(i)},this.eachYearOfInterval=i=>{var c;const s=(c=this.overrides)!=null&&c.eachYearOfInterval?this.overrides.eachYearOfInterval(i):S_(i),o=new Set(s.map(a=>this.getYear(a)));if(o.size===s.length)return s;const l=[];return o.forEach(a=>{l.push(new Date(a,0,1))}),l},this.endOfBroadcastWeek=i=>{var s;return(s=this.overrides)!=null&&s.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(i):Ek(i,this)},this.endOfISOWeek=i=>{var s;return(s=this.overrides)!=null&&s.endOfISOWeek?this.overrides.endOfISOWeek(i):k_(i)},this.endOfMonth=i=>{var s;return(s=this.overrides)!=null&&s.endOfMonth?this.overrides.endOfMonth(i):Xc(i)},this.endOfWeek=(i,s)=>{var o;return(o=this.overrides)!=null&&o.endOfWeek?this.overrides.endOfWeek(i,s):da(i,this.options)},this.endOfYear=i=>{var s;return(s=this.overrides)!=null&&s.endOfYear?this.overrides.endOfYear(i):Kc(i)},this.format=(i,s,o)=>{var c;const l=(c=this.overrides)!=null&&c.format?this.overrides.format(i,s,this.options):Kt(i,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=i=>{var s;return(s=this.overrides)!=null&&s.getISOWeek?this.overrides.getISOWeek(i):cl(i)},this.getMonth=(i,s)=>{var o;return(o=this.overrides)!=null&&o.getMonth?this.overrides.getMonth(i,this.options):xS(i,this.options)},this.getYear=(i,s)=>{var o;return(o=this.overrides)!=null&&o.getYear?this.overrides.getYear(i,this.options):wS(i,this.options)},this.getWeek=(i,s)=>{var o;return(o=this.overrides)!=null&&o.getWeek?this.overrides.getWeek(i,this.options):ul(i,this.options)},this.isAfter=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isAfter?this.overrides.isAfter(i,s):CS(i,s)},this.isBefore=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isBefore?this.overrides.isBefore(i,s):_S(i,s)},this.isDate=i=>{var s;return(s=this.overrides)!=null&&s.isDate?this.overrides.isDate(i):i2(i)},this.isSameDay=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isSameDay?this.overrides.isSameDay(i,s):C_(i,s)},this.isSameMonth=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isSameMonth?this.overrides.isSameMonth(i,s):xk(i,s)},this.isSameYear=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isSameYear?this.overrides.isSameYear(i,s):wk(i,s)},this.max=i=>{var s;return(s=this.overrides)!=null&&s.max?this.overrides.max(i):x_(i)},this.min=i=>{var s;return(s=this.overrides)!=null&&s.min?this.overrides.min(i):w_(i)},this.setMonth=(i,s)=>{var o;return(o=this.overrides)!=null&&o.setMonth?this.overrides.setMonth(i,s):Ck(i,s)},this.setYear=(i,s)=>{var o;return(o=this.overrides)!=null&&o.setYear?this.overrides.setYear(i,s):_k(i,s)},this.startOfBroadcastWeek=(i,s)=>{var o;return(o=this.overrides)!=null&&o.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(i,this):p2(i,this)},this.startOfDay=i=>{var s;return(s=this.overrides)!=null&&s.startOfDay?this.overrides.startOfDay(i):Us(i)},this.startOfISOWeek=i=>{var s;return(s=this.overrides)!=null&&s.startOfISOWeek?this.overrides.startOfISOWeek(i):Mi(i)},this.startOfMonth=i=>{var s;return(s=this.overrides)!=null&&s.startOfMonth?this.overrides.startOfMonth(i):Ui(i)},this.startOfWeek=(i,s)=>{var o;return(o=this.overrides)!=null&&o.startOfWeek?this.overrides.startOfWeek(i,this.options):rr(i,this.options)},this.startOfYear=i=>{var s;return(s=this.overrides)!=null&&s.startOfYear?this.overrides.startOfYear(i):ua(i)},this.options={locale:g2,...n},this.overrides=r}getDigitMap(){const{numerals:n="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:n}),i={};for(let s=0;s<10;s++)i[s.toString()]=r.format(s);return i}replaceDigits(n){const r=this.getDigitMap();return n.replace(/\d/g,i=>r[i]||i)}formatNumber(n){return this.replaceDigits(n.toString())}getMonthYearOrder(){var r;const n=(r=this.options.locale)==null?void 0:r.code;return n&&Tn.yearFirstLocales.has(n)?"year-first":"month-first"}formatMonthYear(n){const{locale:r,timeZone:i,numerals:s}=this.options,o=r==null?void 0:r.code;if(o&&Tn.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:i,numberingSystem:s}).format(n)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(n,l)}}Tn.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Cr=new Tn;class v2{constructor(n,r,i=Cr){this.date=n,this.displayMonth=r,this.outside=!!(r&&!i.isSameMonth(n,r)),this.dateLib=i,this.isoDate=i.format(n,"yyyy-MM-dd"),this.displayMonthId=i.format(r,"yyyy-MM"),this.dateMonthId=i.format(n,"yyyy-MM")}isEqualTo(n){return this.dateLib.isSameDay(n.date,this.date)&&this.dateLib.isSameMonth(n.displayMonth,this.displayMonth)}}class Tk{constructor(n,r){this.date=n,this.weeks=r}}class Nk{constructor(n,r){this.days=r,this.weekNumber=n}}function Mk(t){return V.createElement("button",{...t})}function Ak(t){return V.createElement("span",{...t})}function Dk(t){const{size:n=24,orientation:r="left",className:i}=t;return V.createElement("svg",{className:i,width:n,height:n,viewBox:"0 0 24 24"},r==="up"&&V.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&V.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&V.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&V.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function Rk(t){const{day:n,modifiers:r,...i}=t;return V.createElement("td",{...i})}function Pk(t){const{day:n,modifiers:r,...i}=t,s=V.useRef(null);return V.useEffect(()=>{var o;r.focused&&((o=s.current)==null||o.focus())},[r.focused]),V.createElement("button",{ref:s,...i})}var $e;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})($e||($e={}));var It;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(It||(It={}));var Qn;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Qn||(Qn={}));var wn;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(wn||(wn={}));function Lk(t){const{options:n,className:r,components:i,classNames:s,...o}=t,l=[s[$e.Dropdown],r].join(" "),c=n==null?void 0:n.find(({value:a})=>a===o.value);return V.createElement("span",{"data-disabled":o.disabled,className:s[$e.DropdownRoot]},V.createElement(i.Select,{className:l,...o},n==null?void 0:n.map(({value:a,label:f,disabled:u})=>V.createElement(i.Option,{key:a,value:a,disabled:u},f))),V.createElement("span",{className:s[$e.CaptionLabel],"aria-hidden":!0},c==null?void 0:c.label,V.createElement(i.Chevron,{orientation:"down",size:18,className:s[$e.Chevron]})))}function Ik(t){return V.createElement("div",{...t})}function Ok(t){return V.createElement("div",{...t})}function Bk(t){const{calendarMonth:n,displayIndex:r,...i}=t;return V.createElement("div",{...i},t.children)}function zk(t){const{calendarMonth:n,displayIndex:r,...i}=t;return V.createElement("div",{...i})}function jk(t){return V.createElement("table",{...t})}function Fk(t){return V.createElement("div",{...t})}const b2=V.createContext(void 0);function mo(){const t=V.useContext(b2);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function Hk(t){const{components:n}=mo();return V.createElement(n.Dropdown,{...t})}function $k(t){const{onPreviousClick:n,onNextClick:r,previousMonth:i,nextMonth:s,...o}=t,{components:l,classNames:c,labels:{labelPrevious:a,labelNext:f}}=mo(),u=V.useCallback(y=>{s&&(r==null||r(y))},[s,r]),m=V.useCallback(y=>{i&&(n==null||n(y))},[i,n]);return V.createElement("nav",{...o},V.createElement(l.PreviousMonthButton,{type:"button",className:c[$e.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":a(i),onClick:m},V.createElement(l.Chevron,{disabled:i?void 0:!0,className:c[$e.Chevron],orientation:"left"})),V.createElement(l.NextMonthButton,{type:"button",className:c[$e.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":f(s),onClick:u},V.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[$e.Chevron]})))}function Vk(t){const{components:n}=mo();return V.createElement(n.Button,{...t})}function Wk(t){return V.createElement("option",{...t})}function Uk(t){const{components:n}=mo();return V.createElement(n.Button,{...t})}function qk(t){const{rootRef:n,...r}=t;return V.createElement("div",{...r,ref:n})}function Yk(t){return V.createElement("select",{...t})}function Gk(t){const{week:n,...r}=t;return V.createElement("tr",{...r})}function Zk(t){return V.createElement("th",{...t})}function Xk(t){return V.createElement("thead",{"aria-hidden":!0},V.createElement("tr",{...t}))}function Kk(t){const{week:n,...r}=t;return V.createElement("th",{...r})}function Qk(t){return V.createElement("th",{...t})}function Jk(t){return V.createElement("tbody",{...t})}function eE(t){const{components:n}=mo();return V.createElement(n.Dropdown,{...t})}const tE=Object.freeze(Object.defineProperty({__proto__:null,Button:Mk,CaptionLabel:Ak,Chevron:Dk,Day:Rk,DayButton:Pk,Dropdown:Lk,DropdownNav:Ik,Footer:Ok,Month:Bk,MonthCaption:zk,MonthGrid:jk,Months:Fk,MonthsDropdown:Hk,Nav:$k,NextMonthButton:Vk,Option:Wk,PreviousMonthButton:Uk,Root:qk,Select:Yk,Week:Gk,WeekNumber:Kk,WeekNumberHeader:Qk,Weekday:Zk,Weekdays:Xk,Weeks:Jk,YearsDropdown:eE},Symbol.toStringTag,{value:"Module"}));function Ir(t,n,r=!1,i=Cr){let{from:s,to:o}=t;const{differenceInCalendarDays:l,isSameDay:c}=i;return s&&o?(l(o,s)<0&&([s,o]=[o,s]),l(n,s)>=(r?1:0)&&l(o,n)>=(r?1:0)):!r&&o?c(o,n):!r&&s?c(s,n):!1}function vu(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function dl(t){return!!(t&&typeof t=="object"&&"from"in t)}function bu(t){return!!(t&&typeof t=="object"&&"after"in t)}function yu(t){return!!(t&&typeof t=="object"&&"before"in t)}function y2(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function x2(t,n){return Array.isArray(t)&&t.every(n.isDate)}function Or(t,n,r=Cr){const i=Array.isArray(n)?n:[n],{isSameDay:s,differenceInCalendarDays:o,isAfter:l}=r;return i.some(c=>{if(typeof c=="boolean")return c;if(r.isDate(c))return s(t,c);if(x2(c,r))return c.some(a=>s(t,a));if(dl(c))return Ir(c,t,!1,r);if(y2(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(vu(c)){const a=o(c.before,t),f=o(c.after,t),u=a>0,m=f<0;return l(c.before,c.after)?m&&u:u||m}return bu(c)?o(t,c.after)>0:yu(c)?o(c.before,t)>0:typeof c=="function"?c(t):!1})}function nE(t,n,r,i,s){const{disabled:o,hidden:l,modifiers:c,showOutsideDays:a,broadcastCalendar:f,today:u=s.today()}=n,{isSameDay:m,isSameMonth:y,startOfMonth:_,isBefore:S,endOfMonth:E,isAfter:d}=s,h=r&&_(r),v=i&&E(i),x={[It.focused]:[],[It.outside]:[],[It.disabled]:[],[It.hidden]:[],[It.today]:[]},g={};for(const b of t){const{date:w,displayMonth:k}=b,N=!!(k&&!y(w,k)),T=!!(h&&S(w,h)),D=!!(v&&d(w,v)),I=!!(o&&Or(w,o,s)),L=!!(l&&Or(w,l,s))||T||D||!f&&!a&&N||f&&a===!1&&N,R=m(w,u);N&&x.outside.push(b),I&&x.disabled.push(b),L&&x.hidden.push(b),R&&x.today.push(b),c&&Object.keys(c).forEach(P=>{const O=c==null?void 0:c[P];O&&Or(w,O,s)&&(g[P]?g[P].push(b):g[P]=[b])})}return b=>{const w={[It.focused]:!1,[It.disabled]:!1,[It.hidden]:!1,[It.outside]:!1,[It.today]:!1},k={};for(const N in x){const T=x[N];w[N]=T.some(D=>D===b)}for(const N in g)k[N]=g[N].some(T=>T===b);return{...w,...k}}}function rE(t,n,r={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[o])=>(r[o]?s.push(r[o]):n[It[o]]?s.push(n[It[o]]):n[Qn[o]]&&s.push(n[Qn[o]]),s),[n[$e.Day]])}function iE(t){return{...tE,...t}}function sE(t){const n={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([r,i])=>{r.startsWith("data-")&&(n[r]=i)}),n}function xu(){const t={};for(const n in $e)t[$e[n]]=`rdp-${$e[n]}`;for(const n in It)t[It[n]]=`rdp-${It[n]}`;for(const n in Qn)t[Qn[n]]=`rdp-${Qn[n]}`;for(const n in wn)t[wn[n]]=`rdp-${wn[n]}`;return t}function w2(t,n,r){return(r??new Tn(n)).formatMonthYear(t)}const oE=w2;function aE(t,n,r){return(r??new Tn(n)).format(t,"d")}function lE(t,n=Cr){return n.format(t,"LLLL")}function cE(t,n,r){return(r??new Tn(n)).format(t,"cccccc")}function uE(t,n=Cr){return t<10?n.formatNumber(`0${t.toLocaleString()}`):n.formatNumber(`${t.toLocaleString()}`)}function dE(){return""}function C2(t,n=Cr){return n.format(t,"yyyy")}const fE=C2,hE=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:w2,formatDay:aE,formatMonthCaption:oE,formatMonthDropdown:lE,formatWeekNumber:uE,formatWeekNumberHeader:dE,formatWeekdayName:cE,formatYearCaption:fE,formatYearDropdown:C2},Symbol.toStringTag,{value:"Module"}));function mE(t){return t!=null&&t.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t!=null&&t.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...hE,...t}}function wu(t,n,r,i){let s=(i??new Tn(r)).format(t,"PPPP");return n.today&&(s=`Today, ${s}`),n.selected&&(s=`${s}, selected`),s}const pE=wu;function Cu(t,n,r){return(r??new Tn(n)).formatMonthYear(t)}const gE=Cu;function _2(t,n,r,i){let s=(i??new Tn(r)).format(t,"PPPP");return n!=null&&n.today&&(s=`Today, ${s}`),s}function S2(t){return"Choose the Month"}function k2(){return""}const vE="Go to the Next Month";function E2(t,n){return vE}function T2(t){return"Go to the Previous Month"}function N2(t,n,r){return(r??new Tn(n)).format(t,"cccc")}function M2(t,n){return`Week ${t}`}function A2(t){return"Week Number"}function D2(t){return"Choose the Year"}const bE=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:gE,labelDay:pE,labelDayButton:wu,labelGrid:Cu,labelGridcell:_2,labelMonthDropdown:S2,labelNav:k2,labelNext:E2,labelPrevious:T2,labelWeekNumber:M2,labelWeekNumberHeader:A2,labelWeekday:N2,labelYearDropdown:D2},Symbol.toStringTag,{value:"Module"})),qn=(t,n,r)=>n||(r?typeof r=="function"?r:(...i)=>r:t);function yE(t,n){var i;const r=((i=n.locale)==null?void 0:i.labels)??{};return{...bE,...t??{},labelDayButton:qn(wu,t==null?void 0:t.labelDayButton,r.labelDayButton),labelMonthDropdown:qn(S2,t==null?void 0:t.labelMonthDropdown,r.labelMonthDropdown),labelNext:qn(E2,t==null?void 0:t.labelNext,r.labelNext),labelPrevious:qn(T2,t==null?void 0:t.labelPrevious,r.labelPrevious),labelWeekNumber:qn(M2,t==null?void 0:t.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:qn(D2,t==null?void 0:t.labelYearDropdown,r.labelYearDropdown),labelGrid:qn(Cu,t==null?void 0:t.labelGrid,r.labelGrid),labelGridcell:qn(_2,t==null?void 0:t.labelGridcell,r.labelGridcell),labelNav:qn(k2,t==null?void 0:t.labelNav,r.labelNav),labelWeekNumberHeader:qn(A2,t==null?void 0:t.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:qn(N2,t==null?void 0:t.labelWeekday,r.labelWeekday)}}function xE(t,n,r,i,s){const{startOfMonth:o,startOfYear:l,endOfYear:c,eachMonthOfInterval:a,getMonth:f}=s;return a({start:l(t),end:c(t)}).map(y=>{const _=i.formatMonthDropdown(y,s),S=f(y),E=n&&y<o(n)||r&&y>o(r)||!1;return{value:S,label:_,disabled:E}})}function wE(t,n={},r={}){let i={...n==null?void 0:n[$e.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{i={...i,...r==null?void 0:r[s]}}),i}function CE(t,n,r,i){const s=i??t.today(),o=r?t.startOfBroadcastWeek(s,t):n?t.startOfISOWeek(s):t.startOfWeek(s),l=[];for(let c=0;c<7;c++){const a=t.addDays(o,c);l.push(a)}return l}function _E(t,n,r,i,s=!1){if(!t||!n)return;const{startOfYear:o,endOfYear:l,eachYearOfInterval:c,getYear:a}=i,f=o(t),u=l(n),m=c({start:f,end:u});return s&&m.reverse(),m.map(y=>{const _=r.formatYearDropdown(y,i);return{value:a(y),label:_,disabled:!1}})}function SE(t,n={}){var c;const{weekStartsOn:r,locale:i}=n,s=r??((c=i==null?void 0:i.options)==null?void 0:c.weekStartsOn)??0,o=a=>{const f=typeof a=="number"||typeof a=="string"?new Date(a):a;return new rn(f.getFullYear(),f.getMonth(),f.getDate(),12,0,0,t)},l=a=>{const f=o(a);return new Date(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0,0)};return{today:()=>o(rn.tz(t)),newDate:(a,f,u)=>new rn(a,f,u,12,0,0,t),startOfDay:a=>o(a),startOfWeek:(a,f)=>{const u=o(a),m=(f==null?void 0:f.weekStartsOn)??s,y=(u.getDay()-m+7)%7;return u.setDate(u.getDate()-y),u},startOfISOWeek:a=>{const f=o(a),u=(f.getDay()-1+7)%7;return f.setDate(f.getDate()-u),f},startOfMonth:a=>{const f=o(a);return f.setDate(1),f},startOfYear:a=>{const f=o(a);return f.setMonth(0,1),f},endOfWeek:(a,f)=>{const u=o(a),_=((((f==null?void 0:f.weekStartsOn)??s)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+_),u},endOfISOWeek:a=>{const f=o(a),u=(7-f.getDay())%7;return f.setDate(f.getDate()+u),f},endOfMonth:a=>{const f=o(a);return f.setMonth(f.getMonth()+1,0),f},endOfYear:a=>{const f=o(a);return f.setMonth(11,31),f},eachMonthOfInterval:a=>{const f=o(a.start),u=o(a.end),m=[],y=new rn(f.getFullYear(),f.getMonth(),1,12,0,0,t),_=u.getFullYear()*12+u.getMonth();for(;y.getFullYear()*12+y.getMonth()<=_;)m.push(new rn(y,t)),y.setMonth(y.getMonth()+1,1);return m},addDays:(a,f)=>{const u=o(a);return u.setDate(u.getDate()+f),u},addWeeks:(a,f)=>{const u=o(a);return u.setDate(u.getDate()+f*7),u},addMonths:(a,f)=>{const u=o(a);return u.setMonth(u.getMonth()+f),u},addYears:(a,f)=>{const u=o(a);return u.setFullYear(u.getFullYear()+f),u},eachYearOfInterval:a=>{const f=o(a.start),u=o(a.end),m=[],y=new rn(f.getFullYear(),0,1,12,0,0,t);for(;y.getFullYear()<=u.getFullYear();)m.push(new rn(y,t)),y.setFullYear(y.getFullYear()+1,0,1);return m},getWeek:(a,f)=>{var m;const u=l(a);return ul(u,{weekStartsOn:(f==null?void 0:f.weekStartsOn)??s,firstWeekContainsDate:(f==null?void 0:f.firstWeekContainsDate)??((m=i==null?void 0:i.options)==null?void 0:m.firstWeekContainsDate)??1})},getISOWeek:a=>{const f=l(a);return cl(f)},differenceInCalendarDays:(a,f)=>{const u=l(a),m=l(f);return hu(u,m)},differenceInCalendarMonths:(a,f)=>{const u=l(a),m=l(f);return o2(u,m)}}}const po=t=>t instanceof HTMLElement?t:null,ic=t=>[...t.querySelectorAll("[data-animated-month]")??[]],kE=t=>po(t.querySelector("[data-animated-month]")),sc=t=>po(t.querySelector("[data-animated-caption]")),oc=t=>po(t.querySelector("[data-animated-weeks]")),EE=t=>po(t.querySelector("[data-animated-nav]")),TE=t=>po(t.querySelector("[data-animated-weekdays]"));function NE(t,n,{classNames:r,months:i,focused:s,dateLib:o}){const l=V.useRef(null),c=V.useRef(i),a=V.useRef(!1);V.useLayoutEffect(()=>{const f=c.current;if(c.current=i,!n||!t.current||!(t.current instanceof HTMLElement)||i.length===0||f.length===0||i.length!==f.length)return;const u=o.isSameMonth(i[0].date,f[0].date),m=o.isAfter(i[0].date,f[0].date),y=m?r[wn.caption_after_enter]:r[wn.caption_before_enter],_=m?r[wn.weeks_after_enter]:r[wn.weeks_before_enter],S=l.current,E=t.current.cloneNode(!0);if(E instanceof HTMLElement?(ic(E).forEach(x=>{if(!(x instanceof HTMLElement))return;const g=kE(x);g&&x.contains(g)&&x.removeChild(g);const b=sc(x);b&&b.classList.remove(y);const w=oc(x);w&&w.classList.remove(_)}),l.current=E):l.current=null,a.current||u||s)return;const d=S instanceof HTMLElement?ic(S):[],h=ic(t.current);if(h!=null&&h.every(v=>v instanceof HTMLElement)&&d&&d.every(v=>v instanceof HTMLElement)){a.current=!0,t.current.style.isolation="isolate";const v=EE(t.current);v&&(v.style.zIndex="1"),h.forEach((x,g)=>{const b=d[g];if(!b)return;x.style.position="relative",x.style.overflow="hidden";const w=sc(x);w&&w.classList.add(y);const k=oc(x);k&&k.classList.add(_);const N=()=>{a.current=!1,t.current&&(t.current.style.isolation=""),v&&(v.style.zIndex=""),w&&w.classList.remove(y),k&&k.classList.remove(_),x.style.position="",x.style.overflow="",x.contains(b)&&x.removeChild(b)};b.style.pointerEvents="none",b.style.position="absolute",b.style.overflow="hidden",b.setAttribute("aria-hidden","true");const T=TE(b);T&&(T.style.opacity="0");const D=sc(b);D&&(D.classList.add(m?r[wn.caption_before_exit]:r[wn.caption_after_exit]),D.addEventListener("animationend",N));const I=oc(b);I&&I.classList.add(m?r[wn.weeks_before_exit]:r[wn.weeks_after_exit]),x.insertBefore(b,x.firstChild)})}})}function ME(t,n,r,i){const s=t[0],o=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:a}=r??{},{addDays:f,differenceInCalendarDays:u,differenceInCalendarMonths:m,endOfBroadcastWeek:y,endOfISOWeek:_,endOfMonth:S,endOfWeek:E,isAfter:d,startOfBroadcastWeek:h,startOfISOWeek:v,startOfWeek:x}=i,g=a?h(s,i):l?v(s):x(s),b=a?y(o):l?_(S(o)):E(S(o)),w=n&&(a?y(n):l?_(n):E(n)),k=w&&d(b,w)?w:b,N=u(k,g),T=m(o,s)+1,D=[];for(let R=0;R<=N;R++){const P=f(g,R);D.push(P)}const L=(a?35:42)*T;if(c&&D.length<L){const R=L-D.length;for(let P=0;P<R;P++){const O=f(D[D.length-1],1);D.push(O)}}return D}function AE(t){const n=[];return t.reduce((r,i)=>{const s=i.weeks.reduce((o,l)=>o.concat(l.days.slice()),n.slice());return r.concat(s.slice())},n.slice())}function DE(t,n,r,i){const{numberOfMonths:s=1}=r,o=[];for(let l=0;l<s;l++){const c=i.addMonths(t,l);if(n&&c>n)break;o.push(c)}return o}function $f(t,n,r,i){const{month:s,defaultMonth:o,today:l=i.today(),numberOfMonths:c=1}=t;let a=s||o||l;const{differenceInCalendarMonths:f,addMonths:u,startOfMonth:m}=i;if(r&&f(r,a)<c-1){const y=-1*(c-1);a=u(r,y)}return n&&f(a,n)<0&&(a=n),m(a)}function RE(t,n,r,i){const{addDays:s,endOfBroadcastWeek:o,endOfISOWeek:l,endOfMonth:c,endOfWeek:a,getISOWeek:f,getWeek:u,startOfBroadcastWeek:m,startOfISOWeek:y,startOfWeek:_}=i,S=t.reduce((E,d)=>{const h=r.broadcastCalendar?m(d,i):r.ISOWeek?y(d):_(d),v=r.broadcastCalendar?o(d):r.ISOWeek?l(c(d)):a(c(d)),x=n.filter(k=>k>=h&&k<=v),g=r.broadcastCalendar?35:42;if(r.fixedWeeks&&x.length<g){const k=n.filter(N=>{const T=g-x.length;return N>v&&N<=s(v,T)});x.push(...k)}const b=x.reduce((k,N)=>{const T=r.ISOWeek?f(N):u(N),D=k.find(L=>L.weekNumber===T),I=new v2(N,d,i);return D?D.days.push(I):k.push(new Nk(T,[I])),k},[]),w=new Tk(d,b);return E.push(w),E},[]);return r.reverseMonths?S.reverse():S}function PE(t,n){let{startMonth:r,endMonth:i}=t;const{startOfYear:s,startOfDay:o,startOfMonth:l,endOfMonth:c,addYears:a,endOfYear:f,newDate:u,today:m}=n,{fromYear:y,toYear:_,fromMonth:S,toMonth:E}=t;!r&&S&&(r=S),!r&&y&&(r=n.newDate(y,0,1)),!i&&E&&(i=E),!i&&_&&(i=u(_,11,31));const d=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return r?r=l(r):y?r=u(y,0,1):!r&&d&&(r=s(a(t.today??m(),-100))),i?i=c(i):_?i=u(_,11,31):!i&&d&&(i=f(t.today??m())),[r&&o(r),i&&o(i)]}function LE(t,n,r,i){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:o=1}=r,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:a}=i,f=s?o:1,u=l(t);if(!n)return c(u,f);if(!(a(n,t)<o))return c(u,f)}function IE(t,n,r,i){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:o}=r,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:a}=i,f=s?o??1:1,u=l(t);if(!n)return c(u,-f);if(!(a(u,n)<=0))return c(u,-f)}function OE(t){const n=[];return t.reduce((r,i)=>r.concat(i.weeks.slice()),n.slice())}function fl(t,n){const[r,i]=V.useState(t);return[n===void 0?r:n,i]}function BE(t,n){var g;const[r,i]=PE(t,n),{startOfMonth:s,endOfMonth:o}=n,l=$f(t,r,i,n),[c,a]=fl(l,t.month?l:void 0);V.useEffect(()=>{const b=$f(t,r,i,n);a(b)},[t.timeZone]);const{months:f,weeks:u,days:m,previousMonth:y,nextMonth:_}=V.useMemo(()=>{const b=DE(c,i,{numberOfMonths:t.numberOfMonths},n),w=ME(b,t.endMonth?o(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},n),k=RE(b,w,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},n),N=OE(k),T=AE(k),D=IE(c,r,t,n),I=LE(c,i,t,n);return{months:k,weeks:N,days:T,previousMonth:D,nextMonth:I}},[n,c.getTime(),i==null?void 0:i.getTime(),r==null?void 0:r.getTime(),t.disableNavigation,t.broadcastCalendar,(g=t.endMonth)==null?void 0:g.getTime(),t.fixedWeeks,t.ISOWeek,t.numberOfMonths,t.pagedNavigation,t.reverseMonths]),{disableNavigation:S,onMonthChange:E}=t,d=b=>u.some(w=>w.days.some(k=>k.isEqualTo(b))),h=b=>{if(S)return;let w=s(b);r&&w<s(r)&&(w=s(r)),i&&w>s(i)&&(w=s(i)),a(w),E==null||E(w)};return{months:f,weeks:u,days:m,navStart:r,navEnd:i,previousMonth:y,nextMonth:_,goToMonth:h,goToDay:b=>{d(b)||h(b.date)}}}var ar;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(ar||(ar={}));function Vf(t){return!t[It.disabled]&&!t[It.hidden]&&!t[It.outside]}function zE(t,n,r,i){let s,o=-1;for(const l of t){const c=n(l);Vf(c)&&(c[It.focused]&&o<ar.FocusedModifier?(s=l,o=ar.FocusedModifier):i!=null&&i.isEqualTo(l)&&o<ar.LastFocused?(s=l,o=ar.LastFocused):r(l.date)&&o<ar.Selected?(s=l,o=ar.Selected):c[It.today]&&o<ar.Today&&(s=l,o=ar.Today))}return s||(s=t.find(l=>Vf(n(l)))),s}function jE(t,n,r,i,s,o,l){const{ISOWeek:c,broadcastCalendar:a}=o,{addDays:f,addMonths:u,addWeeks:m,addYears:y,endOfBroadcastWeek:_,endOfISOWeek:S,endOfWeek:E,max:d,min:h,startOfBroadcastWeek:v,startOfISOWeek:x,startOfWeek:g}=l;let w={day:f,week:m,month:u,year:y,startOfWeek:k=>a?v(k,l):c?x(k):g(k),endOfWeek:k=>a?_(k):c?S(k):E(k)}[t](r,n==="after"?1:-1);return n==="before"&&i?w=d([i,w]):n==="after"&&s&&(w=h([s,w])),w}function R2(t,n,r,i,s,o,l,c=0){if(c>365)return;const a=jE(t,n,r.date,i,s,o,l),f=!!(o.disabled&&Or(a,o.disabled,l)),u=!!(o.hidden&&Or(a,o.hidden,l)),m=a,y=new v2(a,m,l);return!f&&!u?y:R2(t,n,y,i,s,o,l,c+1)}function FE(t,n,r,i,s){const{autoFocus:o}=t,[l,c]=V.useState(),a=zE(n.days,r,i||(()=>!1),l),[f,u]=V.useState(o?a:void 0);return{isFocusTarget:E=>!!(a!=null&&a.isEqualTo(E)),setFocused:u,focused:f,blur:()=>{c(f),u(void 0)},moveFocus:(E,d)=>{if(!f)return;const h=R2(E,d,f,n.navStart,n.navEnd,t,s);h&&(t.disableNavigation&&!n.days.some(x=>x.isEqualTo(h))||(n.goToDay(h),u(h)))}}}function HE(t,n){const{selected:r,required:i,onSelect:s}=t,[o,l]=fl(r,s?r:void 0),c=s?r:o,{isSameDay:a}=n,f=_=>(c==null?void 0:c.some(S=>a(S,_)))??!1,{min:u,max:m}=t;return{selected:c,select:(_,S,E)=>{let d=[...c??[]];if(f(_)){if((c==null?void 0:c.length)===u||i&&(c==null?void 0:c.length)===1)return;d=c==null?void 0:c.filter(h=>!a(h,_))}else(c==null?void 0:c.length)===m?d=[_]:d=[...d,_];return s||l(d),s==null||s(d,_,S,E),d},isSelected:f}}function $E(t,n,r=0,i=0,s=!1,o=Cr){const{from:l,to:c}=n||{},{isSameDay:a,isAfter:f,isBefore:u}=o;let m;if(!l&&!c)m={from:t,to:r>0?void 0:t};else if(l&&!c)a(l,t)?r===0?m={from:l,to:t}:s?m={from:l,to:void 0}:m=void 0:u(t,l)?m={from:t,to:l}:m={from:l,to:t};else if(l&&c)if(a(l,t)&&a(c,t))s?m={from:l,to:c}:m=void 0;else if(a(l,t))m={from:l,to:r>0?void 0:t};else if(a(c,t))m={from:t,to:r>0?void 0:t};else if(u(t,l))m={from:t,to:c};else if(f(t,l))m={from:l,to:t};else if(f(t,c))m={from:l,to:t};else throw new Error("Invalid range");if(m!=null&&m.from&&(m!=null&&m.to)){const y=o.differenceInCalendarDays(m.to,m.from);i>0&&y>i?m={from:t,to:void 0}:r>1&&y<r&&(m={from:t,to:void 0})}return m}function VE(t,n,r=Cr){const i=Array.isArray(n)?n:[n];let s=t.from;const o=r.differenceInCalendarDays(t.to,t.from),l=Math.min(o,6);for(let c=0;c<=l;c++){if(i.includes(s.getDay()))return!0;s=r.addDays(s,1)}return!1}function Wf(t,n,r=Cr){return Ir(t,n.from,!1,r)||Ir(t,n.to,!1,r)||Ir(n,t.from,!1,r)||Ir(n,t.to,!1,r)}function WE(t,n,r=Cr){const i=Array.isArray(n)?n:[n];if(i.filter(c=>typeof c!="function").some(c=>typeof c=="boolean"?c:r.isDate(c)?Ir(t,c,!1,r):x2(c,r)?c.some(a=>Ir(t,a,!1,r)):dl(c)?c.from&&c.to?Wf(t,{from:c.from,to:c.to},r):!1:y2(c)?VE(t,c.dayOfWeek,r):vu(c)?r.isAfter(c.before,c.after)?Wf(t,{from:r.addDays(c.after,1),to:r.addDays(c.before,-1)},r):Or(t.from,c,r)||Or(t.to,c,r):bu(c)||yu(c)?Or(t.from,c,r)||Or(t.to,c,r):!1))return!0;const l=i.filter(c=>typeof c=="function");if(l.length){let c=t.from;const a=r.differenceInCalendarDays(t.to,t.from);for(let f=0;f<=a;f++){if(l.some(u=>u(c)))return!0;c=r.addDays(c,1)}}return!1}function UE(t,n){const{disabled:r,excludeDisabled:i,selected:s,required:o,onSelect:l}=t,[c,a]=fl(s,l?s:void 0),f=l?s:c;return{selected:f,select:(y,_,S)=>{const{min:E,max:d}=t,h=y?$E(y,f,E,d,o,n):void 0;return i&&r&&(h!=null&&h.from)&&h.to&&WE({from:h.from,to:h.to},r,n)&&(h.from=y,h.to=void 0),l||a(h),l==null||l(h,y,_,S),h},isSelected:y=>f&&Ir(f,y,!1,n)}}function qE(t,n){const{selected:r,required:i,onSelect:s}=t,[o,l]=fl(r,s?r:void 0),c=s?r:o,{isSameDay:a}=n;return{selected:c,select:(m,y,_)=>{let S=m;return!i&&c&&c&&a(m,c)&&(S=void 0),s||l(S),s==null||s(S,m,y,_),S},isSelected:m=>c?a(c,m):!1}}function YE(t,n){const r=qE(t,n),i=HE(t,n),s=UE(t,n);switch(t.mode){case"single":return r;case"multiple":return i;case"range":return s;default:return}}function Ln(t,n){return t instanceof rn&&t.timeZone===n?t:new rn(t,n)}function $i(t,n,r){return Ln(t,n)}function Uf(t,n,r){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?$i(t,n):Array.isArray(t)?t.map(i=>i instanceof Date?$i(i,n):i):dl(t)?{...t,from:t.from?Ln(t.from,n):t.from,to:t.to?Ln(t.to,n):t.to}:vu(t)?{before:$i(t.before,n),after:$i(t.after,n)}:bu(t)?{after:$i(t.after,n)}:yu(t)?{before:$i(t.before,n)}:t}function ac(t,n,r){return t&&(Array.isArray(t)?t.map(i=>Uf(i,n)):Uf(t,n))}function GE(t){var yt;let n=t;const r=n.timeZone;if(r&&(n={...t,timeZone:r},n.today&&(n.today=Ln(n.today,r)),n.month&&(n.month=Ln(n.month,r)),n.defaultMonth&&(n.defaultMonth=Ln(n.defaultMonth,r)),n.startMonth&&(n.startMonth=Ln(n.startMonth,r)),n.endMonth&&(n.endMonth=Ln(n.endMonth,r)),n.mode==="single"&&n.selected?n.selected=Ln(n.selected,r):n.mode==="multiple"&&n.selected?n.selected=(yt=n.selected)==null?void 0:yt.map(Ue=>Ln(Ue,r)):n.mode==="range"&&n.selected&&(n.selected={from:n.selected.from?Ln(n.selected.from,r):n.selected.from,to:n.selected.to?Ln(n.selected.to,r):n.selected.to}),n.disabled!==void 0&&(n.disabled=ac(n.disabled,r)),n.hidden!==void 0&&(n.hidden=ac(n.hidden,r)),n.modifiers)){const Ue={};Object.keys(n.modifiers).forEach(rt=>{var He;Ue[rt]=ac((He=n.modifiers)==null?void 0:He[rt],r)}),n.modifiers=Ue}const{components:i,formatters:s,labels:o,dateLib:l,locale:c,classNames:a}=V.useMemo(()=>{const Ue={...g2,...n.locale},rt=n.broadcastCalendar?1:n.weekStartsOn,He=n.noonSafe&&n.timeZone?SE(n.timeZone,{weekStartsOn:rt,locale:Ue}):void 0,Ye=n.dateLib&&He?{...He,...n.dateLib}:n.dateLib??He,ht=new Tn({locale:Ue,weekStartsOn:rt,firstWeekContainsDate:n.firstWeekContainsDate,useAdditionalWeekYearTokens:n.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:n.useAdditionalDayOfYearTokens,timeZone:n.timeZone,numerals:n.numerals},Ye);return{dateLib:ht,components:iE(n.components),formatters:mE(n.formatters),labels:yE(n.labels,ht.options),locale:Ue,classNames:{...xu(),...n.classNames}}},[n.locale,n.broadcastCalendar,n.weekStartsOn,n.firstWeekContainsDate,n.useAdditionalWeekYearTokens,n.useAdditionalDayOfYearTokens,n.timeZone,n.numerals,n.dateLib,n.noonSafe,n.components,n.formatters,n.labels,n.classNames]);n.today||(n={...n,today:l.today()});const{captionLayout:f,mode:u,navLayout:m,numberOfMonths:y=1,onDayBlur:_,onDayClick:S,onDayFocus:E,onDayKeyDown:d,onDayMouseEnter:h,onDayMouseLeave:v,onNextClick:x,onPrevClick:g,showWeekNumber:b,styles:w}=n,{formatCaption:k,formatDay:N,formatMonthDropdown:T,formatWeekNumber:D,formatWeekNumberHeader:I,formatWeekdayName:L,formatYearDropdown:R}=s,P=BE(n,l),{days:O,months:U,navStart:H,navEnd:B,previousMonth:j,nextMonth:F,goToMonth:Y}=P,q=nE(O,n,H,B,l),{isSelected:G,select:$,selected:Z}=YE(n,l)??{},{blur:ee,focused:te,isFocusTarget:se,moveFocus:ie,setFocused:ae}=FE(n,P,q,G??(()=>!1),l),{labelDayButton:de,labelGridcell:be,labelGrid:ce,labelMonthDropdown:pe,labelNav:Se,labelPrevious:Re,labelNext:Fe,labelWeekday:Ie,labelWeekNumber:Xe,labelWeekNumberHeader:X,labelYearDropdown:re}=o,oe=V.useMemo(()=>CE(l,n.ISOWeek,n.broadcastCalendar,n.today),[l,n.ISOWeek,n.broadcastCalendar,n.today]),xe=u!==void 0||S!==void 0,ve=V.useCallback(()=>{j&&(Y(j),g==null||g(j))},[j,Y,g]),ue=V.useCallback(()=>{F&&(Y(F),x==null||x(F))},[Y,F,x]),fe=V.useCallback((Ue,rt)=>He=>{He.preventDefault(),He.stopPropagation(),ae(Ue),!rt.disabled&&($==null||$(Ue.date,rt,He),S==null||S(Ue.date,rt,He))},[$,S,ae]),De=V.useCallback((Ue,rt)=>He=>{ae(Ue),E==null||E(Ue.date,rt,He)},[E,ae]),he=V.useCallback((Ue,rt)=>He=>{ee(),_==null||_(Ue.date,rt,He)},[ee,_]),Oe=V.useCallback((Ue,rt)=>He=>{const Ye={ArrowLeft:[He.shiftKey?"month":"day",n.dir==="rtl"?"after":"before"],ArrowRight:[He.shiftKey?"month":"day",n.dir==="rtl"?"before":"after"],ArrowDown:[He.shiftKey?"year":"week","after"],ArrowUp:[He.shiftKey?"year":"week","before"],PageUp:[He.shiftKey?"year":"month","before"],PageDown:[He.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ye[He.key]){He.preventDefault(),He.stopPropagation();const[ht,ot]=Ye[He.key];ie(ht,ot)}d==null||d(Ue.date,rt,He)},[ie,d,n.dir]),Ve=V.useCallback((Ue,rt)=>He=>{h==null||h(Ue.date,rt,He)},[h]),We=V.useCallback((Ue,rt)=>He=>{v==null||v(Ue.date,rt,He)},[v]),mt=V.useCallback(Ue=>rt=>{const He=Number(rt.target.value),Ye=l.setMonth(l.startOfMonth(Ue),He);Y(Ye)},[l,Y]),nt=V.useCallback(Ue=>rt=>{const He=Number(rt.target.value),Ye=l.setYear(l.startOfMonth(Ue),He);Y(Ye)},[l,Y]),{className:ft,style:bt}=V.useMemo(()=>({className:[a[$e.Root],n.className].filter(Boolean).join(" "),style:{...w==null?void 0:w[$e.Root],...n.style}}),[a,n.className,n.style,w]),xt=sE(n),qe=V.useRef(null);NE(qe,!!n.animate,{classNames:a,months:U,focused:te,dateLib:l});const wt={dayPickerProps:n,selected:Z,select:$,isSelected:G,months:U,nextMonth:F,previousMonth:j,goToMonth:Y,getModifiers:q,components:i,classNames:a,styles:w,labels:o,formatters:s};return V.createElement(b2.Provider,{value:wt},V.createElement(i.Root,{rootRef:n.animate?qe:void 0,className:ft,style:bt,dir:n.dir,id:n.id,lang:n.lang,nonce:n.nonce,title:n.title,role:n.role,"aria-label":n["aria-label"],"aria-labelledby":n["aria-labelledby"],...xt},V.createElement(i.Months,{className:a[$e.Months],style:w==null?void 0:w[$e.Months]},!n.hideNavigation&&!m&&V.createElement(i.Nav,{"data-animated-nav":n.animate?"true":void 0,className:a[$e.Nav],style:w==null?void 0:w[$e.Nav],"aria-label":Se(),onPreviousClick:ve,onNextClick:ue,previousMonth:j,nextMonth:F}),U.map((Ue,rt)=>V.createElement(i.Month,{"data-animated-month":n.animate?"true":void 0,className:a[$e.Month],style:w==null?void 0:w[$e.Month],key:rt,displayIndex:rt,calendarMonth:Ue},m==="around"&&!n.hideNavigation&&rt===0&&V.createElement(i.PreviousMonthButton,{type:"button",className:a[$e.PreviousMonthButton],tabIndex:j?void 0:-1,"aria-disabled":j?void 0:!0,"aria-label":Re(j),onClick:ve,"data-animated-button":n.animate?"true":void 0},V.createElement(i.Chevron,{disabled:j?void 0:!0,className:a[$e.Chevron],orientation:n.dir==="rtl"?"right":"left"})),V.createElement(i.MonthCaption,{"data-animated-caption":n.animate?"true":void 0,className:a[$e.MonthCaption],style:w==null?void 0:w[$e.MonthCaption],calendarMonth:Ue,displayIndex:rt},f!=null&&f.startsWith("dropdown")?V.createElement(i.DropdownNav,{className:a[$e.Dropdowns],style:w==null?void 0:w[$e.Dropdowns]},(()=>{const He=f==="dropdown"||f==="dropdown-months"?V.createElement(i.MonthsDropdown,{key:"month",className:a[$e.MonthsDropdown],"aria-label":pe(),classNames:a,components:i,disabled:!!n.disableNavigation,onChange:mt(Ue.date),options:xE(Ue.date,H,B,s,l),style:w==null?void 0:w[$e.Dropdown],value:l.getMonth(Ue.date)}):V.createElement("span",{key:"month"},T(Ue.date,l)),Ye=f==="dropdown"||f==="dropdown-years"?V.createElement(i.YearsDropdown,{key:"year",className:a[$e.YearsDropdown],"aria-label":re(l.options),classNames:a,components:i,disabled:!!n.disableNavigation,onChange:nt(Ue.date),options:_E(H,B,s,l,!!n.reverseYears),style:w==null?void 0:w[$e.Dropdown],value:l.getYear(Ue.date)}):V.createElement("span",{key:"year"},R(Ue.date,l));return l.getMonthYearOrder()==="year-first"?[Ye,He]:[He,Ye]})(),V.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},k(Ue.date,l.options,l))):V.createElement(i.CaptionLabel,{className:a[$e.CaptionLabel],role:"status","aria-live":"polite"},k(Ue.date,l.options,l))),m==="around"&&!n.hideNavigation&&rt===y-1&&V.createElement(i.NextMonthButton,{type:"button",className:a[$e.NextMonthButton],tabIndex:F?void 0:-1,"aria-disabled":F?void 0:!0,"aria-label":Fe(F),onClick:ue,"data-animated-button":n.animate?"true":void 0},V.createElement(i.Chevron,{disabled:F?void 0:!0,className:a[$e.Chevron],orientation:n.dir==="rtl"?"left":"right"})),rt===y-1&&m==="after"&&!n.hideNavigation&&V.createElement(i.Nav,{"data-animated-nav":n.animate?"true":void 0,className:a[$e.Nav],style:w==null?void 0:w[$e.Nav],"aria-label":Se(),onPreviousClick:ve,onNextClick:ue,previousMonth:j,nextMonth:F}),V.createElement(i.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":ce(Ue.date,l.options,l)||void 0,className:a[$e.MonthGrid],style:w==null?void 0:w[$e.MonthGrid]},!n.hideWeekdays&&V.createElement(i.Weekdays,{"data-animated-weekdays":n.animate?"true":void 0,className:a[$e.Weekdays],style:w==null?void 0:w[$e.Weekdays]},b&&V.createElement(i.WeekNumberHeader,{"aria-label":X(l.options),className:a[$e.WeekNumberHeader],style:w==null?void 0:w[$e.WeekNumberHeader],scope:"col"},I()),oe.map(He=>V.createElement(i.Weekday,{"aria-label":Ie(He,l.options,l),className:a[$e.Weekday],key:String(He),style:w==null?void 0:w[$e.Weekday],scope:"col"},L(He,l.options,l)))),V.createElement(i.Weeks,{"data-animated-weeks":n.animate?"true":void 0,className:a[$e.Weeks],style:w==null?void 0:w[$e.Weeks]},Ue.weeks.map(He=>V.createElement(i.Week,{className:a[$e.Week],key:He.weekNumber,style:w==null?void 0:w[$e.Week],week:He},b&&V.createElement(i.WeekNumber,{week:He,style:w==null?void 0:w[$e.WeekNumber],"aria-label":Xe(He.weekNumber,{locale:c}),className:a[$e.WeekNumber],scope:"row",role:"rowheader"},D(He.weekNumber,l)),He.days.map(Ye=>{const{date:ht}=Ye,ot=q(Ye);if(ot[It.focused]=!ot.hidden&&!!(te!=null&&te.isEqualTo(Ye)),ot[Qn.selected]=(G==null?void 0:G(ht))||ot.selected,dl(Z)){const{from:vn,to:Ae}=Z;ot[Qn.range_start]=!!(vn&&Ae&&l.isSameDay(ht,vn)),ot[Qn.range_end]=!!(vn&&Ae&&l.isSameDay(ht,Ae)),ot[Qn.range_middle]=Ir(Z,ht,!0,l)}const kt=wE(ot,w,n.modifiersStyles),$n=rE(ot,a,n.modifiersClassNames),gn=!xe&&!ot.hidden?be(ht,ot,l.options,l):void 0;return V.createElement(i.Day,{key:`${Ye.isoDate}_${Ye.displayMonthId}`,day:Ye,modifiers:ot,className:$n.join(" "),style:kt,role:"gridcell","aria-selected":ot.selected||void 0,"aria-label":gn,"data-day":Ye.isoDate,"data-month":Ye.outside?Ye.dateMonthId:void 0,"data-selected":ot.selected||void 0,"data-disabled":ot.disabled||void 0,"data-hidden":ot.hidden||void 0,"data-outside":Ye.outside||void 0,"data-focused":ot.focused||void 0,"data-today":ot.today||void 0},!ot.hidden&&xe?V.createElement(i.DayButton,{className:a[$e.DayButton],style:w==null?void 0:w[$e.DayButton],type:"button",day:Ye,modifiers:ot,disabled:!ot.focused&&ot.disabled||void 0,"aria-disabled":ot.focused&&ot.disabled||void 0,tabIndex:se(Ye)?0:-1,"aria-label":de(ht,ot,l.options,l),onClick:fe(Ye,ot),onBlur:he(Ye,ot),onFocus:De(Ye,ot),onKeyDown:Oe(Ye,ot),onMouseEnter:Ve(Ye,ot),onMouseLeave:We(Ye,ot)},N(ht,l.options,l)):!ot.hidden&&N(Ye.date,l.options,l))})))))))),n.footer&&V.createElement(i.Footer,{className:a[$e.Footer],style:w==null?void 0:w[$e.Footer],role:"status","aria-live":"polite"},n.footer)))}function ha({className:t,classNames:n,showOutsideDays:r=!0,captionLayout:i="label",buttonVariant:s="ghost",formatters:o,components:l,...c}){const a=xu();return p.jsx(GE,{showOutsideDays:r,className:Q("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:i,formatters:{formatMonthDropdown:f=>f.toLocaleString("default",{month:"short"}),...o},classNames:{root:Q("w-fit",a.root),months:Q("flex gap-4 flex-col md:flex-row relative",a.months),month:Q("flex flex-col w-full gap-4",a.month),nav:Q("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",a.nav),button_previous:Q(ts({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_previous),button_next:Q(ts({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_next),month_caption:Q("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",a.month_caption),dropdowns:Q("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",a.dropdowns),dropdown_root:Q("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",a.dropdown_root),dropdown:Q("absolute bg-popover inset-0 opacity-0",a.dropdown),caption_label:Q("select-none font-medium",i==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",a.caption_label),table:"w-full border-collapse",weekdays:Q("flex",a.weekdays),weekday:Q("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",a.weekday),week:Q("flex w-full mt-2",a.week),week_number_header:Q("select-none w-(--cell-size)",a.week_number_header),week_number:Q("text-[0.8rem] select-none text-muted-foreground",a.week_number),day:Q("relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",c.showWeekNumber?"[&:nth-child(2)[data-selected=true]_button]:rounded-l-md":"[&:first-child[data-selected=true]_button]:rounded-l-md",a.day),range_start:Q("rounded-l-md bg-accent",a.range_start),range_middle:Q("rounded-none",a.range_middle),range_end:Q("rounded-r-md bg-accent",a.range_end),today:Q("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",a.today),outside:Q("text-muted-foreground aria-selected:text-muted-foreground",a.outside),disabled:Q("text-muted-foreground opacity-50",a.disabled),hidden:Q("invisible",a.hidden),...n},components:{Root:({className:f,rootRef:u,...m})=>p.jsx("div",{"data-slot":"calendar",ref:u,className:Q(f),...m}),Chevron:({className:f,orientation:u,...m})=>u==="left"?p.jsx(Ai,{className:Q("size-4",f),...m}):u==="right"?p.jsx(In,{className:Q("size-4",f),...m}):p.jsx(Ma,{className:Q("size-4",f),...m}),DayButton:ZE,WeekNumber:({children:f,...u})=>p.jsx("td",{...u,children:p.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:f})}),...l},...c})}function ZE({className:t,day:n,modifiers:r,...i}){const s=xu(),o=C.useRef(null);return C.useEffect(()=>{var l;r.focused&&((l=o.current)==null||l.focus())},[r.focused]),p.jsx(Ke,{ref:o,variant:"ghost",size:"icon","data-day":n.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:Q("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",s.day,t),...i})}const lc=t=>{if(t){if(t instanceof Date)return isNaN(t.getTime())?void 0:t;if(typeof t=="string")try{if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[r,i,s]=t.split("-").map(Number),o=new Date(r,i-1,s,12,0,0);return isNaN(o.getTime())?void 0:o}if(t.includes("T")){const r=new Date(t);if(!isNaN(r.getTime()))return new Date(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),12,0,0)}const n=new Date(t);return isNaN(n.getTime())?void 0:n}catch{return}}},XE=(t,n)=>{if(t)return n?new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())).toISOString():Kt(t,"yyyy-MM-dd")},_u=C.forwardRef(({date:t,onDateChange:n,placeholder:r="yyyy-mm-dd",className:i,sendUTC:s=!1,label:o,description:l,error:c,required:a,clearable:f=!0,minDate:u,maxDate:m,...y},_)=>{const[S,E]=C.useState(!1),[d,h]=C.useState(new Date),[v,x]=C.useState(""),[g,b]=C.useState(""),w=C.useId(),k=C.useMemo(()=>lc(t),[t]),N=C.useMemo(()=>lc(u),[u]),T=C.useMemo(()=>lc(m),[m]);C.useEffect(()=>{k?(x(Kt(k,"yyyy-MM-dd")),b("")):t||(x(""),b(""))},[t,k]),C.useEffect(()=>{S&&h(k||new Date)},[S,k]);const D=H=>{n==null||n(XE(H,s))},I=H=>{if(!H){n==null||n(void 0),E(!1);return}b(""),D(H),E(!1)},L=H=>{const j=H.target.value.replace(/[^\d-]/g,"").slice(0,10);if(x(j),j===""){b(""),n==null||n(void 0);return}if(/^\d{4}-\d{2}-\d{2}$/.test(j)){const F=bk(j,"yyyy-MM-dd",new Date);if(!s2(F)){b("Invalid date");return}if(N){const Y=new Date(N.getFullYear(),N.getMonth(),N.getDate());if(F<Y){b(`Date must be on or after ${Kt(Y,"yyyy-MM-dd")}`);return}}if(T){const Y=new Date(T.getFullYear(),T.getMonth(),T.getDate());if(F>Y){b(`Date must be on or before ${Kt(Y,"yyyy-MM-dd")}`);return}}b(""),h(new Date(F.getFullYear(),F.getMonth(),1)),D(new Date(F.getFullYear(),F.getMonth(),F.getDate(),12))}else b(""),n==null||n(void 0)},R=H=>{const B=v;if(/^\d$/.test(H.key)&&(B.length===4||B.length===7)){H.preventDefault();const j=B+"-"+H.key;x(j.slice(0,10)),L({target:{value:j.slice(0,10)}})}},P=H=>{H.stopPropagation(),H.preventDefault(),x(""),b(""),n==null||n(void 0)},O=H=>{if(N){const B=new Date(N.getFullYear(),N.getMonth(),N.getDate());if(new Date(H.getFullYear(),H.getMonth(),H.getDate())<B)return!0}if(T){const B=new Date(T.getFullYear(),T.getMonth(),T.getDate());if(new Date(H.getFullYear(),H.getMonth(),H.getDate())>B)return!0}return!1},U=c||g;return p.jsxs("div",{className:"space-y-2 relative",children:[o&&p.jsxs(br,{htmlFor:w,className:Q(U&&"text-destructive"),children:[o,a&&p.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsxs("div",{className:"relative flex-1",children:[p.jsx(ni,{ref:_,id:w,type:"text",value:v,onChange:L,onKeyDown:R,placeholder:r,className:Q("pr-8",U&&"border-destructive focus-visible:ring-destructive",i)}),f&&v&&p.jsx("button",{type:"button",onClick:P,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,"aria-label":"Clear date",children:p.jsx(er,{className:"h-3.5 w-3.5"})})]}),p.jsxs(du,{open:S,onOpenChange:E,children:[p.jsx(fu,{asChild:!0,children:p.jsx(Ke,{type:"button",variant:"outline",size:"icon",className:Q("shrink-0",U&&"border-destructive"),"aria-label":"Open date picker",children:p.jsx(ea,{className:"h-4 w-4"})})}),p.jsxs(ll,{className:"w-auto p-0",align:"end",children:[p.jsx(ha,{mode:"single",selected:k,onSelect:I,month:d,onMonthChange:h,captionLayout:"dropdown",fromYear:1900,toYear:2030,disabled:O,...y}),p.jsxs("div",{className:"border-t p-3 flex gap-2",children:[p.jsx(Ke,{type:"button",variant:"outline",size:"sm",className:"flex-1 cursor-pointer",onClick:()=>{const H=new Date;O(H)||I(new Date(H.getFullYear(),H.getMonth(),H.getDate(),12))},disabled:O(new Date),children:"Today"}),p.jsx(Ke,{type:"button",variant:"outline",size:"sm",className:"flex-1 cursor-pointer",onClick:()=>{const H=new Date;H.setDate(H.getDate()+1),O(H)||I(new Date(H.getFullYear(),H.getMonth(),H.getDate(),12))},disabled:O(new Date(new Date().setDate(new Date().getDate()+1))),children:"Tomorrow"})]})]})]})]}),l&&!U&&p.jsx("p",{className:"text-sm text-muted-foreground",children:l}),U&&p.jsx("p",{className:"text-sm text-destructive",children:U})]})});_u.displayName="DatePicker";const Su=C.forwardRef(({dateRange:t,onDateRangeChange:n,placeholder:r="Pick a date range",className:i,clearable:s=!0,sendUTC:o=!1,popoverContentClassName:l,showExtendedPresets:c=!1,presets:a,...f},u)=>{const[m,y]=C.useState(!1),[_,S]=C.useState(null),[E,d]=C.useState("from"),[h,v]=C.useState(new Date),[x,g]=C.useState(Si(new Date,1)),b=B=>{if(B){if(B instanceof Date)return B;if(typeof B=="string"){const j=B.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(j){const[,F,Y,q]=j;return new Date(Number(F),Number(Y)-1,Number(q))}return new Date(B)}}},w=(B,j)=>{const F=Ui(B||new Date),Y=j?Ui(j):Si(F,1),q=Y.getTime()===F.getTime()?Si(F,1):Y;return{left:F,right:q}};C.useEffect(()=>{if(m){let B,j;t!=null&&t.from?(B=b(t.from),j=t.to?b(t.to):void 0,S({from:B,to:j})):S(null),d("from");const{left:F,right:Y}=w(B,j);v(F),g(Y)}},[m]);const k=B=>{B.stopPropagation(),n==null||n({from:void 0,to:void 0}),S(null),d("from")},N=()=>{if(!(t!=null&&t.from))return r;const B=b(t.from);if(t.to){const j=b(t.to);return`${Kt(B,"LLL dd, y")} - ${Kt(j,"LLL dd, y")}`}return Kt(B,"LLL dd, y")},T=B=>{if(!B||!B.from)return{from:void 0,to:void 0};if(o){const j=new Date(Date.UTC(B.from.getFullYear(),B.from.getMonth(),B.from.getDate(),0,0,0)).toISOString(),F=B.to?new Date(Date.UTC(B.to.getFullYear(),B.to.getMonth(),B.to.getDate(),0,0,0)).toISOString():void 0;return{from:j,to:F}}return{from:B.from?Kt(B.from,"yyyy-MM-dd"):void 0,to:B.to?Kt(B.to,"yyyy-MM-dd"):void 0}},D=(B,j)=>{j&&(S(F=>({...F,[E]:j})),E==="from"&&!(_!=null&&_.to)&&d("to"))},I=()=>{if(!(_!=null&&_.from))return;const B=T(_);n==null||n(B),y(!1),S(null),d("from")},L=(B,j)=>{S({from:B,to:j}),d("from");const{left:F,right:Y}=w(B,j);v(F),g(Y)},R=_||(t!=null&&t.from?{from:b(t.from),to:t.to?b(t.to):void 0}:void 0),P=!!(_!=null&&_.from),O=_!=null&&_.from&&(_!=null&&_.to)?`Apply: ${Kt(_.from,"MMM dd")} – ${Kt(_.to,"MMM dd")}`:_!=null&&_.from?`Apply: ${Kt(_.from,"MMM dd")}`:"Apply",U=C.useMemo(()=>{const B=new Date,j=rc(B,1),F=[{label:"Today",from:B,to:B},{label:"Yesterday",from:j,to:j},{label:"This Week",from:rr(B,{weekStartsOn:0}),to:da(B,{weekStartsOn:0})},{label:"Last Week",from:rr(rc(B,7),{weekStartsOn:0}),to:da(rc(B,7),{weekStartsOn:0})},{label:"This Month",from:Ui(B),to:Xc(B)},{label:"Last Month",from:Ui(zf(B)),to:Xc(zf(B))}];return c?[...F,{label:"This Quarter",from:Rf(B),to:Pf(B)},{label:"Last Quarter",from:Rf(jf(B)),to:Pf(jf(B))},{label:"This Year",from:ua(B),to:Kc(B)},{label:"Last Year",from:ua(Ff(B)),to:Kc(Ff(B))}]:F},[c]),H=a??U;return p.jsx("div",{className:Q("grid gap-2 relative",i),children:p.jsxs(du,{open:m,onOpenChange:y,children:[p.jsx(fu,{asChild:!0,children:p.jsxs(Ke,{ref:u,id:"date-range",variant:"outline",className:Q("w-full justify-between text-left font-normal",!(t!=null&&t.from)&&"text-muted-foreground"),...f,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(ea,{className:"h-4 w-4"}),N()]}),s&&(t==null?void 0:t.from)&&p.jsx(er,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-foreground",onClick:k})]})}),p.jsx(ll,{className:Q("w-auto p-0 z-[100]",l),align:"start",onOpenAutoFocus:B=>B.preventDefault(),children:p.jsxs("div",{className:"flex",children:[p.jsxs("div",{className:"flex flex-col gap-1 border-r p-3 min-w-[140px] max-h-[420px] overflow-y-auto",children:[p.jsx("div",{className:"text-sm font-medium mb-1 text-muted-foreground",children:"Quick Select"}),H.map(B=>p.jsx(Ke,{variant:"ghost",size:"sm",className:"justify-start font-normal cursor-pointer",onClick:()=>L(B.from,B.to),children:B.label},B.label))]}),p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b",children:[p.jsxs("button",{type:"button",onClick:()=>d("from"),className:"flex-1 text-left cursor-pointer",children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"From"}),p.jsx("div",{className:Q("text-sm rounded-md border px-3 py-1.5 transition-colors",E==="from"?"border-primary ring-1 ring-primary":"border-input",!(_!=null&&_.from)&&"text-muted-foreground border-dashed"),children:_!=null&&_.from?Kt(_.from,"LLL dd, y"):"Select date"})]}),p.jsxs("button",{type:"button",onClick:()=>d("to"),className:"flex-1 text-left cursor-pointer",children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"To"}),p.jsx("div",{className:Q("text-sm rounded-md border px-3 py-1.5 transition-colors",E==="to"?"border-primary ring-1 ring-primary":"border-input",!(_!=null&&_.to)&&"text-muted-foreground border-dashed"),children:_!=null&&_.to?Kt(_.to,"LLL dd, y"):"Select date"})]})]}),p.jsxs("div",{className:"flex gap-4 p-3",children:[p.jsx(ha,{mode:"range",captionLayout:"dropdown",numberOfMonths:1,month:h,onMonthChange:v,selected:R,onSelect:D,className:"p-0"}),p.jsx(ha,{mode:"range",captionLayout:"dropdown",numberOfMonths:1,month:x,onMonthChange:g,selected:R,onSelect:D,className:"p-0"})]}),p.jsx("div",{className:"flex items-center justify-end gap-2 border-t px-4 py-3",children:p.jsxs("div",{className:"flex gap-2",children:[p.jsx(Ke,{variant:"outline",size:"sm",className:"cursor-pointer",onClick:()=>{S(null),d("from"),y(!1)},children:"Cancel"}),p.jsx(Ke,{size:"sm",disabled:!P,className:"cursor-pointer",onClick:I,children:O})]})})]})]})})]})})});Su.displayName="DateRangePicker";var hl={},ku={};const P2={name:"blockquote",display:"command",add:function(t,n){const r=t.context;r.blockquote={targetButton:n,tag:t.util.createElement("BLOCKQUOTE")}},active:function(t){if(!t)this.util.removeClass(this.context.blockquote.targetButton,"active");else if(/blockquote/i.test(t.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0;return!1},action:function(){const t=this.util.getParentElement(this.getSelectionNode(),"blockquote");t?this.detachRangeFormatElement(t,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},L2={name:"align",display:"submenu",add:function(t,n){const r=t.icons,i=t.context;i.align={targetButton:n,_itemMenu:null,_alignList:null,currentAlign:"",defaultDir:t.options.rtl?"right":"left",icons:{justify:r.align_justify,left:r.align_left,right:r.align_right,center:r.align_center}};let s=this.setSubmenu(t),o=i.align._itemMenu=s.querySelector("ul");o.addEventListener("click",this.pickup.bind(t)),i.align._alignList=o.querySelectorAll("li button"),t.initMenuTarget(this.name,n,s),s=null,o=null},setSubmenu:function(t){const n=t.lang,r=t.icons,i=t.util.createElement("DIV"),s=t.options.alignItems;let o="";for(let l=0,c,a;l<s.length;l++)c=s[l],a=n.toolbar["align"+c.charAt(0).toUpperCase()+c.slice(1)],o+='<li><button type="button" class="se-btn-list se-btn-align" data-value="'+c+'" title="'+a+'" aria-label="'+a+'"><span class="se-list-icon">'+r["align_"+c]+"</span>"+a+"</button></li>";return i.className="se-submenu se-list-layer se-list-align",i.innerHTML='<div class="se-list-inner"><ul class="se-list-basic">'+o+"</ul></div>",i},active:function(t){const n=this.context.align,r=n.targetButton,i=r.firstElementChild;if(!t)this.util.changeElement(i,n.icons[n.defaultDir]),r.removeAttribute("data-focus");else if(this.util.isFormatElement(t)){const s=t.style.textAlign;if(s)return this.util.changeElement(i,n.icons[s]||n.icons[n.defaultDir]),r.setAttribute("data-focus",s),!0}return!1},on:function(){const t=this.context.align,n=t._alignList,r=t.targetButton.getAttribute("data-focus")||t.defaultDir;if(r!==t.currentAlign){for(let i=0,s=n.length;i<s;i++)r===n[i].getAttribute("data-value")?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active");t.currentAlign=r}},exchangeDir:function(){const t=this.options.rtl?"right":"left";if(!this.context.align||this.context.align.defaultDir===t)return;this.context.align.defaultDir=t;let n=this.context.align._itemMenu,r=n.querySelector('[data-value="left"]'),i=n.querySelector('[data-value="right"]');if(r&&i){const s=r.parentElement,o=i.parentElement;s.appendChild(i),o.appendChild(r)}},pickup:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=null;for(;!r&&!/UL/i.test(n.tagName);)r=n.getAttribute("data-value"),n=n.parentNode;if(!r)return;const i=this.context.align.defaultDir,s=this.getSelectedElements();for(let o=0,l=s.length;o<l;o++)this.util.setStyle(s[o],"textAlign",r===i?"":r);this.effectNode=null,this.submenuOff(),this.focus(),this.history.push(!1)}},I2={name:"font",display:"submenu",add:function(t,n){const r=t.context;r.font={targetText:n.querySelector(".txt"),targetTooltip:n.parentNode.querySelector(".se-tooltip-text"),_fontList:null,currentFont:""};let i=this.setSubmenu(t);i.querySelector(".se-list-inner").addEventListener("click",this.pickup.bind(t)),r.font._fontList=i.querySelectorAll("ul li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.lang,r=t.util.createElement("DIV");r.className="se-submenu se-list-layer se-list-font-family";let i,s,o,l,c=t.options.font,a='<div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="default_value se-btn-list" title="'+n.toolbar.default+'" aria-label="'+n.toolbar.default+'">('+n.toolbar.default+")</button></li>";for(o=0,l=c.length;o<l;o++)i=c[o],s=i.split(",")[0],a+='<li><button type="button" class="se-btn-list" data-value="'+i+'" data-txt="'+s+'" title="'+s+'" aria-label="'+s+'" style="font-family:'+i+';">'+s+"</button></li>";return a+="</ul></div>",r.innerHTML=a,r},active:function(t){const n=this.context.font.targetText,r=this.context.font.targetTooltip;if(t){if(t.style&&t.style.fontFamily.length>0){const i=t.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(n,i),this.util.changeTxt(r,this.lang.toolbar.font+" ("+i+")"),!0}}else{const i=this.hasFocus?this.wwComputedStyle.fontFamily:this.lang.toolbar.font;this.util.changeTxt(n,i),this.util.changeTxt(r,this.hasFocus?this.lang.toolbar.font+(i?" ("+i+")":""):i)}return!1},on:function(){const t=this.context.font,n=t._fontList,r=t.targetText.textContent;if(r!==t.currentFont){for(let i=0,s=n.length;i<s;i++)r===(n[i].getAttribute("data-value")||"").replace(/'|"/g,"")?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active");t.currentFont=r}},pickup:function(t){if(!/^BUTTON$/i.test(t.target.tagName))return!1;t.preventDefault(),t.stopPropagation();let n=t.target.getAttribute("data-value");if(n){const r=this.util.createElement("SPAN");/[\s\d\W]/.test(n)&&!/^['"].*['"]$/.test(n)&&(n='"'+n+'"'),r.style.fontFamily=n,this.nodeChange(r,["font-family"],null,null)}else this.nodeChange(null,["font-family"],["span"],!0);this.submenuOff()}},O2={name:"fontSize",display:"submenu",add:function(t,n){const r=t.context;r.fontSize={targetText:n.querySelector(".txt"),_sizeList:null,currentSize:""};let i=this.setSubmenu(t),s=i.querySelector("ul");s.addEventListener("click",this.pickup.bind(t)),r.fontSize._sizeList=s.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null,s=null},setSubmenu:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-submenu se-list-layer se-list-font-size";const s=n.fontSize?n.fontSize:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72];let o='<div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="default_value se-btn-list" title="'+r.toolbar.default+'" aria-label="'+r.toolbar.default+'">('+r.toolbar.default+")</button></li>";for(let l=0,c=n.fontSizeUnit,a=s.length,f;l<a;l++)f=s[l],o+='<li><button type="button" class="se-btn-list" data-value="'+f+c+'" title="'+f+c+'" aria-label="'+f+c+'" style="font-size:'+f+c+';">'+f+"</button></li>";return o+="</ul></div>",i.innerHTML=o,i},active:function(t){if(!t)this.util.changeTxt(this.context.fontSize.targetText,this.hasFocus?this._convertFontSize.call(this,this.options.fontSizeUnit,this.wwComputedStyle.fontSize):this.lang.toolbar.fontSize);else if(t.style&&t.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,this._convertFontSize.call(this,this.options.fontSizeUnit,t.style.fontSize)),!0;return!1},on:function(){const t=this.context.fontSize,n=t._sizeList,r=t.targetText.textContent;if(r!==t.currentSize){for(let i=0,s=n.length;i<s;i++)r===n[i].getAttribute("data-value")?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active");t.currentSize=r}},pickup:function(t){if(!/^BUTTON$/i.test(t.target.tagName))return!1;t.preventDefault(),t.stopPropagation();const n=t.target.getAttribute("data-value");if(n){const r=this.util.createElement("SPAN");r.style.fontSize=n,this.nodeChange(r,["font-size"],null,null)}else this.nodeChange(null,["font-size"],["span"],!0);this.submenuOff()}},B2={name:"colorPicker",add:function(t){const n=t.context;n.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]},n.colorPicker.colorListHTML=this.createColorList(t,this._makeColorList)},createColorList:function(t,n){const r=t.options,i=t.lang,s=!r.colorList||r.colorList.length===0?["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"]:r.colorList;let o=[],l='<div class="se-list-inner">';for(let c=0,a=s.length,f;c<a;c++)f=s[c],f&&(typeof f=="string"&&(o.push(f),c<a-1)||(o.length>0&&(l+='<div class="se-selector-color">'+n(o)+"</div>",o=[]),typeof f=="object"&&(l+='<div class="se-selector-color">'+n(f)+"</div>")));return l+='<form class="se-form-group"><input type="text" maxlength="9" class="_se_color_picker_input se-color-input"/><button type="submit" class="se-btn-primary _se_color_picker_submit" title="'+i.dialogBox.submitButton+'" aria-label="'+i.dialogBox.submitButton+'">'+t.icons.checked+'</button><button type="button" class="se-btn _se_color_picker_remove" title="'+i.toolbar.removeFormat+'" aria-label="'+i.toolbar.removeFormat+'">'+t.icons.erase+"</button></form></div>",l},_makeColorList:function(t){let n="";n+='<ul class="se-color-pallet">';for(let r=0,i=t.length,s;r<i;r++)s=t[r],typeof s=="string"&&(n+='<li><button type="button" data-value="'+s+'" title="'+s+'" aria-label="'+s+'" style="background-color:'+s+';"></button></li>');return n+="</ul>",n},init:function(t,n){const r=this.plugins.colorPicker;let i=n||r.getColorInNode.call(this,t)||this.context.colorPicker._defaultColor;i=r.isHexColor(i)?i:r.rgb2hex(i)||i;const s=this.context.colorPicker._colorList;if(s)for(let o=0,l=s.length;o<l;o++)i.toLowerCase()===s[o].getAttribute("data-value").toLowerCase()?this.util.addClass(s[o],"active"):this.util.removeClass(s[o],"active");r.setInputText.call(this,r.colorName2hex.call(this,i))},setCurrentColor:function(t){this.context.colorPicker._currentColor=t,this.context.colorPicker._colorInput.style.borderColor=t},setInputText:function(t){t=/^#/.test(t)?t:"#"+t,this.context.colorPicker._colorInput.value=t,this.plugins.colorPicker.setCurrentColor.call(this,t)},getColorInNode:function(t){let n="";const r=this.context.colorPicker._styleProperty;for(;t&&!this.util.isWysiwygDiv(t)&&n.length===0;)t.nodeType===1&&t.style[r]&&(n=t.style[r]),t=t.parentNode;return n},isHexColor:function(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)},rgb2hex:function(t){const n=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return n&&n.length===4?"#"+("0"+parseInt(n[1],10).toString(16)).slice(-2)+("0"+parseInt(n[2],10).toString(16)).slice(-2)+("0"+parseInt(n[3],10).toString(16)).slice(-2):""},colorName2hex:function(t){if(/^#/.test(t))return t;var n=this.util.createElement("div");n.style.display="none",n.style.color=t;var r=this._w.getComputedStyle(this._d.body.appendChild(n)).color.match(/\d+/g).map(function(i){return parseInt(i,10)});return this.util.removeItem(n),r.length>=3?"#"+((1<<24)+(r[0]<<16)+(r[1]<<8)+r[2]).toString(16).substr(1):!1}},z2={name:"fontColor",display:"submenu",add:function(t,n){t.addModule([B2]);const r=t.context;r.fontColor={previewEl:null,colorInput:null,colorList:null};let i=this.setSubmenu(t);r.fontColor.colorInput=i.querySelector("._se_color_picker_input"),r.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(t)),i.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(t)),i.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(t)),i.addEventListener("click",this.pickup.bind(t)),r.fontColor.colorList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.context.colorPicker.colorListHTML,r=t.util.createElement("DIV");return r.className="se-submenu se-list-layer",r.innerHTML=n,r},on:function(){const t=this.context.colorPicker,n=this.context.fontColor;t._colorInput=n.colorInput;const r=this.wwComputedStyle.color;t._defaultColor=r?this.plugins.colorPicker.isHexColor(r)?r:this.plugins.colorPicker.rgb2hex(r):"#333333",t._styleProperty="color",t._colorList=n.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(t){this.plugins.colorPicker.setCurrentColor.call(this,t.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(t){t.preventDefault(),t.stopPropagation(),this.plugins.fontColor.applyColor.call(this,t.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(t){if(!t)return;const n=this.util.createElement("SPAN");n.style.color=t,this.nodeChange(n,["color"],null,null),this.submenuOff()}},j2={name:"hiliteColor",display:"submenu",add:function(t,n){t.addModule([B2]);const r=t.context;r.hiliteColor={previewEl:null,colorInput:null,colorList:null};let i=this.setSubmenu(t);r.hiliteColor.colorInput=i.querySelector("._se_color_picker_input"),r.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(t)),i.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(t)),i.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(t)),i.addEventListener("click",this.pickup.bind(t)),r.hiliteColor.colorList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.context.colorPicker.colorListHTML,r=t.util.createElement("DIV");return r.className="se-submenu se-list-layer",r.innerHTML=n,r},on:function(){const t=this.context.colorPicker,n=this.context.hiliteColor;t._colorInput=n.colorInput;const r=this.wwComputedStyle.backgroundColor;t._defaultColor=r?this.plugins.colorPicker.isHexColor(r)?r:this.plugins.colorPicker.rgb2hex(r):"#ffffff",t._styleProperty="backgroundColor",t._colorList=n.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(t){this.plugins.colorPicker.setCurrentColor.call(this,t.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(t){t.preventDefault(),t.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,t.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(t){if(!t)return;const n=this.util.createElement("SPAN");n.style.backgroundColor=t,this.nodeChange(n,["background-color"],null,null),this.submenuOff()}},F2={name:"horizontalRule",display:"submenu",add:function(t,n){t.context.horizontalRule={currentHR:null};let r=this.setSubmenu(t);r.querySelector("ul").addEventListener("click",this.horizontalRulePick.bind(t)),t.initMenuTarget(this.name,n,r),r=null},setSubmenu:function(t){const n=t.lang,r=t.util.createElement("DIV"),i=t.options.hrItems||[{name:n.toolbar.hr_solid,class:"__se__solid"},{name:n.toolbar.hr_dashed,class:"__se__dashed"},{name:n.toolbar.hr_dotted,class:"__se__dotted"}];let s="";for(let o=0,l=i.length;o<l;o++)s+='<li><button type="button" class="se-btn-list btn_line" data-command="horizontalRule" data-value="'+i[o].class+'" title="'+i[o].name+'" aria-label="'+i[o].name+'"><hr'+(i[o].class?' class="'+i[o].class+'"':"")+(i[o].style?' style="'+i[o].style+'"':"")+"/></button></li>";return r.className="se-submenu se-list-layer se-list-line",r.innerHTML='<div class="se-list-inner"><ul class="se-list-basic">'+s+"</ul></div>",r},active:function(t){if(!t)this.util.hasClass(this.context.horizontalRule.currentHR,"on")&&this.controllersOff();else if(/HR/i.test(t.nodeName))return this.context.horizontalRule.currentHR=t,this.util.hasClass(t,"on")||(this.util.addClass(t,"on"),this.controllersOn("hr",this.util.removeClass.bind(this.util,t,"on"))),!0;return!1},appendHr:function(t){return this.focus(),this.insertComponent(t.cloneNode(!1),!1,!0,!1)},horizontalRulePick:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=n.getAttribute("data-command");for(;!r&&!/UL/i.test(n.tagName);)n=n.parentNode,r=n.getAttribute("data-command");if(!r)return;const i=this.plugins.horizontalRule.appendHr.call(this,n.firstElementChild);i&&(this.setRange(i,0,i,0),this.submenuOff())}},H2={name:"list",display:"submenu",add:function(t,n){const r=t.context;r.list={targetButton:n,_list:null,currentList:"",icons:{bullets:t.icons.list_bullets,number:t.icons.list_number}};let i=this.setSubmenu(t),s=i.querySelector("ul");s.addEventListener("click",this.pickup.bind(t)),r.list._list=s.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null,s=null},setSubmenu:function(t){const n=t.lang,r=t.util.createElement("DIV");return r.className="se-submenu se-list-layer",r.innerHTML='<div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="se-btn-list se-tooltip" data-command="OL" title="'+n.toolbar.orderList+'" aria-label="'+n.toolbar.orderList+'">'+t.icons.list_number+'</button></li><li><button type="button" class="se-btn-list se-tooltip" data-command="UL" title="'+n.toolbar.unorderList+'" aria-label="'+n.toolbar.unorderList+'">'+t.icons.list_bullets+"</button></li></ul></div>",r},active:function(t){const n=this.context.list.targetButton,r=n.firstElementChild,i=this.util;if(i.isList(t)){const s=t.nodeName;return n.setAttribute("data-focus",s),i.addClass(n,"active"),/UL/i.test(s)?i.changeElement(r,this.context.list.icons.bullets):i.changeElement(r,this.context.list.icons.number),!0}else n.removeAttribute("data-focus"),i.changeElement(r,this.context.list.icons.number),i.removeClass(n,"active");return!1},on:function(){const t=this.context.list,n=t._list,r=t.targetButton.getAttribute("data-focus")||"";if(r!==t.currentList){for(let i=0,s=n.length;i<s;i++)r===n[i].getAttribute("data-command")?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active");t.currentList=r}},editList:function(t,n,r){let i=this.getRange(),s=n||this.getSelectedElementsAndComponents(!1);if(s.length===0&&(n||(i=this.getRange_addLine(i,null),s=this.getSelectedElementsAndComponents(!1),s.length===0)))return;const o=this.util;o.sortByDepth(s,!0);let l=s[0],c=s[s.length-1],a=(o.isListCell(l)||o.isComponent(l))&&!l.previousElementSibling?l.parentNode.previousElementSibling:l.previousElementSibling,f=(o.isListCell(c)||o.isComponent(c))&&!c.nextElementSibling?c.parentNode.nextElementSibling:c.nextElementSibling;const u=i.collapsed,m={sc:i.startContainer,so:i.startContainer===i.endContainer&&o.onlyZeroWidthSpace(i.startContainer)&&i.startOffset===0&&i.endOffset===1?i.endOffset:i.startOffset,ec:i.endContainer,eo:i.endOffset};let y=null,_=!0;for(let S=0,E=s.length;S<E;S++)if(!o.isList(o.getRangeFormatElement(s[S],(function(d){return this.getRangeFormatElement(d)&&d!==s[S]}).bind(o)))){_=!1;break}if(_&&(!a||l.tagName!==a.tagName||t!==a.tagName.toUpperCase())&&(!f||c.tagName!==f.tagName||t!==f.tagName.toUpperCase())){if(r){for(let x=0,g=s.length;x<g;x++)for(let b=x-1;b>=0;b--)if(s[b].contains(s[x])){s.splice(x,1),x--,g--;break}}const S=o.getRangeFormatElement(l),E=S&&S.tagName===t;let d,h;const v=(function(x){return!this.isComponent(x)}).bind(o);E||(h=o.createElement(t));for(let x=0,g=s.length,b,w;x<g;x++)w=o.getRangeFormatElement(s[x],v),!(!w||!o.isList(w))&&(b?b!==w?(r&&o.isListCell(w.parentNode)?this.plugins.list._detachNested.call(this,d.f):y=this.detachRangeFormatElement(d.f[0].parentNode,d.f,h,!1,!0),w=s[x].parentNode,E||(h=o.createElement(t)),b=w,d={r:b,f:[o.getParentElement(s[x],"LI")]}):d.f.push(o.getParentElement(s[x],"LI")):(b=w,d={r:b,f:[o.getParentElement(s[x],"LI")]}),x===g-1&&(r&&o.isListCell(w.parentNode)?this.plugins.list._detachNested.call(this,d.f):y=this.detachRangeFormatElement(d.f[0].parentNode,d.f,h,!1,!0)))}else{const S=a&&a.parentNode,E=f&&f.parentNode;a=S&&!o.isWysiwygDiv(S)&&S.nodeName===t?S:a,f=E&&!o.isWysiwygDiv(E)&&E.nodeName===t?E:f;const d=a&&a.tagName===t,h=f&&f.tagName===t;let v=d?a:o.createElement(t),x=null,g=null,b=null;const w=(function(k){return!this.isComponent(k)&&!this.isList(k)}).bind(o);for(let k=0,N=s.length,T,D,I,L,R,P,O,U,H;k<N;k++){if(D=s[k],D.childNodes.length===0&&!o._isIgnoreNodeChange(D)){o.removeItem(D);continue}if(L=s[k+1],R=D.parentNode,P=L?L.parentNode:null,I=o.isListCell(D),H=o.isRangeFormatElement(R)?R:null,O=I&&!o.isWysiwygDiv(R)?R.parentNode:R,U=I&&!o.isWysiwygDiv(R)?!L||o.isListCell(O)?R:R.nextSibling:D.nextSibling,T=o.createElement("LI"),o.copyFormatAttributes(T,D),k===0&&m.sc===D&&(m.sc=T),k===N-1&&m.ec===D&&(m.ec=T),o.isComponent(D)){const B=/^HR$/i.test(D.nodeName);B||(T.innerHTML="<br>"),T.innerHTML+=D.outerHTML,B&&(T.innerHTML+="<br>")}else{const B=D.childNodes;for(;B[0];)T.appendChild(B[0])}v.appendChild(T),(!L||O!==P||o.isRangeFormatElement(U))&&(x||(x=v),(!d||!L||O!==P)&&!(L&&o.isList(P)&&P===R)&&v.parentNode!==O&&O.insertBefore(v,U)),o.removeItem(D),d&&g===null&&(g=v.children.length-1),L&&(o.getRangeFormatElement(P,w)!==o.getRangeFormatElement(R,w)||o.isList(P)&&o.isList(R)&&o.getElementDepth(P)!==o.getElementDepth(R))&&(v=o.createElement(t)),H&&H.children.length===0&&o.removeItem(H)}g&&(x=x.children[g]),h&&(b=v.children.length-1,v.innerHTML+=f.innerHTML,v.children[b],o.removeItem(f))}return this.effectNode=null,u&&y||m},_detachNested:function(t){const n=t[0],r=t[t.length-1],i=r.nextElementSibling,s=n.parentNode,o=s.parentNode.nextElementSibling,l=s.parentNode.parentNode;for(let a=0,f=t.length;a<f;a++)l.insertBefore(t[a],o);if(i&&s.children.length>0){const a=s.cloneNode(!1),f=s.childNodes,u=this.util.getPositionIndex(i);for(;f[u];)a.appendChild(f[u]);r.appendChild(a)}s.children.length===0&&this.util.removeItem(s),this.util.mergeSameTags(l);const c=this.util.getEdgeChildNodes(n,r);return{cc:n.parentNode,sc:c.sc,ec:c.ec}},editInsideList:function(t,n){n=n||this.getSelectedElements().filter((function(l){return this.isListCell(l)}).bind(this.util));const r=n.length;if(r===0||!t&&!this.util.isListCell(n[0].previousElementSibling)&&!this.util.isListCell(n[r-1].nextElementSibling))return{sc:n[0],so:0,ec:n[r-1],eo:1};let i=n[0].parentNode,s=n[r-1],o=null;if(t){if(i!==s.parentNode&&this.util.isList(s.parentNode.parentNode)&&s.nextElementSibling)for(s=s.nextElementSibling;s;)n.push(s),s=s.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),n,!0)}else{let l=this.util.createElement(i.nodeName),c=n[0].previousElementSibling,a=s.nextElementSibling;const f={s:null,e:null,sl:i,el:i};for(let y=0,_=r,S;y<_;y++)S=n[y],S.parentNode!==i&&(this.plugins.list._insiedList.call(this,i,l,c,a,f),i=S.parentNode,l=this.util.createElement(i.nodeName)),c=S.previousElementSibling,a=S.nextElementSibling,l.appendChild(S);this.plugins.list._insiedList.call(this,i,l,c,a,f);const u=this.util.getNodeFromPath(f.s,f.sl),m=this.util.getNodeFromPath(f.e,f.el);o={sc:u,so:0,ec:m,eo:m.textContent.length}}return o},_insiedList:function(t,n,r,i,s){let o=!1;if(r&&n.tagName===r.tagName){const l=n.children;for(;l[0];)r.appendChild(l[0]);n=r,o=!0}if(i&&n.tagName===i.tagName){const l=i.children;for(;l[0];)n.appendChild(l[0]);const c=i.nextElementSibling;i.parentNode.removeChild(i),i=c}if(!o){this.util.isListCell(r)&&(t=r,i=null),t.insertBefore(n,i),s.s||(s.s=this.util.getNodePath(n.firstElementChild.firstChild,t,null),s.sl=t);const l=t.contains(s.sl)?this.util.getNodePath(s.sl,t):null;s.e=this.util.getNodePath(n.lastElementChild.firstChild,t,null),s.el=t,this.util.mergeSameTags(t,[s.s,s.e,l],!1),this.util.mergeNestedTags(t),l&&(s.sl=this.util.getNodeFromPath(l,t))}return n},pickup:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r="";for(;!r&&!/^UL$/i.test(n.tagName);)r=n.getAttribute("data-command"),n=n.parentNode;if(!r)return;const i=this.plugins.list.editList.call(this,r,null,!1);i&&this.setRange(i.sc,i.so,i.ec,i.eo),this.submenuOff(),this.history.push(!1)}},$2={name:"table",display:"submenu",add:function(t,n){const r=t.context;let i=r.table={_element:null,_tdElement:null,_trElement:null,_trElements:null,_tableXY:[],_maxWidth:!0,_fixedColumn:!1,_rtl:t.options.rtl,cellControllerTop:t.options.tableCellControllerPosition==="top",resizeText:null,headerButton:null,mergeButton:null,splitButton:null,splitMenu:null,maxText:t.lang.controller.maxSize,minText:t.lang.controller.minSize,_physical_cellCnt:0,_logical_cellCnt:0,_rowCnt:0,_rowIndex:0,_physical_cellIndex:0,_logical_cellIndex:0,_current_colSpan:0,_current_rowSpan:0,icons:{expansion:t.icons.expansion,reduction:t.icons.reduction}},s=this.setSubmenu(t),o=s.querySelector(".se-controller-table-picker");i.tableHighlight=s.querySelector(".se-table-size-highlighted"),i.tableUnHighlight=s.querySelector(".se-table-size-unhighlighted"),i.tableDisplay=s.querySelector(".se-table-size-display"),t.options.rtl&&(i.tableHighlight.style.left=10*18-13+"px");let l=this.setController_table(t);i.tableController=l,i.resizeButton=l.querySelector("._se_table_resize"),i.resizeText=l.querySelector("._se_table_resize > span > span"),i.columnFixedButton=l.querySelector("._se_table_fixed_column"),i.headerButton=l.querySelector("._se_table_header");let c=this.setController_tableEditor(t,i.cellControllerTop);i.resizeDiv=c,i.splitMenu=c.querySelector(".se-btn-group-sub"),i.mergeButton=c.querySelector("._se_table_merge_button"),i.splitButton=c.querySelector("._se_table_split_button"),i.insertRowAboveButton=c.querySelector("._se_table_insert_row_a"),i.insertRowBelowButton=c.querySelector("._se_table_insert_row_b"),o.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(t,i)),o.addEventListener("click",this.appendTable.bind(t)),c.addEventListener("click",this.onClick_tableController.bind(t)),l.addEventListener("click",this.onClick_tableController.bind(t)),t.initMenuTarget(this.name,n,s),r.element.relative.appendChild(c),r.element.relative.appendChild(l),s=null,o=null,c=null,l=null,i=null},setSubmenu:function(t){const n=t.util.createElement("DIV");return n.className="se-submenu se-selector-table",n.innerHTML='<div class="se-table-size"><div class="se-table-size-picker se-controller-table-picker"></div><div class="se-table-size-highlighted"></div><div class="se-table-size-unhighlighted"></div></div><div class="se-table-size-display">1 x 1</div>',n},setController_table:function(t){const n=t.lang,r=t.icons,i=t.util.createElement("DIV");return i.className="se-controller se-controller-table",i.innerHTML='<div><div class="se-btn-group"><button type="button" data-command="resize" class="se-btn se-tooltip _se_table_resize">'+r.expansion+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.maxSize+'</span></span></button><button type="button" data-command="layout" class="se-btn se-tooltip _se_table_fixed_column">'+r.fixed_column_width+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.fixedColumnWidth+'</span></span></button><button type="button" data-command="header" class="se-btn se-tooltip _se_table_header">'+r.table_header+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.tableHeader+'</span></span></button><button type="button" data-command="remove" class="se-btn se-tooltip">'+r.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.remove+"</span></span></button></div></div>",i},setController_tableEditor:function(t,n){const r=t.lang,i=t.icons,s=t.util.createElement("DIV");return s.className="se-controller se-controller-table-cell",s.innerHTML=(n?"":'<div class="se-arrow se-arrow-up"></div>')+'<div class="se-btn-group"><button type="button" data-command="insert" data-value="row" data-option="up" class="se-btn se-tooltip _se_table_insert_row_a">'+i.insert_row_above+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.insertRowAbove+'</span></span></button><button type="button" data-command="insert" data-value="row" data-option="down" class="se-btn se-tooltip _se_table_insert_row_b">'+i.insert_row_below+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.insertRowBelow+'</span></span></button><button type="button" data-command="delete" data-value="row" class="se-btn se-tooltip">'+i.delete_row+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.deleteRow+'</span></span></button><button type="button" data-command="merge" class="_se_table_merge_button se-btn se-tooltip" disabled>'+i.merge_cell+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.mergeCells+'</span></span></button></div><div class="se-btn-group" style="padding-top: 0;"><button type="button" data-command="insert" data-value="cell" data-option="left" class="se-btn se-tooltip">'+i.insert_column_left+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.insertColumnBefore+'</span></span></button><button type="button" data-command="insert" data-value="cell" data-option="right" class="se-btn se-tooltip">'+i.insert_column_right+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.insertColumnAfter+'</span></span></button><button type="button" data-command="delete" data-value="cell" class="se-btn se-tooltip">'+i.delete_column+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.deleteColumn+'</span></span></button><button type="button" data-command="onsplit" class="_se_table_split_button se-btn se-tooltip">'+i.split_cell+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.splitCells+'</span></span></button><div class="se-btn-group-sub sun-editor-common se-list-layer se-table-split"><div class="se-list-inner"><ul class="se-list-basic"><li class="se-btn-list" data-command="split" data-value="vertical" style="line-height:32px;" title="'+r.controller.VerticalSplit+'" aria-label="'+r.controller.VerticalSplit+'">'+r.controller.VerticalSplit+'</li><li class="se-btn-list" data-command="split" data-value="horizontal" style="line-height:32px;" title="'+r.controller.HorizontalSplit+'" aria-label="'+r.controller.HorizontalSplit+'">'+r.controller.HorizontalSplit+"</li></ul></div></div></div>",s},appendTable:function(){const t=this.util.createElement("TABLE"),n=this.plugins.table.createCells,r=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],s="<tbody>";for(;i>0;)s+="<tr>"+n.call(this,"td",r)+"</tr>",--i;if(s+="</tbody>",t.innerHTML=s,this.insertComponent(t,!1,!0,!1)){const l=t.querySelector("td div");this.setRange(l,0,l,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(t,n,r){if(t=t.toLowerCase(),r){const i=this.util.createElement(t);return i.innerHTML="<div><br></div>",i}else{let i="";for(;n>0;)i+="<"+t+"><div><br></div></"+t+">",n--;return i}},onMouseMove_tablePicker:function(t,n){n.stopPropagation();let r=this._w.Math.ceil(n.offsetX/18),i=this._w.Math.ceil(n.offsetY/18);r=r<1?1:r,i=i<1?1:i,t._rtl&&(t.tableHighlight.style.left=r*18-13+"px",r=11-r),t.tableHighlight.style.width=r+"em",t.tableHighlight.style.height=i+"em",this.util.changeTxt(t.tableDisplay,r+" x "+i),t._tableXY=[r,i]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const t=this.context.table.tableHighlight.style,n=this.context.table.tableUnHighlight.style;t.width="1em",t.height="1em",n.width="10em",n.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const t=this.context.table,n=this.plugins.table;if(n._removeEvents.call(this),n._selectedTable){const r=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let i=0,s=r.length;i<s;i++)this.util.removeClass(r[i],"se-table-selected-cell")}n._toggleEditor.call(this,!0),t._element=null,t._tdElement=null,t._trElement=null,t._trElements=null,t._tableXY=[],t._maxWidth=!0,t._fixedColumn=!1,t._physical_cellCnt=0,t._logical_cellCnt=0,t._rowCnt=0,t._rowIndex=0,t._physical_cellIndex=0,t._logical_cellIndex=0,t._current_colSpan=0,t._current_rowSpan=0,n._shift=!1,n._selectedCells=null,n._selectedTable=null,n._ref=null,n._fixedCell=null,n._selectedCell=null,n._fixedCellName=null},call_controller_tableEdit:function(t){const n=this.plugins.table,r=this.context.table;if(!this.getSelection().isCollapsed&&!n._selectedCell){this.controllersOff(),this.util.removeClass(t,"se-table-selected-cell");return}const i=r._element||this.plugins.table._selectedTable||this.util.getParentElement(t,"TABLE");r._maxWidth=this.util.hasClass(i,"se-table-size-100")||i.style.width==="100%"||!i.style.width&&!this.util.hasClass(i,"se-table-size-auto"),r._fixedColumn=this.util.hasClass(i,"se-table-layout-fixed")||i.style.tableLayout==="fixed",n.setTableStyle.call(this,r._maxWidth?"width|column":"width"),n.setPositionControllerTop.call(this,i),n.setPositionControllerDiv.call(this,t,n._shift),n._shift||this.controllersOn(r.resizeDiv,r.tableController,n.init.bind(this),t,"table")},setPositionControllerTop:function(t){this.setControllerPosition(this.context.table.tableController,t,"top",{left:0,top:0})},setPositionControllerDiv:function(t,n){const r=this.context.table,i=r.resizeDiv;this.plugins.table.setCellInfo.call(this,t,n),r.cellControllerTop?this.setControllerPosition(i,r._element,"top",{left:r.tableController.offsetWidth,top:0}):this.setControllerPosition(i,t,"bottom",{left:0,top:0})},setCellInfo:function(t,n){const r=this.context.table,i=r._element=this.plugins.table._selectedTable||this.util.getParentElement(t,"TABLE");if(/THEAD/i.test(i.firstElementChild.nodeName)?this.util.addClass(r.headerButton,"active"):this.util.removeClass(r.headerButton,"active"),n||r._physical_cellCnt===0){r._tdElement!==t&&(r._tdElement=t,r._trElement=t.parentNode);const s=r._trElements=i.rows,o=t.cellIndex;let l=0;for(let u=0,m=s[0].cells,y=s[0].cells.length;u<y;u++)l+=m[u].colSpan;const c=r._rowIndex=r._trElement.rowIndex;r._rowCnt=s.length,r._physical_cellCnt=r._trElement.cells.length,r._logical_cellCnt=l,r._physical_cellIndex=o,r._current_colSpan=r._tdElement.colSpan-1,r._current_rowSpan-r._trElement.cells[o].rowSpan-1;let a=[],f=[];for(let u=0,m,y;u<=c;u++){m=s[u].cells,y=0;for(let _=0,S=m.length,E,d,h,v;_<S;_++){if(E=m[_],d=E.colSpan-1,h=E.rowSpan-1,v=_+y,f.length>0)for(let x=0,g;x<f.length;x++)g=f[x],!(g.row>u)&&(v>=g.index?(y+=g.cs,v+=g.cs,g.rs-=1,g.row=u+1,g.rs<1&&(f.splice(x,1),x--)):_===S-1&&(g.rs-=1,g.row=u+1,g.rs<1&&(f.splice(x,1),x--)));if(u===c&&_===o){r._logical_cellIndex=v;break}h>0&&a.push({index:v,cs:d+1,rs:h,row:-1}),y+=d}f=f.concat(a).sort(function(_,S){return _.index-S.index}),a=[]}a=null,f=null}},editTable:function(t,n){const r=this.plugins.table,i=this.context.table,s=i._element,o=t==="row";if(o){const l=i._trElement.parentNode;if(/^THEAD$/i.test(l.nodeName)){if(n==="up")return;if(!l.nextElementSibling||!/^TBODY$/i.test(l.nextElementSibling.nodeName)){s.innerHTML+="<tbody><tr>"+r.createCells.call(this,"td",i._logical_cellCnt,!1)+"</tr></tbody>";return}}}if(r._ref){const l=i._tdElement,c=r._selectedCells;if(o)if(n)r.setCellInfo.call(this,n==="up"?c[0]:c[c.length-1],!0),r.editRow.call(this,n,l);else{let a=c[0].parentNode;const f=[c[0]];for(let u=1,m=c.length,y;u<m;u++)y=c[u],a!==y.parentNode&&(f.push(y),a=y.parentNode);for(let u=0,m=f.length;u<m;u++)r.setCellInfo.call(this,f[u],!0),r.editRow.call(this,n)}else{const a=c[0].parentNode;if(n){let f=null;for(let u=0,m=c.length-1;u<m;u++)if(a!==c[u+1].parentNode){f=c[u];break}r.setCellInfo.call(this,n==="left"?c[0]:f||c[0],!0),r.editCell.call(this,n,l)}else{const f=[c[0]];for(let u=1,m=c.length,y;u<m&&(y=c[u],a===y.parentNode);u++)f.push(y);for(let u=0,m=f.length;u<m;u++)r.setCellInfo.call(this,f[u],!0),r.editCell.call(this,n)}}n||r.init.call(this)}else r[o?"editRow":"editCell"].call(this,n);if(!n){const l=s.children;for(let c=0;c<l.length;c++)l[c].children.length===0&&(this.util.removeItem(l[c]),c--);s.children.length===0&&this.util.removeItem(s)}},editRow:function(t,n){const r=this.context.table,i=!t,s=t==="up",o=r._rowIndex,l=i||s?o:o+r._current_rowSpan+1,c=i?-1:1,a=r._trElements;let f=r._logical_cellCnt;for(let u=0,m=o+(i?-1:0),y;u<=m;u++){if(y=a[u].cells,y.length===0)return;for(let _=0,S=y.length,E,d;_<S;_++)E=y[_].rowSpan,d=y[_].colSpan,!(E<2&&d<2)&&E+u>l&&l>u&&(y[_].rowSpan=E+c,f-=d)}if(i){const u=a[o+1];if(u){const m=[];let y=a[o].cells,_=0;for(let S=0,E=y.length,d,h;S<E;S++)d=y[S],h=S+_,_+=d.colSpan-1,d.rowSpan>1&&(d.rowSpan-=1,m.push({cell:d.cloneNode(!1),index:h}));if(m.length>0){let S=m.shift();y=u.cells,_=0;for(let E=0,d=y.length,h,v;E<d&&(h=y[E],v=E+_,_+=h.colSpan-1,!(v>=S.index&&(E--,_--,_+=S.cell.colSpan-1,u.insertBefore(S.cell,h),S=m.shift(),!S)));E++);if(S){u.appendChild(S.cell);for(let E=0,d=m.length;E<d;E++)u.appendChild(m[E].cell)}}}r._element.deleteRow(l)}else{const u=r._element.insertRow(l);u.innerHTML=this.plugins.table.createCells.call(this,"td",f,!1)}i?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,n||r._tdElement,!0)},editCell:function(t,n){const r=this.context.table,i=this.util,s=!t,o=t==="left",l=r._current_colSpan,c=s||o?r._logical_cellIndex:r._logical_cellIndex+l+1,a=r._trElements;let f=[],u=[],m=0;const y=[],_=[];for(let S=0,E=r._rowCnt,d,h,v,x,g,b;S<E;S++){d=a[S],h=c,g=!1,v=d.cells,b=0;for(let w=0,k,N=v.length,T,D,I;w<N&&(k=v[w],!!k);w++)if(T=k.rowSpan-1,D=k.colSpan-1,s){if(I=w+b,u.length>0){const L=!v[w+1];for(let R=0,P;R<u.length;R++)P=u[R],!(P.row>S)&&(I>=P.index?(b+=P.cs,I=w+b,P.rs-=1,P.row=S+1,P.rs<1&&(u.splice(R,1),R--)):L&&(P.rs-=1,P.row=S+1,P.rs<1&&(u.splice(R,1),R--)))}T>0&&f.push({rs:T,cs:D+1,index:I,row:-1}),I>=h&&I+D<=h+l?y.push(k):I<=h+l&&I+D>=h?k.colSpan-=i.getOverlapRangeAtIndex(c,c+l,I,I+D):T>0&&(I<h||I+D>h+l)&&_.push({cell:k,i:S,rs:S+T}),b+=D}else{if(w>=h)break;if(D>0){if(m<1&&D+w>=h){k.colSpan+=1,h=null,m=T+1;break}h-=D}if(!g){for(let L=0,R;L<u.length;L++)R=u[L],h-=R.cs,R.rs-=1,R.rs<1&&(u.splice(L,1),L--);g=!0}}if(u=u.concat(f).sort(function(w,k){return w.index-k.index}),f=[],!s){if(m>0){m-=1;continue}h!==null&&v.length>0&&(x=this.plugins.table.createCells.call(this,v[0].nodeName,0,!0),x=d.insertBefore(x,v[h]))}}if(s){let S,E;for(let d=0,h=y.length,v;d<h;d++)v=y[d].parentNode,i.removeItem(y[d]),v.cells.length===0&&(S||(S=i.getArrayIndex(a,v)),E=i.getArrayIndex(a,v),i.removeItem(v));for(let d=0,h=_.length,v;d<h;d++)v=_[d],v.cell.rowSpan=i.getOverlapRangeAtIndex(S,E,v.i,v.rs);this.controllersOff()}else this.plugins.table.setPositionControllerDiv.call(this,n||r._tdElement,!0)},_closeSplitMenu:null,openSplitMenu:function(){this.util.addClass(this.context.table.splitButton,"on"),this.context.table.splitMenu.style.display="inline-table",this.plugins.table._closeSplitMenu=(function(){this.util.removeClass(this.context.table.splitButton,"on"),this.context.table.splitMenu.style.display="none",this.removeDocEvent("click",this.plugins.table._closeSplitMenu),this.plugins.table._closeSplitMenu=null}).bind(this),this.addDocEvent("click",this.plugins.table._closeSplitMenu)},splitCells:function(t){const n=this.util,r=t==="vertical",i=this.context.table,s=i._tdElement,o=i._trElements,l=i._trElement,c=i._logical_cellIndex,a=i._rowIndex,f=this.plugins.table.createCells.call(this,s.nodeName,0,!0);if(r){const u=s.colSpan;if(f.rowSpan=s.rowSpan,u>1)f.colSpan=this._w.Math.floor(u/2),s.colSpan=u-f.colSpan,l.insertBefore(f,s.nextElementSibling);else{let m=[],y=[];for(let _=0,S=i._rowCnt,E,d;_<S;_++){E=o[_].cells,d=0;for(let h=0,v=E.length,x,g,b,w;h<v;h++){if(x=E[h],g=x.colSpan-1,b=x.rowSpan-1,w=h+d,y.length>0)for(let k=0,N;k<y.length;k++)N=y[k],!(N.row>_)&&(w>=N.index?(d+=N.cs,w+=N.cs,N.rs-=1,N.row=_+1,N.rs<1&&(y.splice(k,1),k--)):h===v-1&&(N.rs-=1,N.row=_+1,N.rs<1&&(y.splice(k,1),k--)));if(w<=c&&b>0&&m.push({index:w,cs:g+1,rs:b,row:-1}),x!==s&&w<=c&&w+g>=c+u-1){x.colSpan+=1;break}if(w>c)break;d+=g}y=y.concat(m).sort(function(h,v){return h.index-v.index}),m=[]}l.insertBefore(f,s.nextElementSibling)}}else{const u=s.rowSpan;if(f.colSpan=s.colSpan,u>1){f.rowSpan=this._w.Math.floor(u/2);const m=u-f.rowSpan,y=[],_=n.getArrayIndex(o,l)+m;for(let h=0,v,x;h<_;h++){v=o[h].cells,x=0;for(let g=0,b=v.length,w,k,N;g<b&&(N=g+x,!(N>=c));g++)w=v[g],k=w.rowSpan-1,k>0&&k+h>=_&&N<c&&y.push({index:N,cs:w.colSpan}),x+=w.colSpan-1}const S=o[_],E=S.cells;let d=y.shift();for(let h=0,v=E.length,x=0,g,b,w,k;h<v;h++){if(w=h+x,g=E[h],b=g.colSpan-1,k=w+b+1,d&&k>=d.index&&(x+=d.cs,k+=d.cs,d=y.shift()),k>=c||h===v-1){S.insertBefore(f,g.nextElementSibling);break}x+=b}s.rowSpan=m}else{f.rowSpan=s.rowSpan;const m=n.createElement("TR");m.appendChild(f);for(let S=0,E;S<a;S++){if(E=o[S].cells,E.length===0)return;for(let d=0,h=E.length;d<h;d++)S+E[d].rowSpan-1>=a&&(E[d].rowSpan+=1)}const y=i._physical_cellIndex,_=l.cells;for(let S=0,E=_.length;S<E;S++)S!==y&&(_[S].rowSpan+=1);l.parentNode.insertBefore(m,l.nextElementSibling)}}this.focusEdge(s),this.plugins.table.setPositionControllerDiv.call(this,s,!0)},mergeCells:function(){const t=this.plugins.table,n=this.context.table,r=this.util,i=t._ref,s=t._selectedCells,o=s[0];let l=null,c=null,a=i.ce-i.cs+1,f=i.re-i.rs+1,u="",m=null;for(let y=1,_=s.length,S,E;y<_;y++){S=s[y],m!==S.parentNode&&(m=S.parentNode),E=S.children;for(let d=0,h=E.length;d<h;d++)r.isFormatElement(E[d])&&r.onlyZeroWidthSpace(E[d].textContent)&&r.removeItem(E[d]);u+=S.innerHTML,r.removeItem(S),m.cells.length===0&&(l?c=m:l=m,f-=1)}if(l){const y=n._trElements,_=r.getArrayIndex(y,l),S=r.getArrayIndex(y,c||l),E=[];for(let d=0,h;d<=S;d++){if(h=y[d].cells,h.length===0){E.push(y[d]);continue}for(let v=0,x=h.length,g,b;v<x;v++)g=h[v],b=g.rowSpan-1,b>0&&d+b>=_&&(g.rowSpan-=r.getOverlapRangeAtIndex(_,S,d,d+b))}for(let d=0,h=E.length;d<h;d++)r.removeItem(E[d])}o.innerHTML+=u,o.colSpan=a,o.rowSpan=f,this.controllersOff(),t.setActiveButton.call(this,!0,!1),t.call_controller_tableEdit.call(this,o),r.addClass(o,"se-table-selected-cell"),this.focusEdge(o)},toggleHeader:function(){const t=this.util,n=this.context.table.headerButton,r=t.hasClass(n,"active"),i=this.context.table._element;if(r)t.removeItem(i.querySelector("thead"));else{const s=t.createElement("THEAD");s.innerHTML="<tr>"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"</tr>",i.insertBefore(s,i.firstElementChild)}t.toggleClass(n,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(t){const n=this.context.table,r=n._element;let i,s,o,l;t.indexOf("width")>-1&&(i=n.resizeButton.firstElementChild,s=n.resizeText,n._maxWidth?(o=n.icons.reduction,l=n.minText,n.columnFixedButton.style.display="block",this.util.removeClass(r,"se-table-size-auto"),this.util.addClass(r,"se-table-size-100")):(o=n.icons.expansion,l=n.maxText,n.columnFixedButton.style.display="none",this.util.removeClass(r,"se-table-size-100"),this.util.addClass(r,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(s,l)),t.indexOf("column")>-1&&(n._fixedColumn?(this.util.removeClass(r,"se-table-layout-auto"),this.util.addClass(r,"se-table-layout-fixed"),this.util.addClass(n.columnFixedButton,"active")):(this.util.removeClass(r,"se-table-layout-fixed"),this.util.addClass(r,"se-table-layout-auto"),this.util.removeClass(n.columnFixedButton,"active")))},setActiveButton:function(t,n){const r=this.context.table;/^TH$/i.test(t.nodeName)?(r.insertRowAboveButton.setAttribute("disabled",!0),r.insertRowBelowButton.setAttribute("disabled",!0)):(r.insertRowAboveButton.removeAttribute("disabled"),r.insertRowBelowButton.removeAttribute("disabled")),!n||t===n?(r.splitButton.removeAttribute("disabled"),r.mergeButton.setAttribute("disabled",!0)):(r.splitButton.setAttribute("disabled",!0),r.mergeButton.removeAttribute("disabled"))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(t){this.context.element.wysiwyg.setAttribute("contenteditable",t),t?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(t){t.stopPropagation();const n=this.plugins.table;n._shift?n._initBind&&(this._wd.removeEventListener("touchmove",n._initBind),n._initBind=null):(n._removeEvents.call(this),n._toggleEditor.call(this,!0)),!(!n._fixedCell||!n._selectedTable)&&(n.setActiveButton.call(this,n._fixedCell,n._selectedCell),n.call_controller_tableEdit.call(this,n._selectedCell||n._fixedCell),n._selectedCells=n._selectedTable.querySelectorAll(".se-table-selected-cell"),n._selectedCell&&n._fixedCell&&this.focusEdge(n._selectedCell),n._shift||(n._fixedCell=null,n._selectedCell=null,n._fixedCellName=null))},_onCellMultiSelect:function(t){this._antiBlur=!0;const n=this.plugins.table,r=this.util.getParentElement(t.target,this.util.isCell);if(n._shift)r===n._fixedCell?n._toggleEditor.call(this,!0):n._toggleEditor.call(this,!1);else if(!n._ref){if(r===n._fixedCell)return;n._toggleEditor.call(this,!1)}!r||r===n._selectedCell||n._fixedCellName!==r.nodeName||n._selectedTable!==this.util.getParentElement(r,"TABLE")||(n._selectedCell=r,n._setMultiCells.call(this,n._fixedCell,r))},_setMultiCells:function(t,n){const r=this.plugins.table,i=r._selectedTable.rows,s=this.util,o=r._selectedTable.querySelectorAll(".se-table-selected-cell");for(let u=0,m=o.length;u<m;u++)s.removeClass(o[u],"se-table-selected-cell");if(t===n&&(s.addClass(t,"se-table-selected-cell"),!r._shift))return;let l=!0,c=[],a=[];const f=r._ref={_i:0,cs:null,ce:null,rs:null,re:null};for(let u=0,m=i.length,y,_;u<m;u++){y=i[u].cells,_=0;for(let S=0,E=y.length,d,h,v,x;S<E;S++){if(d=y[S],v=d.colSpan-1,x=d.rowSpan-1,h=S+_,c.length>0)for(let g=0,b;g<c.length;g++)b=c[g],!(b.row>u)&&(h>=b.index?(_+=b.cs,h+=b.cs,b.rs-=1,b.row=u+1,b.rs<1&&(c.splice(g,1),g--)):S===E-1&&(b.rs-=1,b.row=u+1,b.rs<1&&(c.splice(g,1),g--)));if(l){if((d===t||d===n)&&(f.cs=f.cs!==null&&f.cs<h?f.cs:h,f.ce=f.ce!==null&&f.ce>h+v?f.ce:h+v,f.rs=f.rs!==null&&f.rs<u?f.rs:u,f.re=f.re!==null&&f.re>u+x?f.re:u+x,f._i+=1),f._i===2){l=!1,c=[],a=[],u=-1;break}}else if(s.getOverlapRangeAtIndex(f.cs,f.ce,h,h+v)&&s.getOverlapRangeAtIndex(f.rs,f.re,u,u+x)){const g=f.cs<h?f.cs:h,b=f.ce>h+v?f.ce:h+v,w=f.rs<u?f.rs:u,k=f.re>u+x?f.re:u+x;if(f.cs!==g||f.ce!==b||f.rs!==w||f.re!==k){f.cs=g,f.ce=b,f.rs=w,f.re=k,u=-1,c=[],a=[];break}s.addClass(d,"se-table-selected-cell")}x>0&&a.push({index:h,cs:v+1,rs:x,row:-1}),_+=d.colSpan-1}c=c.concat(a).sort(function(S,E){return S.index-E.index}),a=[]}},_removeEvents:function(){const t=this.plugins.table;t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null),t._bindOnSelect&&(this._wd.removeEventListener("mousedown",t._bindOnSelect),this._wd.removeEventListener("mousemove",t._bindOnSelect),t._bindOnSelect=null),t._bindOffSelect&&(this._wd.removeEventListener("mouseup",t._bindOffSelect),t._bindOffSelect=null),t._bindOffShift&&(this._wd.removeEventListener("keyup",t._bindOffShift),t._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(t,n){const r=this.plugins.table;r._removeEvents.call(this),this.controllersOff(),r._shift=n,r._fixedCell=t,r._fixedCellName=t.nodeName,r._selectedTable=this.util.getParentElement(t,"TABLE");const i=r._selectedTable.querySelectorAll(".se-table-selected-cell");for(let s=0,o=i.length;s<o;s++)this.util.removeClass(i[s],"se-table-selected-cell");this.util.addClass(t,"se-table-selected-cell"),r._bindOnSelect=r._onCellMultiSelect.bind(this),r._bindOffSelect=r._offCellMultiSelect.bind(this),n?(r._bindOffShift=(function(){this.controllersOn(this.context.table.resizeDiv,this.context.table.tableController,this.plugins.table.init.bind(this),t,"table"),r._ref||this.controllersOff()}).bind(this),this._wd.addEventListener("keyup",r._bindOffShift,!1),this._wd.addEventListener("mousedown",r._bindOnSelect,!1)):this._wd.addEventListener("mousemove",r._bindOnSelect,!1),this._wd.addEventListener("mouseup",r._bindOffSelect,!1),r._initBind=r.init.bind(this),this._wd.addEventListener("touchmove",r._initBind,!1)},onClick_tableController:function(t){t.stopPropagation();const n=t.target.getAttribute("data-command")?t.target:t.target.parentNode;if(n.getAttribute("disabled"))return;const r=n.getAttribute("data-command"),i=n.getAttribute("data-value"),s=n.getAttribute("data-option"),o=this.plugins.table;if(typeof o._closeSplitMenu=="function"&&(o._closeSplitMenu(),r==="onsplit")||!r)return;t.preventDefault();const l=this.context.table;switch(r){case"insert":case"delete":o.editTable.call(this,i,s);break;case"header":o.toggleHeader.call(this);break;case"onsplit":o.openSplitMenu.call(this);break;case"split":o.splitCells.call(this,i);break;case"merge":o.mergeCells.call(this);break;case"resize":l._maxWidth=!l._maxWidth,o.setTableStyle.call(this,"width"),o.setPositionControllerTop.call(this,l._element),o.setPositionControllerDiv.call(this,l._tdElement,o._shift);break;case"layout":l._fixedColumn=!l._fixedColumn,o.setTableStyle.call(this,"column"),o.setPositionControllerTop.call(this,l._element),o.setPositionControllerDiv.call(this,l._tdElement,o._shift);break;case"remove":const c=l._element.parentNode;this.util.removeItem(l._element),this.controllersOff(),c!==this.context.element.wysiwyg&&this.util.removeItemAllParents(c,function(a){return a.childNodes.length===0},null),this.focus()}this.history.push(!1)}},V2={name:"formatBlock",display:"submenu",add:function(t,n){const r=t.context;r.formatBlock={targetText:n.querySelector(".txt"),targetTooltip:n.parentNode.querySelector(".se-tooltip-text"),_formatList:null,currentFormat:""};let i=this.setSubmenu(t);i.querySelector("ul").addEventListener("click",this.pickUp.bind(t)),r.formatBlock._formatList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.options,r=t.lang.toolbar,i=t.util.createElement("DIV");i.className="se-submenu se-list-layer se-list-format";const s=["p","div","blockquote","pre","h1","h2","h3","h4","h5","h6"],o=!n.formats||n.formats.length===0?s:n.formats;let l='<div class="se-list-inner"><ul class="se-list-basic">';for(let c=0,a=o.length,f,u,m,y,_,S,E;c<a;c++)f=o[c],typeof f=="string"&&s.indexOf(f)>-1?(u=f.toLowerCase(),m=u==="blockquote"?"range":u==="pre"?"free":"replace",_=/^h/.test(u)?u.match(/\d+/)[0]:"",y=r["tag_"+(_?"h":u)]+_,E="",S=""):(u=f.tag.toLowerCase(),m=f.command,y=f.name||u,E=f.class,S=E?' class="'+E+'"':""),l+='<li><button type="button" class="se-btn-list" data-command="'+m+'" data-value="'+u+'" data-class="'+E+'" title="'+y+'" aria-label="'+y+'"><'+u+S+">"+y+"</"+u+"></button></li>";return l+="</ul></div>",i.innerHTML=l,i},active:function(t){let n=this.lang.toolbar.formats;const r=this.context.formatBlock.targetText;if(!t)this.util.changeTxt(r,n);else if(this.util.isFormatElement(t)){const s=this.context.formatBlock._formatList,o=t.nodeName.toLowerCase(),l=(t.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let c=0,a=s.length,f;c<a;c++)if(f=s[c],o===f.getAttribute("data-value")&&l===f.getAttribute("data-class")){n=f.title;break}return this.util.changeTxt(r,n),r.setAttribute("data-value",o),r.setAttribute("data-class",l),!0}return!1},on:function(){const t=this.context.formatBlock,n=t._formatList,r=t.targetText,i=(r.getAttribute("data-value")||"")+(r.getAttribute("data-class")||"");if(i!==t.currentFormat){for(let s=0,o=n.length,l;s<o;s++)l=n[s],i===l.getAttribute("data-value")+l.getAttribute("data-class")?this.util.addClass(l,"active"):this.util.removeClass(l,"active");t.currentFormat=i}},pickUp:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=null,i=null,s=null,o="";for(;!r&&!/UL/i.test(n.tagName);){if(r=n.getAttribute("data-command"),i=n.getAttribute("data-value"),o=n.getAttribute("data-class"),r){s=n.firstChild;break}n=n.parentNode}if(r){if(r==="range"){const l=s.cloneNode(!1);this.applyRangeFormatElement(l)}else{let l=this.getRange(),c=this.getSelectedElementsAndComponents(!1);if(c.length===0&&(l=this.getRange_addLine(l,null),c=this.getSelectedElementsAndComponents(!1),c.length===0))return;const a=l.startOffset,f=l.endOffset,u=this.util;let m=c[0],y=c[c.length-1];const _=u.getNodePath(l.startContainer,m,null,null),S=u.getNodePath(l.endContainer,y,null,null),E=this.detachList(c,!1);E.sc&&(m=E.sc),E.ec&&(y=E.ec),this.setRange(u.getNodeFromPath(_,m),a,u.getNodeFromPath(S,y),f);const d=this.getSelectedElementsAndComponents(!1);if(r==="free"){const h=d.length-1;let v=d[h].parentNode,x=s.cloneNode(!1);const g=x;for(let b=h,w,k,N,T,D,I,L=!0;b>=0;b--)if(w=d[b],w!==(d[b+1]?d[b+1].parentNode:null)){if(I=u.isComponent(w),k=I?"":w.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),N=u.getParentElement(w,function(R){return R.parentNode===v}),(v!==w.parentNode||I)&&(u.isFormatElement(v)?(v.parentNode.insertBefore(x,v.nextSibling),v=v.parentNode):(v.insertBefore(x,N?N.nextSibling:null),v=w.parentNode),T=x.nextSibling,T&&x.nodeName===T.nodeName&&u.isSameAttributes(x,T)&&(x.innerHTML+="<BR>"+T.innerHTML,u.removeItem(T)),x=s.cloneNode(!1),L=!0),D=x.innerHTML,x.innerHTML=(L||!k||!D||/<br>$/i.test(k)?k:k+"<BR>")+D,b===0){v.insertBefore(x,w),T=w.nextSibling,T&&x.nodeName===T.nodeName&&u.isSameAttributes(x,T)&&(x.innerHTML+="<BR>"+T.innerHTML,u.removeItem(T));const R=x.previousSibling;R&&x.nodeName===R.nodeName&&u.isSameAttributes(x,R)&&(R.innerHTML+="<BR>"+x.innerHTML,u.removeItem(x))}I||u.removeItem(w),k&&(L=!1)}this.setRange(g,0,g,0)}else{for(let h=0,v=d.length,x,g;h<v;h++)x=d[h],(x.nodeName.toLowerCase()!==i.toLowerCase()||(x.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()!==o)&&!u.isComponent(x)&&(g=s.cloneNode(!1),u.copyFormatAttributes(g,x),g.innerHTML=x.innerHTML,x.parentNode.replaceChild(g,x)),h===0&&(m=g||x),h===v-1&&(y=g||x),g=null;this.setRange(u.getNodeFromPath(_,m),a,u.getNodeFromPath(S,y),f)}this.history.push(!1)}this.submenuOff()}}},W2={name:"lineHeight",display:"submenu",add:function(t,n){const r=t.context;r.lineHeight={_sizeList:null,currentSize:-1};let i=this.setSubmenu(t),s=i.querySelector("ul");s.addEventListener("click",this.pickup.bind(t)),r.lineHeight._sizeList=s.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null,s=null},setSubmenu:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-submenu se-list-layer";const s=n.lineHeights?n.lineHeights:[{text:"1",value:1},{text:"1.15",value:1.15},{text:"1.5",value:1.5},{text:"2",value:2}];let o='<div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="default_value se-btn-list" title="'+r.toolbar.default+'" aria-label="'+r.toolbar.default+'">('+r.toolbar.default+")</button></li>";for(let l=0,c=s.length,a;l<c;l++)a=s[l],o+='<li><button type="button" class="se-btn-list" data-value="'+a.value+'" title="'+a.text+'" aria-label="'+a.text+'">'+a.text+"</button></li>";return o+="</ul></div>",i.innerHTML=o,i},on:function(){const t=this.context.lineHeight,n=t._sizeList,r=this.util.getFormatElement(this.getSelectionNode()),i=r?r.style.lineHeight+"":"";if(i!==t.currentSize){for(let s=0,o=n.length;s<o;s++)i===n[s].getAttribute("data-value")?this.util.addClass(n[s],"active"):this.util.removeClass(n[s],"active");t.currentSize=i}},pickup:function(t){if(!/^BUTTON$/i.test(t.target.tagName))return!1;t.preventDefault(),t.stopPropagation();const n=t.target.getAttribute("data-value")||"",r=this.getSelectedElements();for(let i=0,s=r.length;i<s;i++)r[i].style.lineHeight=n;this.submenuOff(),this.history.push(!1)}},U2={name:"template",display:"submenu",add:function(t,n){const r=t.context;r.template={selectedIndex:-1};let i=this.setSubmenu(t);i.querySelector("ul").addEventListener("click",this.pickup.bind(t)),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.options.templates;if(!n||n.length===0)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const r=t.util.createElement("DIV");r.className="se-list-layer";let i='<div class="se-submenu se-list-inner"><ul class="se-list-basic">';for(let s=0,o=n.length,l;s<o;s++)l=n[s],i+='<li><button type="button" class="se-btn-list" data-value="'+s+'" title="'+l.name+'" aria-label="'+l.name+'">'+l.name+"</button></li>";return i+="</ul></div>",r.innerHTML=i,r},pickup:function(t){if(!/^BUTTON$/i.test(t.target.tagName))return!1;t.preventDefault(),t.stopPropagation(),this.context.template.selectedIndex=t.target.getAttribute("data-value")*1;const n=this.options.templates[this.context.template.selectedIndex];if(n.html)this.setContents(n.html);else throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.submenuOff()}},q2={name:"paragraphStyle",display:"submenu",add:function(t,n){const r=t.context;r.paragraphStyle={_classList:null};let i=this.setSubmenu(t);i.querySelector("ul").addEventListener("click",this.pickUp.bind(t)),r.paragraphStyle._classList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.options,r=t.util.createElement("DIV");r.className="se-submenu se-list-layer se-list-format";const i=t.lang.menu,s={spaced:{name:i.spaced,class:"__se__p-spaced",_class:""},bordered:{name:i.bordered,class:"__se__p-bordered",_class:""},neon:{name:i.neon,class:"__se__p-neon",_class:""}},o=!n.paragraphStyles||n.paragraphStyles.length===0?["spaced","bordered","neon"]:n.paragraphStyles;let l='<div class="se-list-inner"><ul class="se-list-basic">';for(let c=0,a=o.length,f,u,m,y;c<a;c++){if(f=o[c],typeof f=="string"){const _=s[f.toLowerCase()];if(!_)continue;f=_}u=f.name,m=f.class?' class="'+f.class+'"':"",y=f._class,l+='<li><button type="button" class="se-btn-list'+(y?" "+y:"")+'" data-value="'+f.class+'" title="'+u+'" aria-label="'+u+'"><div'+m+">"+u+"</div></button></li>"}return l+="</ul></div>",r.innerHTML=l,r},on:function(){const n=this.context.paragraphStyle._classList,r=this.util.getFormatElement(this.getSelectionNode());for(let i=0,s=n.length;i<s;i++)this.util.hasClass(r,n[i].getAttribute("data-value"))?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active")},pickUp:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=null;for(;!/^UL$/i.test(n.tagName)&&(r=n.getAttribute("data-value"),!r);)n=n.parentNode;if(!r)return;let i=this.getSelectedElements();if(i.length===0&&(this.getRange_addLine(this.getRange(),null),i=this.getSelectedElements(),i.length===0))return;const s=this.util.hasClass(n,"active")?this.util.removeClass.bind(this.util):this.util.addClass.bind(this.util);for(let o=0,l=i.length;o<l;o++)s(i[o],r);this.submenuOff(),this.history.push(!1)}},Y2={name:"textStyle",display:"submenu",add:function(t,n){const r=t.context;r.textStyle={_styleList:null};let i=this.setSubmenu(t),s=i.querySelector("ul");s.addEventListener("click",this.pickup.bind(t)),r.textStyle._styleList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null,s=null},setSubmenu:function(t){const n=t.options,r=t.util.createElement("DIV");r.className="se-submenu se-list-layer se-list-format";const i={code:{name:t.lang.menu.code,class:"__se__t-code",tag:"code"},translucent:{name:t.lang.menu.translucent,style:"opacity: 0.5;",tag:"span"},shadow:{name:t.lang.menu.shadow,class:"__se__t-shadow",tag:"span"}},s=n.textStyles?n.textStyles:t._w.Object.keys(i);let o='<div class="se-list-inner"><ul class="se-list-basic">';for(let l=0,c=s.length,a,f,u,m,y,_,S;l<c;l++){if(a=s[l],m="",_="",y=[],typeof a=="string"){const E=i[a.toLowerCase()];if(!E)continue;a=E}u=a.name,f=a.tag||"span",S=a._class,a.style&&(m+=' style="'+a.style+'"',_+=a.style.replace(/:[^;]+(;|$)\s*/g,","),y.push("style")),a.class&&(m+=' class="'+a.class+'"',_+="."+a.class.trim().replace(/\s+/g,",."),y.push("class")),_=_.replace(/,$/,""),o+='<li><button type="button" class="se-btn-list'+(S?" "+S:"")+'" data-command="'+f+'" data-value="'+_+'" title="'+u+'" aria-label="'+u+'"><'+f+m+">"+u+"</"+f+"></button></li>"}return o+="</ul></div>",r.innerHTML=o,r},on:function(){const t=this.util,r=this.context.textStyle._styleList,i=this.getSelectionNode();for(let s=0,o=r.length,l,c,a;s<o;s++){l=r[s],c=l.getAttribute("data-value").split(",");for(let f=0,u,m;f<c.length;f++){for(u=i,a=!1;u&&!t.isFormatElement(u)&&!t.isComponent(u);){if(u.nodeName.toLowerCase()===l.getAttribute("data-command").toLowerCase()&&(m=c[f],/^\./.test(m)?t.hasClass(u,m.replace(/^\./,"")):u.style[m])){a=!0;break}u=u.parentNode}if(!a)break}a?t.addClass(l,"active"):t.removeClass(l,"active")}},pickup:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=null,i=null;for(;!r&&!/UL/i.test(n.tagName);){if(r=n.getAttribute("data-command"),r){i=n.firstChild;break}n=n.parentNode}if(!r)return;const s=i.style.cssText.replace(/:.+(;|$)/g,",").split(",");s.pop();const o=i.classList;for(let a=0,f=o.length;a<f;a++)s.push("."+o[a]);const l=this.util.hasClass(n,"active")?null:i.cloneNode(!1),c=l?null:[i.nodeName];this.nodeChange(l,s,c,!0),this.submenuOff()}};var G2={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"dialog",add:function(s){const o=s.context;o.dialog={kind:"",updateModal:!1,_closeSignal:!1};let l=s.util.createElement("DIV");l.className="se-dialog sun-editor-common";let c=s.util.createElement("DIV");c.className="se-dialog-back",c.style.display="none";let a=s.util.createElement("DIV");a.className="se-dialog-inner",a.style.display="none",l.appendChild(c),l.appendChild(a),o.dialog.modalArea=l,o.dialog.back=c,o.dialog.modal=a,o.dialog.modal.addEventListener("mousedown",this._onMouseDown_dialog.bind(s)),o.dialog.modal.addEventListener("click",this._onClick_dialog.bind(s)),o.element.relative.appendChild(l),l=null,c=null,a=null},_onMouseDown_dialog:function(s){/se-dialog-inner/.test(s.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},_onClick_dialog:function(s){(/close/.test(s.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(s,o){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=(function(c){/27/.test(c.keyCode)&&this.plugins.dialog.close.call(this)}).bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=o,this.options.popupDisplay==="full"?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=s,this.modalForm=this.context[s].modal;const l=this.context[s].focusElement;typeof this.plugins[s].on=="function"&&this.plugins[s].on.call(this,o),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",l&&l.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const s=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,typeof this.plugins[s].init=="function"&&this.plugins[s].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"dialog",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(G2);var KE=G2.exports;const go=Di(KE),QE={name:"selectMenu",add:function(t){t.context.selectMenu={caller:{},callerContext:null}},setForm:function(){return'<div class="se-select-list"></div>'},createList:function(t,n,r){t.form.innerHTML="<ul>"+r+"</ul>",t.items=n,t.menus=t.form.querySelectorAll("li")},initEvent:function(t,n){const r=n.querySelector(".se-select-list"),i=this.context.selectMenu.caller[t]={form:r,items:[],menus:[],index:-1,item:null,clickMethod:null,callerName:t};r.addEventListener("mousedown",this.plugins.selectMenu.onMousedown_list),r.addEventListener("mousemove",this.plugins.selectMenu.onMouseMove_list.bind(this,i)),r.addEventListener("click",this.plugins.selectMenu.onClick_list.bind(this,i))},onMousedown_list:function(t){t.preventDefault(),t.stopPropagation()},onMouseMove_list:function(t,n){this.util.addClass(t.form,"__se_select-menu-mouse-move");const r=n.target.getAttribute("data-index");r&&(t.index=r*1)},onClick_list:function(t,n){const r=n.target.getAttribute("data-index");r&&t.clickMethod.call(this,t.items[r])},moveItem:function(t,n){this.util.removeClass(t.form,"__se_select-menu-mouse-move"),n=t.index+n;const r=t.menus,i=r.length,s=t.index=n>=i?0:n<0?i-1:n;for(let o=0;o<i;o++)o===s?this.util.addClass(r[o],"active"):this.util.removeClass(r[o],"active");t.item=t.items[s]},getItem:function(t,n){return n=!n||n<0?t.index:n,t.items[n]},on:function(t,n){const r=this.context.selectMenu.caller[t];this.context.selectMenu.callerContext=r,r.clickMethod=n,r.callerName=t},open:function(t,n){const r=t.form;r.style.visibility="hidden",r.style.display="block",n(r),r.style.visibility=""},close:function(t){t.form.style.display="none",t.items=[],t.menus=[],t.index=-1,t.item=null},init:function(t){t&&(t.items=[],t.menus=[],t.index=-1,t.item=null,t.callerName="",this.context.selectMenu.callerContext=null)}},Z2={name:"anchor",add:function(t){t.addModule([QE]),t.context.anchor={caller:{},forms:this.setDialogForm(t),host:(t._w.location.origin+t._w.location.pathname).replace(/\/$/,""),callerContext:null}},setDialogForm:function(t){const n=t.lang,r=t.options.linkRel,i=(t.options.linkRelDefault.default||"").split(" "),s=t.icons,o=t.util.createElement("DIV");let l='<div class="se-dialog-body"><div class="se-dialog-form"><label>'+n.dialogBox.linkBox.url+'</label><div class="se-dialog-form-files"><input class="se-input-form se-input-url" type="text" placeholder="'+(t.options.protocol||"")+'" /><button type="button" class="se-btn se-dialog-files-edge-button _se_bookmark_button" title="'+n.dialogBox.linkBox.bookmark+'" aria-label="'+n.dialogBox.linkBox.bookmark+'">'+s.bookmark+"</button>"+t.plugins.selectMenu.setForm()+'</div><div class="se-anchor-preview-form"><span class="se-svg se-anchor-preview-icon _se_anchor_bookmark_icon">'+s.bookmark+'</span><span class="se-svg se-anchor-preview-icon _se_anchor_download_icon">'+s.download+'</span><pre class="se-link-preview"></pre></div></div><div class="se-dialog-form"><label>'+n.dialogBox.linkBox.text+'</label><input class="se-input-form _se_anchor_text" type="text" /></div><div class="se-dialog-form-footer"><label><input type="checkbox" class="se-dialog-btn-check _se_anchor_check" /> '+n.dialogBox.linkBox.newWindowCheck+'</label><label><input type="checkbox" class="se-dialog-btn-check _se_anchor_download" /> '+n.dialogBox.linkBox.downloadLinkCheck+"</label>";if(r.length>0){l+='<div class="se-anchor-rel"><button type="button" class="se-btn se-btn-select se-anchor-rel-btn"><rel></button><div class="se-anchor-rel-wrapper"><pre class="se-link-preview se-anchor-rel-preview"></pre></div><div class="se-list-layer"><div class="se-list-inner"><ul class="se-list-basic se-list-checked">';for(let c=0,a=r.length,f;c<a;c++)f=r[c],l+='<li><button type="button" class="se-btn-list'+(i.indexOf(f)>-1?" se-checked":"")+'" data-command="'+f+'" title="'+f+'" aria-label="'+f+'"><span class="se-svg">'+s.checked+"</span>"+f+"</button></li>";l+="</ul></div></div></div>"}return l+="</div></div>",o.innerHTML=l,o},initEvent:function(t,n){const r=this.plugins.anchor,i=this.context.anchor.caller[t]={modal:n,urlInput:null,linkDefaultRel:this.options.linkRelDefault,defaultRel:this.options.linkRelDefault.default||"",currentRel:[],linkAnchor:null,linkValue:"",_change:!1,callerName:t};typeof i.linkDefaultRel.default=="string"&&(i.linkDefaultRel.default=i.linkDefaultRel.default.trim()),typeof i.linkDefaultRel.check_new_window=="string"&&(i.linkDefaultRel.check_new_window=i.linkDefaultRel.check_new_window.trim()),typeof i.linkDefaultRel.check_bookmark=="string"&&(i.linkDefaultRel.check_bookmark=i.linkDefaultRel.check_bookmark.trim()),i.urlInput=n.querySelector(".se-input-url"),i.anchorText=n.querySelector("._se_anchor_text"),i.newWindowCheck=n.querySelector("._se_anchor_check"),i.downloadCheck=n.querySelector("._se_anchor_download"),i.download=n.querySelector("._se_anchor_download_icon"),i.preview=n.querySelector(".se-link-preview"),i.bookmark=n.querySelector("._se_anchor_bookmark_icon"),i.bookmarkButton=n.querySelector("._se_bookmark_button"),this.plugins.selectMenu.initEvent.call(this,t,n);const s=this.context.selectMenu.caller[t];this.options.linkRel.length>0&&(i.relButton=n.querySelector(".se-anchor-rel-btn"),i.relList=n.querySelector(".se-list-layer"),i.relPreview=n.querySelector(".se-anchor-rel-preview"),i.relButton.addEventListener("click",r.onClick_relButton.bind(this,i)),i.relList.addEventListener("click",r.onClick_relList.bind(this,i))),i.newWindowCheck.addEventListener("change",r.onChange_newWindowCheck.bind(this,i)),i.downloadCheck.addEventListener("change",r.onChange_downloadCheck.bind(this,i)),i.anchorText.addEventListener("input",r.onChangeAnchorText.bind(this,i)),i.urlInput.addEventListener("input",r.onChangeUrlInput.bind(this,i)),i.urlInput.addEventListener("keydown",r.onKeyDownUrlInput.bind(this,s)),i.urlInput.addEventListener("focus",r.onFocusUrlInput.bind(this,i,s)),i.urlInput.addEventListener("blur",r.onBlurUrlInput.bind(this,s)),i.bookmarkButton.addEventListener("click",r.onClick_bookmarkButton.bind(this,i))},on:function(t,n){const r=this.plugins.anchor;if(!n)r.init.call(this,t),t.anchorText.value=this.getSelection().toString().trim(),t.newWindowCheck.checked=this.options.linkTargetNewWindow;else if(t.linkAnchor){this.context.dialog.updateModal=!0;const i=t.linkAnchor.getAttribute("href");t.linkValue=t.preview.textContent=t.urlInput.value=r.selfPathBookmark.call(this,i)?i.substr(i.lastIndexOf("#")):i,t.anchorText.value=t.linkAnchor.textContent,t.newWindowCheck.checked=!!/_blank/i.test(t.linkAnchor.target),t.downloadCheck.checked=t.linkAnchor.download}this.context.anchor.callerContext=t,r.setRel.call(this,t,n&&t.linkAnchor?t.linkAnchor.rel:t.defaultRel),r.setLinkPreview.call(this,t,t.linkValue),this.plugins.selectMenu.on.call(this,t.callerName,this.plugins.anchor.setHeaderBookmark)},selfPathBookmark:function(t){const n=this._w.location.href.replace(/\/$/,"");return t.indexOf("#")===0||t.indexOf(n)===0&&t.indexOf("#")===(n.indexOf("#")===-1?n.length:n.substr(0,n.indexOf("#")).length)},_closeRelMenu:null,toggleRelList:function(t,n){if(!n)this.plugins.anchor._closeRelMenu&&this.plugins.anchor._closeRelMenu();else{const r=t.relButton,i=t.relList;this.util.addClass(r,"active"),i.style.visibility="hidden",i.style.display="block",this.options.rtl?i.style.left=r.offsetLeft-i.offsetWidth-1+"px":i.style.left=r.offsetLeft+r.offsetWidth+1+"px",i.style.top=r.offsetTop+r.offsetHeight/2-i.offsetHeight/2+"px",i.style.visibility="",this.plugins.anchor._closeRelMenu=(function(s,o,l){l&&(s.relButton.contains(l.target)||s.relList.contains(l.target))||(this.util.removeClass(o,"active"),s.relList.style.display="none",this.modalForm.removeEventListener("click",this.plugins.anchor._closeRelMenu),this.plugins.anchor._closeRelMenu=null)}).bind(this,t,r),this.modalForm.addEventListener("click",this.plugins.anchor._closeRelMenu)}},onClick_relButton:function(t,n){this.plugins.anchor.toggleRelList.call(this,t,!this.util.hasClass(n.target,"active"))},onClick_relList:function(t,n){const r=n.target,i=r.getAttribute("data-command");if(!i)return;const s=t.currentRel,o=this.util.toggleClass(r,"se-checked"),l=s.indexOf(i);o?l===-1&&s.push(i):l>-1&&s.splice(l,1),t.relPreview.title=t.relPreview.textContent=s.join(" ")},setRel:function(t,n){const r=t.relList,i=t.currentRel=n?n.split(" "):[];if(!r)return;const s=r.querySelectorAll("button");for(let o=0,l=s.length,c;o<l;o++)c=s[o].getAttribute("data-command"),i.indexOf(c)>-1?this.util.addClass(s[o],"se-checked"):this.util.removeClass(s[o],"se-checked");t.relPreview.title=t.relPreview.textContent=i.join(" ")},createHeaderList:function(t,n,r){const i=this.util.getListChildren(this.context.element.wysiwyg,function(c){return/h[1-6]/i.test(c.nodeName)});if(i.length===0)return;const s=new this._w.RegExp("^"+r.replace(/^#/,""),"i"),o=[];let l="";for(let c=0,a=i.length,f;c<a;c++)f=i[c],s.test(f.textContent)&&(o.push(f),l+='<li class="se-select-item" data-index="'+c+'">'+f.textContent+"</li>");o.length===0?this.plugins.selectMenu.close.call(this,n):(this.plugins.selectMenu.createList(n,o,l),this.plugins.selectMenu.open.call(this,n,this.plugins.anchor._setMenuListPosition.bind(this,t)))},_setMenuListPosition:function(t,n){n.style.top=t.urlInput.offsetHeight+1+"px"},onKeyDownUrlInput:function(t,n){switch(n.keyCode){case 38:n.preventDefault(),n.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,t,-1);break;case 40:n.preventDefault(),n.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,t,1);break;case 13:t.index>-1&&(n.preventDefault(),n.stopPropagation(),this.plugins.anchor.setHeaderBookmark.call(this,this.plugins.selectMenu.getItem(t,null)));break}},setHeaderBookmark:function(t){const n=this.context.anchor.callerContext,r=t.id||"h_"+this._w.Math.random().toString().replace(/.+\./,"");t.id=r,n.urlInput.value="#"+r,(!n.anchorText.value.trim()||!n._change)&&(n.anchorText.value=t.textContent),this.plugins.anchor.setLinkPreview.call(this,n,n.urlInput.value),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext),this.context.anchor.callerContext.urlInput.focus()},onChangeAnchorText:function(t,n){t._change=!!n.target.value.trim()},onChangeUrlInput:function(t,n){const r=n.target.value.trim();this.plugins.anchor.setLinkPreview.call(this,t,r),this.plugins.anchor.selfPathBookmark.call(this,r)?this.plugins.anchor.createHeaderList.call(this,t,this.context.selectMenu.callerContext,r):this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)},onFocusUrlInput:function(t,n){const r=t.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,r)&&this.plugins.anchor.createHeaderList.call(this,t,n,r)},onBlurUrlInput:function(t){this.plugins.selectMenu.close.call(this,t)},setLinkPreview:function(t,n){const r=t.preview,i=this.options.linkProtocol,s=this.options.linkNoPrefix,o=/^(mailto\:|tel\:|sms\:|https*\:\/\/|#)/.test(n)||n.indexOf(i)===0,l=i?this._w.RegExp("^"+this.util.escapeStringRegexp(n.substr(0,i.length))).test(i):!1;n=t.linkValue=r.textContent=n?s?n:i&&!o&&!l?i+n:o?n:/^www\./.test(n)?"http://"+n:this.context.anchor.host+(/^\//.test(n)?"":"/")+n:"",this.plugins.anchor.selfPathBookmark.call(this,n)?(t.bookmark.style.display="block",this.util.addClass(t.bookmarkButton,"active")):(t.bookmark.style.display="none",this.util.removeClass(t.bookmarkButton,"active")),!this.plugins.anchor.selfPathBookmark.call(this,n)&&t.downloadCheck.checked?t.download.style.display="block":t.download.style.display="none"},setCtx:function(t,n){t&&(n.linkAnchor=t,n.linkValue=t.href,n.currentRel=t.rel.split(" "))},updateAnchor:function(t,n,r,i,s){!this.plugins.anchor.selfPathBookmark.call(this,n)&&i.downloadCheck.checked?t.setAttribute("download",r||n):t.removeAttribute("download"),i.newWindowCheck.checked?t.target="_blank":t.removeAttribute("target");const o=i.currentRel.join(" ");o?t.rel=o:t.removeAttribute("rel"),t.href=n,s?t.children.length===0&&(t.textContent=""):t.textContent=r},createAnchor:function(t,n){if(t.linkValue.length===0)return null;const r=t.linkValue,i=t.anchorText,s=i.value.length===0?r:i.value,o=t.linkAnchor||this.util.createElement("A");return this.plugins.anchor.updateAnchor.call(this,o,r,s,t,n),t.linkValue=t.preview.textContent=t.urlInput.value=t.anchorText.value="",o},onClick_bookmarkButton:function(t){let n=t.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,n)?(n=n.substr(1),t.bookmark.style.display="none",this.util.removeClass(t.bookmarkButton,"active"),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)):(n="#"+n,t.bookmark.style.display="block",this.util.addClass(t.bookmarkButton,"active"),t.downloadCheck.checked=!1,t.download.style.display="none",this.plugins.anchor.createHeaderList.call(this,t,this.context.selectMenu.callerContext,n)),t.urlInput.value=n,this.plugins.anchor.setLinkPreview.call(this,t,n),t.urlInput.focus()},onChange_newWindowCheck:function(t,n){typeof t.linkDefaultRel.check_new_window=="string"&&(n.target.checked?this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relMerge.call(this,t,t.linkDefaultRel.check_new_window)):this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relDelete.call(this,t,t.linkDefaultRel.check_new_window)))},onChange_downloadCheck:function(t,n){n.target.checked?(t.download.style.display="block",t.bookmark.style.display="none",this.util.removeClass(t.bookmarkButton,"active"),t.linkValue=t.preview.textContent=t.urlInput.value=t.urlInput.value.replace(/^\#+/,""),typeof t.linkDefaultRel.check_bookmark=="string"&&this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relMerge.call(this,t,t.linkDefaultRel.check_bookmark))):(t.download.style.display="none",typeof t.linkDefaultRel.check_bookmark=="string"&&this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relDelete.call(this,t,t.linkDefaultRel.check_bookmark)))},_relMerge:function(t,n){const r=t.currentRel;if(!n)return r.join(" ");if(/^only\:/.test(n))return n=n.replace(/^only\:/,"").trim(),t.currentRel=n.split(" "),n;const i=n.split(" ");for(let s=0,o=i.length,l;s<o;s++)l=r.indexOf(i[s]),l===-1&&r.push(i[s]);return r.join(" ")},_relDelete:function(t,n){if(!n)return t.currentRel.join(" ");/^only\:/.test(n)&&(n=n.replace(/^only\:/,"").trim());const r=t.currentRel.join(" ").replace(this._w.RegExp(n+"\\s*"),"");return t.currentRel=r.split(" "),r},init:function(t){t.linkAnchor=null,t.linkValue=t.preview.textContent=t.urlInput.value="",t.anchorText.value="",t.newWindowCheck.checked=!1,t.downloadCheck.checked=!1,t._change=!1,this.plugins.anchor.setRel.call(this,t,t.defaultRel),t.relList&&this.plugins.anchor.toggleRelList.call(this,t,!1),this.context.anchor.callerContext=null,this.plugins.selectMenu.init.call(this,this.context.selectMenu.callerContext)}},X2={name:"link",display:"dialog",add:function(t){t.addModule([go,Z2]);const n=t.context,r=n.link={focusElement:null,_linkAnchor:null,anchorCtx:null};let i=this.setDialog(t);r.modal=i;let s=this.setController_LinkButton(t);r.linkController=s,i.querySelector("form").addEventListener("submit",this.submit.bind(t)),s.addEventListener("click",this.onClick_linkController.bind(t)),n.dialog.modal.appendChild(i),n.element.relative.appendChild(s),t.plugins.anchor.initEvent.call(t,"link",i),r.focusElement=n.anchor.caller.link.urlInput,i=null,s=null},setDialog:function(t){const n=t.lang,r=t.util.createElement("DIV"),i=t.icons;r.className="se-dialog-content",r.style.display="none";let s='<form><div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" title="'+n.dialogBox.close+'" aria-label="'+n.dialogBox.close+'">'+i.cancel+'</button><span class="se-modal-title">'+n.dialogBox.linkBox.title+"</span></div>"+t.context.anchor.forms.innerHTML+'<div class="se-dialog-footer"><button type="submit" class="se-btn-primary" title="'+n.dialogBox.submitButton+'" aria-label="'+n.dialogBox.submitButton+'"><span>'+n.dialogBox.submitButton+"</span></button></div></form>";return r.innerHTML=s,r},setController_LinkButton:function(t){const n=t.lang,r=t.icons,i=t.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='<div class="se-arrow se-arrow-up"></div><div class="link-content"><span><a target="_blank" href=""></a> </span><div class="se-btn-group"><button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">'+r.edit+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.edit+'</span></span></button><button type="button" data-command="unlink" tabindex="-1" class="se-btn se-tooltip">'+r.unlink+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.unlink+'</span></span></button><button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">'+r.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.remove+"</span></span></button></div></div>",i},open:function(){this.plugins.dialog.open.call(this,"link",this.currentControllerName==="link")},submit:function(t){this.showLoading(),t.preventDefault(),t.stopPropagation();try{const n=this.plugins.anchor.createAnchor.call(this,this.context.anchor.caller.link,!1);if(n===null)return;if(this.context.dialog.updateModal){const r=this.context.link._linkAnchor.childNodes[0];this.setRange(r,0,r,r.textContent.length)}else{const r=this.getSelectedElements();if(r.length>1){const i=this.util.createElement(r[0].nodeName);if(i.appendChild(n),!this.insertNode(i,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(t){if(!t)this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();else if(this.util.isAnchor(t)&&t.getAttribute("data-image-link")===null)return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,t),!0;return!1},on:function(t){this.plugins.anchor.on.call(this,this.context.anchor.caller.link,t)},call_controller:function(t){this.editLink=this.context.link._linkAnchor=this.context.anchor.caller.link.linkAnchor=t;const n=this.context.link.linkController,r=n.querySelector("a");r.href=t.href,r.title=t.textContent,r.textContent=t.textContent,this.util.addClass(t,"on"),this.setControllerPosition(n,t,"bottom",{left:0,top:0}),this.controllersOn(n,t,"link",this.util.removeClass.bind(this.util,this.context.link._linkAnchor,"on"))},onClick_linkController:function(t){t.stopPropagation();const n=t.target.getAttribute("data-command")||t.target.parentNode.getAttribute("data-command");if(n){if(t.preventDefault(),/update/.test(n))this.plugins.dialog.open.call(this,"link",!0);else if(/unlink/.test(n)){const r=this.util.getChildElement(this.context.link._linkAnchor,function(s){return s.childNodes.length===0||s.nodeType===3},!1),i=this.util.getChildElement(this.context.link._linkAnchor,function(s){return s.childNodes.length===0||s.nodeType===3},!0);this.setRange(r,0,i,i.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.anchor.caller.link.linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){this.context.link.linkController.style.display="none",this.plugins.anchor.init.call(this,this.context.anchor.caller.link)}};var K2={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"component",set_container:function(s,o){const l=this.util.createElement("DIV");return l.className="se-component "+o,l.appendChild(s),l},set_cover:function(s){const o=this.util.createElement("FIGURE");return o.appendChild(s),o},create_caption:function(){const s=this.util.createElement("FIGCAPTION");return s.innerHTML="<div>"+this.lang.dialogBox.caption+"</div>",s}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(K2);var JE=K2.exports;const Eu=Di(JE);var Q2={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"resizing",add:function(s){const o=s.icons,l=s.context;l.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:o.align_justify,left:o.align_left,right:o.align_right,center:o.align_center}};let c=this.setController_resize(s);l.resizing.resizeContainer=c,l.resizing.resizeDiv=c.querySelector(".se-modal-resize"),l.resizing.resizeDot=c.querySelector(".se-resize-dot"),l.resizing.resizeDisplay=c.querySelector(".se-resize-display");let a=this.setController_button(s);l.resizing.resizeButton=a;let f=l.resizing.resizeHandles=l.resizing.resizeDot.querySelectorAll("span");l.resizing.resizeButtonGroup=a.querySelector("._se_resizing_btn_group"),l.resizing.rotationButtons=a.querySelectorAll("._se_resizing_btn_group ._se_rotation"),l.resizing.percentageButtons=a.querySelectorAll("._se_resizing_btn_group ._se_percentage"),l.resizing.alignMenu=a.querySelector(".se-resizing-align-list"),l.resizing.alignMenuList=l.resizing.alignMenu.querySelectorAll("button"),l.resizing.alignButton=a.querySelector("._se_resizing_align_button"),l.resizing.autoSizeButton=a.querySelector("._se_resizing_btn_group ._se_auto_size"),l.resizing.captionButton=a.querySelector("._se_resizing_caption_button"),c.addEventListener("mousedown",function(u){u.preventDefault()}),f[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),a.addEventListener("click",this.onClick_resizeButton.bind(s)),l.element.relative.appendChild(c),l.element.relative.appendChild(a),c=null,a=null,f=null},setController_resize:function(s){const o=s.util.createElement("DIV");return o.className="se-controller se-resizing-container",o.style.display="none",o.innerHTML='<div class="se-modal-resize"></div><div class="se-resize-dot"><span class="tl"></span><span class="tr"></span><span class="bl"></span><span class="br"></span><span class="lw"></span><span class="th"></span><span class="rw"></span><span class="bh"></span><div class="se-resize-display"></div></div>',o},setController_button:function(s){const o=s.lang,l=s.icons,c=s.util.createElement("DIV");return c.className="se-controller se-controller-resizing",c.innerHTML='<div class="se-arrow se-arrow-up"></div><div class="se-btn-group _se_resizing_btn_group"><button type="button" data-command="percent" data-value="1" class="se-tooltip _se_percentage"><span>100%</span><span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.resize100+'</span></span></button><button type="button" data-command="percent" data-value="0.75" class="se-tooltip _se_percentage"><span>75%</span><span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.resize75+'</span></span></button><button type="button" data-command="percent" data-value="0.5" class="se-tooltip _se_percentage"><span>50%</span><span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.resize50+'</span></span></button><button type="button" data-command="auto" class="se-btn se-tooltip _se_auto_size">'+l.auto_size+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.autoSize+'</span></span></button><button type="button" data-command="rotate" data-value="-90" class="se-btn se-tooltip _se_rotation">'+l.rotate_left+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.rotateLeft+'</span></span></button><button type="button" data-command="rotate" data-value="90" class="se-btn se-tooltip _se_rotation">'+l.rotate_right+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.rotateRight+'</span></span></button></div><div class="se-btn-group" style="padding-top: 0;"><button type="button" data-command="mirror" data-value="h" class="se-btn se-tooltip">'+l.mirror_horizontal+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.mirrorHorizontal+'</span></span></button><button type="button" data-command="mirror" data-value="v" class="se-btn se-tooltip">'+l.mirror_vertical+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.mirrorVertical+'</span></span></button><button type="button" data-command="onalign" class="se-btn se-tooltip _se_resizing_align_button">'+l.align_justify+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.toolbar.align+'</span></span></button><div class="se-btn-group-sub sun-editor-common se-list-layer se-resizing-align-list"><div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="basic">'+l.align_justify+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.basic+'</span></span></button></li><li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="left">'+l.align_left+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.left+'</span></span></button></li><li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="center">'+l.align_center+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.center+'</span></span></button></li><li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="right">'+l.align_right+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.right+'</span></span></button></li></ul></div></div><button type="button" data-command="caption" class="se-btn se-tooltip _se_resizing_caption_button">'+l.caption+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.caption+'</span></span></button><button type="button" data-command="revert" class="se-btn se-tooltip">'+l.revert+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.revertButton+'</span></span></button><button type="button" data-command="update" class="se-btn se-tooltip">'+l.modify+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.edit+'</span></span></button><button type="button" data-command="delete" class="se-btn se-tooltip">'+l.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.remove+"</span></span></button></div>",c},_module_getSizeX:function(s,o,l,c){return o||(o=s._element),l||(l=s._cover),c||(c=s._container),o?/%$/.test(o.style.width)?(c&&this.util.getNumber(c.style.width,2)||100)+"%":o.style.width:""},_module_getSizeY:function(s,o,l,c){return o||(o=s._element),l||(l=s._cover),c||(c=s._container),!c||!l?o&&o.style.height||"":this.util.getNumber(l.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?l.style.height:!/%$/.test(o.style.height)||!/%$/.test(o.style.width)?o.style.height:(c&&this.util.getNumber(c.style.height,2)||100)+"%"},_module_setModifyInputSize:function(s,o){const l=s._onlyPercentage&&this.context.resizing._rotateVertical;s.proportion.checked=s._proportionChecked=s._element.getAttribute("data-proportion")!=="false";let c=l?"":this.plugins.resizing._module_getSizeX.call(this,s);if(c===s._defaultSizeX&&(c=""),s._onlyPercentage&&(c=this.util.getNumber(c,2)),s.inputX.value=c,o.setInputSize.call(this,"x"),!s._onlyPercentage){let a=l?"":this.plugins.resizing._module_getSizeY.call(this,s);a===s._defaultSizeY&&(a=""),s._onlyPercentage&&(a=this.util.getNumber(a,2)),s.inputY.value=a}s.inputX.disabled=!!l,s.inputY.disabled=!!l,s.proportion.disabled=!!l,o.setRatio.call(this)},_module_setInputSize:function(s,o){if(s._onlyPercentage){o==="x"&&s.inputX.value>100&&(s.inputX.value=100);return}if(s.proportion.checked&&s._ratio&&/\d/.test(s.inputX.value)&&/\d/.test(s.inputY.value)){const l=s.inputX.value.replace(/\d+|\./g,"")||s.sizeUnit,c=s.inputY.value.replace(/\d+|\./g,"")||s.sizeUnit;if(l!==c)return;const a=l==="%"?2:0;o==="x"?s.inputY.value=this.util.getNumber(s._ratioY*this.util.getNumber(s.inputX.value,a),a)+c:s.inputX.value=this.util.getNumber(s._ratioX*this.util.getNumber(s.inputY.value,a),a)+l}},_module_setRatio:function(s){const o=s.inputX.value,l=s.inputY.value;if(s.proportion.checked&&/\d+/.test(o)&&/\d+/.test(l)){const c=o.replace(/\d+|\./g,"")||s.sizeUnit,a=l.replace(/\d+|\./g,"")||s.sizeUnit;if(c!==a)s._ratio=!1;else if(!s._ratio){const f=this.util.getNumber(o,0),u=this.util.getNumber(l,0);s._ratio=!0,s._ratioX=f/u,s._ratioY=u/f}}else s._ratio=!1},_module_sizeRevert:function(s){s._onlyPercentage?s.inputX.value=s._origin_w>100?100:s._origin_w:(s.inputX.value=s._origin_w,s.inputY.value=s._origin_h)},_module_saveCurrentSize:function(s){const o=this.plugins.resizing._module_getSizeX.call(this,s),l=this.plugins.resizing._module_getSizeY.call(this,s);s._element.setAttribute("width",o.replace("px","")),s._element.setAttribute("height",l.replace("px","")),s._element.setAttribute("data-size",o+","+l),s._videoRatio&&(s._videoRatio=l)},call_controller_resize:function(s,o){const l=this.context.resizing,c=this.context[o];l._resize_plugin=o;const a=l.resizeContainer,f=l.resizeDiv,u=this.util.getOffset(s,this.context.element.wysiwygFrame),m=l._rotateVertical=/^(90|270)$/.test(Math.abs(s.getAttribute("data-rotate")).toString()),y=m?s.offsetHeight:s.offsetWidth,_=m?s.offsetWidth:s.offsetHeight,S=u.top,E=u.left-this.context.element.wysiwygFrame.scrollLeft;a.style.top=S+"px",a.style.left=E+"px",a.style.width=y+"px",a.style.height=_+"px",f.style.top="0px",f.style.left="0px",f.style.width=y+"px",f.style.height=_+"px";let d=s.getAttribute("data-align")||"basic";d=d==="none"?"basic":d;const h=this.util.getParentElement(s,this.util.isComponent),v=this.util.getParentElement(s,"FIGURE"),x=this.plugins.resizing._module_getSizeX.call(this,c,s,v,h)||"auto",g=c._onlyPercentage&&o==="image"?"":", "+(this.plugins.resizing._module_getSizeY.call(this,c,s,v,h)||"auto");this.util.changeTxt(l.resizeDisplay,this.lang.dialogBox[d]+" ("+x+g+")"),l.resizeButtonGroup.style.display=c._resizing?"":"none";const b=c._resizing&&!c._resizeDotHide&&!c._onlyPercentage?"flex":"none",w=l.resizeHandles;for(let L=0,R=w.length;L<R;L++)w[L].style.display=b;if(c._resizing){const L=l.rotationButtons;L[0].style.display=L[1].style.display=c._rotation?"":"none"}if(c._alignHide)l.alignButton.style.display="none";else{l.alignButton.style.display="";const L=l.alignMenuList;this.util.changeElement(l.alignButton.firstElementChild,l.alignIcons[d]);for(let R=0,P=L.length;R<P;R++)L[R].getAttribute("data-value")===d?this.util.addClass(L[R],"on"):this.util.removeClass(L[R],"on")}const k=l.percentageButtons,N=/%$/.test(s.style.width)&&/%$/.test(h.style.width)?this.util.getNumber(h.style.width,0)/100+"":"";for(let L=0,R=k.length;L<R;L++)k[L].getAttribute("data-value")===N?this.util.addClass(k[L],"active"):this.util.removeClass(k[L],"active");c._captionShow?(l.captionButton.style.display="",this.util.getChildElement(s.parentNode,"figcaption")?(this.util.addClass(l.captionButton,"active"),c._captionChecked=!0):(this.util.removeClass(l.captionButton,"active"),c._captionChecked=!1)):l.captionButton.style.display="none",a.style.display="block";const T={left:0,top:50};this.options.iframe&&(T.left-=this.context.element.wysiwygFrame.parentElement.offsetLeft,T.top-=this.context.element.wysiwygFrame.parentElement.offsetTop),this.setControllerPosition(l.resizeButton,a,"bottom",T);const D=function(){this.util.setDisabledButtons.call(this.util,!1,this.resizingDisabledButtons),this.history._resetCachingButton()};this.controllersOn(a,l.resizeButton,D.bind(this),s,o),this.util.setDisabledButtons(!0,this.resizingDisabledButtons),l._resize_w=y,l._resize_h=_;const I=(s.getAttribute("origin-size")||"").split(",");return l._origin_w=I[0]||s.naturalWidth,l._origin_h=I[1]||s.naturalHeight,{w:y,h:_,t:S,l:E}},_closeAlignMenu:null,openAlignMenu:function(){const s=this.context.resizing.alignButton;this.util.addClass(s,"on"),this.context.resizing.alignMenu.style.top=s.offsetTop+s.offsetHeight+"px",this.context.resizing.alignMenu.style.left=s.offsetLeft-s.offsetWidth/2+"px",this.context.resizing.alignMenu.style.display="block",this.plugins.resizing._closeAlignMenu=(function(){this.util.removeClass(this.context.resizing.alignButton,"on"),this.context.resizing.alignMenu.style.display="none",this.removeDocEvent("click",this.plugins.resizing._closeAlignMenu),this.plugins.resizing._closeAlignMenu=null}).bind(this),this.addDocEvent("click",this.plugins.resizing._closeAlignMenu)},onClick_resizeButton:function(s){s.stopPropagation();const o=s.target,l=o.getAttribute("data-command")||o.parentNode.getAttribute("data-command");if(!l)return;const c=o.getAttribute("data-value")||o.parentNode.getAttribute("data-value"),a=this.context.resizing._resize_plugin,f=this.context[a],u=f._element,m=this.plugins[a];if(s.preventDefault(),!(typeof this.plugins.resizing._closeAlignMenu=="function"&&(this.plugins.resizing._closeAlignMenu(),l==="onalign"))){switch(l){case"auto":this.plugins.resizing.resetTransform.call(this,u),m.setAutoSize.call(this),this.selectComponent(u,a);break;case"percent":let y=this.plugins.resizing._module_getSizeY.call(this,f);if(this.context.resizing._rotateVertical){const b=u.getAttribute("data-percentage");b&&(y=b.split(",")[1])}this.plugins.resizing.resetTransform.call(this,u),m.setPercentSize.call(this,c*100,this.util.getNumber(y,0)===null||!/%$/.test(y)?"":y),this.selectComponent(u,a);break;case"mirror":const _=u.getAttribute("data-rotate")||"0";let S=u.getAttribute("data-rotateX")||"",E=u.getAttribute("data-rotateY")||"";c==="h"&&!this.context.resizing._rotateVertical||c==="v"&&this.context.resizing._rotateVertical?E=E?"":"180":S=S?"":"180",u.setAttribute("data-rotateX",S),u.setAttribute("data-rotateY",E),this.plugins.resizing._setTransForm(u,_,S,E);break;case"rotate":const d=this.context.resizing,h=u.getAttribute("data-rotate")*1+c*1,v=this._w.Math.abs(h)>=360?0:h;u.setAttribute("data-rotate",v),d._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(v).toString()),this.plugins.resizing.setTransformSize.call(this,u,null,null),this.selectComponent(u,a);break;case"onalign":this.plugins.resizing.openAlignMenu.call(this);return;case"align":const x=c==="basic"?"none":c;m.setAlign.call(this,x,null,null,null),this.selectComponent(u,a);break;case"caption":const g=!f._captionChecked;if(m.openModify.call(this,!0),f._captionChecked=f.captionCheckEl.checked=g,m.update_image.call(this,!1,!1,!1),g){const b=this.util.getChildElement(f._caption,function(w){return w.nodeType===3});b?this.setRange(b,0,b,b.textContent.length):f._caption.focus(),this.controllersOff()}else this.selectComponent(u,a),m.openModify.call(this,!0);break;case"revert":m.setOriginSize.call(this),this.selectComponent(u,a);break;case"update":m.openModify.call(this),this.controllersOff();break;case"delete":m.destroy.call(this);break}this.history.push(!1)}},resetTransform:function(s){const o=(s.getAttribute("data-size")||s.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,s.style.maxWidth="",s.style.transform="",s.style.transformOrigin="",s.setAttribute("data-rotate",""),s.setAttribute("data-rotateX",""),s.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,o[0]?o[0]:"auto",o[1]?o[1]:"",!0)},setTransformSize:function(s,o,l){let c=s.getAttribute("data-percentage");const a=this.context.resizing._rotateVertical,f=s.getAttribute("data-rotate")*1;let u="";if(c&&!a)c=c.split(","),c[0]==="auto"&&c[1]==="auto"?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,c[0],c[1]);else{const m=this.util.getParentElement(s,"FIGURE"),y=o||s.offsetWidth,_=l||s.offsetHeight,S=(a?_:y)+"px",E=(a?y:_)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,y+"px",_+"px",!0),m.style.width=S,m.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":E,a){let d=y/2+"px "+y/2+"px 0",h=_/2+"px "+_/2+"px 0";u=f===90||f===-270?h:d}}s.style.transformOrigin=u,this.plugins.resizing._setTransForm(s,f.toString(),s.getAttribute("data-rotateX")||"",s.getAttribute("data-rotateY")||""),a?s.style.maxWidth="none":s.style.maxWidth="",this.plugins.resizing.setCaptionPosition.call(this,s)},_setTransForm:function(s,o,l,c){let a=(s.offsetWidth-s.offsetHeight)*(/-/.test(o)?1:-1),f="";if(/[1-9]/.test(o)&&(l||c))switch(f=l?"Y":"X",o){case"90":f=l&&c?"X":c?f:"";break;case"270":a*=-1,f=l&&c?"Y":l?f:"";break;case"-90":f=l&&c?"Y":l?f:"";break;case"-270":a*=-1,f=l&&c?"X":c?f:"";break;default:f=""}o%180===0&&(s.style.maxWidth=""),s.style.transform="rotate("+o+"deg)"+(l?" rotateX("+l+"deg)":"")+(c?" rotateY("+c+"deg)":"")+(f?" translate"+f+"("+a+"px)":"")},setCaptionPosition:function(s){const o=this.util.getChildElement(this.util.getParentElement(s,"FIGURE"),"FIGCAPTION");o&&(o.style.marginTop=(this.context.resizing._rotateVertical?s.offsetWidth-s.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(s){s.stopPropagation(),s.preventDefault();const o=this.context.resizing,l=o._resize_direction=s.target.classList[0];o._resizeClientX=s.clientX,o._resizeClientY=s.clientY,this.context.element.resizeBackground.style.display="block",o.resizeButton.style.display="none",o.resizeDiv.style.float=/l/.test(l)?"right":/r/.test(l)?"left":"none";const c=(function(u){if(u.type==="keydown"&&u.keyCode!==27)return;const m=o._isChange;o._isChange=!1,this.removeDocEvent("mousemove",a),this.removeDocEvent("mouseup",c),this.removeDocEvent("keydown",c),u.type==="keydown"?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,l),m&&this.history.push(!1))}).bind(this),a=this.plugins.resizing.resizing_element.bind(this,o,l,this.context[o._resize_plugin]);this.addDocEvent("mousemove",a),this.addDocEvent("mouseup",c),this.addDocEvent("keydown",c)},resizing_element:function(s,o,l,c){const a=c.clientX,f=c.clientY;let u=l._element_w,m=l._element_h;const y=l._element_w+(/r/.test(o)?a-s._resizeClientX:s._resizeClientX-a),_=l._element_h+(/b/.test(o)?f-s._resizeClientY:s._resizeClientY-f),S=l._element_h/l._element_w*y;/t/.test(o)&&(s.resizeDiv.style.top=l._element_h-(/h/.test(o)?_:S)+"px"),/l/.test(o)&&(s.resizeDiv.style.left=l._element_w-y+"px"),/r|l/.test(o)&&(s.resizeDiv.style.width=y+"px",u=y),/^(t|b)[^h]$/.test(o)?(s.resizeDiv.style.height=S+"px",m=S):/^(t|b)h$/.test(o)&&(s.resizeDiv.style.height=_+"px",m=_),s._resize_w=u,s._resize_h=m,this.util.changeTxt(s.resizeDisplay,this._w.Math.round(u)+" x "+this._w.Math.round(m)),s._isChange=!0},cancel_controller_resize:function(s){const o=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let l=this._w.Math.round(o?this.context.resizing._resize_h:this.context.resizing._resize_w),c=this._w.Math.round(o?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!o&&!/%$/.test(l)){const u=this.context.element.wysiwygFrame.clientWidth-32-2;this.util.getNumber(l,0)>u&&(c=this._w.Math.round(c/l*u),l=u)}const a=this.context.resizing._resize_plugin;this.plugins[a].setSize.call(this,l,c,!1,s),o&&this.plugins.resizing.setTransformSize.call(this,this.context[this.context.resizing._resize_plugin]._element,l,c),this.selectComponent(this.context[a]._element,a)}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(Q2);var eT=Q2.exports;const J2=Di(eT);var ev={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"fileManager",_xmlHttp:null,_checkMediaComponent:function(s){return/IMG|IFRAME|VIDEO|AUDIO/i.test(s.tagName)?/FIGURE/i.test(s.parentElement.nodeName)||/FIGURE/i.test(s.parentElement.parentElement.nodeName):!0},upload:function(s,o,l,c,a){this.showLoading();const f=this.plugins.fileManager,u=f._xmlHttp=this.util.getXMLHttpRequest();if(u.onreadystatechange=f._callBackUpload.bind(this,u,c,a),u.open("post",s,!0),o!==null&&typeof o=="object"&&this._w.Object.keys(o).length>0)for(let m in o)u.setRequestHeader(m,o[m]);u.send(l)},_callBackUpload:function(s,o,l){if(s.readyState===4)if(s.status===200)try{o(s)}catch(c){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+c.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const c=s.responseText?JSON.parse(s.responseText):s;if(typeof l!="function"||l("",c,this)){const a="[SUNEDITOR.fileManager.upload.serverException] status: "+s.status+", response: "+(c.errorMessage||s.responseText);throw this.functions.noticeOpen(a),Error(a)}}},checkInfo:function(s,o,l,c,a){let f=[];for(let h=0,v=o.length;h<v;h++)f=f.concat([].slice.call(this.context.element.wysiwyg.querySelectorAll(o[h]+':not([data-se-embed="true"])')));const u=this.plugins.fileManager,m=this.context[s],y=m._infoList,_=u.setInfo.bind(this);if(f.length===y.length)if(this._componentsInfoReset){for(let h=0,v=f.length;h<v;h++)_(s,f[h],l,null,a);return}else{let h=!1;for(let v=0,x=y.length,g;v<x;v++)if(g=y[v],f.filter(function(b){return g.src===b.src&&g.index.toString()===b.getAttribute("data-index")}).length===0){h=!0;break}if(!h)return}const S=a?this.context.resizing._resize_plugin:"";a&&(this.context.resizing._resize_plugin=s);const E=[],d=[];for(let h=0,v=y.length;h<v;h++)d[h]=y[h].index;for(m.__updateTags=f;f.length>0;){const h=f.shift();!this.util.getParentElement(h,this.util.isMediaComponent)||!u._checkMediaComponent(h)?(E.push(m._infoIndex),c(h)):!h.getAttribute("data-index")||d.indexOf(h.getAttribute("data-index")*1)<0?(E.push(m._infoIndex),h.removeAttribute("data-index"),_(s,h,l,null,a)):E.push(h.getAttribute("data-index")*1)}for(let h=0,v;h<y.length;h++)v=y[h].index,!(E.indexOf(v)>-1)&&(y.splice(h,1),typeof l=="function"&&l(null,v,"delete",null,0,this),h--);a&&(this.context.resizing._resize_plugin=S)},setInfo:function(s,o,l,c,a){const f=a?this.context.resizing._resize_plugin:"";a&&(this.context.resizing._resize_plugin=s);const u=this.plugins[s],m=this.context[s],y=m._infoList;let _=o.getAttribute("data-index"),S=null,E="";if(c||(c={name:o.getAttribute("data-file-name")||(typeof o.src=="string"?o.src.split("/").pop():""),size:o.getAttribute("data-file-size")||0}),!_||this._componentsInfoInit)E="create",_=m._infoIndex++,o.setAttribute("data-index",_),o.setAttribute("data-file-name",c.name),o.setAttribute("data-file-size",c.size),S={src:o.src,index:_*1,name:c.name,size:c.size},y.push(S);else{E="update",_*=1;for(let d=0,h=y.length;d<h;d++)if(_===y[d].index){S=y[d];break}S||(_=m._infoIndex++,S={index:_},y.push(S)),S.src=o.src,S.name=o.getAttribute("data-file-name"),S.size=o.getAttribute("data-file-size")*1}if(S.element=o,S.delete=u.destroy.bind(this,o),S.select=(function(d){d.scrollIntoView(!0),this._w.setTimeout(u.select.bind(this,d))}).bind(this,o),a){if(!o.getAttribute("origin-size")&&o.naturalWidth&&o.setAttribute("origin-size",o.naturalWidth+","+o.naturalHeight),!o.getAttribute("data-origin")){const d=this.util.getParentElement(o,this.util.isMediaComponent),h=this.util.getParentElement(o,"FIGURE"),v=this.plugins.resizing._module_getSizeX.call(this,m,o,h,d),x=this.plugins.resizing._module_getSizeY.call(this,m,o,h,d);o.setAttribute("data-origin",v+","+x),o.setAttribute("data-size",v+","+x)}if(!o.style.width){const d=(o.getAttribute("data-size")||o.getAttribute("data-origin")||"").split(",");u.onModifyMode.call(this,o,null),u.applySize.call(this,d[0],d[1])}this.context.resizing._resize_plugin=f}typeof l=="function"&&l(o,_,E,S,--m._uploadFileLength<0?0:m._uploadFileLength,this)},deleteInfo:function(s,o,l){if(o>=0){const c=this.context[s]._infoList;for(let a=0,f=c.length;a<f;a++)if(o===c[a].index){c.splice(a,1),typeof l=="function"&&l(null,o,"delete",null,0,this);return}}},resetInfo:function(s,o){const l=this.context[s];if(typeof o=="function"){const c=l._infoList;for(let a=0,f=c.length;a<f;a++)o(null,c[a].index,"delete",null,0,this)}l._infoList=[],l._infoIndex=0}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"fileManager",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(ev);var tT=ev.exports;const Tu=Di(tT),tv={name:"image",display:"dialog",add:function(t){t.addModule([go,Z2,Eu,J2,Tu]);const n=t.options,r=t.context,i=r.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,sizeUnit:n._imageSizeUnit,_linkElement:"",_altText:"",_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_src:{_linkValue:""},svgDefaultSize:"30%",base64RenderIndex:0,_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:n.imageWidth==="auto"?"":n.imageWidth,_origin_h:n.imageHeight==="auto"?"":n.imageHeight,_proportionChecked:!0,_resizing:n.imageResizing,_resizeDotHide:!n.imageHeightShow,_rotation:n.imageRotation,_alignHide:!n.imageAlignShow,_onlyPercentage:n.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let s=this.setDialog(t);i.modal=s,i.imgInputFile=s.querySelector("._se_image_file"),i.imgUrlFile=s.querySelector("._se_image_url"),i.focusElement=i.imgInputFile||i.imgUrlFile,i.altText=s.querySelector("._se_image_alt"),i.captionCheckEl=s.querySelector("._se_image_check_caption"),i.previewSrc=s.querySelector("._se_tab_content_image .se-link-preview"),s.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(t)),s.querySelector("form").addEventListener("submit",this.submit.bind(t)),i.imgInputFile&&s.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(i.imgInputFile,i.imgUrlFile,i.previewSrc)),i.imgUrlFile&&i.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(i.previewSrc,i._v_src,n.linkProtocol)),i.imgInputFile&&i.imgUrlFile&&i.imgInputFile.addEventListener("change",this._fileInputChange.bind(i));const o=s.querySelector(".__se__gallery");o&&o.addEventListener("click",this._openGallery.bind(t)),i.proportion={},i.inputX={},i.inputY={},n.imageResizing&&(i.proportion=s.querySelector("._se_image_check_proportion"),i.inputX=s.querySelector("._se_image_size_x"),i.inputY=s.querySelector("._se_image_size_y"),i.inputX.value=n.imageWidth,i.inputY.value=n.imageHeight,i.inputX.addEventListener("keyup",this.setInputSize.bind(t,"x")),i.inputY.addEventListener("keyup",this.setInputSize.bind(t,"y")),i.inputX.addEventListener("change",this.setRatio.bind(t)),i.inputY.addEventListener("change",this.setRatio.bind(t)),i.proportion.addEventListener("change",this.setRatio.bind(t)),s.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(t))),r.dialog.modal.appendChild(s),t.plugins.anchor.initEvent.call(t,"image",s.querySelector("._se_tab_content_url")),i.anchorCtx=t.context.anchor.caller.image,s=null},setDialog:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-dialog-content se-dialog-image",i.style.display="none";let s='<div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" class="close" title="'+r.dialogBox.close+'" aria-label="'+r.dialogBox.close+'">'+t.icons.cancel+'</button><span class="se-modal-title">'+r.dialogBox.imageBox.title+'</span></div><div class="se-dialog-tabs"><button type="button" class="_se_tab_link active" data-tab-link="image">'+r.toolbar.image+'</button><button type="button" class="_se_tab_link" data-tab-link="url">'+r.toolbar.link+'</button></div><form method="post" enctype="multipart/form-data"><div class="_se_tab_content _se_tab_content_image"><div class="se-dialog-body"><div style="border-bottom: 1px dashed #ccc;">';if(n.imageFileInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.imageBox.file+'</label><div class="se-dialog-form-files"><input class="se-input-form _se_image_file" type="file" accept="'+n.imageAccept+'"'+(n.imageMultipleFile?' multiple="multiple"':"")+'/><button type="button" class="se-btn se-dialog-files-edge-button se-file-remove" title="'+r.controller.remove+'" aria-label="'+r.controller.remove+'">'+t.icons.cancel+"</button></div></div>"),n.imageUrlInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.imageBox.url+'</label><div class="se-dialog-form-files"><input class="se-input-form se-input-url _se_image_url" type="text" />'+(n.imageGalleryUrl&&t.plugins.imageGallery?'<button type="button" class="se-btn se-dialog-files-edge-button __se__gallery" title="'+r.toolbar.imageGallery+'" aria-label="'+r.toolbar.imageGallery+'">'+t.icons.image_gallery+"</button>":"")+'</div><pre class="se-link-preview"></pre></div>'),s+='</div><div class="se-dialog-form"><label>'+r.dialogBox.imageBox.altText+'</label><input class="se-input-form _se_image_alt" type="text" /></div>',n.imageResizing){const o=n.imageSizeOnlyPercentage,l=o?' style="display: none !important;"':"",c=n.imageHeightShow?"":' style="display: none !important;"';s+='<div class="se-dialog-form">',o||!n.imageHeightShow?s+='<div class="se-dialog-size-text"><label class="size-w">'+r.dialogBox.size+"</label></div>":s+='<div class="se-dialog-size-text"><label class="size-w">'+r.dialogBox.width+'</label><label class="se-dialog-size-x"> </label><label class="size-h">'+r.dialogBox.height+"</label></div>",s+='<input class="se-input-control _se_image_size_x" placeholder="auto"'+(o?' type="number" min="1"':'type="text"')+(o?' max="100"':"")+' /><label class="se-dialog-size-x"'+c+">"+(o?"%":"x")+'</label><input type="text" class="se-input-control _se_image_size_y" placeholder="auto"'+l+(o?' max="100"':"")+c+"/><label"+l+c+'><input type="checkbox" class="se-dialog-btn-check _se_image_check_proportion" checked/> '+r.dialogBox.proportion+'</label><button type="button" title="'+r.dialogBox.revertButton+'" aria-label="'+r.dialogBox.revertButton+'" class="se-btn se-dialog-btn-revert" style="float: right;">'+t.icons.revert+"</button></div>"}return s+='<div class="se-dialog-form se-dialog-form-footer"><label><input type="checkbox" class="se-dialog-btn-check _se_image_check_caption" /> '+r.dialogBox.caption+'</label></div></div></div><div class="_se_tab_content _se_tab_content_url" style="display: none">'+t.context.anchor.forms.innerHTML+'</div><div class="se-dialog-footer"><div'+(n.imageAlignShow?"":' style="display: none"')+'><label><input type="radio" name="suneditor_image_radio" class="se-dialog-btn-radio" value="none" checked>'+r.dialogBox.basic+'</label><label><input type="radio" name="suneditor_image_radio" class="se-dialog-btn-radio" value="left">'+r.dialogBox.left+'</label><label><input type="radio" name="suneditor_image_radio" class="se-dialog-btn-radio" value="center">'+r.dialogBox.center+'</label><label><input type="radio" name="suneditor_image_radio" class="se-dialog-btn-radio" value="right">'+r.dialogBox.right+'</label></div><button type="submit" class="se-btn-primary" title="'+r.dialogBox.submitButton+'" aria-label="'+r.dialogBox.submitButton+'"><span>'+r.dialogBox.submitButton+"</span></button></div></form>",i.innerHTML=s,i},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(t,n){this.value="",t&&(t.removeAttribute("disabled"),n.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(t){this.altText.value=t.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-value")||t.src,this.imgUrlFile.focus()},_onLinkPreview:function(t,n,r){const i=r.target.value.trim();t._linkValue=this.textContent=i?n&&i.indexOf("://")===-1&&i.indexOf("#")!==0?n+i:i.indexOf("://")===-1?"/"+i:i:""},fileTags:["img"],select:function(t){this.plugins.image.onModifyMode.call(this,t,this.plugins.resizing.call_controller_resize.call(this,t,"image"))},destroy:function(t){const n=t||this.context.image._element,r=this.util.getParentElement(n,this.util.isMediaComponent)||n,i=n.getAttribute("data-index")*1;if(typeof this.functions.onImageDeleteBefore=="function"&&this.functions.onImageDeleteBefore(n,r,i,this)===!1)return;let s=r.previousElementSibling||r.nextElementSibling;const o=r.parentNode;this.util.removeItem(r),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,function(l){return l.childNodes.length===0},null),this.focusEdge(s),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(t){const n=this.context.image;t?n.imgInputFile&&this.options.imageMultipleFile&&n.imgInputFile.removeAttribute("multiple"):(n.inputX.value=n._origin_w=this.options.imageWidth===n._defaultSizeX?"":this.options.imageWidth,n.inputY.value=n._origin_h=this.options.imageHeight===n._defaultSizeY?"":this.options.imageHeight,n.imgInputFile&&this.options.imageMultipleFile&&n.imgInputFile.setAttribute("multiple","multiple")),this.plugins.anchor.on.call(this,n.anchorCtx,t)},open:function(){this.plugins.dialog.open.call(this,"image",this.currentControllerName==="image")},openTab:function(t){const n=this.context.image.modal,r=t==="init"?n.querySelector("._se_tab_link"):t.target;if(!/^BUTTON$/i.test(r.tagName))return!1;const i=r.getAttribute("data-tab-link"),s="_se_tab_content";let o,l,c;for(l=n.getElementsByClassName(s),o=0;o<l.length;o++)l[o].style.display="none";for(c=n.getElementsByClassName("_se_tab_link"),o=0;o<c.length;o++)this.util.removeClass(c[o],"active");return n.querySelector("."+s+"_"+i).style.display="block",this.util.addClass(r,"active"),i==="image"&&this.context.image.focusElement?this.context.image.focusElement.focus():i==="url"&&this.context.anchor.caller.image.urlInput.focus(),!1},submit:function(t){const n=this.context.image,r=this.plugins.image;t.preventDefault(),t.stopPropagation(),n._altText=n.altText.value,n._align=n.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,n._captionChecked=n.captionCheckEl.checked,n._resizing&&(n._proportionChecked=n.proportion.checked);try{this.context.dialog.updateModal&&r.update_image.call(this,!1,!0,!1),n.imgInputFile&&n.imgInputFile.files.length>0?(this.showLoading(),r.submitAction.call(this,this.context.image.imgInputFile.files)):n.imgUrlFile&&n._v_src._linkValue.length>0&&(this.showLoading(),r.onRender_imgUrl.call(this,n._v_src._linkValue))}catch(i){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+i.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(t){if(t.length===0)return;let n=0,r=[];for(let c=0,a=t.length;c<a;c++)/image/i.test(t[c].type)&&(r.push(t[c]),n+=t[c].size);const i=this.options.imageUploadSizeLimit;if(i>0){let c=0;const a=this.context.image._infoList;for(let f=0,u=a.length;f<u;f++)c+=a[f].size*1;if(n+c>i){this.closeLoading();const f="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";(typeof this.functions.onImageUploadError!="function"||this.functions.onImageUploadError(f,{limitSize:i,currentSize:c,uploadSize:n},this))&&this.functions.noticeOpen(f);return}}const s=this.context.image;s._uploadFileLength=r.length;const l={anchor:this.plugins.anchor.createAnchor.call(this,s.anchorCtx,!0),inputWidth:s.inputX.value,inputHeight:s.inputY.value,align:s._align,isUpdate:this.context.dialog.updateModal,alt:s._altText,element:s._element};if(typeof this.functions.onImageUploadBefore=="function"){const c=this.functions.onImageUploadBefore(r,l,this,(function(a){a&&this._w.Array.isArray(a.result)?this.plugins.image.register.call(this,l,a):this.plugins.image.upload.call(this,l,a)}).bind(this));if(typeof c>"u")return;if(!c){this.closeLoading();return}this._w.Array.isArray(c)&&c.length>0&&(r=c)}this.plugins.image.upload.call(this,l,r)},error:function(t,n){if(this.closeLoading(),typeof this.functions.onImageUploadError!="function"||this.functions.onImageUploadError(t,n,this))throw this.functions.noticeOpen(t),Error("[SUNEDITOR.plugin.image.error] response: "+t)},upload:function(t,n){if(!n){this.closeLoading();return}if(typeof n=="string"){this.plugins.image.error.call(this,n,null);return}const r=this.options.imageUploadUrl,i=this.context.dialog.updateModal?1:n.length;if(typeof r=="string"&&r.length>0){const s=new FormData;for(let o=0;o<i;o++)s.append("file-"+o,n[o]);this.plugins.fileManager.upload.call(this,r,this.options.imageUploadHeader,s,this.plugins.image.callBack_imgUpload.bind(this,t),this.functions.onImageUploadError)}else this.plugins.image.setup_reader.call(this,n,t.anchor,t.inputWidth,t.inputHeight,t.align,t.alt,i,t.isUpdate)},callBack_imgUpload:function(t,n){if(typeof this.functions.imageUploadHandler=="function")this.functions.imageUploadHandler(n,t,this);else{const r=JSON.parse(n.responseText);r.errorMessage?this.plugins.image.error.call(this,r.errorMessage,r):this.plugins.image.register.call(this,t,r)}},register:function(t,n){const r=n.result;for(let i=0,s=r.length,o;i<s;i++)if(o={name:r[i].name,size:r[i].size},t.isUpdate){this.plugins.image.update_src.call(this,r[i].url,t.element,o);break}else this.plugins.image.create_image.call(this,r[i].url,t.anchor,t.inputWidth,t.inputHeight,t.align,o,t.alt);this.closeLoading()},setup_reader:function(t,n,r,i,s,o,l,c){try{if(l===0){this.closeLoading(),console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");return}this.context.image.base64RenderIndex=l;const a=this._w.FileReader,f=[l];this.context.image.inputX.value=r,this.context.image.inputY.value=i;for(let u=0,m,y;u<l;u++)m=new a,y=t[u],m.onload=(function(_,S,E,d,h){f[h]={result:_.result,file:d},--this.context.image.base64RenderIndex===0&&(this.plugins.image.onRender_imgBase64.call(this,S,f,E,n,r,i,s,o),this.closeLoading())}).bind(this,m,c,this.context.image._element,y,u),m.readAsDataURL(y)}catch(a){throw this.closeLoading(),Error('[SUNEDITOR.image.setup_reader.fail] cause : "'+a.message+'"')}},onRender_imgBase64:function(t,n,r,i,s,o,l,c){const a=this.plugins.image.update_src,f=this.plugins.image.create_image;for(let u=0,m=n.length;u<m;u++)t?(this.context.image._element.setAttribute("data-file-name",n[u].file.name),this.context.image._element.setAttribute("data-file-size",n[u].file.size),a.call(this,n[u].result,r,n[u].file)):f.call(this,n[u].result,i,s,o,l,n[u].file,c)},onRender_imgUrl:function(t){if(t||(t=this.context.image._v_src._linkValue),!t)return!1;const n=this.context.image;try{const r={name:t.split("/").pop(),size:0};this.context.dialog.updateModal?this.plugins.image.update_src.call(this,t,n._element,r):this.plugins.image.create_image.call(this,t,this.plugins.anchor.createAnchor.call(this,n.anchorCtx,!0),n.inputX.value,n.inputY.value,n._align,r,n._altText)}catch(r){throw Error('[SUNEDITOR.image.URLRendering.fail] cause : "'+r.message+'"')}finally{this.closeLoading()}},onRender_link:function(t,n){return n?(n.setAttribute("data-image-link","image"),t.setAttribute("data-image-link",n.href),n.appendChild(t),n):t},setInputSize:function(t,n){if(n&&n.keyCode===32){n.preventDefault();return}this.plugins.resizing._module_setInputSize.call(this,this.context.image,t)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const t=this.plugins.image,n=this.context.image,r=(function(i){t.onModifyMode.call(this,i,null),t.openModify.call(this,!0),n.inputX.value=n._origin_w,n.inputY.value=n._origin_h;const s=this.util.getFormatElement(i);s&&(n._align=s.style.textAlign||s.style.float),this.util.isAnchor(i.parentNode)&&!n.anchorCtx.linkValue&&(n.anchorCtx.linkValue=" "),t.update_image.call(this,!0,!1,!0),t.init.call(this)}).bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,r,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(t,n,r,i,s,o,l){const c=this.plugins.image,a=this.context.image;this.context.resizing._resize_plugin="image";let f=this.util.createElement("IMG");f.src=t,f.alt=l,f.setAttribute("data-rotate","0"),n=c.onRender_link.call(this,f,n?n.cloneNode(!1):null),a._resizing&&f.setAttribute("data-proportion",a._proportionChecked);const u=this.plugins.component.set_cover.call(this,n),m=this.plugins.component.set_container.call(this,u,"se-image-container");a._captionChecked&&(a._caption=this.plugins.component.create_caption.call(this),u.appendChild(a._caption)),a._element=f,a._cover=u,a._container=m,c.applySize.call(this,r,i),c.setAlign.call(this,s,f,u,m),f.onload=c._image_create_onload.bind(this,f,a.svgDefaultSize,m),this.insertComponent(m,!0,!0,!this.options.mediaAutoSelect)&&this.plugins.fileManager.setInfo.call(this,"image",f,this.functions.onImageUpload,o,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(t,n,r){if(t.offsetWidth===0&&this.plugins.image.applySize.call(this,n,""),this.options.mediaAutoSelect)this.selectComponent(t,"image");else{const i=this.appendFormatTag(r,null);i&&this.setRange(i,0,i,0)}this.history.push(!1)},update_image:function(t,n,r){const i=this.context.image;let s=i._element,o=i._cover,l=i._container,c=!1;o===null&&(c=!0,s=i._element.cloneNode(!0),o=this.plugins.component.set_cover.call(this,s)),l===null?(o=o.cloneNode(!0),s=o.querySelector("img"),c=!0,l=this.plugins.component.set_container.call(this,o,"se-image-container")):c&&(l.innerHTML="",l.appendChild(o),i._cover=o,i._element=s,c=!1);let a;const f=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;/%$/.test(s.style.width)?a=f!==l.style.width||u!==l.style.height:a=f!==s.style.width||u!==s.style.height,s.alt=i._altText;let m=!1;i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),o.appendChild(i._caption),m=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,m=!0);let y=null;const _=this.plugins.anchor.createAnchor.call(this,i.anchorCtx,!0);if(_)i._linkElement!==_||c&&!l.contains(_)?(i._linkElement=_.cloneNode(!1),o.insertBefore(this.plugins.image.onRender_link.call(this,s,i._linkElement),i._caption),y=i._element):i._linkElement.setAttribute("data-image-link","image");else if(i._linkElement!==null){const E=s;if(E.setAttribute("data-image-link",""),o.contains(i._linkElement)){const d=E.cloneNode(!0);o.removeChild(i._linkElement),o.insertBefore(d,i._caption),i._element=s=d}}let S=null;if(c){const E=i._element.parentNode;if(S=this.util.isRangeFormatElement(E)||this.util.isWysiwygDiv(E)?i._element:E||i._element,this.util.getParentElement(i._element,this.util.isNotCheckingNode))S=y?_:i._element,S.parentNode.replaceChild(l,S);else if(this.util.isListCell(S)){const d=this.util.getParentElement(i._element,function(h){return h.parentNode===S});S.insertBefore(l,d),this.util.removeItem(i._element),this.util.removeEmptyNode(d,null,!0)}else if(this.util.isFormatElement(S)){const d=this.util.getParentElement(i._element,function(h){return h.parentNode===S});S=this.util.splitElement(S,d),S.parentNode.insertBefore(l,S),this.util.removeItem(i._element),this.util.removeEmptyNode(S,null,!0),S.children.length===0&&(S.innerHTML=this.util.htmlRemoveWhiteSpace(S.innerHTML))}else if(this.util.isFormatElement(S.parentNode)){const d=S.parentNode;d.parentNode.insertBefore(l,S.previousSibling?d.nextElementSibling:d),i.__updateTags.map(function(h){return S.contains(h)}).length===0&&this.util.removeItem(S)}else S=this.util.isFigures(S.parentNode)?S.parentNode:S,S.parentNode.replaceChild(l,S);s=l.querySelector("img"),i._element=s,i._cover=o,i._container=l}y&&(c?(this.util.removeItem(y),this.util.getListChildren(_,function(E){return/IMG/i.test(E.tagName)}).length===0&&this.util.removeItem(_)):this.util.removeItem(_)),(m||!i._onlyPercentage&&a)&&!t&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0))),i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),a&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),t&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),n&&this.selectComponent(s,"image"),r||this.history.push(!1)},update_src:function(t,n,r){n.src=t,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",n,this.functions.onImageUpload,r,!0)),this.selectComponent(n,"image")},onModifyMode:function(t,n){if(!t)return;const r=this.context.image;r._linkElement=r.anchorCtx.linkAnchor=this.util.isAnchor(t.parentNode)?t.parentNode:null,r._element=t,r._cover=this.util.getParentElement(t,"FIGURE"),r._container=this.util.getParentElement(t,this.util.isMediaComponent),r._caption=this.util.getChildElement(r._cover,"FIGCAPTION"),r._align=t.getAttribute("data-align")||t.style.float||"none",t.style.float="",this.plugins.anchor.setCtx(r._linkElement,r.anchorCtx),n&&(r._element_w=n.w,r._element_h=n.h,r._element_t=n.t,r._element_l=n.l);let i=r._element.getAttribute("data-size")||r._element.getAttribute("data-origin"),s,o;i?(i=i.split(","),s=i[0],o=i[1]):n&&(s=n.w,o=n.h),r._origin_w=s||t.style.width||t.width||"",r._origin_h=o||t.style.height||t.height||""},openModify:function(t){const n=this.context.image;n.imgUrlFile&&(n._v_src._linkValue=n.previewSrc.textContent=n.imgUrlFile.value=n._element.src),n._altText=n.altText.value=n._element.alt,(n.modal.querySelector('input[name="suneditor_image_radio"][value="'+n._align+'"]')||n.modal.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,n._align=n.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,n._captionChecked=n.captionCheckEl.checked=!!n._caption,n._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,n,this.plugins.image),t||this.plugins.dialog.open.call(this,"image",!0)},applySize:function(t,n){const r=this.context.image;return t||(t=r.inputX.value||this.options.imageWidth),n||(n=r.inputY.value||this.options.imageHeight),r._onlyPercentage&&t||/%$/.test(t)?(this.plugins.image.setPercentSize.call(this,t,n),!0):((!t||t==="auto")&&(!n||n==="auto")?this.plugins.image.setAutoSize.call(this):this.plugins.image.setSize.call(this,t,n,!1),!1)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},setSize:function(t,n,r,i){const s=this.context.image,o=/^(rw|lw)$/.test(i)&&/\d+/.test(s._element.style.height);/^(th|bh)$/.test(i)&&/\d+/.test(s._element.style.width)||(s._element.style.width=this.util.isNumber(t)?t+s.sizeUnit:t,this.plugins.image.cancelPercentAttr.call(this)),o||(s._element.style.height=this.util.isNumber(n)?n+s.sizeUnit:/%$/.test(n)?"":n),s._align==="center"&&this.plugins.image.setAlign.call(this,null,null,null,null),r||s._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,s)},setAutoSize:function(){const t=this.context.image;t._caption&&(t._caption.style.marginTop=""),this.plugins.resizing.resetTransform.call(this,t._element),this.plugins.image.cancelPercentAttr.call(this),t._element.style.maxWidth="",t._element.style.width="",t._element.style.height="",t._cover.style.width="",t._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),t._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,t)},setOriginSize:function(){const t=this.context.image;t._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,t._element),this.plugins.image.cancelPercentAttr.call(this);const n=(t._element.getAttribute("data-origin")||"").split(","),r=n[0],i=n[1];n&&(t._onlyPercentage||/%$/.test(r)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,r,i):this.plugins.image.setSize.call(this,r,i),this.plugins.resizing._module_saveCurrentSize.call(this,t))},setPercentSize:function(t,n){const r=this.context.image;n=n&&!/%$/.test(n)&&!this.util.getNumber(n,0)?this.util.isNumber(n)?n+"%":n:this.util.isNumber(n)?n+r.sizeUnit:n||"";const i=/%$/.test(n);r._container.style.width=this.util.isNumber(t)?t+"%":t,r._container.style.height="",r._cover.style.width="100%",r._cover.style.height=i?n:"",r._element.style.width="100%",r._element.style.height=i?"":n,r._element.style.maxWidth="",r._align==="center"&&this.plugins.image.setAlign.call(this,null,null,null,null),r._element.setAttribute("data-percentage",t+","+n),this.plugins.resizing.setCaptionPosition.call(this,r._element),this.plugins.resizing._module_saveCurrentSize.call(this,r)},cancelPercentAttr:function(){const t=this.context.image;t._cover.style.width="",t._cover.style.height="",t._container.style.width="",t._container.style.height="",this.util.removeClass(t._container,this.context.image._floatClassRegExp),this.util.addClass(t._container,"__se__float-"+t._align),t._align==="center"&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(t,n,r,i){const s=this.context.image;t||(t=s._align),n||(n=s._element),r||(r=s._cover),i||(i=s._container),/%$/.test(n.style.width)&&t==="center"?(i.style.minWidth="100%",r.style.width=i.style.width):(i.style.minWidth="",r.style.width=this.context.resizing._rotateVertical?n.style.height||n.offsetHeight:!n.style.width||n.style.width==="auto"?"":n.style.width||"100%"),this.util.hasClass(i,"__se__float-"+t)||(this.util.removeClass(i,s._floatClassRegExp),this.util.addClass(i,"__se__float-"+t)),n.setAttribute("data-align",t)},init:function(){const t=this.context.image;t.imgInputFile&&(t.imgInputFile.value=""),t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=""),t.imgInputFile&&t.imgUrlFile&&(t.imgUrlFile.removeAttribute("disabled"),t.previewSrc.style.textDecoration=""),t.altText.value="",t.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,t.captionCheckEl.checked=!1,t._element=null,this.plugins.image.openTab.call(this,"init"),t._resizing&&(t.inputX.value=this.options.imageWidth===t._defaultSizeX?"":this.options.imageWidth,t.inputY.value=this.options.imageHeight===t._defaultSizeY?"":this.options.imageHeight,t.proportion.checked=!0,t._ratio=!1,t._ratioX=1,t._ratioY=1),this.plugins.anchor.init.call(this,t.anchorCtx)}},nv={name:"video",display:"dialog",add:function(t){t.addModule([go,Eu,J2,Tu]);const n=t.options,r=t.context,i=r.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,sizeUnit:n._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:n.youtubeQuery,_vimeoQuery:n.vimeoQuery,_videoRatio:n.videoRatio*100+"%",_defaultRatio:n.videoRatio*100+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:n.videoRatio*100+"%",_origin_w:n.videoWidth==="100%"?"":n.videoWidth,_origin_h:n.videoHeight==="56.25%"?"":n.videoHeight,_proportionChecked:!0,_resizing:n.videoResizing,_resizeDotHide:!n.videoHeightShow,_rotation:n.videoRotation,_alignHide:!n.videoAlignShow,_onlyPercentage:n.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let s=this.setDialog(t);i.modal=s,i.videoInputFile=s.querySelector("._se_video_file"),i.videoUrlFile=s.querySelector(".se-input-url"),i.focusElement=i.videoUrlFile||i.videoInputFile,i.preview=s.querySelector(".se-link-preview"),s.querySelector("form").addEventListener("submit",this.submit.bind(t)),i.videoInputFile&&s.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(i.videoInputFile,i.videoUrlFile,i.preview)),i.videoInputFile&&i.videoUrlFile&&i.videoInputFile.addEventListener("change",this._fileInputChange.bind(i)),i.videoUrlFile&&i.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(i.preview,i,n.linkProtocol)),i.proportion={},i.videoRatioOption={},i.inputX={},i.inputY={},n.videoResizing&&(i.proportion=s.querySelector("._se_video_check_proportion"),i.videoRatioOption=s.querySelector(".se-video-ratio"),i.inputX=s.querySelector("._se_video_size_x"),i.inputY=s.querySelector("._se_video_size_y"),i.inputX.value=n.videoWidth,i.inputY.value=n.videoHeight,i.inputX.addEventListener("keyup",this.setInputSize.bind(t,"x")),i.inputY.addEventListener("keyup",this.setInputSize.bind(t,"y")),i.inputX.addEventListener("change",this.setRatio.bind(t)),i.inputY.addEventListener("change",this.setRatio.bind(t)),i.proportion.addEventListener("change",this.setRatio.bind(t)),i.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(t)),s.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(t))),r.dialog.modal.appendChild(s),s=null},setDialog:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-dialog-content",i.style.display="none";let s='<form method="post" enctype="multipart/form-data"><div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" title="'+r.dialogBox.close+'" aria-label="'+r.dialogBox.close+'">'+t.icons.cancel+'</button><span class="se-modal-title">'+r.dialogBox.videoBox.title+'</span></div><div class="se-dialog-body">';if(n.videoFileInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.videoBox.file+'</label><div class="se-dialog-form-files"><input class="se-input-form _se_video_file" type="file" accept="'+n.videoAccept+'"'+(n.videoMultipleFile?' multiple="multiple"':"")+'/><button type="button" data-command="filesRemove" class="se-btn se-dialog-files-edge-button se-file-remove" title="'+r.controller.remove+'" aria-label="'+r.controller.remove+'">'+t.icons.cancel+"</button></div></div>"),n.videoUrlInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.videoBox.url+'</label><input class="se-input-form se-input-url" type="text" /><pre class="se-link-preview"></pre></div>'),n.videoResizing){const o=n.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=n.videoRatio,c=n.videoSizeOnlyPercentage,a=c?' style="display: none !important;"':"",f=n.videoHeightShow?"":' style="display: none !important;"',u=n.videoRatioShow?"":' style="display: none !important;"',m=!c&&!n.videoHeightShow&&!n.videoRatioShow?' style="display: none !important;"':"";s+='<div class="se-dialog-form"><div class="se-dialog-size-text"><label class="size-w">'+r.dialogBox.width+'</label><label class="se-dialog-size-x"> </label><label class="size-h"'+f+">"+r.dialogBox.height+'</label><label class="size-h"'+u+">("+r.dialogBox.ratio+')</label></div><input class="se-input-control _se_video_size_x" placeholder="100%"'+(c?' type="number" min="1"':'type="text"')+(c?' max="100"':"")+'/><label class="se-dialog-size-x"'+m+">"+(c?"%":"x")+'</label><input class="se-input-control _se_video_size_y" placeholder="'+n.videoRatio*100+'%"'+(c?' type="number" min="1"':'type="text"')+(c?' max="100"':"")+f+'/><select class="se-input-select se-video-ratio" title="'+r.dialogBox.ratio+'" aria-label="'+r.dialogBox.ratio+'"'+u+">",f||(s+='<option value=""> - </option>');for(let y=0,_=o.length;y<_;y++)s+='<option value="'+o[y].value+'"'+(l.toString()===o[y].value.toString()?" selected":"")+">"+o[y].name+"</option>";s+='</select><button type="button" title="'+r.dialogBox.revertButton+'" aria-label="'+r.dialogBox.revertButton+'" class="se-btn se-dialog-btn-revert" style="float: right;">'+t.icons.revert+'</button></div><div class="se-dialog-form se-dialog-form-footer"'+a+m+'><label><input type="checkbox" class="se-dialog-btn-check _se_video_check_proportion" checked/> '+r.dialogBox.proportion+"</label></div>"}return s+='</div><div class="se-dialog-footer"><div'+(n.videoAlignShow?"":' style="display: none"')+'><label><input type="radio" name="suneditor_video_radio" class="se-dialog-btn-radio" value="none" checked>'+r.dialogBox.basic+'</label><label><input type="radio" name="suneditor_video_radio" class="se-dialog-btn-radio" value="left">'+r.dialogBox.left+'</label><label><input type="radio" name="suneditor_video_radio" class="se-dialog-btn-radio" value="center">'+r.dialogBox.center+'</label><label><input type="radio" name="suneditor_video_radio" class="se-dialog-btn-radio" value="right">'+r.dialogBox.right+'</label></div><button type="submit" class="se-btn-primary" title="'+r.dialogBox.submitButton+'" aria-label="'+r.dialogBox.submitButton+'"><span>'+r.dialogBox.submitButton+"</span></button></div></form>",i.innerHTML=s,i},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(t,n){this.value="",t&&(t.removeAttribute("disabled"),n.style.textDecoration="")},_onLinkPreview:function(t,n,r){const i=r.target.value.trim();/^<iframe.*\/iframe>$/.test(i)?(t._linkValue=i,this.textContent='<IFrame :src=".."></IFrame>'):t._linkValue=this.textContent=i?n&&i.indexOf("://")===-1&&i.indexOf("#")!==0?n+i:i.indexOf("://")===-1?"/"+i:i:""},_setTagAttrs:function(t){t.setAttribute("controls",!0);const n=this.options.videoTagAttrs;if(n)for(let r in n)this.util.hasOwn(n,r)&&t.setAttribute(r,n[r])},createVideoTag:function(){const t=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,t),t},_setIframeAttrs:function(t){t.frameBorder="0",t.allowFullscreen=!0;const n=this.options.videoIframeAttrs;if(n)for(let r in n)this.util.hasOwn(n,r)&&t.setAttribute(r,n[r])},createIframeTag:function(){const t=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,t),t},fileTags:["iframe","video"],select:function(t){this.plugins.video.onModifyMode.call(this,t,this.plugins.resizing.call_controller_resize.call(this,t,"video"))},destroy:function(t){const n=t||this.context.video._element,r=this.context.video._container,i=n.getAttribute("data-index")*1;if(typeof this.functions.onVideoDeleteBefore=="function"&&this.functions.onVideoDeleteBefore(n,r,i,this)===!1)return;let s=r.previousElementSibling||r.nextElementSibling;const o=r.parentNode;this.util.removeItem(r),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,function(l){return l.childNodes.length===0},null),this.focusEdge(s),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(t){const n=this.context.video;t?n.videoInputFile&&this.options.videoMultipleFile&&n.videoInputFile.removeAttribute("multiple"):(n.inputX.value=n._origin_w=this.options.videoWidth===n._defaultSizeX?"":this.options.videoWidth,n.inputY.value=n._origin_h=this.options.videoHeight===n._defaultSizeY?"":this.options.videoHeight,n.proportion.disabled=!0,n.videoInputFile&&this.options.videoMultipleFile&&n.videoInputFile.setAttribute("multiple","multiple")),n._resizing&&this.plugins.video.setVideoRatioSelect.call(this,n._origin_h||n._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video",this.currentControllerName==="video")},setVideoRatio:function(t){const n=this.context.video,r=t.target.options[t.target.selectedIndex].value;n._defaultSizeY=n._videoRatio=r?r*100+"%":n._defaultSizeY,n.inputY.placeholder=r?r*100+"%":"",n.inputY.value=""},setInputSize:function(t,n){if(n&&n.keyCode===32){n.preventDefault();return}const r=this.context.video;this.plugins.resizing._module_setInputSize.call(this,r,t),t==="y"&&this.plugins.video.setVideoRatioSelect.call(this,n.target.value||r._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(t){const n=this.context.video,r=this.plugins.video;t.preventDefault(),t.stopPropagation(),n._align=n.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{n.videoInputFile&&n.videoInputFile.files.length>0?(this.showLoading(),r.submitAction.call(this,this.context.video.videoInputFile.files)):n.videoUrlFile&&n._linkValue.length>0&&(this.showLoading(),r.setup_url.call(this,n._linkValue))}catch(i){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+i.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(t){if(t.length===0)return;let n=0,r=[];for(let l=0,c=t.length;l<c;l++)/video/i.test(t[l].type)&&(r.push(t[l]),n+=t[l].size);const i=this.options.videoUploadSizeLimit;if(i>0){let l=0;const c=this.context.video._infoList;for(let a=0,f=c.length;a<f;a++)l+=c[a].size*1;if(n+l>i){this.closeLoading();const a="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";(typeof this.functions.onVideoUploadError!="function"||this.functions.onVideoUploadError(a,{limitSize:i,currentSize:l,uploadSize:n},this))&&this.functions.noticeOpen(a);return}}const s=this.context.video;s._uploadFileLength=r.length;const o={inputWidth:s.inputX.value,inputHeight:s.inputY.value,align:s._align,isUpdate:this.context.dialog.updateModal,element:s._element};if(typeof this.functions.onVideoUploadBefore=="function"){const l=this.functions.onVideoUploadBefore(r,o,this,(function(c){c&&this._w.Array.isArray(c.result)?this.plugins.video.register.call(this,o,c):this.plugins.video.upload.call(this,o,c)}).bind(this));if(typeof l>"u")return;if(!l){this.closeLoading();return}typeof l=="object"&&l.length>0&&(r=l)}this.plugins.video.upload.call(this,o,r)},error:function(t,n){if(this.closeLoading(),typeof this.functions.onVideoUploadError!="function"||this.functions.onVideoUploadError(t,n,this))throw this.functions.noticeOpen(t),Error("[SUNEDITOR.plugin.video.error] response: "+t)},upload:function(t,n){if(!n){this.closeLoading();return}if(typeof n=="string"){this.plugins.video.error.call(this,n,null);return}const r=this.options.videoUploadUrl,i=this.context.dialog.updateModal?1:n.length;if(typeof r=="string"&&r.length>0){const s=new FormData;for(let o=0;o<i;o++)s.append("file-"+o,n[o]);this.plugins.fileManager.upload.call(this,r,this.options.videoUploadHeader,s,this.plugins.video.callBack_videoUpload.bind(this,t),this.functions.onVideoUploadError)}else throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.')},callBack_videoUpload:function(t,n){if(typeof this.functions.videoUploadHandler=="function")this.functions.videoUploadHandler(n,t,this);else{const r=JSON.parse(n.responseText);r.errorMessage?this.plugins.video.error.call(this,r.errorMessage,r):this.plugins.video.register.call(this,t,r)}},register:function(t,n){const r=n.result,i=this.plugins.video.createVideoTag.call(this);for(let s=0,o=r.length,l;s<o;s++)l={name:r[s].name,size:r[s].size},this.plugins.video.create_video.call(this,t.isUpdate?t.element:i.cloneNode(!1),r[s].url,t.inputWidth,t.inputHeight,t.align,l,t.isUpdate);this.closeLoading()},setup_url:function(t){try{const n=this.context.video;if(t||(t=n._linkValue),!t||/^<iframe.*\/iframe>$/.test(t)&&(t=new this._w.DOMParser().parseFromString(t,"text/html").querySelector("iframe").src,t.length===0))return!1;if(/youtu\.?be/.test(t)){if(/^http/.test(t)||(t="https://"+t),t=t.replace("watch?v=",""),/^\/\/.+\/embed\//.test(t)||(t=t.replace(t.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),n._youtubeQuery.length>0)if(/\?/.test(t)){const r=t.split("?");t=r[0]+"?"+n._youtubeQuery+"&"+r[1]}else t+="?"+n._youtubeQuery}else if(/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1),n._vimeoQuery.length>0))if(/\?/.test(t)){const r=t.split("?");t=r[0]+"?"+n._vimeoQuery+"&"+r[1]}else t+="?"+n._vimeoQuery;this.plugins.video.create_video.call(this,this.plugins.video[!/embed|iframe|player|\/e\/|\.php|\.html?/.test(t)&&!/vimeo\.com/.test(t)?"createVideoTag":"createIframeTag"].call(this),t,n.inputX.value,n.inputY.value,n._align,null,this.context.dialog.updateModal)}catch(n){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+n.message+'"')}finally{this.closeLoading()}},create_video:function(t,n,r,i,s,o,l){this.context.resizing._resize_plugin="video";const c=this.context.video;let a=null,f=null,u=!1;if(l){if(t=c._element,t.src!==n){u=!0;const E=/youtu\.?be/.test(n),d=/vimeo\.com/.test(n);if((E||d)&&!/^iframe$/i.test(t.nodeName)){const h=this.plugins.video.createIframeTag.call(this);h.src=n,t.parentNode.replaceChild(h,t),c._element=t=h}else if(!E&&!d&&!/^video$/i.test(t.nodeName)){const h=this.plugins.video.createVideoTag.call(this);h.src=n,t.parentNode.replaceChild(h,t),c._element=t=h}else t.src=n}f=c._container,a=this.util.getParentElement(t,"FIGURE")}else u=!0,t.src=n,c._element=t,a=this.plugins.component.set_cover.call(this,t),f=this.plugins.component.set_container.call(this,a,"se-video-container");c._cover=a,c._container=f;const m=this.plugins.resizing._module_getSizeX.call(this,c)!==(r||c._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,c)!==(i||c._videoRatio),y=!l||m;c._resizing&&(this.context.video._proportionChecked=c.proportion.checked,t.setAttribute("data-proportion",c._proportionChecked));let _=!1;y&&(_=this.plugins.video.applySize.call(this)),_&&s==="center"||this.plugins.video.setAlign.call(this,null,t,a,f);let S=!0;if(l)c._resizing&&this.context.resizing._rotateVertical&&y&&this.plugins.resizing.setTransformSize.call(this,t,null,null);else if(S=this.insertComponent(f,!1,!0,!this.options.mediaAutoSelect),!this.options.mediaAutoSelect){const E=this.appendFormatTag(f,null);E&&this.setRange(E,0,E,0)}S&&(u&&this.plugins.fileManager.setInfo.call(this,"video",t,this.functions.onVideoUpload,o,!0),l&&(this.selectComponent(t,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(t){if(!t)return;const n=this.context.video;/^video$/i.test(t.nodeName)?this.plugins.video._setTagAttrs.call(this,t):this.plugins.video._setIframeAttrs.call(this,t);const r=t.parentNode;let i=this.util.isRangeFormatElement(r)||this.util.isWysiwygDiv(r)?t:r||t;const s=t;n._element=t=t.cloneNode(!0);const o=n._cover=this.plugins.component.set_cover.call(this,t),l=n._container=this.plugins.component.set_container.call(this,o,"se-video-container");try{const c=i.querySelector("figcaption");let a=null;c&&(a=this.util.createElement("DIV"),a.innerHTML=c.innerHTML,this.util.removeItem(c));const f=(t.getAttribute("data-size")||t.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,f[0]||s.style.width||s.width||"",f[1]||s.style.height||s.height||"");const u=this.util.getFormatElement(s);if(u&&(n._align=u.style.textAlign||u.style.float),this.plugins.video.setAlign.call(this,null,t,o,l),this.util.getParentElement(s,this.util.isNotCheckingNode))s.parentNode.replaceChild(l,s);else if(this.util.isListCell(i)){const m=this.util.getParentElement(s,function(y){return y.parentNode===i});i.insertBefore(l,m),this.util.removeItem(s),this.util.removeEmptyNode(m,null,!0)}else if(this.util.isFormatElement(i)){const m=this.util.getParentElement(s,function(y){return y.parentNode===i});i=this.util.splitElement(i,m),i.parentNode.insertBefore(l,i),this.util.removeItem(s),this.util.removeEmptyNode(i,null,!0),i.children.length===0&&(i.innerHTML=this.util.htmlRemoveWhiteSpace(i.innerHTML))}else i.parentNode.replaceChild(l,i);a&&i.parentNode.insertBefore(a,l.nextElementSibling)}catch(c){console.warn("[SUNEDITOR.video.error] Maybe the video tag is nested.",c)}this.plugins.fileManager.setInfo.call(this,"video",t,this.functions.onVideoUpload,null,!0),this.plugins.video.init.call(this)},onModifyMode:function(t,n){const r=this.context.video;r._element=t,r._cover=this.util.getParentElement(t,"FIGURE"),r._container=this.util.getParentElement(t,this.util.isMediaComponent),r._align=t.style.float||t.getAttribute("data-align")||"none",t.style.float="",n&&(r._element_w=n.w,r._element_h=n.h,r._element_t=n.t,r._element_l=n.l);let i=r._element.getAttribute("data-size")||r._element.getAttribute("data-origin"),s,o;i?(i=i.split(","),s=i[0],o=i[1]):n&&(s=n.w,o=n.h),r._origin_w=s||t.style.width||t.width||"",r._origin_h=o||t.style.height||t.height||""},openModify:function(t){const n=this.context.video;if(n.videoUrlFile&&(n._linkValue=n.preview.textContent=n.videoUrlFile.value=n._element.src||(n._element.querySelector("source")||"").src||""),(n.modal.querySelector('input[name="suneditor_video_radio"][value="'+n._align+'"]')||n.modal.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,n._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,n,this.plugins.video);const r=n._videoRatio=this.plugins.resizing._module_getSizeY.call(this,n);this.plugins.video.setVideoRatioSelect.call(this,r)||(n.inputY.value=n._onlyPercentage?this.util.getNumber(r,2):r)}t||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(t){let n=!1;const r=this.context.video,i=r.videoRatioOption.options;/%$/.test(t)||r._onlyPercentage?t=this.util.getNumber(t,2)/100+"":(!this.util.isNumber(t)||t*1>=1)&&(t=""),r.inputY.placeholder="";for(let s=0,o=i.length;s<o;s++)i[s].value===t?(n=i[s].selected=!0,r.inputY.placeholder=t?t*100+"%":""):i[s].selected=!1;return n},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"video",["iframe","video"],this.functions.onVideoUpload,this.plugins.video._update_videoCover.bind(this),!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"video",this.functions.onVideoUpload)},applySize:function(t,n){const r=this.context.video;return t||(t=r.inputX.value||this.options.videoWidth),n||(n=r.inputY.value||this.options.videoHeight),r._onlyPercentage||/%$/.test(t)||!t?(this.plugins.video.setPercentSize.call(this,t||"100%",n||(/%$/.test(r._videoRatio)?r._videoRatio:r._defaultRatio)),!0):((!t||t==="auto")&&(!n||n==="auto")?this.plugins.video.setAutoSize.call(this):this.plugins.video.setSize.call(this,t,n||r._videoRatio||r._defaultRatio,!1),!1)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.video)},setSize:function(t,n,r,i){const s=this.context.video,o=/^(rw|lw)$/.test(i),l=/^(th|bh)$/.test(i);l||(t=this.util.getNumber(t,0)),o||(n=this.util.isNumber(n)?n+s.sizeUnit:n||""),t=t?t+s.sizeUnit:"",l||(s._element.style.width=t),o||(s._cover.style.paddingBottom=s._cover.style.height=n),!l&&!/%$/.test(t)&&(s._cover.style.width=t,s._container.style.width=""),!o&&!/%$/.test(n)?s._element.style.height=n:s._element.style.height="",r||s._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,s)},setAutoSize:function(){this.plugins.video.setPercentSize.call(this,100,this.context.video._defaultRatio)},setOriginSize:function(t){const n=this.context.video;n._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,n._element),this.plugins.video.cancelPercentAttr.call(this);const r=((t?n._element.getAttribute("data-size"):"")||n._element.getAttribute("data-origin")||"").split(",");if(r){const i=r[0],s=r[1];n._onlyPercentage||/%$/.test(i)&&(/%$/.test(s)||!/\d/.test(s))?this.plugins.video.setPercentSize.call(this,i,s):this.plugins.video.setSize.call(this,i,s),this.plugins.resizing._module_saveCurrentSize.call(this,n)}},setPercentSize:function(t,n){const r=this.context.video;n=n&&!/%$/.test(n)&&!this.util.getNumber(n,0)?this.util.isNumber(n)?n+"%":n:this.util.isNumber(n)?n+r.sizeUnit:n||r._defaultRatio,r._container.style.width=this.util.isNumber(t)?t+"%":t,r._container.style.height="",r._cover.style.width="100%",r._cover.style.height=n,r._cover.style.paddingBottom=n,r._element.style.width="100%",r._element.style.height="100%",r._element.style.maxWidth="",r._align==="center"&&this.plugins.video.setAlign.call(this,null,null,null,null),r._element.setAttribute("data-percentage",t+","+n),this.plugins.resizing._module_saveCurrentSize.call(this,r)},cancelPercentAttr:function(){const t=this.context.video;t._cover.style.width="",t._cover.style.height="",t._cover.style.paddingBottom="",t._container.style.width="",t._container.style.height="",this.util.removeClass(t._container,this.context.video._floatClassRegExp),this.util.addClass(t._container,"__se__float-"+t._align),t._align==="center"&&this.plugins.video.setAlign.call(this,null,null,null,null)},setAlign:function(t,n,r,i){const s=this.context.video;t||(t=s._align),n||(n=s._element),r||(r=s._cover),i||(i=s._container),/%$/.test(n.style.width)&&t==="center"?(i.style.minWidth="100%",r.style.width=i.style.width,r.style.height=r.style.height,r.style.paddingBottom=/%$/.test(r.style.height)?this.util.getNumber(this.util.getNumber(r.style.height,2)/100*this.util.getNumber(r.style.width,2),2)+"%":r.style.height):(i.style.minWidth="",r.style.width=this.context.resizing._rotateVertical?n.style.height||n.offsetHeight:n.style.width||"100%",r.style.paddingBottom=r.style.height),this.util.hasClass(i,"__se__float-"+t)||(this.util.removeClass(i,s._floatClassRegExp),this.util.addClass(i,"__se__float-"+t)),n.setAttribute("data-align",t)},init:function(){const t=this.context.video;t.videoInputFile&&(t.videoInputFile.value=""),t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=""),t.videoInputFile&&t.videoUrlFile&&(t.videoUrlFile.removeAttribute("disabled"),t.preview.style.textDecoration=""),t._origin_w=this.options.videoWidth,t._origin_h=this.options.videoHeight,t.modal.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,t._resizing&&(t.inputX.value=this.options.videoWidth===t._defaultSizeX?"":this.options.videoWidth,t.inputY.value=this.options.videoHeight===t._defaultSizeY?"":this.options.videoHeight,t.proportion.checked=!0,t.proportion.disabled=!0,this.plugins.video.setVideoRatioSelect.call(this,t._defaultRatio))}},rv={name:"audio",display:"dialog",add:function(t){t.addModule([go,Eu,Tu]);const n=t.context,r=n.audio={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,targetSelect:null,_origin_w:t.options.audioWidth,_origin_h:t.options.audioHeight,_linkValue:"",_element:null,_cover:null,_container:null};let i=this.setDialog(t);r.modal=i,r.audioInputFile=i.querySelector("._se_audio_files"),r.audioUrlFile=i.querySelector(".se-input-url"),r.focusElement=r.audioInputFile||r.audioUrlFile,r.preview=i.querySelector(".se-link-preview");let s=this.setController(t);r.controller=s,i.querySelector("form").addEventListener("submit",this.submit.bind(t)),r.audioInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(r.audioInputFile,r.audioUrlFile,r.preview)),r.audioInputFile&&r.audioUrlFile&&r.audioInputFile.addEventListener("change",this._fileInputChange.bind(r)),s.addEventListener("click",this.onClick_controller.bind(t)),r.audioUrlFile&&r.audioUrlFile.addEventListener("input",this._onLinkPreview.bind(r.preview,r,t.options.linkProtocol)),n.dialog.modal.appendChild(i),n.element.relative.appendChild(s),i=null,s=null},setDialog:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-dialog-content",i.style.display="none";let s='<form method="post" enctype="multipart/form-data"><div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" title="'+r.dialogBox.close+'" aria-label="'+r.dialogBox.close+'">'+t.icons.cancel+'</button><span class="se-modal-title">'+r.dialogBox.audioBox.title+'</span></div><div class="se-dialog-body">';return n.audioFileInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.audioBox.file+'</label><div class="se-dialog-form-files"><input class="se-input-form _se_audio_files" type="file" accept="'+n.audioAccept+'"'+(n.audioMultipleFile?' multiple="multiple"':"")+'/><button type="button" data-command="filesRemove" class="se-btn se-dialog-files-edge-button se-file-remove" title="'+r.controller.remove+'" aria-label="'+r.controller.remove+'">'+t.icons.cancel+"</button></div></div>"),n.audioUrlInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.audioBox.url+'</label><input class="se-input-form se-input-url" type="text" /><pre class="se-link-preview"></pre></div>'),s+='</div><div class="se-dialog-footer"><button type="submit" class="se-btn-primary" title="'+r.dialogBox.submitButton+'" aria-label="'+r.dialogBox.submitButton+'"><span>'+r.dialogBox.submitButton+"</span></button></div></form>",i.innerHTML=s,i},setController:function(t){const n=t.lang,r=t.icons,i=t.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='<div class="se-arrow se-arrow-up"></div><div class="link-content"><div class="se-btn-group"><button type="button" data-command="update" tabindex="-1" class="se-tooltip">'+r.edit+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.edit+'</span></span></button><button type="button" data-command="delete" tabindex="-1" class="se-tooltip">'+r.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.remove+"</span></span></button></div></div>",i},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(t,n){this.value="",t&&(t.removeAttribute("disabled"),n.style.textDecoration="")},_createAudioTag:function(){const t=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,t);const n=this.context.audio._origin_w,r=this.context.audio._origin_h;return t.setAttribute("origin-size",n+","+r),t.style.cssText=(n?"width:"+n+"; ":"")+(r?"height:"+r+";":""),t},_setTagAttrs:function(t){t.setAttribute("controls",!0);const n=this.options.audioTagAttrs;if(n)for(let r in n)this.util.hasOwn(n,r)&&t.setAttribute(r,n[r])},_onLinkPreview:function(t,n,r){const i=r.target.value.trim();t._linkValue=this.textContent=i?n&&i.indexOf("://")===-1&&i.indexOf("#")!==0?n+i:i.indexOf("://")===-1?"/"+i:i:""},fileTags:["audio"],select:function(t){this.plugins.audio.onModifyMode.call(this,t)},destroy:function(t){t=t||this.context.audio._element;const n=this.util.getParentElement(t,this.util.isComponent)||t,r=t.getAttribute("data-index")*1;if(typeof this.functions.onAudioDeleteBefore=="function"&&this.functions.onAudioDeleteBefore(t,n,r,this)===!1)return;const i=n.previousElementSibling||n.nextElementSibling,s=n.parentNode;this.util.removeItem(n),this.plugins.audio.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,function(o){return o.childNodes.length===0},null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",r,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(t){const n=this.context.audio;t?n._element?(this.context.dialog.updateModal=!0,n._linkValue=n.preview.textContent=n.audioUrlFile.value=n._element.src,n.audioInputFile&&this.options.audioMultipleFile&&n.audioInputFile.removeAttribute("multiple")):n.audioInputFile&&this.options.audioMultipleFile&&n.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),n.audioInputFile&&this.options.audioMultipleFile&&n.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio",this.currentControllerName==="audio")},submit:function(t){const n=this.context.audio;t.preventDefault(),t.stopPropagation();try{n.audioInputFile&&n.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,n.audioInputFile.files)):n.audioUrlFile&&n._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,n._linkValue))}catch(r){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+r.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(t){if(t.length===0)return;let n=0,r=[];for(let l=0,c=t.length;l<c;l++)/audio/i.test(t[l].type)&&(r.push(t[l]),n+=t[l].size);const i=this.options.audioUploadSizeLimit;if(i>0){let l=0;const c=this.context.audio._infoList;for(let a=0,f=c.length;a<f;a++)l+=c[a].size*1;if(n+l>i){this.closeLoading();const a="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";(typeof this.functions.onAudioUploadError!="function"||this.functions.onAudioUploadError(a,{limitSize:i,currentSize:l,uploadSize:n},this))&&this.functions.noticeOpen(a);return}}const s=this.context.audio;s._uploadFileLength=r.length;const o={isUpdate:this.context.dialog.updateModal,element:s._element};if(typeof this.functions.onAudioUploadBefore=="function"){const l=this.functions.onAudioUploadBefore(r,o,this,(function(c){c&&this._w.Array.isArray(c.result)?this.plugins.audio.register.call(this,o,c):this.plugins.audio.upload.call(this,o,c)}).bind(this));if(typeof l>"u")return;if(!l){this.closeLoading();return}typeof l=="object"&&l.length>0&&(r=l)}this.plugins.audio.upload.call(this,o,r)},error:function(t,n){if(this.closeLoading(),typeof this.functions.onAudioUploadError!="function"||this.functions.onAudioUploadError(t,n,this))throw this.functions.noticeOpen(t),Error("[SUNEDITOR.plugin.audio.exception] response: "+t)},upload:function(t,n){if(!n){this.closeLoading();return}if(typeof n=="string"){this.plugins.audio.error.call(this,n,null);return}const r=this.options.audioUploadUrl,i=this.context.dialog.updateModal?1:n.length,s=new FormData;for(let o=0;o<i;o++)s.append("file-"+o,n[o]);this.plugins.fileManager.upload.call(this,r,this.options.audioUploadHeader,s,this.plugins.audio.callBack_upload.bind(this,t),this.functions.onAudioUploadError)},callBack_upload:function(t,n){if(typeof this.functions.audioUploadHandler=="function")this.functions.audioUploadHandler(n,t,this);else{const r=JSON.parse(n.responseText);r.errorMessage?this.plugins.audio.error.call(this,r.errorMessage,r):this.plugins.audio.register.call(this,t,r)}},register:function(t,n){const r=n.result;for(let i=0,s=r.length,o,l;i<s;i++)t.isUpdate?l=t.element:l=this.plugins.audio._createAudioTag.call(this),o={name:r[i].name,size:r[i].size},this.plugins.audio.create_audio.call(this,l,r[i].url,o,t.isUpdate);this.closeLoading()},setupUrl:function(t){try{if(t.length===0)return!1;this.plugins.audio.create_audio.call(this,this.plugins.audio._createAudioTag.call(this),t,null,this.context.dialog.updateModal)}catch(n){throw Error('[SUNEDITOR.audio.audio.fail] cause : "'+n.message+'"')}finally{this.closeLoading()}},create_audio:function(t,n,r,i){const s=this.context.audio;if(i)if(s._element&&(t=s._element),t&&t.src!==n)t.src=n,this.selectComponent(t,"audio");else{this.selectComponent(t,"audio");return}else{t.src=n;const o=this.plugins.component.set_cover.call(this,t),l=this.plugins.component.set_container.call(this,o,"");if(!this.insertComponent(l,!1,!0,!this.options.mediaAutoSelect)){this.focus();return}if(!this.options.mediaAutoSelect){const c=this.appendFormatTag(l,null);c&&this.setRange(c,0,c,0)}}this.plugins.fileManager.setInfo.call(this,"audio",t,this.functions.onAudioUpload,r,!1),i&&this.history.push(!1)},updateCover:function(t){const n=this.context.audio;this.plugins.audio._setTagAttrs.call(this,t);const r=t.parentNode;let i=this.util.isRangeFormatElement(r)||this.util.isWysiwygDiv(r)?t:r||t;const s=t;n._element=t=t.cloneNode(!1);const o=this.plugins.component.set_cover.call(this,t),l=this.plugins.component.set_container.call(this,o,"se-audio-container");try{if(this.util.getParentElement(s,this.util.isNotCheckingNode))s.parentNode.replaceChild(l,s);else if(this.util.isListCell(i)){const c=this.util.getParentElement(s,function(a){return a.parentNode===i});i.insertBefore(l,c),this.util.removeItem(s),this.util.removeEmptyNode(c,null,!0)}else if(this.util.isFormatElement(i)){const c=this.util.getParentElement(s,function(a){return a.parentNode===i});i=this.util.splitElement(i,c),i.parentNode.insertBefore(l,i),this.util.removeItem(s),this.util.removeEmptyNode(i,null,!0),i.children.length===0&&(i.innerHTML=this.util.htmlRemoveWhiteSpace(i.innerHTML))}else i.parentNode.replaceChild(l,i)}catch(c){console.warn("[SUNEDITOR.audio.error] Maybe the audio tag is nested.",c)}this.plugins.fileManager.setInfo.call(this,"audio",t,this.functions.onAudioUpload,null,!1),this.plugins.audio.init.call(this)},onModifyMode:function(t){const n=this.context.audio;this.setControllerPosition(n.controller,t,"bottom",{left:0,top:0}),this.controllersOn(n.controller,t,this.plugins.audio.onControllerOff.bind(this,t),"audio"),this.util.addClass(t,"active"),n._element=t,n._cover=this.util.getParentElement(t,"FIGURE"),n._container=this.util.getParentElement(t,this.util.isComponent)},openModify:function(t){if(this.context.audio.audioUrlFile){const n=this.context.audio;n._linkValue=n.preview.textContent=n.audioUrlFile.value=n._element.src}t||this.plugins.dialog.open.call(this,"audio",!0)},onClick_controller:function(t){t.stopPropagation();const n=t.target.getAttribute("data-command");n&&(t.preventDefault(),/update/.test(n)?this.plugins.audio.openModify.call(this,!1):this.plugins.audio.destroy.call(this,this.context.audio._element),this.controllersOff())},onControllerOff:function(t){this.util.removeClass(t,"active"),this.context.audio.controller.style.display="none"},init:function(){if(this.context.dialog.updateModal)return;const t=this.context.audio;t.audioInputFile&&(t.audioInputFile.value=""),t.audioUrlFile&&(t._linkValue=t.preview.textContent=t.audioUrlFile.value=""),t.audioInputFile&&t.audioUrlFile&&(t.audioUrlFile.removeAttribute("disabled"),t.preview.style.textDecoration=""),t._element=null}},qf="https://katex.org/docs/supported.html",iv={name:"math",display:"dialog",add:function(t){t.addModule([go]);const n=t.context;n.math={focusElement:null,previewElement:null,fontSizeElement:null,defaultFontSize:"",_mathExp:null};let r=this.setDialog(t);n.math.modal=r,n.math.focusElement=r.querySelector(".se-math-exp"),n.math.previewElement=r.querySelector(".se-math-preview"),n.math.fontSizeElement=r.querySelector(".se-math-size"),n.math.focusElement.addEventListener("paste",function(s){typeof t.functions.onPasteMath=="function"&&t.functions.onPasteMath(s,t)},!1),n.math.focusElement.addEventListener(t.util.isIE?"textinput":"input",this._renderMathExp.bind(t,n.math),!1),n.math.fontSizeElement.addEventListener("change",(function(s){this.fontSize=s.target.value}).bind(n.math.previewElement.style),!1);let i=this.setController_MathButton(t);n.math.mathController=i,n.math._mathExp=null,r.querySelector("form").addEventListener("submit",this.submit.bind(t),!1),i.addEventListener("click",this.onClick_mathController.bind(t)),n.math.previewElement.style.fontSize=n.math.defaultFontSize,n.dialog.modal.appendChild(r),n.element.relative.appendChild(i),r=null,i=null},setDialog:function(t){const n=t.lang,r=t.util.createElement("DIV"),i=t.options.mathFontSize;let s=i[0].value;r.className="se-dialog-content",r.style.display="none";let o='<form><div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" title="'+n.dialogBox.close+'" aria-label="'+n.dialogBox.close+'">'+t.icons.cancel+'</button><span class="se-modal-title">'+n.dialogBox.mathBox.title+'</span></div><div class="se-dialog-body"><div class="se-dialog-form"><label>'+n.dialogBox.mathBox.inputLabel+' (<a href="'+qf+'" target="_blank">KaTeX</a>)</label><textarea class="se-input-form se-math-exp" type="text"></textarea></div><div class="se-dialog-form"><label>'+n.dialogBox.mathBox.fontSizeLabel+'</label><select class="se-input-select se-math-size">';for(let l=0,c=i.length,a;l<c;l++)a=i[l],a.default&&(s=a.value),o+='<option value="'+a.value+'"'+(a.default?" selected":"")+">"+a.text+"</option>";return o+='</select></div><div class="se-dialog-form"><label>'+n.dialogBox.mathBox.previewLabel+'</label><p class="se-math-preview"></p></div></div><div class="se-dialog-footer"><button type="submit" class="se-btn-primary" title="'+n.dialogBox.submitButton+'" aria-label="'+n.dialogBox.submitButton+'"><span>'+n.dialogBox.submitButton+"</span></button></div></form>",t.context.math.defaultFontSize=s,r.innerHTML=o,r},setController_MathButton:function(t){const n=t.lang,r=t.util.createElement("DIV");return r.className="se-controller se-controller-link",r.innerHTML='<div class="se-arrow se-arrow-up"></div><div class="link-content"><div class="se-btn-group"><button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">'+t.icons.edit+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.edit+'</span></span></button><button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">'+t.icons.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.remove+"</span></span></button></div></div>",r},open:function(){this.plugins.dialog.open.call(this,"math",this.currentControllerName==="math")},managedTags:function(){return{className:"katex",method:function(t){if(!t.getAttribute("data-exp")||!this.options.katex)return;const n=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(t.getAttribute("data-exp"))));t.innerHTML=n.querySelector(".katex").innerHTML,t.setAttribute("contenteditable",!1)}}},_renderer:function(t){let n="";try{this.util.removeClass(this.context.math.focusElement,"se-error"),n=this.options.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0})}catch(r){this.util.addClass(this.context.math.focusElement,"se-error"),n='<span class="se-math-katex-error">Katex syntax error. (Refer <a href="'+qf+'" target="_blank">KaTeX</a>)</span>',console.warn("[SUNEDITOR.math.Katex.error] ",r)}return n},_renderMathExp:function(t,n){t.previewElement.innerHTML=this.plugins.math._renderer.call(this,n.target.value)},submit:function(t){this.showLoading(),t.preventDefault(),t.stopPropagation();const n=(function(){if(this.context.math.focusElement.value.trim().length===0)return!1;const r=this.context.math,i=r.focusElement.value,s=r.previewElement.querySelector(".katex");if(!s)return!1;if(s.className="__se__katex "+s.className,s.setAttribute("contenteditable",!1),s.setAttribute("data-exp",this.util.HTMLEncoder(i)),s.setAttribute("data-font-size",r.fontSizeElement.value),s.style.fontSize=r.fontSizeElement.value,this.context.dialog.updateModal){const o=this.util.getParentElement(r._mathExp,".katex");o.parentNode.replaceChild(s,o),this.setRange(s,0,s,1)}else{const o=this.getSelectedElements();if(o.length>1){const c=this.util.createElement(o[0].nodeName);if(c.appendChild(s),!this.insertNode(c,null,!0))return!1}else if(!this.insertNode(s,null,!0))return!1;const l=this.util.createTextNode(this.util.zeroWidthSpace);s.parentNode.insertBefore(l,s.nextSibling),this.setRange(s,0,s,1)}return r.focusElement.value="",r.fontSizeElement.value="1em",r.previewElement.style.fontSize="1em",r.previewElement.innerHTML="",!0}).bind(this);try{n()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch{this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(t){if(!t)this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();else if(t.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(t,0,t,1),this.plugins.math.call_controller.call(this,t)),!0;return!1},on:function(t){if(!t)this.plugins.math.init.call(this);else{const n=this.context.math;if(n._mathExp){const r=this.util.HTMLDecoder(n._mathExp.getAttribute("data-exp")),i=n._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,n.focusElement.value=r,n.fontSizeElement.value=i,n.previewElement.innerHTML=this.plugins.math._renderer.call(this,r),n.previewElement.style.fontSize=i}}},call_controller:function(t){this.context.math._mathExp=t;const n=this.context.math.mathController;this.setControllerPosition(n,t,"bottom",{left:0,top:0}),this.controllersOn(n,t,"math")},onClick_mathController:function(t){t.stopPropagation();const n=t.target.getAttribute("data-command")||t.target.parentNode.getAttribute("data-command");n&&(t.preventDefault(),/update/.test(n)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const t=this.context.math;t.mathController.style.display="none",t._mathExp=null,t.focusElement.value="",t.previewElement.innerHTML=""}};var sv={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"fileBrowser",_xmlHttp:null,_loading:null,add:function(s){const o=s.context;o.fileBrowser={_closeSignal:!1,area:null,header:null,tagArea:null,body:null,list:null,tagElements:null,items:[],selectedTags:[],selectorHandler:null,contextPlugin:"",columnSize:4};let l=s.util.createElement("DIV");l.className="se-file-browser sun-editor-common";let c=s.util.createElement("DIV");c.className="se-file-browser-back";let a=s.util.createElement("DIV");a.className="se-file-browser-inner",a.innerHTML=this.set_browser(s),l.appendChild(c),l.appendChild(a),this._loading=l.querySelector(".se-loading-box"),o.fileBrowser.area=l,o.fileBrowser.header=a.querySelector(".se-file-browser-header"),o.fileBrowser.titleArea=a.querySelector(".se-file-browser-title"),o.fileBrowser.tagArea=a.querySelector(".se-file-browser-tags"),o.fileBrowser.body=a.querySelector(".se-file-browser-body"),o.fileBrowser.list=a.querySelector(".se-file-browser-list"),o.fileBrowser.tagArea.addEventListener("click",this.onClickTag.bind(s)),o.fileBrowser.list.addEventListener("click",this.onClickFile.bind(s)),a.addEventListener("mousedown",this._onMouseDown_browser.bind(s)),a.addEventListener("click",this._onClick_browser.bind(s)),o.element.relative.appendChild(l),l=null,c=null,a=null},set_browser:function(s){const o=s.lang;return'<div class="se-file-browser-content"><div class="se-file-browser-header"><button type="button" data-command="close" class="se-btn se-file-browser-close" class="close" title="'+o.dialogBox.close+'" aria-label="'+o.dialogBox.close+'">'+s.icons.cancel+'</button><span class="se-file-browser-title"></span><div class="se-file-browser-tags"></div></div><div class="se-file-browser-body"><div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div><div class="se-file-browser-list"></div></div></div>'},_onMouseDown_browser:function(s){/se-file-browser-inner/.test(s.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(s){s.stopPropagation(),(/close/.test(s.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(s,o){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=(function(f){/27/.test(f.keyCode)&&this.plugins.fileBrowser.close.call(this)}).bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const l=this.context.fileBrowser;l.contextPlugin=s,l.selectorHandler=o;const c=this.context[s],a=c.listClass;this.util.hasClass(l.list,a)||(l.list.className="se-file-browser-list "+a),this.options.popupDisplay==="full"?l.area.style.position="fixed":l.area.style.position="absolute",l.titleArea.textContent=c.title,l.area.style.display="block",this.context[s].directData?this.plugins.fileBrowser._drawListItem.call(this,this.context[s].directData,!0):this.plugins.fileBrowser._drawFileList.call(this,this.context[s].url,this.context[s].header)},_bindClose:null,close:function(){const s=this.plugins.fileBrowser;s._xmlHttp&&s._xmlHttp.abort(),s._bindClose&&(this._d.removeEventListener("keydown",s._bindClose),s._bindClose=null);const o=this.context.fileBrowser;o.area.style.display="none",o.selectorHandler=null,o.selectedTags=[],o.items=[],o.list.innerHTML=o.tagArea.innerHTML=o.titleArea.textContent="",typeof this.plugins[o.contextPlugin].init=="function"&&this.plugins[o.contextPlugin].init.call(this),o.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(s,o){const l=this.plugins.fileBrowser,c=l._xmlHttp=this.util.getXMLHttpRequest();if(c.onreadystatechange=l._callBackGet.bind(this,c),c.open("get",s,!0),o!==null&&typeof o=="object"&&this._w.Object.keys(o).length>0)for(let a in o)c.setRequestHeader(a,o[a]);c.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(s){if(s.readyState===4){if(this.plugins.fileBrowser._xmlHttp=null,s.status===200)try{const o=JSON.parse(s.responseText);o.result.length>0?this.plugins.fileBrowser._drawListItem.call(this,o.result,!0):o.nullMessage&&(this.context.fileBrowser.list.innerHTML=o.nullMessage)}catch(o){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+o.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),s.status!==0){const o=s.responseText?JSON.parse(s.responseText):s,l="[SUNEDITOR.fileBrowser.get.serverException] status: "+s.status+", response: "+(o.errorMessage||s.responseText);throw Error(l)}}},_drawListItem:function(s,o){const l=this.context.fileBrowser,c=this.context[l.contextPlugin],a=[],f=s.length,u=c.columnSize||l.columnSize,m=u<=1?1:Math.round(f/u)||1,y=c.itemTemplateHandler;let _="",S='<div class="se-file-item-column">',E=1;for(let d=0,h,v;d<f;d++)if(h=s[d],v=h.tag?typeof h.tag=="string"?h.tag.split(","):h.tag:[],v=h.tag=v.map(function(x){return x.trim()}),S+=y(h),(d+1)%m===0&&E<u&&d+1<f&&(E++,S+='</div><div class="se-file-item-column">'),o&&v.length>0)for(let x=0,g=v.length,b;x<g;x++)b=v[x],b&&a.indexOf(b)===-1&&(a.push(b),_+='<a title="'+b+'" aria-label="'+b+'">'+b+"</a>");S+="</div>",l.list.innerHTML=S,o&&(l.items=s,l.tagArea.innerHTML=_,l.tagElements=l.tagArea.querySelectorAll("A"))},onClickTag:function(s){const o=s.target;if(!this.util.isAnchor(o))return;const l=o.textContent,c=this.plugins.fileBrowser,a=this.context.fileBrowser,f=a.tagArea.querySelector('a[title="'+l+'"]'),u=a.selectedTags,m=u.indexOf(l);m>-1?(u.splice(m,1),this.util.removeClass(f,"on")):(u.push(l),this.util.addClass(f,"on")),c._drawListItem.call(this,u.length===0?a.items:a.items.filter(function(y){return y.tag.some(function(_){return u.indexOf(_)>-1})}),!1)},onClickFile:function(s){s.preventDefault(),s.stopPropagation();const o=this.context.fileBrowser,l=o.list;let c=s.target,a=null;if(c===l)return;for(;l!==c.parentNode&&(a=c.getAttribute("data-command"),!a);)c=c.parentNode;if(!a)return;(o.selectorHandler||this.context[o.contextPlugin].selectorHandler)(c,c.parentNode.querySelector(".__se__img_name").textContent),this.plugins.fileBrowser.close.call(this)}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(sv);var nT=sv.exports;const rT=Di(nT),ov={name:"imageGallery",add:function(t){t.addModule([rT]);const n=t.context;n.imageGallery={title:t.lang.toolbar.imageGallery,directData:t.options.imageGalleryData,url:t.options.imageGalleryUrl,header:t.options.imageGalleryHeader,listClass:"se-image-list",itemTemplateHandler:this.drawItems,selectorHandler:this.setImage.bind(t),columnSize:4}},open:function(t){this.plugins.fileBrowser.open.call(this,"imageGallery",t)},drawItems:function(t){const n=t.src.split("/").pop();return'<div class="se-file-item-img"><img src="'+(t.thumbnail||t.src)+'" alt="'+(t.alt||n)+'" data-command="pick" data-value="'+(t.src||t.thumbnail)+'"><div class="se-file-img-name se-file-name-back"></div><div class="se-file-img-name __se__img_name">'+(t.name||n)+"</div></div>"},setImage:function(t,n){this.callPlugin("image",(function(){const r={name:n,size:0};this.plugins.image.create_image.call(this,t.getAttribute("data-value"),null,this.context.image._origin_w,this.context.image._origin_h,"none",r,t.alt)}).bind(this),null)}},av={blockquote:P2,align:L2,font:I2,fontSize:O2,fontColor:z2,hiliteColor:j2,horizontalRule:F2,list:H2,table:$2,formatBlock:V2,lineHeight:W2,template:U2,paragraphStyle:q2,textStyle:Y2,link:X2,image:tv,video:nv,audio:rv,math:iv,imageGallery:ov},iT=Object.freeze(Object.defineProperty({__proto__:null,align:L2,audio:rv,blockquote:P2,default:av,font:I2,fontColor:z2,fontSize:O2,formatBlock:V2,hiliteColor:j2,horizontalRule:F2,image:tv,imageGallery:ov,lineHeight:W2,link:X2,list:H2,math:iv,paragraphStyle:q2,table:$2,template:U2,textStyle:Y2,video:nv},Symbol.toStringTag,{value:"Module"})),sT=Cg(iT),Yf={rtl:{italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10.5 15.8" xml:space="preserve"><g><path d="M0.3,0.1c0.3,0,0.5,0,0.7,0c1,0.1,1.7,0.1,2.2,0.1H4L7.2,0l0.2,1.1H7c-0.5,0-1,0.1-1.5,0.3v0.4l0.3,1.9L6,4.4L6.3,6 l0.1,0.4l0.1,0.5c0.1,0.2,0.1,0.4,0.2,0.7s0.1,0.6,0.2,0.9L7,9.1l0.6,2.8l0.3,1.4c0.1,0.4,0.2,0.7,0.4,1c0.4,0.2,0.8,0.3,1.2,0.4 l0.8,0.2l0.2,0.9l-1.1,0c-0.9-0.1-1.5-0.1-1.8-0.1h-2c-0.9,0.1-1.4,0.2-1.5,0.2c-0.1,0-0.2,0-0.3,0H3.4c-0.1,0-0.2,0-0.2,0 l-0.1-0.4c0-0.2-0.1-0.4-0.1-0.6l0.7-0.1c0.4,0,0.8-0.1,1.2-0.2c0-0.1,0-0.2,0-0.3l-0.1-0.5l-0.4-2.4L4,9.6L3.4,6.4 C3.2,5.7,3,4.7,2.7,3.3c0-0.3-0.1-0.5-0.1-0.8C2.5,2.1,2.4,1.9,2.3,1.6C2,1.4,1.6,1.3,1.3,1.2C0.9,1.2,0.5,1.1,0.2,0.9L0,0.4L0,0 L0.3,0.1L0.3,0.1z"/></g></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 12.4" xml:space="preserve"><g><g><path d="M15.5,10.1L15.5,10.1c0.1,0,0.3,0.1,0.3,0.3v1.7c0,0.1,0,0.1-0.1,0.2c-0.1,0.1-0.1,0.1-0.2,0.1l-15.2,0 c-0.1,0-0.1,0-0.2-0.1C0,12.2,0,12.2,0,12.1l0-1.7c0-0.1,0-0.1,0.1-0.2c0.1-0.1,0.1-0.1,0.2-0.1C0.3,10.1,15.5,10.1,15.5,10.1z M9.8,6.7c0.1,0,0.1,0,0.2,0.1C10.1,6.9,10.1,7,10.1,7v1.7c0,0.1,0,0.2-0.1,0.2C10,9,9.9,9,9.8,9L0.3,9C0.2,9,0.1,9,0.1,8.9 C0,8.9,0,8.8,0,8.7V7C0,7,0,6.9,0.1,6.8c0.1-0.1,0.1-0.1,0.2-0.1C0.3,6.7,9.8,6.7,9.8,6.7z M0.3,3.4h9.6h0c0.1,0,0.3,0.1,0.3,0.3 v1.7v0c0,0.1-0.1,0.3-0.3,0.3H0.3c-0.1,0-0.1,0-0.2-0.1C0,5.5,0,5.4,0,5.3V3.6c0-0.1,0-0.1,0.1-0.2C0.1,3.4,0.2,3.4,0.3,3.4 L0.3,3.4z M0.3,0l15.2,0c0.1,0,0.1,0,0.2,0.1c0.1,0.1,0.1,0.1,0.1,0.2V2c0,0.1,0,0.2-0.1,0.2c-0.1,0.1-0.1,0.1-0.2,0.1H0.3 c-0.1,0-0.1,0-0.2-0.1C0,2.1,0,2,0,2l0-1.7c0-0.1,0-0.1,0.1-0.2C0.1,0,0.2,0,0.3,0z"/></g><path d="M13.1,3.5L15.7,6c0.1,0.1,0.1,0.3,0,0.4l-2.5,2.5C13.1,9,13,9,12.9,9c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2V3.7 c0-0.1,0-0.2,0.1-0.2c0.1-0.1,0.1-0.1,0.2-0.1C13,3.4,13.1,3.4,13.1,3.5z"/></g></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 12.4" xml:space="preserve"><g><g><path d="M15.5,10.1L15.5,10.1c0.1,0,0.3,0.1,0.3,0.3v1.7c0,0.1,0,0.1-0.1,0.2c-0.1,0.1-0.1,0.1-0.2,0.1l-15.2,0 c-0.1,0-0.1,0-0.2-0.1C0,12.2,0,12.2,0,12.1l0-1.7c0-0.1,0-0.1,0.1-0.2c0.1-0.1,0.1-0.1,0.2-0.1C0.3,10.1,15.5,10.1,15.5,10.1z M9.8,6.7c0.1,0,0.1,0,0.2,0.1C10.1,6.9,10.1,7,10.1,7v1.7c0,0.1,0,0.2-0.1,0.2C10,9,9.9,9,9.8,9L0.3,9C0.2,9,0.1,9,0.1,8.9 C0,8.9,0,8.8,0,8.7V7C0,7,0,6.9,0.1,6.8c0.1-0.1,0.1-0.1,0.2-0.1C0.3,6.7,9.8,6.7,9.8,6.7z M0.3,3.4h9.6h0c0.1,0,0.3,0.1,0.3,0.3 v1.7v0c0,0.1-0.1,0.3-0.3,0.3H0.3c-0.1,0-0.1,0-0.2-0.1C0,5.5,0,5.4,0,5.3V3.6c0-0.1,0-0.1,0.1-0.2C0.1,3.4,0.2,3.4,0.3,3.4 L0.3,3.4z M0.3,0l15.2,0c0.1,0,0.1,0,0.2,0.1c0.1,0.1,0.1,0.1,0.1,0.2V2c0,0.1,0,0.2-0.1,0.2c-0.1,0.1-0.1,0.1-0.2,0.1H0.3 c-0.1,0-0.1,0-0.2-0.1C0,2.1,0,2,0,2l0-1.7c0-0.1,0-0.1,0.1-0.2C0.1,0,0.2,0,0.3,0z"/></g><path d="M15.5,3.4c0.1,0,0.1,0,0.2,0.1c0.1,0.1,0.1,0.1,0.1,0.2v5.1c0,0.1,0,0.1-0.1,0.2C15.6,9,15.5,9,15.5,9 c-0.1,0-0.1,0-0.2-0.1l-2.5-2.5c-0.1-0.1-0.1-0.3,0-0.4l2.5-2.5C15.3,3.4,15.4,3.4,15.5,3.4z"/></g></svg>',list_bullets:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 12.4" xml:space="preserve"><g><path d="M12.4,10.7c0,0.9,0.8,1.7,1.7,1.7c0.9,0,1.7-0.8,1.7-1.7C15.7,9.8,15,9,14.1,9c-0.4,0-0.9,0.2-1.2,0.5 C12.5,9.8,12.4,10.2,12.4,10.7C12.4,10.7,12.4,10.7,12.4,10.7z M12.4,6.2c0,0.9,0.8,1.7,1.7,1.7c0.4,0,0.9-0.2,1.2-0.5 c0.3-0.3,0.4-0.7,0.4-1.1c0-0.9-0.7-1.7-1.6-1.7C13.1,4.6,12.4,5.3,12.4,6.2C12.4,6.2,12.4,6.2,12.4,6.2z M0,9.8v1.7 c0,0.1,0,0.1,0.1,0.2c0.1,0.1,0.1,0.1,0.2,0.1l10.7,0c0,0,0,0,0,0c0.1,0,0.3-0.1,0.3-0.3V9.8c0-0.1,0-0.1-0.1-0.2 C11.1,9.6,11,9.6,11,9.6l-10.7,0c-0.1,0-0.1,0-0.2,0.1C0,9.7,0,9.8,0,9.8L0,9.8z M12.9,2.9c0.3,0.3,0.7,0.5,1.2,0.5 c0.4,0,0.9-0.2,1.2-0.5c0.7-0.7,0.7-1.7,0-2.4C14.9,0.2,14.5,0,14.1,0c-0.4,0-0.9,0.2-1.2,0.5c-0.3,0.3-0.5,0.7-0.5,1.2 C12.4,2.1,12.5,2.6,12.9,2.9z M0,5.3V7c0,0.1,0,0.1,0.1,0.2c0.1,0.1,0.1,0.1,0.2,0.1H11c0.1,0,0.1,0,0.2-0.1 c0.1-0.1,0.1-0.1,0.1-0.2V5.3c0,0,0,0,0,0c0-0.1-0.1-0.3-0.3-0.3H0.3c-0.1,0-0.1,0-0.2,0.1C0,5.2,0,5.3,0,5.3L0,5.3z M0,0.8v1.7 c0,0.1,0,0.1,0.1,0.2c0.1,0.1,0.1,0.1,0.2,0.1h10.7c0.1,0,0.1,0,0.2-0.1c0,0,0.1-0.1,0.1-0.2V0.8c0-0.1,0-0.1-0.1-0.2 c0-0.1-0.1-0.1-0.2-0.1H0.3c-0.1,0-0.1,0-0.2,0.1C0,0.7,0,0.8,0,0.8L0,0.8z"/></g></svg>',list_number:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 15.7" xml:space="preserve"><g><path d="M0,11.5l0,1.7c0,0.1,0,0.1,0.1,0.2c0.1,0.1,0.1,0.1,0.2,0.1H11c0.1,0,0.2,0,0.2-0.1c0.1-0.1,0.1-0.1,0.1-0.2v-1.7 c0-0.1,0-0.1-0.1-0.2c-0.1-0.1-0.1-0.1-0.2-0.1H0.3c-0.1,0-0.2,0-0.2,0.1C0,11.4,0,11.4,0,11.5L0,11.5z M0,8.7c0,0.1,0,0.1,0.1,0.2 C0.1,8.9,0.2,9,0.3,9H11c0.1,0,0.2,0,0.2-0.1c0.1-0.1,0.1-0.1,0.1-0.2V7c0-0.1,0-0.1-0.1-0.2c-0.1-0.1-0.1-0.1-0.2-0.1l-10.7,0 c-0.1,0-0.2,0-0.2,0.1C0,6.8,0,6.9,0,7C0,7,0,8.7,0,8.7z M0,2.5v1.7c0,0.1,0,0.1,0.1,0.2c0,0,0.1,0.1,0.2,0.1l10.7,0 c0.1,0,0.2,0,0.2-0.1c0.1-0.1,0.1-0.1,0.1-0.2V2.4c0-0.1,0-0.1-0.1-0.2c-0.1,0-0.1,0-0.2,0H0.3c-0.1,0-0.1,0-0.2,0 C0,2.3,0,2.4,0,2.5L0,2.5z"/></g><path d="M15.6,14.2c0-0.3-0.1-0.6-0.3-0.8c-0.2-0.2-0.4-0.4-0.7-0.4l0.9-1v-0.8h-2.9v1.3h0.9v-0.5h0.9l0,0c-0.1,0.1-0.2,0.2-0.3,0.3 s-0.2,0.3-0.4,0.5l-0.3,0.3l0.2,0.5c0.6,0,0.9,0.1,0.9,0.5c0,0.1-0.1,0.3-0.2,0.4c-0.1,0.1-0.3,0.1-0.4,0.1c-0.3,0-0.7-0.1-0.9-0.3 l-0.5,0.8c0.4,0.4,0.9,0.6,1.5,0.6c0.4,0,0.9-0.1,1.2-0.4C15.5,15.1,15.6,14.7,15.6,14.2z"/><path d="M15.6,8.7h-0.9v0.5h-1.1c0-0.2,0.2-0.4,0.4-0.5c0.2-0.2,0.4-0.3,0.7-0.4c0.3-0.2,0.5-0.3,0.7-0.6c0.2-0.2,0.3-0.5,0.3-0.8 c0-0.4-0.2-0.8-0.5-1c-0.6-0.4-1.4-0.5-2-0.1c-0.3,0.2-0.5,0.4-0.6,0.7L13.3,7c0.1-0.3,0.4-0.5,0.7-0.5c0.1,0,0.3,0,0.3,0.1 c0.1,0.1,0.1,0.2,0.1,0.3c0,0.2-0.1,0.3-0.2,0.4c-0.2,0.1-0.3,0.3-0.5,0.4c-0.2,0.1-0.4,0.3-0.6,0.4c-0.2,0.2-0.4,0.4-0.5,0.6 c-0.1,0.2-0.2,0.5-0.2,0.8c0,0.2,0,0.3,0,0.5h3.2L15.6,8.7L15.6,8.7z"/><path d="M15.6,3.6h-1V0h-0.9l-1.2,1.1l0.6,0.7c0.2-0.1,0.3-0.3,0.4-0.5l0,0v2.2h-0.9v0.9h3L15.6,3.6L15.6,3.6z"/></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 15.7" xml:space="preserve"><g><path d="M7.4,9.9l3.1,3.1c0.3,0.3,0.8,0.5,1.3,0.5c0.5,0,0.9-0.2,1.3-0.5c0,0,0,0,0,0c0.7-0.7,0.7-1.9,0-2.6L9.9,7.3 c0-0.1,0-0.2,0-0.3C9.9,7,10,7,10.1,7l2.2-0.2c0.1,0,0.1,0,0.2,0.1l2.1,2.1c0.4,0.4,0.7,0.8,0.9,1.3c0.2,0.5,0.3,1,0.3,1.5 c0,0.5-0.1,1-0.3,1.5c-0.8,2-3.2,3-5.2,2.2c-0.5-0.2-0.9-0.5-1.3-0.9l-2.1-2.1c-0.1,0-0.1-0.1-0.1-0.2L7,10.1C7,10,7,9.9,7.1,9.9 C7.2,9.8,7.3,9.9,7.4,9.9z M1.2,1.1C1.6,0.7,2,0.4,2.5,0.3c1-0.4,2.1-0.4,3.1,0C6,0.4,6.5,0.7,6.8,1.1L9,3.2C9,3.3,9.1,3.3,9,3.4 L8.8,5.6c0,0.1-0.1,0.2-0.2,0.2c-0.1,0.1-0.2,0.1-0.3,0L5.3,2.7C5,2.3,4.5,2.1,4,2.1c-0.5,0-0.9,0.2-1.3,0.5c0,0,0,0,0,0 C2,3.4,2,4.5,2.7,5.2l3.1,3.2c0.1,0.1,0.1,0.2,0,0.3c0,0.1-0.1,0.1-0.2,0.1L3.5,9C3.4,9,3.4,9,3.3,8.9L1.2,6.8c0,0,0,0,0,0 C-0.4,5.2-0.4,2.7,1.2,1.1L1.2,1.1z M14.3,6h-2.6c0,0,0,0,0,0c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0.1-0.3l2.5-0.7 c0.1,0,0.1,0,0.2,0c0.1,0,0.1,0.1,0.1,0.2l0.1,0.8c0,0.1,0,0.1-0.1,0.2C14.5,6,14.4,6,14.3,6L14.3,6z M10.2,4.1 c0,0.1-0.1,0.2-0.2,0.2l0,0c0,0,0,0,0,0C9.8,4.2,9.7,4.1,9.8,4L9.7,1.4c0-0.1,0-0.1,0.1-0.2c0.1,0,0.1,0,0.2,0h0.8 c0.1,0,0.1,0,0.2,0.1c0,0.1,0,0.1,0,0.2L10.2,4.1L10.2,4.1z M1.5,9.7h1.3h1.3c0.1,0,0.2,0.1,0.2,0.2c0,0.1,0,0.2-0.1,0.3l-2.5,0.6 H1.6c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.1-0.2L1.2,9.9c0-0.1,0-0.1,0.1-0.2c0-0.1,0.1-0.1,0.2-0.1L1.5,9.7z M5.6,11.6 C5.6,11.6,5.6,11.6,5.6,11.6c0-0.1,0.1-0.2,0.3-0.1c0,0,0,0,0,0c0.1,0,0.2,0.1,0.2,0.2v2.6c0,0.1,0,0.1-0.1,0.2 c0,0-0.1,0.1-0.2,0.1L5,14.5c-0.1,0-0.1,0-0.2-0.1c0-0.1,0-0.1,0-0.2L5.6,11.6L5.6,11.6z"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 15.7" xml:space="preserve"><g><path d="M14.6,14.6c1.6-1.6,1.6-4.1,0-5.7l0,0l-3.1-3.1l-1.2,1.6l2.9,2.9c0.4,0.4,0.6,0.9,0.6,1.5c0,1.1-0.9,2.1-2.1,2.1l0,0 c-0.6,0-1.1-0.2-1.5-0.6l-0.4-0.4l-1.7,1l0.8,0.8C10.4,16.2,13,16.2,14.6,14.6L14.6,14.6L14.6,14.6z M3.6,6C3,5.9,2.6,5.5,2.3,5 S1.9,4,2.1,3.4C2.3,2.9,2.6,2.5,3,2.2C3.5,2,4.1,1.9,4.6,2l3.3,1.4l0.5-2L5.1,0.1C4-0.1,2.9,0,2,0.5C1.1,1.1,0.4,1.9,0.2,3 C-0.1,4,0,5.1,0.6,6C1.1,6.9,1.9,7.6,3,7.8l5.4,2l0.5-2L6.2,6.9L3.6,6z"/></g></svg>'},redo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.59 14.18"><g><path d="M11.58,18.48a6.84,6.84,0,1,1,6.85-6.85s0,.26,0,.67a8,8,0,0,1-.22,1.44l.91-.55a.51.51,0,0,1,.36,0,.45.45,0,0,1,.29.22.47.47,0,0,1,.06.36.45.45,0,0,1-.22.29L17.42,15.3l-.12,0h-.25l-.12-.06-.09-.09-.06-.07,0-.06-.87-2.12a.43.43,0,0,1,0-.37.49.49,0,0,1,.27-.26.41.41,0,0,1,.36,0,.53.53,0,0,1,.27.26l.44,1.09a6.51,6.51,0,0,0,.24-1.36,4.58,4.58,0,0,0,0-.64,5.83,5.83,0,0,0-1.73-4.17,5.88,5.88,0,0,0-8.34,0,5.9,5.9,0,0,0,4.17,10.06.51.51,0,0,1,.33.15.48.48,0,0,1,0,.68.53.53,0,0,1-.33.12Z" transform="translate(-4.48 -4.54)"/></g></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.59 14.18"><g><path d="M5,14a.43.43,0,0,1-.22-.29.46.46,0,0,1,.06-.36.43.43,0,0,1,.29-.22.56.56,0,0,1,.36,0l.91.55a8.27,8.27,0,0,1-.22-1.45,5.07,5.07,0,0,1,0-.67A6.85,6.85,0,1,1,13,18.47a.44.44,0,0,1-.33-.13.48.48,0,0,1,0-.68.51.51,0,0,1,.33-.15A5.89,5.89,0,0,0,17.15,7.45a5.88,5.88,0,0,0-8.33,0,5.84,5.84,0,0,0-1.73,4.17s0,.25,0,.65a6.49,6.49,0,0,0,.24,1.37l.44-1.09a.57.57,0,0,1,.27-.26.41.41,0,0,1,.36,0,.53.53,0,0,1,.27.26.43.43,0,0,1,0,.37L7.82,15l0,.09-.09.09-.1.07-.06,0H7.28l-.13,0-1.09-.63c-.65-.36-1-.57-1.1-.63Z" transform="translate(-4.49 -4.53)"/></g></svg>',bold:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.76 15.75"><g><path d="M6.4,3.76V19.5h6.76a5.55,5.55,0,0,0,2-.32,4.93,4.93,0,0,0,1.52-1,4.27,4.27,0,0,0,1.48-3.34,3.87,3.87,0,0,0-.69-2.37,5.74,5.74,0,0,0-.71-.83,3.44,3.44,0,0,0-1.1-.65,3.6,3.6,0,0,0,1.58-1.36,3.66,3.66,0,0,0,.53-1.93,3.7,3.7,0,0,0-1.21-2.87,4.65,4.65,0,0,0-3.25-1.1H6.4Zm2.46,6.65V5.57h3.52a4.91,4.91,0,0,1,1.36.15,2.3,2.3,0,0,1,.85.45,2.06,2.06,0,0,1,.74,1.71,2.3,2.3,0,0,1-.78,1.92,2.54,2.54,0,0,1-.86.46,4.7,4.7,0,0,1-1.32.15H8.86Zm0,7.27V12.15H12.7a4.56,4.56,0,0,1,1.38.17,3.43,3.43,0,0,1,.95.49,2.29,2.29,0,0,1,.92,2,2.73,2.73,0,0,1-.83,2.1,2.66,2.66,0,0,1-.83.58,3.25,3.25,0,0,1-1.26.2H8.86Z" transform="translate(-6.4 -3.75)"/></g></svg>',underline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9.78 15.74"><g><path d="M14.64,3.76h2.52v7.72a4.51,4.51,0,0,1-.59,2.31,3.76,3.76,0,0,1-1.71,1.53,6.12,6.12,0,0,1-2.64.53,5,5,0,0,1-3.57-1.18,4.17,4.17,0,0,1-1.27-3.24V3.76H9.9v7.3a3,3,0,0,0,.55,2,2.3,2.3,0,0,0,1.83.65,2.26,2.26,0,0,0,1.8-.65,3.09,3.09,0,0,0,.55-2V3.76Zm2.52,13.31V19.5H7.39V17.08h9.77Z" transform="translate(-7.38 -3.76)"/></g></svg>',italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10.49 15.76"><g><path d="M17.16,3.79l.37,0-.06.38-.14.52A10,10,0,0,1,16.21,5a9.37,9.37,0,0,0-1,.32,6.68,6.68,0,0,0-.25.89c-.06.31-.11.59-.14.85-.3,1.36-.52,2.41-.68,3.14l-.61,3.18L13.1,15l-.43,2.4-.12.46a.62.62,0,0,0,0,.28c.44.1.85.17,1.23.22l.68.11a4.51,4.51,0,0,1-.08.6l-.09.42a.92.92,0,0,0-.23,0l-.43,0a1.37,1.37,0,0,1-.29,0c-.13,0-.63-.08-1.49-.16l-2,0c-.28,0-.87,0-1.78.12L7,19.5l.17-.88.8-.2A6.61,6.61,0,0,0,9.19,18,2.62,2.62,0,0,0,9.61,17l.28-1.41.58-2.75.12-.66c.05-.3.11-.58.17-.86s.12-.51.17-.69l.12-.48.12-.43.31-1.6.15-.65.31-1.91V5.14a3.86,3.86,0,0,0-1.48-.29l-.38,0,.2-1.06,3.24.14.75,0c.45,0,1.18,0,2.18-.09.23,0,.46,0,.71,0Z" transform="translate(-7.04 -3.76)"/></g></svg>',strike:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.9"><g><path d="M12.94,13a4.27,4.27,0,0,1,1.32.58,1.46,1.46,0,0,1,.55,1.2,1.87,1.87,0,0,1-.88,1.64,4.17,4.17,0,0,1-2.35.59,4.44,4.44,0,0,1-2.74-.71,2.72,2.72,0,0,1-1-2.17H5.57a4.56,4.56,0,0,0,1.55,3.7,7,7,0,0,0,4.47,1.23,6,6,0,0,0,4.07-1.3,4.24,4.24,0,0,0,1.52-3.37,4,4,0,0,0-.26-1.4h-4ZM6.37,10.24A3.27,3.27,0,0,1,6,8.68a4,4,0,0,1,1.48-3.3,5.92,5.92,0,0,1,3.88-1.21,5.58,5.58,0,0,1,3.91,1.24,4.36,4.36,0,0,1,1.45,3.17H14.44a2.12,2.12,0,0,0-.91-1.81,4.45,4.45,0,0,0-2.44-.55,3.69,3.69,0,0,0-2,.51A1.64,1.64,0,0,0,8.3,8.22a1.3,1.3,0,0,0,.48,1.11,7,7,0,0,0,2.1.78l.28.06.28.08H6.37Zm13.09.68a.73.73,0,0,1,.49.21.66.66,0,0,1,.2.48.64.64,0,0,1-.2.48.71.71,0,0,1-.49.19H5.1a.67.67,0,0,1-.49-.19.66.66,0,0,1-.2-.48.64.64,0,0,1,.2-.48.73.73,0,0,1,.49-.21H19.46Z" transform="translate(-4.41 -4.17)"/></g></svg>',subscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 14.61"><g><path d="M15.38,4.33H12.74L11.19,7c-.28.46-.51.87-.69,1.21L10.07,9h0l-.44-.8c-.22-.4-.45-.81-.71-1.23L7.34,4.33H4.68L8.26,10,4.4,16.08H7.1l1.69-2.83c.38-.63.72-1.22,1-1.78l.25-.46h0l.49.92c.24.45.48.89.74,1.32L13,16.08h2.61L11.84,10l1.77-2.84,1.77-2.85Zm4.77,13.75H17v-.15c0-.4.05-.64.16-.72a4.42,4.42,0,0,1,1.16-.31,3.3,3.3,0,0,0,1.54-.56A1.84,1.84,0,0,0,20.15,15a1.78,1.78,0,0,0-.44-1.41A2.8,2.8,0,0,0,18,13.25a2.71,2.71,0,0,0-1.69.37,1.83,1.83,0,0,0-.44,1.43v.23H17v-.23q0-.63.18-.78a1.62,1.62,0,0,1,.88-.15,1.59,1.59,0,0,1,.88.15q.18.15.18.75t-.18.75a3.58,3.58,0,0,1-1.18.33,3.33,3.33,0,0,0-1.52.51,1.57,1.57,0,0,0-.32,1.18v1.15h4.27v-.86Z" transform="translate(-4.4 -4.33)"/></g></svg>',superscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.42"><g><path d="M12,13.14l3.61-5.81H12.94L11.33,10c-.28.46-.51.88-.69,1.25l-.45.83h0l-.45-.85c-.22-.41-.45-.82-.71-1.24L7.4,7.33H4.68l3.66,5.81L4.4,19.33H7.14l1.74-2.87q.58-1,1-1.83l.25-.48h0l.51.94.75,1.37,1.72,2.87h2.67l-1.92-3.09c-1.12-1.8-1.76-2.83-1.92-3.1Zm4.84-4.41h0l0,.15h3.27v.86H15.77V8.58a1.66,1.66,0,0,1,.33-1.22,3.51,3.51,0,0,1,1.56-.51,3.68,3.68,0,0,0,1.21-.34c.13-.1.19-.36.19-.77S19,5.07,18.87,5A1.63,1.63,0,0,0,18,4.8a1.58,1.58,0,0,0-.91.17c-.13.11-.19.38-.19.8V6H15.78V5.76a1.87,1.87,0,0,1,.45-1.47A2.84,2.84,0,0,1,18,3.91a2.8,2.8,0,0,1,1.72.38,1.84,1.84,0,0,1,.45,1.44,1.91,1.91,0,0,1-.34,1.35,3.24,3.24,0,0,1-1.58.57A3.69,3.69,0,0,0,17,8c-.12.1-.17.35-.17.76Z" transform="translate(-4.4 -3.91)"/></g></svg>',erase:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.76"><g><path d="M13.69,17.2h6.46v1.31H8.56L4.41,14.37,14,4.75l6.06,6.06L16.89,14l-3.2,3.19Zm-4.61,0h2.77L14.09,15,9.88,10.75,6.25,14.38l1.41,1.41c.84.82,1.31,1.29,1.42,1.41Z" transform="translate(-4.41 -4.75)"/></g></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M4.68,14.45a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V9.1a.27.27,0,0,1,.08-.19.28.28,0,0,1,.2-.08.25.25,0,0,1,.19.07l2.54,2.54a.29.29,0,0,1,0,.4L4.88,14.36a.24.24,0,0,1-.2.09Zm15.19,1.12a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87Zm0-3.38a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm0-3.37a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm.2-3.29a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M19.87,15.57a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87ZM7.5,14.45a.25.25,0,0,1-.2-.09L4.76,11.84a.29.29,0,0,1,0-.4L7.3,8.9a.29.29,0,0,1,.4,0,.31.31,0,0,1,.07.2v5.06a.32.32,0,0,1-.08.21.26.26,0,0,1-.19.08ZM19.87,8.82a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm0,3.37a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm.2-6.66a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',expansion:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M11.8,13.06l-5.1,5.1H9.51V19.5H4.41V14.4H5.75v2.81L8.3,14.66q2.25-2.23,2.55-2.55Zm8.35-9.3v5.1H18.81V6.05l-5.1,5.1-1-1,5.1-5.1H15.05V3.76Z" transform="translate(-4.41 -3.76)"/></g></svg>',reduction:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M14.91,10h2.87v1.38H12.55V6.12h1.38V9l5.24-5.24.48.49.49.48ZM6.77,11.92H12v5.23H10.62V14.26L5.37,19.5l-1-1L9.63,13.3H6.77Z" transform="translate(-4.4 -3.76)"/></g></svg>',code_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 11.8"><g><path d="M8.09,7.94a.76.76,0,0,1,.53.22.72.72,0,0,1,.21.52.76.76,0,0,1-.22.54L6.18,11.63l2.43,2.44a.69.69,0,0,1,.2.51.66.66,0,0,1-.21.51.75.75,0,0,1-.51.22.63.63,0,0,1-.51-.21h0L4.63,12.15a.7.7,0,0,1-.22-.53.67.67,0,0,1,.25-.55L7.57,8.16a.82.82,0,0,1,.52-.22Zm12.05,3.69a.7.7,0,0,1-.23.52L17,15.1h0a.66.66,0,0,1-.51.21.73.73,0,0,1-.51-.22.75.75,0,0,1-.22-.51.63.63,0,0,1,.21-.51l2.43-2.44L15.92,9.22a.73.73,0,0,1-.22-.53A.74.74,0,0,1,17,8.18h0l2.91,2.91a.67.67,0,0,1,.27.54Zm-5.9-5.9a.73.73,0,0,1,.61.32.71.71,0,0,1,.07.68L11,17a1,1,0,0,1-.22.32.6.6,0,0,1-.35.16.75.75,0,0,1-.69-.26.69.69,0,0,1-.12-.72L13.56,6.23a.75.75,0,0,1,.26-.35.74.74,0,0,1,.42-.15Z" transform="translate(-4.41 -5.73)"/></g></svg>',preview:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.65 15.66"><g><path d="M16.19,14.43l2.49,2.49a.73.73,0,0,1,.21.52.67.67,0,0,1-.22.51.7.7,0,0,1-.52.22.69.69,0,0,1-.51-.21l-2.49-2.48a5.17,5.17,0,0,1-1.34.69,4.64,4.64,0,0,1-1.48.24,4.78,4.78,0,1,1,0-9.56,4.79,4.79,0,0,1,1.84.36,4.9,4.9,0,0,1,1.56,1,4.77,4.77,0,0,1,.46,6.18ZM10,14a3.3,3.3,0,0,0,2.34.93A3.37,3.37,0,0,0,14.7,14a3.3,3.3,0,0,0-1.08-5.41,3.47,3.47,0,0,0-2.56,0A3,3,0,0,0,10,9.28,3.31,3.31,0,0,0,10,14ZM16,4a3.86,3.86,0,0,1,2.77,1.14A3.9,3.9,0,0,1,20,7.85v4a.77.77,0,0,1-.22.53.7.7,0,0,1-.52.21.72.72,0,0,1-.74-.74v-4a2.46,2.46,0,0,0-.72-1.73A2.37,2.37,0,0,0,16,5.45H8.53A2.42,2.42,0,0,0,6.08,7.89v7.52a2.41,2.41,0,0,0,.71,1.73,2.46,2.46,0,0,0,1.74.72h4.08a.73.73,0,0,1,0,1.46H8.53a3.85,3.85,0,0,1-2.78-1.14A3.93,3.93,0,0,1,4.6,15.4V7.87A3.94,3.94,0,0,1,5.76,5.09,3.88,3.88,0,0,1,8.54,4H16Z" transform="translate(-4.45 -3.8)"/></g></svg>',print:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16.05 16.04"><g><path d="M19.76,15.84a1.29,1.29,0,0,0,.39-.92V8.35A2.05,2.05,0,0,0,19.57,7a1.93,1.93,0,0,0-1.38-.57H6.37a1.95,1.95,0,0,0-2,2v6.56a1.23,1.23,0,0,0,.38.92,1.35,1.35,0,0,0,.93.38h2V14.9l-2,0V8.35a.67.67,0,0,1,.18-.47.62.62,0,0,1,.48-.19H18.18a.6.6,0,0,1,.46.19.66.66,0,0,1,.18.47V14.9h-2v1.32h2A1.35,1.35,0,0,0,19.76,15.84ZM17.52,7.69V5.06a1.31,1.31,0,0,0-.38-.92,1.34,1.34,0,0,0-.94-.38H8.34A1.3,1.3,0,0,0,7,5.06V7.69H8.34V5.06h7.87V7.69h1.31ZM8.34,12.93h7.87l0,5.26H8.34V12.93Zm7.87,5.26v0Zm.65,1.31a.6.6,0,0,0,.46-.19.72.72,0,0,0,.2-.47V12.29a.74.74,0,0,0-.2-.47.6.6,0,0,0-.46-.19H7.68a.6.6,0,0,0-.46.19.72.72,0,0,0-.2.47v6.55a.74.74,0,0,0,.2.47.6.6,0,0,0,.46.19h9.18ZM16.67,9.28a.7.7,0,0,0-.94,0,.63.63,0,0,0-.18.46.67.67,0,0,0,.18.47.68.68,0,0,0,.94,0,.66.66,0,0,0,.18-.47A.58.58,0,0,0,16.67,9.28Z" transform="translate(-4.25 -3.61)"/></g></svg>',template:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.27 15.64"><g><path d="M18.18,19.16a1,1,0,0,0,1-1V5.73a1,1,0,0,0-1-1h-2v1h2V18.19H6.37V5.73h2v-1h-2A.94.94,0,0,0,5.68,5a1,1,0,0,0-.29.7V18.18a.94.94,0,0,0,.29.69,1,1,0,0,0,.69.29H18.18ZM9.82,10.31h4.92a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.49.49,0,0,0-.15-.35.47.47,0,0,0-.35-.15H9.82a.49.49,0,0,0-.35.15.47.47,0,0,0-.15.35.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15Zm5.9,4.92H8.83a.49.49,0,0,0-.35.15.47.47,0,0,0-.15.35.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15h6.89a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.51.51,0,0,0-.5-.5ZM7.36,12.77a.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15h8.85a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.49.49,0,0,0-.15-.35.47.47,0,0,0-.35-.15H7.85a.49.49,0,0,0-.35.15.52.52,0,0,0-.14.35Z" transform="translate(-5.14 -3.77)"/><path d="M14.24,6.71a1,1,0,0,0,1-1,1,1,0,0,0-1-1,1,1,0,0,0-1-1h-2a.94.94,0,0,0-.69.28,1,1,0,0,0-.29.7A.94.94,0,0,0,9.62,5a.91.91,0,0,0-.29.69,1,1,0,0,0,.29.7,1,1,0,0,0,.69.29h3.93Z" transform="translate(-5.14 -3.77)"/></g></svg>',line_height:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 13.56"><g><path d="M4.4,4.88V8.26a2,2,0,0,0,.5.39s.1,0,.18-.12a.62.62,0,0,0,.17-.28c.06-.19.13-.44.21-.74s.14-.52.19-.66a.58.58,0,0,1,.21-.3,2.41,2.41,0,0,1,.63-.21,3.83,3.83,0,0,1,.88-.12,9.15,9.15,0,0,1,1.31.06.16.16,0,0,1,.11,0,.26.26,0,0,1,.06.14,4,4,0,0,1,0,.49v2l.05,3.77c0,1.41,0,2.68-.05,3.81a1.79,1.79,0,0,1-.11.49,10.68,10.68,0,0,1-1.4.45,1.12,1.12,0,0,0-.69.43v.31l0,.22.61,0c.85-.08,1.54-.12,2.06-.12a19.76,19.76,0,0,1,2.09.08,15.08,15.08,0,0,0,1.64.08,1.4,1.4,0,0,0,.29,0,1.58,1.58,0,0,0,0-.26l-.05-.43a2.26,2.26,0,0,0-.43-.17l-.77-.22-.15,0a2.55,2.55,0,0,1-.78-.28,2.56,2.56,0,0,1-.11-.75l0-1.29,0-3.15V7.53a10.51,10.51,0,0,1,.06-1.2,3.83,3.83,0,0,1,.6,0l1.88,0a2.18,2.18,0,0,1,.38,0,.45.45,0,0,1,.23.17.9.9,0,0,1,.05.25c0,.16.06.35.1.58a3.33,3.33,0,0,0,.14.55A6.39,6.39,0,0,0,15,9a2.91,2.91,0,0,0,.6-.15,2.77,2.77,0,0,0,0-.46l0-.51,0-2.95-.25,0-.38,0L15,4.94a.71.71,0,0,1-.18.15.45.45,0,0,1-.25.07l-.29,0H8.75l-.15,0H7.45a17,17,0,0,1-1.86,0L5.36,5l-.25-.13ZM19.75,16.14h-.69v-9h.69A.4.4,0,0,0,20.13,7c.06-.11,0-.24-.1-.39L18.92,5.15a.52.52,0,0,0-.86,0L17,6.58c-.12.15-.16.28-.1.39s.18.16.38.16h.69v9h-.69a.4.4,0,0,0-.38.16c-.06.11,0,.24.1.39l1.11,1.43a.52.52,0,0,0,.86,0L20,16.69c.12-.15.16-.28.1-.39a.4.4,0,0,0-.38-.16Z" transform="translate(-4.4 -4.86)"/></g></svg>',paragraph_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.74"><g><path d="M18.18,3.76v2h-2V19.5h-2V5.73h-2V19.5h-2V11.63a3.94,3.94,0,0,1,0-7.87h7.87Z" transform="translate(-6.37 -3.76)"/></g></svg>',text_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13.76 15.74"><g><path d="M17.68,6.71a2.22,2.22,0,0,0,1.06-.22.74.74,0,0,0,.42-.7.73.73,0,0,0-.08-.33.67.67,0,0,0-.17-.22,1,1,0,0,0-.31-.15L18.26,5l-.45-.09A15.27,15.27,0,0,0,13.26,5V4.74c0-.66-.63-1-1.92-1-.24,0-.43.15-.59.46a4,4,0,0,0-.36,1.14h0v0a26.45,26.45,0,0,1-3.5.35A2,2,0,0,0,5.77,6a.84.84,0,0,0-.37.79,2.14,2.14,0,0,0,.41,1.29,1.23,1.23,0,0,0,1.05.63,16.62,16.62,0,0,0,3.29-.45l-.34,3.35c-.16,1.61-.29,2.9-.37,3.86s-.12,1.66-.12,2.09l0,.65a5.15,5.15,0,0,0,.05.6,1.28,1.28,0,0,0,.16.54.34.34,0,0,0,.28.18,1.16,1.16,0,0,0,.79-.46,3.66,3.66,0,0,0,.68-1,22.08,22.08,0,0,0,1-4.33q.49-3.1.78-6.15a24.69,24.69,0,0,1,4.62-.84Z" transform="translate(-5.4 -3.76)"/></g></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M18.53,19.5l.2-.05A1.78,1.78,0,0,0,20.13,18l0-.09V7.14a2,2,0,0,0-.28-.64A3.18,3.18,0,0,0,19.43,6c-.5-.52-1-1-1.55-1.54A2.59,2.59,0,0,0,17.37,4a1.83,1.83,0,0,0-.61-.25H6l-.21,0a1.78,1.78,0,0,0-1.4,1.49l0,.1V17.87a2.49,2.49,0,0,0,.09.37,1.79,1.79,0,0,0,1.44,1.23l.09,0Zm-6.25-.6H6.92a.61.61,0,0,1-.68-.48.78.78,0,0,1,0-.22V12.3a.62.62,0,0,1,.69-.68H17.64a.62.62,0,0,1,.69.69V18.2a.64.64,0,0,1-.71.69H12.28ZM12,9.81H8.15a.63.63,0,0,1-.72-.71v-4a.64.64,0,0,1,.72-.72h7.66a.64.64,0,0,1,.72.72v4a.65.65,0,0,1-.74.72ZM13.5,5V9.18h1.78V5Z" transform="translate(-4.41 -3.76)"/></g></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 475.082 475.081"><g><path d="M164.45,219.27h-63.954c-7.614,0-14.087-2.664-19.417-7.994c-5.327-5.33-7.994-11.801-7.994-19.417v-9.132c0-20.177,7.139-37.401,21.416-51.678c14.276-14.272,31.503-21.411,51.678-21.411h18.271c4.948,0,9.229-1.809,12.847-5.424c3.616-3.617,5.424-7.898,5.424-12.847V54.819c0-4.948-1.809-9.233-5.424-12.85c-3.617-3.612-7.898-5.424-12.847-5.424h-18.271c-19.797,0-38.684,3.858-56.673,11.563c-17.987,7.71-33.545,18.132-46.68,31.267c-13.134,13.129-23.553,28.688-31.262,46.677C3.855,144.039,0,162.931,0,182.726v200.991c0,15.235,5.327,28.171,15.986,38.834c10.66,10.657,23.606,15.985,38.832,15.985h109.639c15.225,0,28.167-5.328,38.828-15.985c10.657-10.663,15.987-23.599,15.987-38.834V274.088c0-15.232-5.33-28.168-15.994-38.832C192.622,224.6,179.675,219.27,164.45,219.27z"/><path d="M459.103,235.256c-10.656-10.656-23.599-15.986-38.828-15.986h-63.953c-7.61,0-14.089-2.664-19.41-7.994c-5.332-5.33-7.994-11.801-7.994-19.417v-9.132c0-20.177,7.139-37.401,21.409-51.678c14.271-14.272,31.497-21.411,51.682-21.411h18.267c4.949,0,9.233-1.809,12.848-5.424c3.613-3.617,5.428-7.898,5.428-12.847V54.819c0-4.948-1.814-9.233-5.428-12.85c-3.614-3.612-7.898-5.424-12.848-5.424h-18.267c-19.808,0-38.691,3.858-56.685,11.563c-17.984,7.71-33.537,18.132-46.672,31.267c-13.135,13.129-23.559,28.688-31.265,46.677c-7.707,17.987-11.567,36.879-11.567,56.674v200.991c0,15.235,5.332,28.171,15.988,38.834c10.657,10.657,23.6,15.985,38.828,15.985h109.633c15.229,0,28.171-5.328,38.827-15.985c10.664-10.663,15.985-23.599,15.985-38.834V274.088C475.082,258.855,469.76,245.92,459.103,235.256z"/></g></svg>',arrow_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 8.67"><g><path d="M18.79,7.52a.8.8,0,0,1,.56-.23.82.82,0,0,1,.79.79.8.8,0,0,1-.23.56l-7.07,7.07a.79.79,0,0,1-.57.25.77.77,0,0,1-.57-.25h0L4.64,8.65a.8.8,0,0,1-.23-.57.82.82,0,0,1,.79-.79.8.8,0,0,1,.56.23L12.28,14l3.26-3.26,3.25-3.26Z" transform="translate(-4.41 -7.29)"/></g></svg>',align_justify:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm0,5.9H20.15v-2H4.41v2Zm0,3.94H20.15v-2H4.41v2Zm0,3.93h7.87v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm11.8,3.94H4.41v2H16.22v-2Zm-11.8,5.9H18.18v-2H4.41v2Zm0,3.93h9.84v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm3.93,5.9H20.15v-2H8.34v2Zm-2,3.94H20.14v-2H6.37v2Zm3.94,3.93h9.84v-2H10.31v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm2,3.94v2H18.18v-2H6.37Zm-1,5.9H19.16v-2H5.39v2Zm2,3.93H17.2v-2H7.36v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',font_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.61"><g><path d="M18.5,15.57,14.28,4.32h-3.4L6.65,15.57h3l.8-2.26h4.23l.8,2.26h3ZM14,11.07H11.14L12.54,7,13.25,9c.41,1.18.64,1.86.7,2ZM4.41,16.69v2.24H20.15V16.69H4.41Z" transform="translate(-4.41 -4.32)"/></g></svg>',highlight_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.66 15.74"><g><path d="M12.32,9.31,13.38,13H11.21l.52-1.83q.46-1.61.54-1.83ZM4.44,3.76H20.1V19.5H4.44V3.76ZM14.71,17.32h2.63L13.7,6H10.89L7.26,17.32H9.89l.63-2.24h3.55l.32,1.12c.18.65.29,1,.32,1.12Z" transform="translate(-4.44 -3.76)"/></g></svg>',list_bullets:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.37"><g><path d="M7.77,16.12a1.59,1.59,0,0,0-.49-1.18,1.62,1.62,0,0,0-1.19-.49,1.68,1.68,0,1,0,0,3.36,1.67,1.67,0,0,0,1.68-1.69Zm0-4.48A1.67,1.67,0,0,0,6.09,10,1.68,1.68,0,0,0,4.9,12.82a1.62,1.62,0,0,0,1.19.49,1.67,1.67,0,0,0,1.68-1.67Zm12.38,3.64a.27.27,0,0,0-.08-.19.28.28,0,0,0-.2-.09H9.19a.28.28,0,0,0-.2.08.29.29,0,0,0-.08.19V17a.27.27,0,0,0,.28.28H19.87a.27.27,0,0,0,.19-.08.24.24,0,0,0,.08-.2V15.28ZM7.77,7.13a1.63,1.63,0,0,0-.49-1.2,1.61,1.61,0,0,0-1.19-.49,1.61,1.61,0,0,0-1.19.49,1.71,1.71,0,0,0,0,2.4,1.62,1.62,0,0,0,1.19.49,1.61,1.61,0,0,0,1.19-.49,1.63,1.63,0,0,0,.49-1.2Zm12.38,3.66a.28.28,0,0,0-.08-.2.29.29,0,0,0-.19-.08H9.19a.27.27,0,0,0-.28.28v1.69a.27.27,0,0,0,.08.19.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08.25.25,0,0,0,.08-.19V10.79Zm0-4.5a.27.27,0,0,0-.08-.19A.25.25,0,0,0,19.88,6H9.19A.28.28,0,0,0,9,6.1a.26.26,0,0,0-.08.19V8A.27.27,0,0,0,9,8.17a.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08A.25.25,0,0,0,20.14,8V6.29Z" transform="translate(-4.41 -5.44)"/></g></svg>',list_number:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.69 15.74"><g><path d="M7.66,18a1.24,1.24,0,0,0-.26-.78,1.17,1.17,0,0,0-.72-.42l.85-1V15H4.58v1.34h.94v-.46l.85,0h0c-.11.11-.22.23-.32.35s-.23.27-.37.47L5.39,17l.23.51c.61-.05.92.11.92.49a.42.42,0,0,1-.18.37.79.79,0,0,1-.45.12A1.41,1.41,0,0,1,5,18.15l-.51.77A2.06,2.06,0,0,0,6,19.5a1.8,1.8,0,0,0,1.2-.41A1.38,1.38,0,0,0,7.66,18Zm0-5.54H6.75V13H5.63A.72.72,0,0,1,6,12.51a5.45,5.45,0,0,1,.66-.45,2.71,2.71,0,0,0,.67-.57,1.19,1.19,0,0,0,.31-.81,1.29,1.29,0,0,0-.45-1,1.86,1.86,0,0,0-2-.11,1.51,1.51,0,0,0-.62.7l.74.52A.87.87,0,0,1,6,10.28a.51.51,0,0,1,.35.12.42.42,0,0,1,.13.33.55.55,0,0,1-.21.4,3,3,0,0,1-.5.38c-.19.13-.39.27-.58.42a2,2,0,0,0-.5.6,1.63,1.63,0,0,0-.21.81,3.89,3.89,0,0,0,.05.48h3.2V12.44Zm12.45,2.82a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2V17a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V15.26ZM7.69,7.32h-1V3.76H5.8L4.6,4.88l.63.68a1.85,1.85,0,0,0,.43-.48h0l0,2.24H4.74V8.2h3V7.32Zm12.43,3.42a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2v1.71a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V10.74Zm0-4.52A.27.27,0,0,0,20,6,.28.28,0,0,0,19.83,6H9.1A.32.32,0,0,0,8.89,6a.24.24,0,0,0-.08.19V7.93a.27.27,0,0,0,.08.19.32.32,0,0,0,.21.08H19.83A.32.32,0,0,0,20,8.12a.26.26,0,0,0,.08-.2V6.22Z" transform="translate(-4.43 -3.76)"/></g></svg>',table:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M4.41,8.05V3.76H8.7V8.05H4.41Zm5.71,0V3.76h4.3V8.05h-4.3Zm5.74-4.29h4.29V8.05H15.86V3.76Zm-11.45,10V9.48H8.7v4.3H4.41Zm5.71,0V9.48h4.3v4.3h-4.3Zm5.74,0V9.48h4.29v4.3H15.86ZM4.41,19.5V15.21H8.7V19.5H4.41Zm5.71,0V15.21h4.3V19.5h-4.3Zm5.74,0V15.21h4.29V19.5H15.86Z" transform="translate(-4.41 -3.76)"/></g></svg>',horizontal_rule:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 2.24"><g><path d="M20.15,12.75V10.51H4.41v2.24H20.15Z" transform="translate(-4.41 -10.51)"/></g></svg>',show_blocks:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.66 15.67"><g><path d="M19.72,5.58a1.64,1.64,0,0,0-1.64-1.64H6.23a1.62,1.62,0,0,0-1.16.48,1.63,1.63,0,0,0-.48,1.16V9.63a1.6,1.6,0,0,0,.48,1.16,1.62,1.62,0,0,0,1.16.47H18.09a1.67,1.67,0,0,0,1.16-.47,1.62,1.62,0,0,0,.48-1.16V5.58Zm-.94,4.05a.68.68,0,0,1-.7.7H6.23a.66.66,0,0,1-.48-.2.74.74,0,0,1-.21-.5V5.58a.66.66,0,0,1,.2-.48.71.71,0,0,1,.48-.21H18.08a.74.74,0,0,1,.5.21.66.66,0,0,1,.2.48ZM6.48,7.72a.21.21,0,0,0,.17-.07.22.22,0,0,0,.07-.17V7.06a1.27,1.27,0,0,1,.11-.52.37.37,0,0,1,.36-.23H8.77A.25.25,0,0,0,9,6.17a.19.19,0,0,0,0-.23.27.27,0,0,0-.2-.12H7.19a.88.88,0,0,0-.72.39,1.51,1.51,0,0,0-.23.85v.42a.24.24,0,0,0,.24.24Zm-.19.81a.21.21,0,0,0,.17-.07.26.26,0,0,0,.07-.17.24.24,0,0,0-.24-.24.2.2,0,0,0-.16.09.2.2,0,0,0-.07.16.22.22,0,0,0,.07.17.23.23,0,0,0,.16.06Zm8.46,5.1a1.63,1.63,0,0,0-.47-1.16A1.61,1.61,0,0,0,13.12,12H6.23a1.6,1.6,0,0,0-1.16.46,1.62,1.62,0,0,0-.48,1.16v4.05a1.64,1.64,0,0,0,1.64,1.64h6.89a1.6,1.6,0,0,0,1.16-.48,1.62,1.62,0,0,0,.47-1.16Zm-.94,4a.7.7,0,0,1-.2.49.65.65,0,0,1-.5.2H6.23a.66.66,0,0,1-.48-.2.75.75,0,0,1-.21-.49v-4a.74.74,0,0,1,.21-.5.66.66,0,0,1,.48-.2h6.89a.68.68,0,0,1,.7.7v4Zm6.15,0v-4a1.6,1.6,0,0,0-.48-1.16A1.67,1.67,0,0,0,18.32,12H17.1a1.63,1.63,0,0,0-1.16.47,1.61,1.61,0,0,0-.47,1.16v4a1.67,1.67,0,0,0,.47,1.16,1.62,1.62,0,0,0,1.16.48h1.22A1.64,1.64,0,0,0,20,17.68Zm-.94-4v4a.75.75,0,0,1-.21.49.62.62,0,0,1-.48.2H17.11a.69.69,0,0,1-.5-.2.7.7,0,0,1-.2-.49v-4a.68.68,0,0,1,.7-.7h1.22a.66.66,0,0,1,.48.2.72.72,0,0,1,.21.5Z" transform="translate(-4.44 -3.79)"/></g></svg>',cancel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M14.15,11.63l5.61,5.61a1.29,1.29,0,0,1,.38.93,1.27,1.27,0,0,1-.4.93,1.25,1.25,0,0,1-.92.4,1.31,1.31,0,0,1-.94-.4l-5.61-5.61L6.67,19.1a1.31,1.31,0,0,1-.94.4,1.24,1.24,0,0,1-.92-.4,1.27,1.27,0,0,1-.4-.93,1.33,1.33,0,0,1,.38-.93l5.61-5.63L4.79,6a1.26,1.26,0,0,1-.38-.93,1.22,1.22,0,0,1,.4-.92,1.28,1.28,0,0,1,.92-.39,1.38,1.38,0,0,1,.94.38l5.61,5.61,5.61-5.61a1.33,1.33,0,0,1,.94-.38,1.26,1.26,0,0,1,.92.39,1.24,1.24,0,0,1,.4.92,1.29,1.29,0,0,1-.39.93L17,8.81l-2.8,2.82Z" transform="translate(-4.41 -3.76)"/></g></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.77"><g><path d="M8.77,8.72a.88.88,0,0,1-.61-.27.82.82,0,0,1-.25-.61.89.89,0,0,1,.25-.62A.82.82,0,0,1,8.77,7a.81.81,0,0,1,.61.25.83.83,0,0,1,.27.62.81.81,0,0,1-.25.61.91.91,0,0,1-.63.27Zm9.62-5a1.74,1.74,0,0,1,1.76,1.76V17.76a1.74,1.74,0,0,1-1.76,1.76H6.16A1.74,1.74,0,0,1,4.4,17.76V5.51A1.74,1.74,0,0,1,6.16,3.75H18.39Zm0,1.75H6.16v8L8.53,11.8a.94.94,0,0,1,.54-.17.86.86,0,0,1,.54.2L11.09,13l3.64-4.55a.78.78,0,0,1,.34-.25.85.85,0,0,1,.42-.07.89.89,0,0,1,.39.12.78.78,0,0,1,.28.29l2.24,3.67V5.51Zm0,12.24V15.6L15.3,10.53,11.89,14.8a.89.89,0,0,1-.59.32.82.82,0,0,1-.64-.18L9,13.62,6.16,15.74v2Z" transform="translate(-4.4 -3.75)"/></g></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.55"><g><path d="M20.15,10.26V18.9l-3.94-1.57v1.2H4.41V10.66H16.22v1.23l2-.81,2-.82ZM14.64,17h0V12.54h0v-.31H6V17h8.67Zm3.94-.37v-4l-2.37,1v2l1.18.48,1.19.48ZM7.94,9.86A2.77,2.77,0,0,1,5.19,7.11a2.76,2.76,0,0,1,5.51,0A2.78,2.78,0,0,1,7.94,9.86Zm0-3.93a1.21,1.21,0,0,0-.83.35,1.15,1.15,0,0,0-.34.84A1.09,1.09,0,0,0,7.11,8,1.15,1.15,0,0,0,8,8.28,1.13,1.13,0,0,0,9.11,7.12,1.16,1.16,0,0,0,7.94,5.93Zm5.9,3.93a2.34,2.34,0,0,1-1.67-.68,2.3,2.3,0,0,1-.68-1.67,2.35,2.35,0,0,1,4-1.67,2.37,2.37,0,0,1,0,3.34,2.33,2.33,0,0,1-1.68.68Zm0-3.14a.75.75,0,1,0,.55.22.73.73,0,0,0-.55-.22Z" transform="translate(-4.41 -4.35)"/></g></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.72"><g><path d="M13.05,13.63a.24.24,0,0,1,.15.22L13.42,16a.19.19,0,0,1-.08.18l-2.12,2.14a4.08,4.08,0,0,1-1.29.85A4,4,0,0,1,4.71,17a3.92,3.92,0,0,1-.3-1.52A4,4,0,0,1,4.71,14a3.91,3.91,0,0,1,.87-1.3L7.7,10.56a.25.25,0,0,1,.2-.06l2.17.22a.21.21,0,0,1,.19.15.24.24,0,0,1,0,.25L7.12,14.23a1.81,1.81,0,0,0,0,2.58,1.78,1.78,0,0,0,1.29.52,1.74,1.74,0,0,0,1.28-.52L12.8,13.7a.24.24,0,0,1,.25-.07ZM19,4.92a4,4,0,0,1,0,5.66L16.86,12.7a.25.25,0,0,1-.17.08l-2.2-.23a.21.21,0,0,1-.19-.15.22.22,0,0,1,0-.25L17.44,9a1.81,1.81,0,0,0,0-2.58,1.78,1.78,0,0,0-1.29-.52,1.74,1.74,0,0,0-1.28.52L11.76,9.57a.21.21,0,0,1-.25,0,.24.24,0,0,1-.16-.21l-.22-2.17a.19.19,0,0,1,.08-.18l2.12-2.14a4.08,4.08,0,0,1,1.29-.85,4.05,4.05,0,0,1,3.06,0,3.85,3.85,0,0,1,1.3.85ZM5.84,9.82a.25.25,0,0,1-.18-.08.19.19,0,0,1-.07-.19l.11-.77a.2.2,0,0,1,.11-.17.24.24,0,0,1,.2,0l2.5.72a.25.25,0,0,1,.15.27.22.22,0,0,1-.23.21l-2.59,0Zm4.12-2-.73-2.5a.27.27,0,0,1,0-.2A.21.21,0,0,1,9.41,5L10.19,5a.25.25,0,0,1,.19,0,.23.23,0,0,1,.08.18l-.05,2.61a.2.2,0,0,1-.19.23h0A.22.22,0,0,1,10,7.85Zm8.76,5.58a.25.25,0,0,1,.18.08.23.23,0,0,1,.06.2l-.11.77a.25.25,0,0,1-.11.17.21.21,0,0,1-.12,0l-.08,0L16,14a.25.25,0,0,1-.15-.27.22.22,0,0,1,.22-.21l1.29,0,1.33,0Zm-4.12,2,.74,2.51a.28.28,0,0,1,0,.2.23.23,0,0,1-.18.11l-.8.11a.23.23,0,0,1-.17-.07.25.25,0,0,1-.08-.18l0-2.61a.22.22,0,0,1,.22-.22.21.21,0,0,1,.26.15Z" transform="translate(-4.41 -3.77)"/></g></svg>',math:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.73"><g><path d="M17.19,5.73a1,1,0,0,0,.71-.29,1,1,0,0,0,.28-.7,1,1,0,0,0-1-1H7.35a1,1,0,0,0-1,1,.77.77,0,0,0,.13.47h0l4.58,6.43L6.68,17.81a1.25,1.25,0,0,0-.29.71.94.94,0,0,0,.28.7.92.92,0,0,0,.69.28H17.2a1,1,0,0,0,.71-.28,1,1,0,0,0,0-1.39.92.92,0,0,0-.71-.29H9.26l3.87-5.43a.86.86,0,0,0,0-.95L9.26,5.73h7.93Z" transform="translate(-6.38 -3.77)"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.72"><g><path d="M19,18.32a4,4,0,0,0,0-5.68L15.85,9.5l-1.17,1.55L17.57,14a2,2,0,0,1,.61,1.47,2.08,2.08,0,0,1-2.09,2.09,2,2,0,0,1-1.47-.61l-.38-.37-1.74,1,.8.78a4,4,0,0,0,5.68,0ZM8,9.77a2,2,0,0,1-1.27-1,1.89,1.89,0,0,1-.21-1.57A2.1,2.1,0,0,1,7.45,6,2,2,0,0,1,9,5.76L12.27,7.2l.49-2L9.48,3.9a4,4,0,0,0-3.06.41A3.82,3.82,0,0,0,4.56,6.73a3.8,3.8,0,0,0,.4,3A3.78,3.78,0,0,0,7.39,11.6l5.38,2,.49-2-2.64-.94L8,9.77Z" transform="translate(-4.41 -3.76)"/></g></svg>',table_header:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M17,19.5v-.78H15.5v.78H17Zm-3,0v-.78H12.5v.78H14Zm-3,0v-.78H9.53v.78H11Zm-3,0v-.78H6.53v.78H8Zm10.55,0a1.73,1.73,0,0,0,.85-.35,1.67,1.67,0,0,0,.56-.76l-.71-.31a1.21,1.21,0,0,1-.35.4,1.34,1.34,0,0,1-.53.23l.08.38c.06.24.09.38.1.41Zm-13.7-.63.55-.55A.77.77,0,0,1,5.25,18a1.31,1.31,0,0,1-.06-.38v-.38H4.41v.38a2,2,0,0,0,.12.68,1.6,1.6,0,0,0,.35.57Zm15.27-2.12V15.26h-.78v1.49h.78Zm-15-1V14.23H4.41v1.49h.78Zm15-2V12.26h-.78v1.49h.78Zm-15-1V11.22H4.41v1.51h.78Zm15-2V9.26h-.78v1.51h.78Zm-15-1V8.17H4.41V9.74h.78Zm15-2V6.28h-.78V7.77h.78Zm-15-1.11V5.33L4.48,5.1a.77.77,0,0,0-.07.27,2.72,2.72,0,0,0,0,.28v1h.79ZM19.21,5l.63-.4A1.62,1.62,0,0,0,19.16,4a1.94,1.94,0,0,0-.91-.22v.78a1.31,1.31,0,0,1,.56.12.88.88,0,0,1,.4.36ZM6,4.54H7.78V3.76H6a.82.82,0,0,0-.28.06l.12.35c.07.21.1.33.11.36Zm10.8,0V3.76H15.28v.78h1.49Zm-3,0V3.76H12.28v.78h1.49Zm-3,0V3.76H9.28v.78h1.51ZM6,10.84h12.6V6.91H6Z" transform="translate(-4.4 -3.76)"/></g></svg>',merge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 15.74"><g><path d="M18.92,13.5h1.23v4.15A1.84,1.84,0,0,1,18.3,19.5H14V18.27H18.3a.6.6,0,0,0,.44-.18.59.59,0,0,0,.18-.44V13.5ZM18.3,3.76a1.84,1.84,0,0,1,1.85,1.85V9.82H18.92V5.6a.6.6,0,0,0-.18-.44A.59.59,0,0,0,18.3,5H14V3.76H18.3Zm1.85,8.51H15.6L17.26,14l-.86.86-3.14-3.17L16.4,8.51l.86.86L15.62,11h4.54v1.24Zm-13.9,6h4.27V19.5H6.25A1.84,1.84,0,0,1,4.4,17.65V13.5H5.63v4.15a.61.61,0,0,0,.62.62Zm0-14.51h4.27V5H6.25a.6.6,0,0,0-.44.18.57.57,0,0,0-.17.43V9.81H4.41V5.6A1.83,1.83,0,0,1,6.25,3.76Zm5,7.9L8.15,14.83,7.3,14,9,12.27H4.41V11H8.94L7.3,9.38,7.73,9l.43-.43Z" transform="translate(-4.4 -3.76)"/></g></svg>',split_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M10.37,12.25H6.74L8.4,13.94l-.87.86L4.41,11.63,7.53,8.5l.87.86L6.74,11h3.62v1.23Zm9.78-.61L17,14.81,16.13,14l1.66-1.69H14.16V11h3.63L16.13,9.37l.43-.43A5.24,5.24,0,0,1,17,8.51ZM18.9,8.22V5.61a.57.57,0,0,0-.18-.43A.65.65,0,0,0,18.29,5H12.88V18.28h5.41a.7.7,0,0,0,.44-.18.57.57,0,0,0,.18-.43V15h1.23v2.64a1.84,1.84,0,0,1-1.85,1.83h-12A1.84,1.84,0,0,1,4.94,19a1.81,1.81,0,0,1-.54-1.29V15H5.63v2.64a.57.57,0,0,0,.18.43.67.67,0,0,0,.44.18h5.41V5H6.25a.7.7,0,0,0-.44.18.56.56,0,0,0-.17.43V8.22H4.41V5.61A1.8,1.8,0,0,1,5,4.31a1.91,1.91,0,0,1,1.31-.55h12a1.89,1.89,0,0,1,1.31.55,1.8,1.8,0,0,1,.54,1.3V8.23H18.9Z" transform="translate(-4.4 -3.76)"/></g></svg>',caption:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.79"><g><path d="M4.41,18.52H20.15v-2H4.41ZM20,4.73H18.07V6h.65v.65H20V4.73ZM17,6V4.73H14.55V6H17ZM13.49,6V4.73H11V6h2.47ZM10,6V4.73H7.5V6H10ZM5.79,6h.65V4.73H4.5V6.67H5.8V6ZM4.5,11.34H5.79V8.48H4.5ZM6.44,13.8H5.79v-.65H4.5v1.94H6.44ZM17,15.09V13.8H14.55v1.29H17Zm-3.52,0V13.8H11v1.29h2.47Zm-3.53,0V13.8H7.5v1.29H10ZM20,13.16H18.72v.65h-.65V15.1H20Zm-1.29-1.82H20V8.48h-1.3v2.86Z" transform="translate(-4.41 -4.73)"/></g></svg>',edit:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.73"><g><path d="M7.51,5.68h6l1.52-1.57H6.94a2.4,2.4,0,0,0-1.79.82A2.8,2.8,0,0,0,4.41,6.8V17a2.55,2.55,0,0,0,.75,1.8A2.48,2.48,0,0,0,7,19.5H17.22a2.57,2.57,0,0,0,1.83-.74,2.52,2.52,0,0,0,.77-1.8V8.83l-1.58,1.54v6a1.54,1.54,0,0,1-1.53,1.53H7.51A1.54,1.54,0,0,1,6,16.41V7.21A1.52,1.52,0,0,1,7.51,5.68Zm5.63,7.47h0L10.7,10.74l-1,3.38,1.71-.48,1.7-.49Zm.34-.34h0l5.36-5.32L16.4,5.08,11,10.4l1.23,1.21,1.21,1.2ZM19.93,6.4a.82.82,0,0,0,.22-.48A.54.54,0,0,0,20,5.47L18.45,4A.67.67,0,0,0,18,3.77a.7.7,0,0,0-.48.21l-.74.72,2.44,2.43.37-.37.35-.36Z" transform="translate(-4.41 -3.77)"/></g></svg>',delete:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.74"><g><path d="M19.16,6.71a.94.94,0,0,0,.69-.28.91.91,0,0,0,.29-.68A1,1,0,0,0,19.85,5a.93.93,0,0,0-.69-.3H14.24A.94.94,0,0,0,14,4.06a.92.92,0,0,0-.7-.3h-2a1,1,0,0,0-.7.3.93.93,0,0,0-.28.68H5.39A.92.92,0,0,0,4.7,5a1,1,0,0,0-.29.71.91.91,0,0,0,.29.68,1,1,0,0,0,.69.28H19.16Zm-12.79,1a1,1,0,0,0-.7.3.94.94,0,0,0-.28.69v8.85A1.88,1.88,0,0,0,6,18.93a1.9,1.9,0,0,0,1.39.57H17.2a1.87,1.87,0,0,0,1.39-.58,1.91,1.91,0,0,0,.58-1.39V8.68A1,1,0,0,0,18.88,8a.89.89,0,0,0-.7-.29,1,1,0,0,0-.69.29.92.92,0,0,0-.29.68v7.87a1,1,0,0,1-1,1H8.34a.94.94,0,0,1-.69-.28,1,1,0,0,1-.29-.71V8.68a1,1,0,0,0-1-1Z" transform="translate(-4.41 -3.76)"/></g></svg>',modify:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 15.74"><g><path d="M19.79,15.23a.66.66,0,0,1,.3.38.59.59,0,0,1-.07.48l-.8,1.38a.66.66,0,0,1-.38.3.59.59,0,0,1-.48-.07l-.68-.38a4.55,4.55,0,0,1-1.34.77v.78a.64.64,0,0,1-.18.45.61.61,0,0,1-.45.18h-1.6a.6.6,0,0,1-.44-.18.66.66,0,0,1-.19-.45v-.78a4.36,4.36,0,0,1-1.32-.77l-.69.38a.58.58,0,0,1-.48.07.66.66,0,0,1-.38-.3l-.38-.66h.83a1.77,1.77,0,0,0,1.23-.52,1.72,1.72,0,0,0,.51-1.23v-.18a3,3,0,0,0,.49-.28l.15.09a1.83,1.83,0,0,0,.88.23A1.75,1.75,0,0,0,15.84,14l.88-1.52a1.7,1.7,0,0,0,.17-1.32,1.66,1.66,0,0,0-.3-.61,1.84,1.84,0,0,0-.51-.45l-.15-.09,0-.29,0-.28.15-.09a1,1,0,0,0,.26-.18l0,.06v.78a4.34,4.34,0,0,1,1.34.77l.68-.38a.68.68,0,0,1,.48-.06.64.64,0,0,1,.38.29l.8,1.38a.58.58,0,0,1,.07.48.63.63,0,0,1-.3.38l-.68.4a3.84,3.84,0,0,1,.08.76,4.13,4.13,0,0,1-.08.78l.34.18.32.2ZM10.17,7.86a1.9,1.9,0,0,1,1.35,3.23,1.85,1.85,0,0,1-1.35.55A1.9,1.9,0,0,1,8.83,8.41a1.92,1.92,0,0,1,1.34-.55Zm1.58,7.2a.73.73,0,0,1-.21.49.66.66,0,0,1-.48.2H9.29a.68.68,0,0,1-.69-.69V14.2a4.75,4.75,0,0,1-1.48-.86l-.75.45a.73.73,0,0,1-.7,0,.63.63,0,0,1-.25-.26L4.54,12a.67.67,0,0,1-.08-.53.71.71,0,0,1,.32-.42l.75-.43a4.8,4.8,0,0,1-.08-.85,4.71,4.71,0,0,1,.08-.85l-.74-.44a.71.71,0,0,1-.32-.42.65.65,0,0,1,.07-.54L5.42,6a.66.66,0,0,1,.42-.32l.18,0a.73.73,0,0,1,.35.09l.75.43A4.68,4.68,0,0,1,8.6,5.33V4.45a.68.68,0,0,1,.69-.69h1.77a.64.64,0,0,1,.48.2.73.73,0,0,1,.21.49v.88a4.75,4.75,0,0,1,1.48.85L14,5.75a.67.67,0,0,1,.34-.09l.18,0a.71.71,0,0,1,.42.32l.89,1.54a.67.67,0,0,1,.06.52.73.73,0,0,1-.32.43l-.75.42a4.8,4.8,0,0,1,.08.85,4.71,4.71,0,0,1-.08.85l.75.43a.66.66,0,0,1,.32.42.73.73,0,0,1-.06.54l-.89,1.52a.69.69,0,0,1-.25.26.7.7,0,0,1-.35.09.64.64,0,0,1-.34-.09l-.75-.45a4.87,4.87,0,0,1-1.48.86v.87ZM7.23,9.75a3,3,0,0,0,.86,2.08,2.94,2.94,0,1,0,4.16-4.16,3,3,0,0,0-2.08-.85A2.94,2.94,0,0,0,7.23,9.75Z" transform="translate(-4.44 -3.76)"/></g></svg>',revert:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 14.69"><g><path d="M18.26,15V12.3l1.89-2V15a2.58,2.58,0,0,1-.24,1c-.2.58-.75.92-1.65,1H7.56v2L4.41,15.63,7.56,13v2h10.7ZM6.3,8.28V11L4.41,13V8.28a2.58,2.58,0,0,1,.24-1c.2-.58.75-.92,1.65-1H17v-2l3.15,3.34L17,10.3v-2H6.3Z" transform="translate(-4.4 -4.28)"/></g></svg>',auto_size:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M6.71,17.19,6.89,16l1.21-.15A6,6,0,0,1,6.81,13.9a5.78,5.78,0,0,1-.45-2.27A6,6,0,0,1,8.1,7.45a5.83,5.83,0,0,1,4.17-1.73l1-1-1-1A7.89,7.89,0,0,0,5,14.64a7.73,7.73,0,0,0,1.71,2.55Zm5.57,2.31h0A7.86,7.86,0,0,0,17.85,6.07L17.67,7.3l-1.21.15a5.9,5.9,0,0,1,1.29,1.92,5.81,5.81,0,0,1,.45,2.26,5.91,5.91,0,0,1-5.9,5.9l-1,1,.49.49.47.5Z" transform="translate(-4.41 -3.76)"/></g></svg>',insert_row_below:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M15.7,1.3c-0.1-0.1-0.1-0.2-0.2-0.2L15.3,1H0.4L0.3,1.1c0,0-0.1,0.1-0.1,0.1c0,0-0.1,0.1-0.1,0.1L0,1.4v7.7l0.1,0.1c0,0.1,0.1,0.1,0.2,0.2l0.1,0.1h2.3V9.3l0.1-0.5L3,8.5l0.1-0.2c-0.1,0-0.2,0-0.3,0H1.2v-6h13.3v6h-1.6c-0.1,0-0.2,0-0.3,0l0.1,0.2l0.2,0.4C12.9,9,13,9.2,13,9.3v0.1h2.3l0.2-0.1c0.1,0,0.1-0.1,0.2-0.2l0.1-0.1V1.4L15.7,1.3z"/><path d="M10.5,7.5C9.9,7.1,9.3,6.8,8.6,6.7c-0.2,0-0.5-0.1-0.7,0c-0.2,0-0.5,0-0.7,0C6.6,6.7,6.1,6.9,5.6,7.3C5.2,7.6,4.7,8,4.4,8.4C4.3,8.6,4.2,8.8,4.2,8.9C4.1,9.1,4,9.3,3.9,9.4C3.9,9.6,3.8,9.7,3.8,9.9c0,0.2-0.1,0.3-0.1,0.5v-0.1c-0.1,0.8,0.1,1.6,0.5,2.4c0.4,0.7,1,1.3,1.7,1.7c0.3,0.2,0.6,0.3,0.9,0.3c0.3,0.1,0.7,0.1,1,0.1c0.3,0,0.7,0,1-0.1c0.3-0.1,0.6-0.2,0.9-0.3c0.5-0.3,0.9-0.6,1.3-1c0.3-0.4,0.6-0.8,0.8-1.3c0.1-0.4,0.2-0.9,0.2-1.4c0-0.5-0.1-1-0.3-1.4C11.5,8.6,11.1,8,10.5,7.5z M10.1,11.3H8.5v1.6H8H7.9H7.3v0v-0.1v-1.4H5.7v-0.4v-0.2v-0.6h0h1.5V8.5h1.2v1.6h1.6V11.3z"/></g></svg>',insert_row_above:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M0.1,14.5c0.1,0.1,0.1,0.2,0.2,0.2l0.1,0.1h14.9l0.1-0.1c0,0,0.1-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1l0.1-0.1V6.7l-0.1-0.1c0-0.1-0.1-0.1-0.2-0.2l-0.1-0.1h-2.3v0.1l-0.1,0.5l-0.2,0.4l-0.1,0.2c0.1,0,0.2,0,0.3,0h1.6v6H1.3v-6h1.6c0.1,0,0.2,0,0.3,0L3.1,7.3L2.9,6.9C2.8,6.8,2.8,6.6,2.7,6.5V6.3H0.4L0.3,6.4c-0.1,0-0.1,0.1-0.2,0.2L0,6.7v7.7L0.1,14.5z"/><path d="M5.3,8.3c0.6,0.5,1.2,0.8,1.9,0.9c0.2,0,0.5,0.1,0.7,0c0.2,0,0.5,0,0.7,0c0.6-0.1,1.1-0.3,1.6-0.6c0.5-0.3,0.9-0.7,1.2-1.2c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.4,0.2-0.5c0.1-0.1,0.1-0.3,0.1-0.4C12,5.8,12,5.6,12,5.4v0.1c0.1-0.8-0.1-1.6-0.5-2.4c-0.4-0.7-1-1.3-1.7-1.7C9.5,1.3,9.2,1.2,8.9,1.1C8.5,1,8.2,1,7.9,1c-0.3,0-0.7,0-1,0.1C6.6,1.2,6.3,1.3,6,1.4C5.5,1.7,5.1,2,4.7,2.4C4.4,2.8,4.1,3.3,3.9,3.8C3.8,4.2,3.7,4.7,3.7,5.2c0,0.5,0.1,1,0.3,1.4C4.3,7.2,4.7,7.8,5.3,8.3z M5.7,4.5h1.6V2.9h0.5h0.1h0.6v0v0.1v1.4H10v0.4v0.2v0.6h0H8.5v1.6H7.3V5.7H5.7V4.5z"/></g></svg>',insert_column_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M14.5,15.7c0.1-0.1,0.2-0.1,0.2-0.2l0.1-0.1V0.4l-0.1-0.1c0,0-0.1-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1L14.4,0H6.7L6.6,0.1c-0.1,0-0.1,0.1-0.2,0.2L6.3,0.4v2.3h0.1l0.5,0.1L7.3,3l0.2,0.1c0-0.1,0-0.2,0-0.3V1.2h6v13.3h-6v-1.6c0-0.1,0-0.2,0-0.3l-0.2,0.1l-0.4,0.2C6.7,12.9,6.6,13,6.4,13H6.3v2.3l0.1,0.2c0,0.1,0.1,0.1,0.2,0.2l0.1,0.1h7.7L14.5,15.7z"/><path d="M8.3,10.5C8.7,10,9,9.3,9.1,8.6c0-0.2,0.1-0.5,0-0.7c0-0.2,0-0.5,0-0.7C9,6.7,8.8,6.1,8.5,5.7C8.2,5.2,7.8,4.8,7.3,4.5C7.2,4.4,7,4.3,6.9,4.2C6.7,4.1,6.5,4,6.4,4C6.2,3.9,6.1,3.9,5.9,3.8c-0.2,0-0.3-0.1-0.5-0.1h0.1C4.7,3.7,3.8,3.9,3.1,4.3C2.4,4.7,1.8,5.3,1.4,6C1.3,6.3,1.2,6.6,1.1,6.9C1,7.2,1,7.6,1,7.9c0,0.3,0,0.7,0.1,1c0.1,0.3,0.2,0.6,0.3,0.9c0.3,0.5,0.6,0.9,1,1.3c0.4,0.3,0.8,0.6,1.3,0.8C4.2,12,4.7,12.1,5.1,12c0.5,0,1-0.1,1.4-0.3C7.2,11.5,7.8,11.1,8.3,10.5zM4.5,10.1V8.5H2.9V8V7.9V7.3h0H3h1.4V5.7h0.4h0.2h0.6v0v1.5h1.6v1.2H5.7v1.6H4.5z"/></g></svg>',insert_column_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M1.3,0.1C1.2,0.2,1.1,0.2,1.1,0.3L1,0.4v14.9l0.1,0.1c0,0,0.1,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1l0.1,0.1h7.7l0.1-0.1c0.1,0,0.1-0.1,0.2-0.2l0.1-0.1v-2.3H9.3l-0.5-0.1l-0.4-0.2l-0.2-0.1c0,0.1,0,0.2,0,0.3v1.6h-6V1.3h6v1.6c0,0.1,0,0.2,0,0.3l0.2-0.1l0.4-0.2C9,2.9,9.2,2.8,9.3,2.8h0.1V0.5L9.4,0.3c0-0.1-0.1-0.1-0.2-0.2L9.1,0H1.4L1.3,0.1z"/><path d="M7.5,5.3C7,5.8,6.7,6.5,6.6,7.2c0,0.2-0.1,0.5,0,0.7c0,0.2,0,0.5,0,0.7c0.1,0.6,0.3,1.1,0.6,1.6c0.3,0.5,0.7,0.9,1.2,1.2c0.2,0.1,0.3,0.2,0.5,0.3c0.2,0.1,0.4,0.2,0.5,0.2c0.1,0.1,0.3,0.1,0.4,0.1c0.2,0,0.3,0.1,0.5,0.1h-0.1c0.8,0.1,1.6-0.1,2.4-0.5c0.7-0.4,1.3-1,1.7-1.7c0.2-0.3,0.3-0.6,0.3-0.9c0.1-0.3,0.1-0.7,0.1-1c0-0.3,0-0.7-0.1-1c-0.1-0.3-0.2-0.6-0.3-0.9c-0.3-0.5-0.6-0.9-1-1.3C13,4.4,12.5,4.2,12,4c-0.4-0.1-0.9-0.2-1.4-0.2c-0.5,0-1,0.1-1.4,0.2C8.5,4.3,7.9,4.7,7.5,5.3z M11.3,5.7v1.6h1.6v0.5v0.1v0.6h0h-0.1h-1.4v1.6h-0.4h-0.2h-0.6v0V8.5H8.5V7.3h1.6V5.7H11.3z"/></g></svg>',delete_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 13.83"><g><path d="M4.7,18.46l.12.08H19.73l.12-.08a.58.58,0,0,0,.22-.22l.08-.12,0-7.69-.08-.11a.77.77,0,0,0-.18-.18l-.11-.08-2.31,0-.08.28-.1.29a1.58,1.58,0,0,1-.12.29l-.14.34s0,0,.18,0H18.9v6H5.64v-6H7.35c.14,0,.2,0,.18,0l-.14-.34a2.85,2.85,0,0,1-.12-.29l-.1-.29-.07-.27-2.31,0-.11.08a.77.77,0,0,0-.18.18l-.08.11,0,7.69.08.12a.47.47,0,0,0,.09.12l.13.09ZM12.11,13a4,4,0,0,0,1.46-.21,4.51,4.51,0,0,0,1.31-.71A4,4,0,0,0,16.26,10a4.32,4.32,0,0,0-.08-2.54,4.34,4.34,0,0,0-1-1.52,4.15,4.15,0,0,0-1.54-1,4.34,4.34,0,0,0-1.35-.22A4.07,4.07,0,0,0,11,4.93,3.94,3.94,0,0,0,9.24,6.07,3.92,3.92,0,0,0,8.15,8.88a3.91,3.91,0,0,0,.12.95A4.16,4.16,0,0,0,12.11,13Zm2.35-4.14v.58H10.09V8.27h4.37v.58Z" transform="translate(-4.4 -4.71)"/></g></svg>',delete_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13.81 15.74"><g><path d="M5.66,19.42l.12.08,7.69,0,.11-.08a.77.77,0,0,0,.18-.18l.08-.11,0-2.32-.15,0-.45-.15-.42-.18-.17-.07a1,1,0,0,0,0,.27v1.63h-6V5h6V6.62a.9.9,0,0,0,0,.26l.17-.07.42-.17a3.91,3.91,0,0,1,.45-.15l.15,0,0-2.32L13.75,4a.77.77,0,0,0-.18-.18l-.11-.08H5.79l-.13.07a.63.63,0,0,0-.21.22l-.08.12V19.08l.08.12a.47.47,0,0,0,.09.12.35.35,0,0,0,.12.1Zm9-3.67a4.16,4.16,0,0,0,2.36-.51,4.08,4.08,0,0,0,1.67-1.72,4,4,0,0,0,.35-.91,3.79,3.79,0,0,0,.1-1,4.71,4.71,0,0,0-.11-1,5,5,0,0,0-.3-.87,4.25,4.25,0,0,0-1-1.25,4.49,4.49,0,0,0-1.34-.81A4.26,4.26,0,0,0,15,7.48a3.88,3.88,0,0,0-1.41.25A4.32,4.32,0,0,0,11.86,9,4,4,0,0,0,11,10.94a4.4,4.4,0,0,0-.05.68,4.5,4.5,0,0,0,.05.68,3.93,3.93,0,0,0,.61,1.57,4.22,4.22,0,0,0,1.18,1.2,4.59,4.59,0,0,0,.48.27c.2.1.37.17.5.22a2.44,2.44,0,0,0,.45.12,4.61,4.61,0,0,0,.5.07Zm2.54-4.12v.58H12.87V11h4.37v.59Z" transform="translate(-5.37 -3.76)"/></g></svg>',fixed_column_width:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6,5H18A1,1 0 0,1 19,6A1,1 0 0,1 18,7H6A1,1 0 0,1 5,6A1,1 0 0,1 6,5M21,2V4H3V2H21M15,8H17V22H15V8M7,8H9V22H7V8M11,8H13V22H11V8Z" /></svg>',rotate_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M0.5,10.2c0,0.1,0,0.2,0,0.3v0.2l0,0c0.1,0.3,0.3,0.6,0.4,0.9l0,0C1,11.8,1.3,12,1.5,11.9h0.1h0.2h0.1c0.1-0.1,0.3-0.3,0.4-0.5v-0.2c0-0.1,0-0.2-0.1-0.3l0,0c-0.2-0.2-0.3-0.4-0.3-0.7l0,0C1.8,10,1.7,9.9,1.5,9.8c-0.1,0-0.2,0-0.3,0H0.9C0.7,9.9,0.6,10,0.5,10.2L0.5,10.2z"/><path d="M2.2,11.5L2.2,11.5L2.2,11.5z"/><path d="M5.9,3.6L5.9,3.6L5.9,3.6z"/><path d="M0.1,7.9c0,0.3,0,0.6,0,0.9l0,0l0,0l0,0l0,0c0,0.2,0.1,0.3,0.2,0.4l0,0c0.2,0.1,0.3,0.2,0.5,0.2l0,0l0,0c0.2,0,0.4-0.1,0.5-0.3l0,0c0-0.1,0.1-0.3,0.1-0.4V8.6l0,0c0-0.2,0-0.5,0-0.7l0,0c0-0.2-0.1-0.4-0.2-0.5C1.1,7.3,0.9,7.2,0.7,7.2S0.3,7.3,0.2,7.4C0.1,7.5,0,7.7,0.1,7.9z"/><path d="M1.9,12.7L1.9,12.7c0,0.2,0,0.4,0.2,0.5l0,0l0.2,0.3l0,0c0.2,0.1,0.3,0.2,0.5,0.4l0,0l0,0l0,0l0,0C2.9,14,3,14.1,3.2,14.1s0.4-0.1,0.5-0.2c0.1-0.2,0.2-0.3,0.2-0.5v-0.1c0-0.2-0.1-0.4-0.2-0.5l0,0l-0.4-0.4l-0.2-0.2l0,0C3,12.1,2.8,12,2.6,12l0,0c-0.2,0-0.4,0.1-0.5,0.2l0,0C2,12.3,1.9,12.5,1.9,12.7z"/><path d="M6.6,15c0,0.2,0.1,0.4,0.2,0.5c0.1,0.1,0.2,0.2,0.4,0.3l0,0c0.3,0,0.5,0,0.7,0h0.3l0,0c0.2,0,0.4-0.1,0.5-0.2c0.1-0.2,0.2-0.3,0.2-0.5l0,0l0,0c0-0.2-0.1-0.4-0.2-0.5l0,0c-0.1-0.1-0.3-0.2-0.5-0.2l0,0H7.9c-0.1,0-0.3,0-0.5,0l0,0H7.3c-0.2-0.1-0.3,0-0.5,0.1l0,0C6.7,14.6,6.6,14.8,6.6,15L6.6,15L6.6,15L6.6,15z"/><path d="M4.2,7.4C4,7.5,4,7.7,4,7.9c0,0.2,0,0.4,0.2,0.5l0,0l3.2,3.2l0,0c0.1,0.1,0.3,0.2,0.5,0.2s0.3-0.1,0.5-0.2l0,0l3.2-3.2l0,0c0.1-0.1,0.2-0.3,0.2-0.5c0-0.2-0.1-0.4-0.2-0.5l0,0C11.5,7.3,11,6.7,10,5.8l0,0L8.4,4.2l0,0C8.3,4.1,8.1,4,7.9,4S7.5,4.1,7.4,4.2L4.2,7.4L4.2,7.4z M6.8,9L5.7,7.9l2.2-2.2l2.3,2.2l-2.3,2.2C7.7,9.9,7.3,9.5,6.8,9L6.8,9z"/><path d="M4.1,14.1C4,14.2,4,14.3,4,14.4v0.2l0,0c0.1,0.1,0.2,0.3,0.4,0.4l0,0c0.3,0.1,0.6,0.2,0.9,0.4h0.1h0.1l0,0c0.2,0,0.3-0.1,0.5-0.1l0,0c0.2-0.1,0.3-0.3,0.3-0.4l0,0l0,0l0,0l0,0v-0.2c0-0.1-0.1-0.2-0.1-0.3l0,0C6.1,14.2,6,14.1,5.8,14l0,0c-0.3-0.1-0.5-0.2-0.8-0.2l0,0c-0.1-0.1-0.2-0.1-0.3-0.1H4.5C4.3,13.7,4.2,13.9,4.1,14.1z"/><path d="M9.3,14.4c0,0.1-0.1,0.3,0,0.4V15l0,0c0,0.1,0.1,0.3,0.5,0.4c0.1,0.1,0.3,0.1,0.4,0.1l0,0h0.1l0,0c0.3-0.1,0.6-0.2,0.9-0.3l0,0c0.1-0.1,0.2-0.2,0.3-0.4l0.1-0.3c0-0.1-0.1-0.2-0.1-0.3l0,0c-0.1-0.2-0.2-0.3-0.4-0.4l0,0h-0.3c-0.1,0-0.2,0-0.3,0l0,0c-0.2,0.1-0.5,0.2-0.8,0.3l0,0C9.5,14.1,9.4,14.2,9.3,14.4L9.3,14.4z"/><path d="M11.4,14.7L11.4,14.7L11.4,14.7z"/><path d="M9.5,15.3L9.5,15.3L9.5,15.3z"/><path d="M15.9,7.9c0-1-0.2-2-0.6-3l0,0c-0.4-1-1-1.9-1.7-2.6C12.8,1.6,12,1,11,0.6l0,0C10.1,0.2,9,0,8,0C7.3,0,6.5,0.1,5.8,0.3l0,0C5.2,0.5,4.6,0.8,4,1.1L3.1,0.2l0,0C2.9,0.1,2.8,0,2.6,0H2.4l0,0C2.2,0,2,0.2,1.9,0.4l0,0L0.1,4.9l0,0C0,5,0,5.1,0,5.2c0,0.2,0.1,0.4,0.2,0.5l0,0c0.2,0.1,0.3,0.2,0.5,0.2h0.1H1l0,0l4.7-1.8l0,0C5.9,4,6.1,3.8,6.1,3.6V3.4C6.1,3.2,6,3,5.9,2.9l0,0L5.1,2.1c0.4-0.2,0.8-0.4,1.3-0.5c0.5-0.1,1.1-0.2,1.7-0.2c0.9,0,1.7,0.2,2.5,0.5l0,0c0.8,0.3,1.5,0.8,2.1,1.4c0.6,0.6,1.1,1.3,1.4,2.1l0,0c0.3,0.8,0.5,1.6,0.5,2.5s-0.2,1.7-0.5,2.5l0,0c-0.3,0.8-0.8,1.5-1.4,2.1c-0.2,0.2-0.4,0.3-0.6,0.5l0,0c-0.2,0.1-0.3,0.3-0.3,0.5v0.1c0,0.1,0,0.3,0.1,0.4l0,0c0.1,0.2,0.3,0.3,0.5,0.3l0,0c0.1,0,0.3-0.1,0.4-0.2l0,0l0,0l0,0l0,0c0.2-0.2,0.5-0.4,0.7-0.6l0,0l0,0l0,0l0,0c0.7-0.8,1.3-1.6,1.7-2.6C15.6,10,15.8,9,15.9,7.9z M1.9,4C2,3.8,2.1,3.5,2.3,3.1l0,0L2.7,2l1.2,1.2L1.9,4z"/><path d="M6.8,15.5L6.8,15.5L6.8,15.5z"/></g></svg>',rotate_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M9.9,15.3L9.9,15.3L9.9,15.3z"/><path d="M6.9,15.1L6.9,15.1c0,0.1,0.1,0.3,0.2,0.4l0,0c0.1,0.2,0.3,0.3,0.5,0.3l0,0h0.3c0.2,0,0.4,0,0.7,0l0,0c0.2-0.1,0.3-0.2,0.4-0.3c0.1-0.1,0.2-0.2,0.2-0.4V15c0-0.2-0.1-0.4-0.2-0.4c-0.2-0.1-0.3-0.2-0.5-0.2H8.4l0,0c-0.1,0-0.3,0-0.5,0H7.6l0,0c-0.2,0-0.4,0.1-0.5,0.2C7,14.7,6.9,14.9,6.9,15.1z"/><path d="M6.5,14.4L6.5,14.4L6.5,14.4z"/><path d="M5.8,5.8L5.8,5.8c-1,0.9-1.5,1.5-1.7,1.6l0,0C4,7.5,4,7.7,4,7.9c0,0.2,0,0.4,0.2,0.5l0,0l3.2,3.2l0,0c0.2,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2l0,0l3.2-3.2l0,0c0.1-0.1,0.2-0.3,0.2-0.5c0-0.2-0.1-0.4-0.2-0.5l0,0L8.4,4.2C8.3,4.1,8.1,4,7.9,4C7.7,4,7.5,4.1,7.4,4.2l0,0L5.8,5.8z M5.6,7.9l2.3-2.2l2.2,2.2L9,9l0,0l0,0l0,0l0,0c-0.5,0.6-0.9,0.9-1.1,1.1L5.6,7.9z"/><path d="M9,15.5L9,15.5L9,15.5z"/><path d="M9.6,14.7v0.2l0,0l0,0l0,0l0,0c0.1,0.2,0.1,0.3,0.3,0.3c0.1,0.1,0.3,0.1,0.4,0.1l0,0h0.1h0.1c0.3-0.1,0.6-0.3,0.9-0.4l0,0c0.1-0.1,0.2-0.2,0.3-0.4l0,0v-0.2c0-0.1,0-0.2-0.1-0.3c-0.1-0.2-0.2-0.3-0.4-0.4H11c-0.1,0-0.2,0.1-0.3,0.1l0,0c-0.2,0.1-0.4,0.2-0.7,0.3l0,0l0,0c-0.1,0.1-0.3,0.2-0.4,0.4C9.6,14.5,9.6,14.6,9.6,14.7z"/><path d="M9,14.5L9,14.5L9,14.5z"/><path d="M9.6,14.4L9.6,14.4L9.6,14.4z"/><path d="M11.7,14L11.7,14L11.7,14z"/><path d="M15.6,7.4L15.6,7.4L15.6,7.4z"/><path d="M15,9.4c0.2,0,0.4,0,0.6-0.2l0,0c0.1-0.1,0.2-0.2,0.2-0.4l0,0l0,0l0,0l0,0c0-0.3,0-0.6,0-0.9c0-0.2-0.1-0.4-0.2-0.5c-0.1-0.1-0.3-0.2-0.5-0.2s-0.4,0.1-0.5,0.2c-0.1,0.1-0.2,0.3-0.2,0.5l0,0c0,0.2,0,0.4,0,0.7l0,0v0.1c0,0.1,0,0.3,0.1,0.4l0,0C14.6,9.3,14.8,9.4,15,9.4L15,9.4L15,9.4z"/><path d="M14,12h0.1h0.2h0.1c0.2,0,0.5-0.2,0.6-0.4l0,0c0.2-0.3,0.3-0.6,0.4-0.9l0,0v-0.2c0-0.1-0.1-0.2-0.1-0.3c-0.1-0.2-0.2-0.3-0.4-0.4h-0.3c-0.1,0-0.2,0-0.3,0C14.2,9.9,14,10,14,10.3l0,0c-0.1,0.2-0.2,0.5-0.3,0.7l0,0c-0.1,0.1-0.1,0.2-0.1,0.3v0.2l0,0l0,0C13.6,11.6,13.8,11.8,14,12z"/><path d="M14.6,7.4L14.6,7.4L14.6,7.4z"/><path d="M4.4,14.2c-0.1,0.1-0.1,0.2-0.1,0.3l0.1,0.2c0,0.2,0.2,0.3,0.3,0.4l0,0c0.3,0.1,0.6,0.3,1.1,0.4l0,0h0.1l0,0c0.1,0,0.2-0.1,0.4-0.2c0.1,0,0.2-0.2,0.3-0.3l0,0v-0.2c0-0.1-0.1-0.3-0.2-0.4c-0.1-0.1-0.2-0.2-0.4-0.3l0,0c-0.2-0.1-0.5-0.2-0.7-0.3l0,0c-0.1,0-0.2,0-0.3,0H4.7l0,0C4.6,13.9,4.4,14,4.4,14.2L4.4,14.2z"/><path d="M11.9,13.3c0,0.2,0.1,0.4,0.2,0.6c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2l0,0l0,0l0,0l0,0c0.1-0.1,0.3-0.3,0.4-0.4l0,0l0.2-0.3l0,0c0.1-0.2,0.2-0.3,0.2-0.5l0,0c0-0.2-0.1-0.4-0.2-0.5l0,0c-0.1-0.1-0.3-0.2-0.5-0.2l0,0c-0.2,0-0.4,0.1-0.5,0.2l0,0l-0.2,0.2l-0.4,0.4l0,0C12,13,11.9,13.1,11.9,13.3L11.9,13.3z"/><path d="M12.1,13.8L12.1,13.8L12.1,13.8z"/><path d="M11.9,13.3L11.9,13.3L11.9,13.3z"/><path d="M15.9,5.2c0-0.1-0.1-0.2-0.1-0.3l0,0L14,0.4l0,0C13.9,0.2,13.7,0,13.5,0l0,0l0,0h-0.2c-0.2,0-0.4,0.1-0.5,0.2l0,0l-0.9,0.9c-0.5-0.3-1.1-0.6-1.8-0.8l0,0C9.4,0.1,8.7,0,7.9,0c-1,0-2,0.2-3,0.6S3,1.6,2.3,2.3C1.6,3.1,1,3.9,0.6,4.9l0,0C0.2,5.8,0,6.8,0,7.9c0,1,0.2,2,0.6,3s0.9,1.8,1.7,2.6l0,0l0,0l0,0l0,0c0.2,0.2,0.5,0.4,0.7,0.6l0,0l0,0l0,0l0,0c0.2,0.1,0.3,0.2,0.5,0.2l0,0c0.2,0,0.4-0.1,0.6-0.3l0,0c0.1-0.1,0.1-0.3,0.1-0.4v-0.1l0,0C4.1,13.3,4,13.1,3.9,13l0,0c-0.2-0.1-0.4-0.3-0.6-0.5c-0.6-0.6-1.1-1.3-1.4-2.1l0,0C1.6,9.6,1.4,8.8,1.4,7.9s0.2-1.7,0.5-2.5l0,0c0.3-0.8,0.8-1.5,1.4-2.1c0.6-0.6,1.3-1.1,2.1-1.4l0,0C6.2,1.6,7,1.4,7.9,1.4c0.6,0,1.1,0.1,1.7,0.2c0.5,0.1,0.9,0.3,1.3,0.5l-0.8,0.8l0,0C10,3.1,9.9,3.2,9.9,3.4v0.2l0,0l0,0c0,0.2,0.2,0.4,0.4,0.5l0,0l4.5,1.8l0,0H15h0.1c0.2,0,0.4-0.1,0.5-0.2l0,0C15.7,5.6,15.8,5.4,15.9,5.2z M11.8,3.2L13,2l0.4,1.1l0,0c0.2,0.4,0.3,0.7,0.4,0.9L11.8,3.2z"/></g></svg>',mirror_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.75 15.74"><g><path d="M13.75,3.76l5.9,15.74h-5.9V3.76ZM4.9,19.5,10.8,3.76V19.5H4.9Z" transform="translate(-4.9 -3.76)"/></g></svg>',mirror_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.75"><g><path d="M20.15,13.1,4.41,19V13.1H20.15ZM4.41,4.25l15.74,5.9H4.41V4.25Z" transform="translate(-4.41 -4.25)"/></g></svg>',checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 12.1"><g><path d="M4.59,12.23l.12.18L9.43,17.5a.58.58,0,0,0,.84,0L20,7.45h0a.58.58,0,0,0,0-.84l-.85-.85a.58.58,0,0,0-.84,0H18.2l-8.12,8.41a.29.29,0,0,1-.42,0l-3.4-3.63a.58.58,0,0,0-.84,0l-.85.85a.6.6,0,0,0-.14.21.51.51,0,0,0,0,.44c.05.06.1.13.16.19Z" transform="translate(-4.38 -5.58)"/></g></svg>',line_break:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6a1,1,0,0,0-1,1v4a1,1,0,0,1-1,1H7.41l1.3-1.29A1,1,0,0,0,7.29,9.29l-3,3a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76,1,1,0,0,0,.21.33l3,3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42L7.41,14H17a3,3,0,0,0,3-3V7A1,1,0,0,0,19,6Z"/></svg>',audio:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z" /></svg>',image_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="30 30 150 150"><g><path d="M152.775,120.548V51.651c0-12.271-9.984-22.254-22.254-22.254H43.727c-12.271,0-22.254,9.983-22.254,22.254v68.896c0,12.27,9.983,22.254,22.254,22.254h86.795C142.791,142.802,152.775,132.817,152.775,120.548z M36.394,51.651c0-4.042,3.291-7.333,7.333-7.333h86.795c4.042,0,7.332,3.291,7.332,7.333v23.917l-14.938-17.767c-1.41-1.678-3.487-2.649-5.68-2.658h-0.029c-2.184,0-4.255,0.954-5.674,2.613L76.709,98.519l-9.096-9.398c-1.427-1.474-3.392-2.291-5.448-2.273c-2.052,0.025-4.004,0.893-5.396,2.4L36.394,111.32V51.651z M41.684,127.585l20.697-22.416l9.312,9.622c1.461,1.511,3.489,2.334,5.592,2.27c2.101-0.066,4.075-1.013,5.44-2.612l34.436-40.308l20.693,24.613v21.794c0,4.042-3.29,7.332-7.332,7.332H43.727C43.018,127.88,42.334,127.775,41.684,127.585z M182.616,152.5V75.657c0-4.12-3.34-7.46-7.461-7.46c-4.119,0-7.46,3.34-7.46,7.46V152.5c0,4.112-3.347,7.46-7.461,7.46h-94c-4.119,0-7.46,3.339-7.46,7.459c0,4.123,3.341,7.462,7.46,7.462h94C172.576,174.881,182.616,164.841,182.616,152.5z"/></g></svg>',bookmark:'<svg viewBox="0 0 24 24"><path d="M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',download:'<svg viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z" /></svg>',dir_ltr:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2H9C6.79 2 5 3.79 5 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zm0 12v3H5v2h12v3l4-4-4-4z"/></svg>',dir_rtl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zM8 14l-4 4 4 4v-3h12v-2H8v-3z"/></svg>',alert_outline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" /></svg>',more_text:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M49.711,142.188h49.027c2.328,0.002,4.394,1.492,5.129,3.699l9.742,29.252c0.363,1.092,1.385,1.828,2.537,1.83l15.883,0.01c0.859,0,1.667-0.412,2.17-1.109s0.641-1.594,0.37-2.41l-16.625-50.045L86.503,28.953c-0.36-1.097-1.383-1.839-2.537-1.842H64.532c-1.153-0.001-2.178,0.736-2.542,1.831L13.847,173.457c-0.271,0.816-0.135,1.713,0.369,2.412c0.503,0.697,1.311,1.109,2.171,1.109h15.872c1.151,0,2.173-0.736,2.537-1.828l9.793-29.287C45.325,143.66,47.39,142.18,49.711,142.188L49.711,142.188z M53.493,119.098l15.607-46.9c0.744-2.196,2.806-3.674,5.125-3.674s4.381,1.478,5.125,3.674l15.607,46.904c0.537,1.621,0.263,3.402-0.736,4.789c-1.018,1.408-2.649,2.24-4.386,2.24H58.615c-1.736,0-3.368-0.832-4.386-2.24C53.23,122.504,52.956,120.721,53.493,119.098L53.493,119.098z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_paragraph:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M128.39,28.499H63.493c-25.558,0-46.354,20.796-46.354,46.354c0,25.559,20.796,46.353,46.354,46.353h9.271v55.625h18.542V47.04h9.271V176.83h18.543V47.04h9.271V28.499z M72.764,102.664h-9.271c-15.337,0-27.813-12.475-27.813-27.812c0-15.336,12.476-27.813,27.813-27.813h9.271V102.664z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="35 30 140 140"><g><path d="M137.215,102.045c0,3.498-2.835,6.332-6.333,6.332H24.549c-3.498,0-6.334-2.834-6.334-6.332l0,0c0-3.498,2.836-6.333,6.334-6.333h106.333C134.38,95.711,137.215,98.547,137.215,102.045L137.215,102.045z M77.715,161.545c-3.498,0-6.333-2.836-6.333-6.334V48.878c0-3.498,2.836-6.333,6.333-6.333l0,0c3.498,0,6.334,2.835,6.334,6.333v106.333C84.049,158.709,81.213,161.545,77.715,161.545L77.715,161.545z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.632,190.465,66.177,190.465,63.32L190.465,63.32z M190.465,101.993c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.888,1.026,5.353,3.056,7.396c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.993L190.465,101.993z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 3.58"><g><path d="M4.64,10.73a1.84,1.84,0,0,1,.65-.65,1.76,1.76,0,0,1,1.79,0A1.79,1.79,0,0,1,8,11.63a1.84,1.84,0,0,1-.25.9,1.69,1.69,0,0,1-.65.65,1.8,1.8,0,0,1-2.69-1.55A2.08,2.08,0,0,1,4.64,10.73Zm6.09,0a1.84,1.84,0,0,1,.65-.65,1.78,1.78,0,0,1,2.67,1.55,1.73,1.73,0,0,1-.24.9,1.84,1.84,0,0,1-.65.65,1.76,1.76,0,0,1-1.79,0,1.79,1.79,0,0,1-.64-2.44Zm6.08,0a1.69,1.69,0,0,1,.65-.65,1.76,1.76,0,0,1,1.79,0,1.79,1.79,0,0,1,.9,1.54,1.73,1.73,0,0,1-.24.9,1.84,1.84,0,0,1-.65.65,1.8,1.8,0,0,1-2.69-1.55A2,2,0,0,1,16.81,10.73Z" transform="translate(-4.39 -9.84)"/></g></svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3.94 15.75"><g><path d="M12.28,7.69a1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39,1.92,1.92,0,0,1,.58-1.39,2,2,0,0,1,1.39-.58,1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39,1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58Zm0,2a1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39A1.92,1.92,0,0,1,13.67,13a2,2,0,0,1-1.39.58A1.92,1.92,0,0,1,10.89,13a2,2,0,0,1-.58-1.39,2,2,0,0,1,2-2Zm0,5.9a1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39,1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58,1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39,1.92,1.92,0,0,1,.58-1.39,1.94,1.94,0,0,1,1.39-.58Z" transform="translate(-10.31 -3.75)"/></g></svg>',attachment:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8.38 15.68"><g><path d="M15.23,6h1v9.78a3.88,3.88,0,0,1-1.31,2.45,4,4,0,0,1-6.57-2.45V7A3,3,0,0,1,9.2,4.89a3,3,0,0,1,5,2.09v8.31a1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58,1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39V8h1v7.32a1,1,0,0,0,.29.69,1,1,0,0,0,.69.28A.9.9,0,0,0,13,16a1,1,0,0,0,.29-.69V7a1.92,1.92,0,0,0-.58-1.39A2,2,0,0,0,11.27,5a1.92,1.92,0,0,0-1.39.58A2,2,0,0,0,9.33,7v8.31a3,3,0,1,0,5.9,0V6Z" transform="translate(-8.08 -3.78)"/></g></svg>',map:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.7 15.62"><g><path d="M12.05,12.42a2.93,2.93,0,1,1,2.07-5A2.88,2.88,0,0,1,15,9.49a3,3,0,0,1-.86,2.07,2.89,2.89,0,0,1-2.07.86Zm0-5.36a2.43,2.43,0,0,0-1.72,4.16,2.48,2.48,0,0,0,1.72.72,2.44,2.44,0,0,0,0-4.88Zm0-3.3A5.84,5.84,0,0,1,17.9,9.62a9.94,9.94,0,0,1-1.73,5A33.59,33.59,0,0,1,12.84,19a1.52,1.52,0,0,1-.23.2,1,1,0,0,1-.55.2h0a1,1,0,0,1-.55-.2,1.52,1.52,0,0,1-.23-.2,33.59,33.59,0,0,1-3.33-4.32,9.93,9.93,0,0,1-1.72-5,5.84,5.84,0,0,1,5.85-5.86ZM12,18.34l.08.05.06-.06a35.58,35.58,0,0,0,3.06-3.93,9.35,9.35,0,0,0,1.74-4.77,4.88,4.88,0,0,0-4.88-4.88A4.79,4.79,0,0,0,8.6,6.17,4.84,4.84,0,0,0,7.17,9.62,9.29,9.29,0,0,0,8.91,14.4,36,36,0,0,0,12,18.34Z" transform="translate(-6.2 -3.76)"/></g></svg>',magic_stick:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.75"><g><path d="M19.86,19.21a1,1,0,0,0,.28-.68,1,1,0,0,0-.28-.7L13,10.93a1,1,0,0,0-.7-.28,1,1,0,0,0-.68,1.65l6.9,6.9a1,1,0,0,0,.69.29.93.93,0,0,0,.69-.28ZM9.19,8.55a3,3,0,0,0,1.68,0,14.12,14.12,0,0,0,1.41-.32A11.26,11.26,0,0,0,10.8,7.06c-.56-.36-.86-.56-.91-.58S10,5.91,10,5.11s0-1.26-.15-1.37a4.35,4.35,0,0,0-1.19.71c-.53.4-.81.62-.87.68a9,9,0,0,0-2-.6,6.84,6.84,0,0,0-.76-.09s0,.27.08.77a8.6,8.6,0,0,0,.61,2q-.09.09-.69.87a3.59,3.59,0,0,0-.68,1.17c.12.17.57.23,1.36.15S7,9.26,7.15,9.23s.21.36.57.91a10.49,10.49,0,0,0,1.14,1.48c0-.1.14-.57.31-1.4a3,3,0,0,0,0-1.67Z" transform="translate(-4.41 -3.74)"/></g></svg>',empty_file:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12.78 15.75"><g><path d="M14.73,3.76,18.67,7.7v9.84a2,2,0,0,1-2,2H7.84a1.89,1.89,0,0,1-1.38-.58,2,2,0,0,1-.57-1.39V5.73a1.93,1.93,0,0,1,.57-1.38,2,2,0,0,1,1.38-.58h6.62l.26,0v0Zm2.95,4.92h-2a1.93,1.93,0,0,1-1.38-.57,2,2,0,0,1-.58-1.4V6.17c0-.36,0-.84,0-1.43H7.85a1,1,0,0,0-.7.29,1,1,0,0,0-.29.7V17.54a1,1,0,0,0,.29.69,1,1,0,0,0,.69.29h8.85a1,1,0,0,0,.71-.29.92.92,0,0,0,.28-.69Zm0-1L14.73,4.74v2A1,1,0,0,0,15,7.4a1,1,0,0,0,.69.29Z" transform="translate(-5.89 -3.76)"/></g></svg>'};var lv={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_LANG a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery",dir_ltr:"Left to right",dir_rtl:"Right to left",mention:"Mention"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window",downloadLinkCheck:"Download link",bookmark:"Bookmark"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return typeof r>"u"&&(n.SUNEDITOR_LANG||Object.defineProperty(n,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:i})),i})})(lv);var oT=lv.exports;const aT=Di(oT),et={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,isChromium:null,isMobile:null,isResizeObserverSupported:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform),this.isChromium=!!window.chrome,this.isResizeObserverSupported=typeof ResizeObserver=="function",this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0)&&"ontouchstart"in window)},_allowedEmptyNodeList:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas",_HTMLConvertor:function(t){const n={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return t.replace(/&|\u00A0|'|"|<|>/g,function(r){return typeof n[r]=="string"?n[r]:r})},zeroWidthSpace:"",zeroWidthRegExp:new RegExp("","g"),onlyZeroWidthRegExp:new RegExp("^+$"),fontValueMap:{"xx-small":1,"x-small":2,small:3,medium:4,large:5,"x-large":6,"xx-large":7},onlyZeroWidthSpace:function(t){return t==null?!1:(typeof t!="string"&&(t=t.textContent),t===""||this.onlyZeroWidthRegExp.test(t))},getXMLHttpRequest:function(){if(this._w.ActiveXObject)try{return new ActiveXObject("Msxml2.XMLHTTP")}catch{try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{return null}}else return this._w.XMLHttpRequest?new XMLHttpRequest:null},getValues:function(t){return t?this._w.Object.keys(t).map(function(n){return t[n]}):[]},camelToKebabCase:function(t){return typeof t=="string"?t.replace(/[A-Z]/g,function(n){return"-"+n.toLowerCase()}):t.map(function(n){return et.camelToKebabCase(n)})},kebabToCamelCase:function(t){return typeof t=="string"?t.replace(/-[a-zA-Z]/g,function(n){return n.replace("-","").toUpperCase()}):t.map(function(n){return et.camelToKebabCase(n)})},createElement:function(t){return this._d.createElement(t)},createTextNode:function(t){return this._d.createTextNode(t||"")},HTMLEncoder:function(t){const n={"<":"$lt;",">":"$gt;"};return t.replace(/<|>/g,function(r){return typeof n[r]=="string"?n[r]:r})},HTMLDecoder:function(t){const n={"$lt;":"<","$gt;":">"};return t.replace(/\$lt;|\$gt;/g,function(r){return typeof n[r]=="string"?n[r]:r})},hasOwn:function(t,n){return this._hasOwn.call(t,n)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(t,n){let r="";const i=[],s=n==="js"?"script":"link",o=n==="js"?"src":"href";let l="(?:";for(let f=0,u=t.length;f<u;f++)l+=t[f]+(f<u-1?"|":")");const c=new this._w.RegExp("(^|.*[\\/])"+l+"(\\.[^\\/]+)?."+n+"(?:\\?.*|;.*)?$","i"),a=new this._w.RegExp(".+\\."+n+"(?:\\?.*|;.*)?$","i");for(let f=this._d.getElementsByTagName(s),u=0;u<f.length;u++)a.test(f[u][o])&&i.push(f[u]);for(let f=0;f<i.length;f++){let u=i[f][o].match(c);if(u){r=u[0];break}}if(r===""&&(r=i.length>0?i[0][o]:""),r.indexOf(":/")===-1&&r.slice(0,2)!=="//"&&(r=r.indexOf("/")===0?location.href.match(/^.*?:\/\/[^\/]*/)[0]+r:location.href.match(/^[^\?]*\/(?:)/)[0]+r),!r)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+n+")";return r},getPageStyle:function(t){let n="";const r=(t||this._d).styleSheets;for(let i=0,s=r.length,o;i<s;i++){try{o=r[i].cssRules}catch{continue}if(o)for(let l=0,c=o.length;l<c;l++)n+=o[l].cssText}return n},getIframeDocument:function(t){let n=t.contentWindow||t.contentDocument;return n.document&&(n=n.document),n},getAttributesToString:function(t,n){if(!t.attributes)return"";const r=t.attributes;let i="";for(let s=0,o=r.length;s<o;s++)n&&n.indexOf(r[s].name)>-1||(i+=r[s].name+'="'+r[s].value+'" ');return i},getByteLength:function(t){if(!t||!t.toString)return 0;t=t.toString();const n=this._w.encodeURIComponent;let r,i;return this.isIE_Edge?(i=this._w.unescape(n(t)).length,r=0,n(t).match(/(%0A|%0D)/gi)!==null&&(r=n(t).match(/(%0A|%0D)/gi).length),i+r):(i=new this._w.TextEncoder("utf-8").encode(t).length,r=0,n(t).match(/(%0A|%0D)/gi)!==null&&(r=n(t).match(/(%0A|%0D)/gi).length),i+r)},isWysiwygDiv:function(t){return t&&t.nodeType===1&&(this.hasClass(t,"se-wrapper-wysiwyg")||/^BODY$/i.test(t.nodeName))},isNonEditable:function(t){return t&&t.nodeType===1&&t.getAttribute("contenteditable")==="false"},isTextStyleElement:function(t){return t&&t.nodeType!==3&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)$/i.test(t.nodeName)},isInputElement:function(t){return t&&t.nodeType===1&&/^(INPUT|TEXTAREA)$/i.test(t.nodeName)},isFormatElement:function(t){return t&&t.nodeType===1&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD|DETAILS)$/i.test(t.nodeName)||this.hasClass(t,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(t)&&!this.isWysiwygDiv(t)},isRangeFormatElement:function(t){return t&&t.nodeType===1&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD|DETAILS)$/i.test(t.nodeName)||this.hasClass(t,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(t){return t&&t.nodeType===1&&(/^(TH|TD)$/i.test(t.nodeName)||this.hasClass(t,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(t){return t&&t.nodeType===1&&(/^PRE$/i.test(t.nodeName)||this.hasClass(t,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(t)&&!this.isWysiwygDiv(t)},isClosureFreeFormatElement:function(t){return t&&t.nodeType===1&&this.hasClass(t,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(t){return t&&(/se-component/.test(t.className)||/^(TABLE|HR)$/.test(t.nodeName))},isUneditableComponent:function(t){return t&&this.hasClass(t,"__se__uneditable")},isMediaComponent:function(t){return t&&/se-component/.test(t.className)},isNotCheckingNode:function(t){return t&&/katex|__se__tag/.test(t.className)},getFormatElement:function(t,n){if(!t)return null;for(n||(n=function(){return!0});t;){if(this.isWysiwygDiv(t))return null;if(this.isRangeFormatElement(t)&&t.firstElementChild,this.isFormatElement(t)&&n(t))return t;t=t.parentNode}return null},getRangeFormatElement:function(t,n){if(!t)return null;for(n||(n=function(){return!0});t;){if(this.isWysiwygDiv(t))return null;if(this.isRangeFormatElement(t)&&!/^(THEAD|TBODY|TR)$/i.test(t.nodeName)&&n(t))return t;t=t.parentNode}return null},getFreeFormatElement:function(t,n){if(!t)return null;for(n||(n=function(){return!0});t;){if(this.isWysiwygDiv(t))return null;if(this.isFreeFormatElement(t)&&n(t))return t;t=t.parentNode}return null},getClosureFreeFormatElement:function(t,n){if(!t)return null;for(n||(n=function(){return!0});t;){if(this.isWysiwygDiv(t))return null;if(this.isClosureFreeFormatElement(t)&&n(t))return t;t=t.parentNode}return null},copyTagAttributes:function(t,n,r){if(n.style.cssText){const s=n.style;for(let o=0,l=s.length;o<l;o++)t.style[s[o]]=s[s[o]]}const i=n.attributes;for(let s=0,o=i.length,l;s<o;s++)l=i[s].name.toLowerCase(),r&&r.indexOf(l)>-1||!i[s].value?t.removeAttribute(l):l!=="style"&&t.setAttribute(i[s].name,i[s].value)},copyFormatAttributes:function(t,n){n=n.cloneNode(!1),n.className=n.className.replace(/(\s|^)__se__format__[^\s]+/g,""),this.copyTagAttributes(t,n)},getArrayItem:function(t,n,r){if(!t||t.length===0)return null;n=n||function(){return!0};const i=[];for(let s=0,o=t.length,l;s<o;s++)if(l=t[s],n(l))if(r)i.push(l);else return l;return r?i:null},arrayIncludes:function(t,n){for(let r=0;r<t.length;r++)if(t[r]===n)return!0;return!1},getArrayIndex:function(t,n){let r=-1;for(let i=0,s=t.length;i<s;i++)if(t[i]===n){r=i;break}return r},nextIdx:function(t,n){let r=this.getArrayIndex(t,n);return r===-1?-1:r+1},prevIdx:function(t,n){let r=this.getArrayIndex(t,n);return r===-1?-1:r-1},getPositionIndex:function(t){let n=0;for(;t=t.previousSibling;)n+=1;return n},getNodePath:function(t,n,r){const i=[];let s=!0;return this.getParentElement(t,(function(o){if(o===n&&(s=!1),s&&!this.isWysiwygDiv(o)){if(r&&o.nodeType===3){let l=null,c=null;r.s=r.e=0;let a=o.previousSibling;for(;a&&a.nodeType===3;)c=a.textContent.replace(this.zeroWidthRegExp,""),r.s+=c.length,o.textContent=c+o.textContent,l=a,a=a.previousSibling,this.removeItem(l);let f=o.nextSibling;for(;f&&f.nodeType===3;)c=f.textContent.replace(this.zeroWidthRegExp,""),r.e+=c.length,o.textContent+=c,l=f,f=f.nextSibling,this.removeItem(l)}i.push(o)}return!1}).bind(this)),i.map(this.getPositionIndex).reverse()},getNodeFromPath:function(t,n){let r=n,i;for(let s=0,o=t.length;s<o&&(i=r.childNodes,i.length!==0);s++)i.length<=t[s]?r=i[i.length-1]:r=i[t[s]];return r},isSameAttributes:function(t,n){if(t.nodeType===3&&n.nodeType===3)return!0;if(t.nodeType===3||n.nodeType===3)return!1;const r=t.style,i=n.style;let s=0;for(let f=0,u=r.length;f<u;f++)r[r[f]]===i[r[f]]&&s++;const o=t.classList,l=n.classList,c=this._w.RegExp;let a=0;for(let f=0,u=o.length;f<u;f++)c("(s|^)"+o[f]+"(s|$)").test(l.value)&&a++;return s===i.length&&s===r.length&&a===l.length&&a===o.length},isEmptyLine:function(t){return!t||!t.parentNode||!t.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&t.children.length===0&&this.onlyZeroWidthSpace(t.textContent)},isSpanWithoutAttr:function(t){return!!t&&t.nodeType===1&&/^SPAN$/i.test(t.nodeName)&&!t.className&&!t.style.cssText},isList:function(t){return t&&/^(OL|UL)$/i.test(typeof t=="string"?t:t.nodeName)},isListCell:function(t){return t&&/^LI$/i.test(typeof t=="string"?t:t.nodeName)},isTable:function(t){return t&&/^(TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(typeof t=="string"?t:t.nodeName)},isCell:function(t){return t&&/^(TD|TH)$/i.test(typeof t=="string"?t:t.nodeName)},isBreak:function(t){return t&&/^BR$/i.test(typeof t=="string"?t:t.nodeName)},isAnchor:function(t){return t&&/^A$/i.test(typeof t=="string"?t:t.nodeName)},isMedia:function(t){return t&&/^(IMG|IFRAME|AUDIO|VIDEO|CANVAS)$/i.test(typeof t=="string"?t:t.nodeName)},isFigures:function(t){return t&&(this.isMedia(t)||/^(FIGURE)$/i.test(typeof t=="string"?t:t.nodeName))},isNumber:function(t){return!!t&&/^-?\d+(\.\d+)?$/.test(t+"")},getNumber:function(t,n){if(!t)return 0;let r=(t+"").match(/-?\d+(\.\d+)?/);return!r||!r[0]?0:(r=r[0],n<0?r*1:n===0?this._w.Math.round(r*1):(r*1).toFixed(n)*1)},getListChildren:function(t,n){const r=[];return!t||!t.children||t.children.length===0||(n=n||function(){return!0},function i(s){if(t!==s&&n(s)&&r.push(s),s.children)for(let o=0,l=s.children.length;o<l;o++)i(s.children[o])}(t)),r},getListChildNodes:function(t,n){const r=[];return!t||t.childNodes.length===0||(n=n||function(){return!0},function i(s){t!==s&&n(s)&&r.push(s);for(let o=0,l=s.childNodes.length;o<l;o++)i(s.childNodes[o])}(t)),r},getElementDepth:function(t){if(!t||this.isWysiwygDiv(t))return-1;let n=0;for(t=t.parentNode;t&&!this.isWysiwygDiv(t);)n+=1,t=t.parentNode;return n},compareElements:function(t,n){let r=t,i=n;for(;r&&i&&r.parentNode!==i.parentNode;)r=r.parentNode,i=i.parentNode;if(!r||!i)return{ancestor:null,a:t,b:n,result:0};const s=r.parentNode.childNodes,o=this.getArrayIndex(s,r),l=this.getArrayIndex(s,i);return{ancestor:r.parentNode,a:r,b:i,result:o>l?1:o<l?-1:0}},getParentElement:function(t,n){let r;if(typeof n=="function")r=n;else{let i;/^\./.test(n)?(i="className",n=n.split(".")[1]):/^#/.test(n)?(i="id",n="^"+n.split("#")[1]+"$"):/^:/.test(n)?(i="name",n="^"+n.split(":")[1]+"$"):(i="nodeName",n="^"+n+"$");const s=new this._w.RegExp(n,"i");r=function(o){return s.test(o[i])}}for(;t&&!r(t);){if(this.isWysiwygDiv(t))return null;t=t.parentNode}return t},getPreviousDeepestNode:function(t,n){let r=t.previousSibling;if(!r){for(let i=t.parentNode;i;i=i.parentNode){if(i===n)return null;if(i.previousSibling){r=i.previousSibling;break}}if(!r)return null}for(;r.lastChild;)r=r.lastChild;return r},getNextDeepestNode:function(t,n){let r=t.nextSibling;if(!r){for(let i=t.parentNode;i;i=i.parentNode){if(i===n)return null;if(i.nextSibling){r=i.nextSibling;break}}if(!r)return null}for(;r.firstChild;)r=r.firstChild;return r},getChildElement:function(t,n,r){let i;if(typeof n=="function")i=n;else{let o;/^\./.test(n)?(o="className",n=n.split(".")[1]):/^#/.test(n)?(o="id",n="^"+n.split("#")[1]+"$"):/^:/.test(n)?(o="name",n="^"+n.split(":")[1]+"$"):(o="nodeName",n="^"+(n==="text"?"#"+n:n)+"$");const l=new this._w.RegExp(n,"i");i=function(c){return l.test(c[o])}}const s=this.getListChildNodes(t,function(o){return i(o)});return s[r?s.length-1:0]},getEdgeChildNodes:function(t,n){if(t){for(n||(n=t);t&&t.nodeType===1&&t.childNodes.length>0&&!this.isBreak(t);)t=t.firstChild;for(;n&&n.nodeType===1&&n.childNodes.length>0&&!this.isBreak(n);)n=n.lastChild;return{sc:t,ec:n||t}}},getOffset:function(t,n){let r=0,i=0,s=t.nodeType===3?t.parentElement:t;const o=this.getParentElement(t,this.isWysiwygDiv.bind(this));for(;s&&!this.hasClass(s,"se-container")&&s!==o;)r+=s.offsetLeft,i+=s.offsetTop,s=s.offsetParent;const l=n&&/iframe/i.test(n.nodeName);return{left:r+(l?n.parentElement.offsetLeft:0),top:i-(o?o.scrollTop:0)+(l?n.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(t,n,r,i){if(t<=i?n<r:n>r)return 0;const s=(t>r?t:r)-(n<i?n:i);return(s<0?s*-1:s)+1},changeTxt:function(t,n){!t||!n||(t.textContent=n)},changeElement:function(t,n){if(typeof n=="string")if(t.outerHTML)t.outerHTML=n;else{const r=this.createElement("DIV");r.innerHTML=n,n=r.firstChild,t.parentNode.replaceChild(n,t)}else n.nodeType===1&&t.parentNode.replaceChild(n,t)},setStyle:function(t,n,r){t.style[n]=r,!r&&!t.style.cssText&&t.removeAttribute("style")},hasClass:function(t,n){if(t)return new this._w.RegExp(n).test(t.className)},addClass:function(t,n){!t||new this._w.RegExp("(\\s|^)"+n+"(\\s|$)").test(t.className)||(t.className+=(t.className.length>0?" ":"")+n)},removeClass:function(t,n){if(!t)return;const r=new this._w.RegExp("(\\s|^)"+n+"(\\s|$)");t.className=t.className.replace(r," ").trim(),t.className.trim()||t.removeAttribute("class")},toggleClass:function(t,n){if(!t)return;let r=!1;const i=new this._w.RegExp("(\\s|^)"+n+"(\\s|$)");return i.test(t.className)?t.className=t.className.replace(i," ").trim():(t.className+=" "+n,r=!0),t.className.trim()||t.removeAttribute("class"),r},isImportantDisabled:function(t){return t.hasAttribute("data-important-disabled")},setDisabledButtons:function(t,n,r){for(let i=0,s=n.length;i<s;i++){let o=n[i];(r||!this.isImportantDisabled(o))&&(o.disabled=t),r&&(t?o.setAttribute("data-important-disabled",""):o.removeAttribute("data-important-disabled"))}},removeItem:function(t){t&&(typeof t.remove=="function"?t.remove():t.parentNode&&t.parentNode.removeChild(t))},removeItemAllParents:function(t,n,r){if(!t)return null;let i=null;return n||(n=(function(s){if(s===r||this.isComponent(s))return!1;const o=s.textContent.trim();return o.length===0||/^(\n|\u200B)+$/.test(o)}).bind(this)),function s(o){if(!et.isWysiwygDiv(o)){const l=o.parentNode;l&&n(o)&&(i={sc:o.previousElementSibling,ec:o.nextElementSibling},et.removeItem(o),s(l))}}(t),i},detachNestedList:function(t,n){const r=this._deleteNestedList(t);let i,s;if(r){i=r.cloneNode(!1),s=r.childNodes;const l=this.getPositionIndex(t);for(;s[l];)i.appendChild(s[l])}else i=t;let o;if(n)o=this.getListChildren(i,(function(l){return this.isListCell(l)&&!l.previousElementSibling}).bind(this));else{const l=this.getElementDepth(t)+2;o=this.getListChildren(t,(function(c){return this.isListCell(c)&&!c.previousElementSibling&&this.getElementDepth(c)===l}).bind(this))}for(let l=0,c=o.length;l<c;l++)this._deleteNestedList(o[l]);return r&&(r.parentNode.insertBefore(i,r.nextSibling),s&&s.length===0&&this.removeItem(r)),i===t?i.parentNode:i},_deleteNestedList:function(t){const n=t.parentNode;let r=n,i=r.parentNode,s,o,l,c,a;for(;this.isListCell(i);){for(c=this.getPositionIndex(t),s=i.nextElementSibling,o=i.parentNode,l=r;l;){if(r=r.nextSibling,this.isList(l)){for(a=l.childNodes;a[c];)o.insertBefore(a[c],s);a.length===0&&this.removeItem(l)}else o.appendChild(l);l=r}r=o,i=o.parentNode}return n.children.length===0&&this.removeItem(n),o},splitElement:function(t,n,r){if(this.isWysiwygDiv(t))return t;if(n&&!this.isNumber(n)){const y=t.childNodes;let _=this.getPositionIndex(n);const S=t.cloneNode(!1),E=t.cloneNode(!1);for(let d=0,h=y.length;d<h;d++){if(d<_)S.appendChild(y[d]);else if(d>_)E.appendChild(y[d]);else continue;d--,h--,_--}return S.childNodes.length>0&&t.parentNode.insertBefore(S,t),E.childNodes.length>0&&t.parentNode.insertBefore(E,t.nextElementSibling),t}const i=t.parentNode;let s=0,o=1,l=!0,c,a,f;if((!r||r<0)&&(r=0),t.nodeType===3){if(s=this.getPositionIndex(t),n>=0&&t.length!==n){t.splitText(n);const y=this.getNodeFromPath([s+1],i);this.onlyZeroWidthSpace(y)&&(y.data=this.zeroWidthSpace)}}else if(t.nodeType===1){if(n===0){for(;t.firstChild;)t=t.firstChild;if(t.nodeType===3){const y=this.createTextNode(this.zeroWidthSpace);t.parentNode.insertBefore(y,t),t=y}}t.previousSibling?t=t.previousSibling:this.getElementDepth(t)===r&&(l=!1)}t.nodeType===1&&(o=0);let u=t;for(;this.getElementDepth(u)>r;)for(s=this.getPositionIndex(u)+o,u=u.parentNode,f=c,c=u.cloneNode(!1),a=u.childNodes,f&&(this.isListCell(c)&&this.isList(f)&&f.firstElementChild?(c.innerHTML=f.firstElementChild.innerHTML,et.removeItem(f.firstElementChild),f.children.length>0&&c.appendChild(f)):c.appendChild(f));a[s];)c.appendChild(a[s]);u.childNodes.length<=1&&(!u.firstChild||u.firstChild.textContent.length===0)&&(u.innerHTML="<br>");const m=u.parentNode;return l&&(u=u.nextSibling),c?(this.mergeSameTags(c,null,!1),this.mergeNestedTags(c,(function(y){return this.isList(y)}).bind(this)),c.childNodes.length>0?m.insertBefore(c,u):c=u,this.isListCell(c)&&c.children&&this.isList(c.children[0])&&c.insertBefore(this.createElement("BR"),c.children[0]),i.childNodes.length===0&&this.removeItem(i),c):u},mergeSameTags:function(t,n,r){const i=this,s=n?n.length:0;let o=null;return s&&(o=this._w.Array.apply(null,new this._w.Array(s)).map(this._w.Number.prototype.valueOf,0)),function l(c,a,f){const u=c.childNodes;for(let m=0,y=u.length,_,S;m<y&&(_=u[m],S=u[m+1],!!_);m++)if(!(i.isBreak(_)||i.isMedia(_)||i.isInputElement(_))){if(r&&i._isIgnoreNodeChange(_)||!r&&(i.isTable(_)||i.isListCell(_)||i.isFormatElement(_)&&!i.isFreeFormatElement(_))){(i.isTable(_)||i.isListCell(_))&&l(_,a+1,m);continue}if(y===1&&c.nodeName===_.nodeName&&c.parentNode){if(s){let E,d,h,v,x;for(let g=0;g<s;g++)if(E=n[g],E&&E[a]===m){for(d=_,h=c,v=a,x=!0;v>=0;){if(i.getArrayIndex(h.childNodes,d)!==E[v]){x=!1;break}d=_.parentNode,h=d.parentNode,v--}x&&(E.splice(a,1),E[a]=m)}}i.copyTagAttributes(_,c),c.parentNode.insertBefore(_,c),i.removeItem(c)}if(!S){_.nodeType===1&&l(_,a+1,m);break}if(_.nodeName===S.nodeName&&i.isSameAttributes(_,S)&&_.href===S.href){const E=_.childNodes;let d=0;for(let g=0,b=E.length;g<b;g++)E[g].textContent.length>0&&d++;const h=_.lastChild,v=S.firstChild;let x=0;if(h&&v){const g=h.nodeType===3&&v.nodeType===3;x=h.textContent.length;let b=h.previousSibling;for(;b&&b.nodeType===3;)x+=b.textContent.length,b=b.previousSibling;if(d>0&&h.nodeType===3&&v.nodeType===3&&(h.textContent.length>0||v.textContent.length>0)&&d--,s){let w=null;for(let k=0;k<s;k++)if(w=n[k],w&&w[a]>m){if(a>0&&w[a-1]!==f)continue;w[a]-=1,w[a+1]>=0&&w[a]===m&&(w[a+1]+=d,g&&h&&h.nodeType===3&&v&&v.nodeType===3&&(o[k]+=x))}}}if(_.nodeType===3){if(x=_.textContent.length,_.textContent+=S.textContent,s){let g=null;for(let b=0;b<s;b++)if(g=n[b],g&&g[a]>m){if(a>0&&g[a-1]!==f)continue;g[a]-=1,g[a+1]>=0&&g[a]===m&&(g[a+1]+=d,o[b]+=x)}}}else _.innerHTML+=S.innerHTML;i.removeItem(S),m--}else _.nodeType===1&&l(_,a+1,m)}}(t,0,0),o},mergeNestedTags:function(t,n){typeof n=="string"?n=(function(r){return this.test(r.tagName)}).bind(new this._w.RegExp("^("+(n||".+")+")$","i")):typeof n!="function"&&(n=function(){return!0}),function r(i){let s=i.children;if(s.length===1&&s[0].nodeName===i.nodeName&&n(i)){const o=s[0];for(s=o.children;s[0];)i.appendChild(s[0]);i.removeChild(o)}for(let o=0,l=i.children.length;o<l;o++)r(i.children[o])}(t)},removeEmptyNode:function(t,n,r){const i=this;n&&(n=i.getParentElement(n,function(s){return t===s.parentElement})),function s(o){if(i._notTextNode(o)||o===n||i.isNonEditable(o))return 0;if(o!==t&&i.onlyZeroWidthSpace(o.textContent)&&(!o.firstChild||!i.isBreak(o.firstChild))&&!o.querySelector(i._allowedEmptyNodeList)){if(o.parentNode)return o.parentNode.removeChild(o),-1}else{const l=o.children;for(let c=0,a=l.length,f=0;c<a;c++)!l[c+f]||i.isComponent(l[c+f])||(f+=s(l[c+f]))}return 0}(t),t.childNodes.length===0&&(r?this.removeItem(t):t.innerHTML="<br>")},htmlRemoveWhiteSpace:function(t){return t?t.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)[^>^<]+>\s+(?=<)/ig,function(n){return n.replace(/\n/g,"").replace(/\s+/," ")}):""},htmlCompress:function(t){return t.replace(/\n/g,"").replace(/>\s+</g,"> <")},sortByDepth:function(t,n){const r=n?1:-1,i=r*-1;t.sort((function(s,o){return!this.isListCell(s)||!this.isListCell(o)?0:(s=this.getElementDepth(s),o=this.getElementDepth(o),s>o?r:s<o?i:0)}).bind(this))},escapeStringRegexp:function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},_isExcludeSelectionElement:function(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.isComponent(t)||/FIGURE/i.test(t.nodeName))},_isIgnoreNodeChange:function(t){return t&&t.nodeType!==3&&(this.isNonEditable(t)||!this.isTextStyleElement(t))},_isMaintainedNode:function(t){return t&&t.nodeType!==3&&/^(a|label|code|summary)$/i.test(typeof t=="string"?t:t.nodeName)},_isSizeNode:function(t){return t&&t.nodeType!==3&&this.isTextStyleElement(t)&&!!t.style.fontSize},_notTextNode:function(t){return t&&t.nodeType!==3&&(this.isComponent(t)||/^(br|input|select|canvas|img|iframe|audio|video)$/i.test(typeof t=="string"?t:t.nodeName))},_disallowedTags:function(t){return/^(meta|script|link|style|[a-z]+\:[a-z]+)$/i.test(t.nodeName)},createTagsWhitelist:function(t){return new RegExp("<\\/?\\b(?!\\b"+(t||"").replace(/\|/g,"\\b|\\b")+"\\b)[^>]*>","gi")},createTagsBlacklist:function(t){return new RegExp("<\\/?\\b(?:\\b"+(t||"^").replace(/\|/g,"\\b|\\b")+"\\b)[^>]*>","gi")},_consistencyCheckOfHTML:function(t,n,r,i,s){const o=[],l=[],c=[],a=[],f=this.getListChildNodes(t,(function(m){if(m.nodeType!==1)return this.isList(m.parentElement)&&o.push(m),!1;if(r.test(m.nodeName)||!n.test(m.nodeName)&&m.childNodes.length===0&&this.isNotCheckingNode(m))return o.push(m),!1;const y=!this.getParentElement(m,this.isNotCheckingNode);if(!this.isTable(m)&&!this.isListCell(m)&&!this.isAnchor(m)&&(this.isFormatElement(m)||this.isRangeFormatElement(m)||this.isTextStyleElement(m))&&m.childNodes.length===0&&y)return l.push(m),!1;if(this.isList(m.parentNode)&&!this.isList(m)&&!this.isListCell(m))return c.push(m),!1;if(this.isCell(m)){const S=m.firstElementChild;if(!this.isFormatElement(S)&&!this.isRangeFormatElement(S)&&!this.isComponent(S))return a.push(m),!1}if(y&&m.className){const S=new this._w.Array(m.classList).map(i).join(" ").trim();S?m.className=S:m.removeAttribute("class")}return s&&m.parentNode!==t&&y&&(this.isListCell(m)&&!this.isList(m.parentNode)||(this.isFormatElement(m)||this.isComponent(m))&&!this.isRangeFormatElement(m.parentNode)&&!this.getParentElement(m,this.isComponent))}).bind(this));for(let m=0,y=o.length;m<y;m++)this.removeItem(o[m]);const u=[];for(let m=0,y=f.length,_,S;m<y;m++)if(_=f[m],S=_.parentNode,!(!S||!S.parentNode))if(this.getParentElement(_,this.isListCell)){const E=_.childNodes;for(let d=E.length-1;y>=0;d--)S.insertBefore(_,E[d]);u.push(_)}else S.parentNode.insertBefore(_,S),u.push(S);for(let m=0,y=u.length,_;m<y;m++)_=u[m],this.onlyZeroWidthSpace(_.textContent.trim())&&this.removeItem(_);for(let m=0,y=l.length;m<y;m++)this.removeItem(l[m]);for(let m=0,y=c.length,_,S,E,d;m<y;m++)if(_=c[m],d=_.parentNode,!!d)if(S=this.createElement("LI"),this.isFormatElement(_)){for(E=_.childNodes;E[0];)S.appendChild(E[0]);d.insertBefore(S,_),this.removeItem(_)}else _=_.nextSibling,S.appendChild(c[m]),d.insertBefore(S,_);for(let m=0,y=a.length,_,S;m<y;m++)_=a[m],S=this.createElement("DIV"),S.innerHTML=_.textContent.trim().length===0&&_.children.length===0?"<br>":_.innerHTML,_.innerHTML=S.outerHTML},_setDefaultOptionStyle:function(t,n){let r="";t.height&&(r+="height:"+t.height+";"),t.minHeight&&(r+="min-height:"+t.minHeight+";"),t.maxHeight&&(r+="max-height:"+t.maxHeight+";"),t.position&&(r+="position:"+t.position+";"),t.width&&(r+="width:"+t.width+";"),t.minWidth&&(r+="min-width:"+t.minWidth+";"),t.maxWidth&&(r+="max-width:"+t.maxWidth+";");let i="",s="",o="";n=r+n;const l=n.split(";");for(let c=0,a=l.length,f;c<a;c++)if(f=l[c].trim(),!!f){if(/^(min-|max-)?width\s*:/.test(f)||/^(z-index|position)\s*:/.test(f)){i+=f+";";continue}if(/^(min-|max-)?height\s*:/.test(f)){/^height/.test(f)&&f.split(":")[1].trim()==="auto"&&(t.height="auto"),s+=f+";";continue}o+=f+";"}return{top:i,frame:s,editor:o}},_setIframeDocument:function(t,n){t.setAttribute("scrolling","auto"),t.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+this._setIframeCssTags(n),t.contentDocument.body.className=n._editableClass,t.contentDocument.body.setAttribute("contenteditable",!0),t.contentDocument.body.setAttribute("autocorrect","off")},_setIframeCssTags:function(t){const n=t.iframeCSSFileName,r=this._w.RegExp;let i="";for(let s=0,o=n.length,l;s<o;s++){if(l=[],/(^https?:\/\/)|(^data:text\/css,)/.test(n[s]))l.push(n[s]);else{const c=new r("(^|.*[\\/])"+n[s]+"(\\..+)?\\.css(?:\\?.*|;.*)?$","i");for(let a=document.getElementsByTagName("link"),f=0,u=a.length,m;f<u;f++)m=a[f].href.match(c),m&&l.push(m[0])}if(!l||l.length===0)throw'[SUNEDITOR.constructor.iframe.fail] The suneditor CSS files installation path could not be automatically detected. Please set the option property "iframeCSSFileName" before creating editor instances.';for(let c=0,a=l.length;c<a;c++)i+='<link href="'+l[c]+'" rel="stylesheet">'}return i+(t.height==="auto"?`<style>
|
|
326
|
+
*/var Tf;function oC(){return Tf||(Tf=1,process.env.NODE_ENV!=="production"&&function(){function t(_,S){return _===S&&(_!==0||1/_===1/S)||_!==_&&S!==S}function n(_,S){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var E=S();if(!m){var d=S();o(E,d)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),m=!0)}d=l({inst:{value:E,getSnapshot:S}});var h=d[0].inst,v=d[1];return a(function(){h.value=E,h.getSnapshot=S,r(h)&&v({inst:h})},[_,E,S]),c(function(){return r(h)&&v({inst:h}),_(function(){r(h)&&v({inst:h})})},[_]),f(E),E}function r(_){var S=_.getSnapshot;_=_.value;try{var E=S();return!o(_,E)}catch{return!0}}function i(_,S){return S()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=V,o=typeof Object.is=="function"?Object.is:t,l=s.useState,c=s.useEffect,a=s.useLayoutEffect,f=s.useDebugValue,u=!1,m=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?i:n;ec.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ec}process.env.NODE_ENV==="production"?qc.exports=sC():qc.exports=oC();var aC=qc.exports;function lC(){return aC.useSyncExternalStore(cC,()=>!0,()=>!1)}function cC(){return()=>{}}var iu="Avatar",[uC]=rC(iu),[dC,_g]=uC(iu),Sg=C.forwardRef((t,n)=>{const{__scopeAvatar:r,...i}=t,[s,o]=C.useState("idle");return p.jsx(dC,{scope:r,imageLoadingStatus:s,onImageLoadingStatusChange:o,children:p.jsx(Qs.span,{...i,ref:n})})});Sg.displayName=iu;var kg="AvatarImage",Eg=C.forwardRef((t,n)=>{const{__scopeAvatar:r,src:i,onLoadingStatusChange:s=()=>{},...o}=t,l=_g(kg,r),c=fC(i,o),a=Qt(f=>{s(f),l.onImageLoadingStatusChange(f)});return qt(()=>{c!=="idle"&&a(c)},[c,a]),c==="loaded"?p.jsx(Qs.img,{...o,ref:n,src:i}):null});Eg.displayName=kg;var Tg="AvatarFallback",Ng=C.forwardRef((t,n)=>{const{__scopeAvatar:r,delayMs:i,...s}=t,o=_g(Tg,r),[l,c]=C.useState(i===void 0);return C.useEffect(()=>{if(i!==void 0){const a=window.setTimeout(()=>c(!0),i);return()=>window.clearTimeout(a)}},[i]),l&&o.imageLoadingStatus!=="loaded"?p.jsx(Qs.span,{...s,ref:n}):null});Ng.displayName=Tg;function Nf(t,n){return t?n?(t.src!==n&&(t.src=n),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function fC(t,{referrerPolicy:n,crossOrigin:r}){const i=lC(),s=C.useRef(null),o=i?(s.current||(s.current=new window.Image),s.current):null,[l,c]=C.useState(()=>Nf(o,t));return qt(()=>{c(Nf(o,t))},[o,t]),qt(()=>{const a=m=>()=>{c(m)};if(!o)return;const f=a("loaded"),u=a("error");return o.addEventListener("load",f),o.addEventListener("error",u),n&&(o.referrerPolicy=n),typeof r=="string"&&(o.crossOrigin=r),()=>{o.removeEventListener("load",f),o.removeEventListener("error",u)}},[o,r,n]),l}var Mg=Sg,Ag=Eg,Dg=Ng;const su=C.forwardRef(({className:t,...n},r)=>p.jsx(Mg,{ref:r,className:Q("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...n}));su.displayName=Mg.displayName;const ou=C.forwardRef(({className:t,...n},r)=>p.jsx(Ag,{ref:r,className:Q("aspect-square h-full w-full",t),...n}));ou.displayName=Ag.displayName;const au=C.forwardRef(({className:t,...n},r)=>p.jsx(Dg,{ref:r,className:Q("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...n}));au.displayName=Dg.displayName;function hC(t,n=[]){let r=[];function i(o,l){const c=C.createContext(l),a=r.length;r=[...r,l];const f=m=>{var h;const{scope:y,children:_,...S}=m,E=((h=y==null?void 0:y[t])==null?void 0:h[a])||c,d=C.useMemo(()=>S,Object.values(S));return p.jsx(E.Provider,{value:d,children:_})};f.displayName=o+"Provider";function u(m,y){var E;const _=((E=y==null?void 0:y[t])==null?void 0:E[a])||c,S=C.useContext(_);if(S)return S;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[f,u]}const s=()=>{const o=r.map(l=>C.createContext(l));return function(c){const a=(c==null?void 0:c[t])||o;return C.useMemo(()=>({[`__scope${t}`]:{...c,[t]:a}}),[c,a])}};return s.scopeName=t,[i,mC(s,...n)]}function mC(...t){const n=t[0];if(t.length===1)return n;const r=()=>{const i=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const l=i.reduce((c,{useScope:a,scopeName:f})=>{const m=a(o)[`__scope${f}`];return{...c,...m}},{});return C.useMemo(()=>({[`__scope${n.scopeName}`]:l}),[l])}};return r.scopeName=n.scopeName,r}function pC(t){const n=gC(t),r=C.forwardRef((i,s)=>{const{children:o,...l}=i,c=C.Children.toArray(o),a=c.find(bC);if(a){const f=a.props.children,u=c.map(m=>m===a?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:m);return p.jsx(n,{...l,ref:s,children:C.isValidElement(f)?C.cloneElement(f,void 0,u):null})}return p.jsx(n,{...l,ref:s,children:o})});return r.displayName=`${t}.Slot`,r}function gC(t){const n=C.forwardRef((r,i)=>{const{children:s,...o}=r;if(C.isValidElement(s)){const l=xC(s),c=yC(o,s.props);return s.type!==C.Fragment&&(c.ref=i?zt(i,l):l),C.cloneElement(s,c)}return C.Children.count(s)>1?C.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Rg=Symbol("radix.slottable");function vC(t){const n=({children:r})=>p.jsx(p.Fragment,{children:r});return n.displayName=`${t}.Slottable`,n.__radixId=Rg,n}function bC(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Rg}function yC(t,n){const r={...n};for(const i in n){const s=t[i],o=n[i];/^on[A-Z]/.test(i)?s&&o?r[i]=(...c)=>{const a=o(...c);return s(...c),a}:s&&(r[i]=s):i==="style"?r[i]={...s,...o}:i==="className"&&(r[i]=[s,o].filter(Boolean).join(" "))}return{...t,...r}}function xC(t){var i,s;let n=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var wC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],CC=wC.reduce((t,n)=>{const r=pC(`Primitive.${n}`),i=C.forwardRef((s,o)=>{const{asChild:l,...c}=s,a=l?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...c,ref:o})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{}),[nl]=hC("Tooltip",[li]),rl=li(),Pg="TooltipProvider",_C=700,Yc="tooltip.open",[SC,lu]=nl(Pg),Lg=t=>{const{__scopeTooltip:n,delayDuration:r=_C,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:o}=t,l=C.useRef(!0),c=C.useRef(!1),a=C.useRef(0);return C.useEffect(()=>{const f=a.current;return()=>window.clearTimeout(f)},[]),p.jsx(SC,{scope:n,isOpenDelayedRef:l,delayDuration:r,onOpen:C.useCallback(()=>{window.clearTimeout(a.current),l.current=!1},[]),onClose:C.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(()=>l.current=!0,i)},[i]),isPointerInTransitRef:c,onPointerInTransitChange:C.useCallback(f=>{c.current=f},[]),disableHoverableContent:s,children:o})};Lg.displayName=Pg;var Ws="Tooltip",[kC,il]=nl(Ws),Ig=t=>{const{__scopeTooltip:n,children:r,open:i,defaultOpen:s,onOpenChange:o,disableHoverableContent:l,delayDuration:c}=t,a=lu(Ws,t.__scopeTooltip),f=rl(n),[u,m]=C.useState(null),y=un(),_=C.useRef(0),S=l??a.disableHoverableContent,E=c??a.delayDuration,d=C.useRef(!1),[h,v]=zn({prop:i,defaultProp:s??!1,onChange:k=>{k?(a.onOpen(),document.dispatchEvent(new CustomEvent(Yc))):a.onClose(),o==null||o(k)},caller:Ws}),x=C.useMemo(()=>h?d.current?"delayed-open":"instant-open":"closed",[h]),g=C.useCallback(()=>{window.clearTimeout(_.current),_.current=0,d.current=!1,v(!0)},[v]),b=C.useCallback(()=>{window.clearTimeout(_.current),_.current=0,v(!1)},[v]),w=C.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{d.current=!0,v(!0),_.current=0},E)},[E,v]);return C.useEffect(()=>()=>{_.current&&(window.clearTimeout(_.current),_.current=0)},[]),p.jsx(ro,{...f,children:p.jsx(kC,{scope:n,contentId:y,open:h,stateAttribute:x,trigger:u,onTriggerChange:m,onTriggerEnter:C.useCallback(()=>{a.isOpenDelayedRef.current?w():g()},[a.isOpenDelayedRef,w,g]),onTriggerLeave:C.useCallback(()=>{S?b():(window.clearTimeout(_.current),_.current=0)},[b,S]),onOpen:g,onClose:b,disableHoverableContent:S,children:r})})};Ig.displayName=Ws;var Gc="TooltipTrigger",Og=C.forwardRef((t,n)=>{const{__scopeTooltip:r,...i}=t,s=il(Gc,r),o=lu(Gc,r),l=rl(r),c=C.useRef(null),a=st(n,c,s.onTriggerChange),f=C.useRef(!1),u=C.useRef(!1),m=C.useCallback(()=>f.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),p.jsx(io,{asChild:!0,...l,children:p.jsx(CC.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:a,onPointerMove:Me(t.onPointerMove,y=>{y.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:Me(t.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:Me(t.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Me(t.onFocus,()=>{f.current||s.onOpen()}),onBlur:Me(t.onBlur,s.onClose),onClick:Me(t.onClick,s.onClose)})})});Og.displayName=Gc;var EC="TooltipPortal",[sL,TC]=nl(EC,{forceMount:void 0}),as="TooltipContent",Bg=C.forwardRef((t,n)=>{const r=TC(as,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...o}=t,l=il(as,t.__scopeTooltip);return p.jsx(nn,{present:i||l.open,children:l.disableHoverableContent?p.jsx(zg,{side:s,...o,ref:n}):p.jsx(NC,{side:s,...o,ref:n})})}),NC=C.forwardRef((t,n)=>{const r=il(as,t.__scopeTooltip),i=lu(as,t.__scopeTooltip),s=C.useRef(null),o=st(n,s),[l,c]=C.useState(null),{trigger:a,onClose:f}=r,u=s.current,{onPointerInTransitChange:m}=i,y=C.useCallback(()=>{c(null),m(!1)},[m]),_=C.useCallback((S,E)=>{const d=S.currentTarget,h={x:S.clientX,y:S.clientY},v=PC(h,d.getBoundingClientRect()),x=LC(h,v),g=IC(E.getBoundingClientRect()),b=BC([...x,...g]);c(b),m(!0)},[m]);return C.useEffect(()=>()=>y(),[y]),C.useEffect(()=>{if(a&&u){const S=d=>_(d,u),E=d=>_(d,a);return a.addEventListener("pointerleave",S),u.addEventListener("pointerleave",E),()=>{a.removeEventListener("pointerleave",S),u.removeEventListener("pointerleave",E)}}},[a,u,_,y]),C.useEffect(()=>{if(l){const S=E=>{const d=E.target,h={x:E.clientX,y:E.clientY},v=(a==null?void 0:a.contains(d))||(u==null?void 0:u.contains(d)),x=!OC(h,l);v?y():x&&(y(),f())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[a,u,l,f,y]),p.jsx(zg,{...t,ref:o})}),[MC,AC]=nl(Ws,{isInside:!1}),DC=vC("TooltipContent"),zg=C.forwardRef((t,n)=>{const{__scopeTooltip:r,children:i,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:l,...c}=t,a=il(as,r),f=rl(r),{onClose:u}=a;return C.useEffect(()=>(document.addEventListener(Yc,u),()=>document.removeEventListener(Yc,u)),[u]),C.useEffect(()=>{if(a.trigger){const m=y=>{const _=y.target;_!=null&&_.contains(a.trigger)&&u()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[a.trigger,u]),p.jsx(vs,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:m=>m.preventDefault(),onDismiss:u,children:p.jsxs(za,{"data-state":a.stateAttribute,...f,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(DC,{children:i}),p.jsx(MC,{scope:r,isInside:!0,children:p.jsx(V6,{id:a.contentId,role:"tooltip",children:s||i})})]})})});Bg.displayName=as;var jg="TooltipArrow",RC=C.forwardRef((t,n)=>{const{__scopeTooltip:r,...i}=t,s=rl(r);return AC(jg,r).isInside?null:p.jsx(ja,{...s,...i,ref:n})});RC.displayName=jg;function PC(t,n){const r=Math.abs(n.top-t.y),i=Math.abs(n.bottom-t.y),s=Math.abs(n.right-t.x),o=Math.abs(n.left-t.x);switch(Math.min(r,i,s,o)){case o:return"left";case s:return"right";case r:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function LC(t,n,r=5){const i=[];switch(n){case"top":i.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":i.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":i.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":i.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return i}function IC(t){const{top:n,right:r,bottom:i,left:s}=t;return[{x:s,y:n},{x:r,y:n},{x:r,y:i},{x:s,y:i}]}function OC(t,n){const{x:r,y:i}=t;let s=!1;for(let o=0,l=n.length-1;o<n.length;l=o++){const c=n[o],a=n[l],f=c.x,u=c.y,m=a.x,y=a.y;u>i!=y>i&&r<(m-f)*(i-u)/(y-u)+f&&(s=!s)}return s}function BC(t){const n=t.slice();return n.sort((r,i)=>r.x<i.x?-1:r.x>i.x?1:r.y<i.y?-1:r.y>i.y?1:0),zC(n)}function zC(t){if(t.length<=1)return t.slice();const n=[];for(let i=0;i<t.length;i++){const s=t[i];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}n.pop();const r=[];for(let i=t.length-1;i>=0;i--){const s=t[i];for(;r.length>=2;){const o=r[r.length-1],l=r[r.length-2];if((o.x-l.x)*(s.y-l.y)>=(o.y-l.y)*(s.x-l.x))r.pop();else break}r.push(s)}return r.pop(),n.length===1&&r.length===1&&n[0].x===r[0].x&&n[0].y===r[0].y?n:n.concat(r)}var jC=Lg,FC=Ig,HC=Og,Fg=Bg;const cu=jC,sl=FC,ol=HC,uo=C.forwardRef(({className:t,sideOffset:n=4,...r},i)=>p.jsx(Fg,{ref:i,sideOffset:n,className:Q("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));uo.displayName=Fg.displayName;function $C(t,n=[]){let r=[];function i(o,l){const c=C.createContext(l),a=r.length;r=[...r,l];const f=m=>{var h;const{scope:y,children:_,...S}=m,E=((h=y==null?void 0:y[t])==null?void 0:h[a])||c,d=C.useMemo(()=>S,Object.values(S));return p.jsx(E.Provider,{value:d,children:_})};f.displayName=o+"Provider";function u(m,y){var E;const _=((E=y==null?void 0:y[t])==null?void 0:E[a])||c,S=C.useContext(_);if(S)return S;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[f,u]}const s=()=>{const o=r.map(l=>C.createContext(l));return function(c){const a=(c==null?void 0:c[t])||o;return C.useMemo(()=>({[`__scope${t}`]:{...c,[t]:a}}),[c,a])}};return s.scopeName=t,[i,VC(s,...n)]}function VC(...t){const n=t[0];if(t.length===1)return n;const r=()=>{const i=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const l=i.reduce((c,{useScope:a,scopeName:f})=>{const m=a(o)[`__scope${f}`];return{...c,...m}},{});return C.useMemo(()=>({[`__scope${n.scopeName}`]:l}),[l])}};return r.scopeName=n.scopeName,r}function Hg(t){const n=WC(t),r=C.forwardRef((i,s)=>{const{children:o,...l}=i,c=C.Children.toArray(o),a=c.find(qC);if(a){const f=a.props.children,u=c.map(m=>m===a?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:m);return p.jsx(n,{...l,ref:s,children:C.isValidElement(f)?C.cloneElement(f,void 0,u):null})}return p.jsx(n,{...l,ref:s,children:o})});return r.displayName=`${t}.Slot`,r}function WC(t){const n=C.forwardRef((r,i)=>{const{children:s,...o}=r;if(C.isValidElement(s)){const l=GC(s),c=YC(o,s.props);return s.type!==C.Fragment&&(c.ref=i?zt(i,l):l),C.cloneElement(s,c)}return C.Children.count(s)>1?C.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var UC=Symbol("radix.slottable");function qC(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===UC}function YC(t,n){const r={...n};for(const i in n){const s=t[i],o=n[i];/^on[A-Z]/.test(i)?s&&o?r[i]=(...c)=>{const a=o(...c);return s(...c),a}:s&&(r[i]=s):i==="style"?r[i]={...s,...o}:i==="className"&&(r[i]=[s,o].filter(Boolean).join(" "))}return{...t,...r}}function GC(t){var i,s;let n=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var ZC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$g=ZC.reduce((t,n)=>{const r=Hg(`Primitive.${n}`),i=C.forwardRef((s,o)=>{const{asChild:l,...c}=s,a=l?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...c,ref:o})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{}),al="Popover",[Vg]=$C(al,[li]),fo=li(),[XC,di]=Vg(al),Wg=t=>{const{__scopePopover:n,children:r,open:i,defaultOpen:s,onOpenChange:o,modal:l=!1}=t,c=fo(n),a=C.useRef(null),[f,u]=C.useState(!1),[m,y]=zn({prop:i,defaultProp:s??!1,onChange:o,caller:al});return p.jsx(ro,{...c,children:p.jsx(XC,{scope:n,contentId:un(),triggerRef:a,open:m,onOpenChange:y,onOpenToggle:C.useCallback(()=>y(_=>!_),[y]),hasCustomAnchor:f,onCustomAnchorAdd:C.useCallback(()=>u(!0),[]),onCustomAnchorRemove:C.useCallback(()=>u(!1),[]),modal:l,children:r})})};Wg.displayName=al;var Ug="PopoverAnchor",KC=C.forwardRef((t,n)=>{const{__scopePopover:r,...i}=t,s=di(Ug,r),o=fo(r),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return C.useEffect(()=>(l(),()=>c()),[l,c]),p.jsx(io,{...o,...i,ref:n})});KC.displayName=Ug;var qg="PopoverTrigger",Yg=C.forwardRef((t,n)=>{const{__scopePopover:r,...i}=t,s=di(qg,r),o=fo(r),l=st(n,s.triggerRef),c=p.jsx($g.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Qg(s.open),...i,ref:l,onClick:Me(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:p.jsx(io,{asChild:!0,...o,children:c})});Yg.displayName=qg;var uu="PopoverPortal",[QC,JC]=Vg(uu,{forceMount:void 0}),Gg=t=>{const{__scopePopover:n,forceMount:r,children:i,container:s}=t,o=di(uu,n);return p.jsx(QC,{scope:n,forceMount:r,children:p.jsx(nn,{present:r||o.open,children:p.jsx(so,{asChild:!0,container:s,children:i})})})};Gg.displayName=uu;var ls="PopoverContent",Zg=C.forwardRef((t,n)=>{const r=JC(ls,t.__scopePopover),{forceMount:i=r.forceMount,...s}=t,o=di(ls,t.__scopePopover);return p.jsx(nn,{present:i||o.open,children:o.modal?p.jsx(t_,{...s,ref:n}):p.jsx(n_,{...s,ref:n})})});Zg.displayName=ls;var e_=Hg("PopoverContent.RemoveScroll"),t_=C.forwardRef((t,n)=>{const r=di(ls,t.__scopePopover),i=C.useRef(null),s=st(n,i),o=C.useRef(!1);return C.useEffect(()=>{const l=i.current;if(l)return Fa(l)},[]),p.jsx(oo,{as:e_,allowPinchZoom:!0,children:p.jsx(Xg,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Me(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),o.current||(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Me(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,a=c.button===0&&c.ctrlKey===!0,f=c.button===2||a;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Me(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),n_=C.forwardRef((t,n)=>{const r=di(ls,t.__scopePopover),i=C.useRef(!1),s=C.useRef(!1);return p.jsx(Xg,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,c;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(i.current||(c=r.triggerRef.current)==null||c.focus(),o.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:o=>{var a,f;(a=t.onInteractOutside)==null||a.call(t,o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=o.target;((f=r.triggerRef.current)==null?void 0:f.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),Xg=C.forwardRef((t,n)=>{const{__scopePopover:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:a,onFocusOutside:f,onInteractOutside:u,...m}=t,y=di(ls,r),_=fo(r);return Pa(),p.jsx(to,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:o,children:p.jsx(vs,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:a,onFocusOutside:f,onDismiss:()=>y.onOpenChange(!1),children:p.jsx(za,{"data-state":Qg(y.open),role:"dialog",id:y.contentId,..._,...m,ref:n,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Kg="PopoverClose",r_=C.forwardRef((t,n)=>{const{__scopePopover:r,...i}=t,s=di(Kg,r);return p.jsx($g.button,{type:"button",...i,ref:n,onClick:Me(t.onClick,()=>s.onOpenChange(!1))})});r_.displayName=Kg;var i_="PopoverArrow",s_=C.forwardRef((t,n)=>{const{__scopePopover:r,...i}=t,s=fo(r);return p.jsx(ja,{...s,...i,ref:n})});s_.displayName=i_;function Qg(t){return t?"open":"closed"}var o_=Wg,a_=Yg,l_=Gg,Jg=Zg;const du=o_,fu=a_,ll=C.forwardRef(({className:t,align:n="center",sideOffset:r=4,...i},s)=>p.jsx(l_,{children:p.jsx(Jg,{ref:s,align:n,sideOffset:r,className:Q("pointer-events-auto z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...i})}));ll.displayName=Jg.displayName;function c_(t,n,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:r}).format(n).split(/\s/g).slice(2).join(" ")}const tc={},Is={};function wi(t,n){try{const i=(tc[t]||(tc[t]=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format))(n).split("GMT")[1];return i in Is?Is[i]:Mf(i,i.split(":"))}catch{if(t in Is)return Is[t];const r=t==null?void 0:t.match(u_);return r?Mf(t,r.slice(1)):NaN}}const u_=/([+-]\d\d):?(\d\d)?/;function Mf(t,n){const r=+(n[0]||0),i=+(n[1]||0),s=+(n[2]||0)/60;return Is[t]=r*60+i>0?r*60+i+s:r*60-i-s}class pr extends Date{constructor(...n){super(),n.length>1&&typeof n[n.length-1]=="string"&&(this.timeZone=n.pop()),this.internal=new Date,isNaN(wi(this.timeZone,this))?this.setTime(NaN):n.length?typeof n[0]=="number"&&(n.length===1||n.length===2&&typeof n[1]!="number")?this.setTime(n[0]):typeof n[0]=="string"?this.setTime(+new Date(n[0])):n[0]instanceof Date?this.setTime(+n[0]):(this.setTime(+new Date(...n)),e2(this),Zc(this)):this.setTime(Date.now())}static tz(n,...r){return r.length?new pr(...r,n):new pr(Date.now(),n)}withTimeZone(n){return new pr(+this,n)}getTimezoneOffset(){const n=-wi(this.timeZone,this);return n>0?Math.floor(n):Math.ceil(n)}setTime(n){return Date.prototype.setTime.apply(this,arguments),Zc(this),+this}[Symbol.for("constructDateFrom")](n){return new pr(+new Date(n),this.timeZone)}}const Af=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!Af.test(t))return;const n=t.replace(Af,"$1UTC");pr.prototype[n]&&(t.startsWith("get")?pr.prototype[t]=function(){return this.internal[n]()}:(pr.prototype[t]=function(){return Date.prototype[n].apply(this.internal,arguments),d_(this),+this},pr.prototype[n]=function(){return Date.prototype[n].apply(this,arguments),Zc(this),+this}))});function Zc(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-wi(t.timeZone,t)*60))}function d_(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),e2(t)}function e2(t){const n=wi(t.timeZone,t),r=n>0?Math.floor(n):Math.ceil(n),i=new Date(+t);i.setUTCHours(i.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),o=-new Date(+i).getTimezoneOffset(),l=s-o,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const a=s-r;a&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+a);const f=new Date(+t);f.setUTCSeconds(0);const u=s>0?f.getSeconds():(f.getSeconds()-60)%60,m=Math.round(-(wi(t.timeZone,t)*60))%60;(m||u)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+u));const y=wi(t.timeZone,t),_=y>0?Math.floor(y):Math.ceil(y),E=-new Date(+t).getTimezoneOffset()-_,d=_!==r,h=E-a;if(d&&h){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+h);const v=wi(t.timeZone,t),x=v>0?Math.floor(v):Math.ceil(v),g=_-x;g&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+g),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+g))}}class rn extends pr{static tz(n,...r){return r.length?new rn(...r,n):new rn(Date.now(),n)}toISOString(){const[n,r,i]=this.tzComponents(),s=`${n}${r}:${i}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[n,r,i,s]=this.internal.toUTCString().split(" ");return`${n==null?void 0:n.slice(0,-1)} ${i} ${r} ${s}`}toTimeString(){const n=this.internal.toUTCString().split(" ")[4],[r,i,s]=this.tzComponents();return`${n} GMT${r}${i}${s} (${c_(this.timeZone,this)})`}toLocaleString(n,r){return Date.prototype.toLocaleString.call(this,n,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleDateString(n,r){return Date.prototype.toLocaleDateString.call(this,n,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleTimeString(n,r){return Date.prototype.toLocaleTimeString.call(this,n,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}tzComponents(){const n=this.getTimezoneOffset(),r=n>0?"-":"+",i=String(Math.floor(Math.abs(n)/60)).padStart(2,"0"),s=String(Math.abs(n)%60).padStart(2,"0");return[r,i,s]}withTimeZone(n){return new rn(+this,n)}[Symbol.for("constructDateFrom")](n){return new rn(+new Date(n),this.timeZone)}}const t2=6048e5,f_=864e5,h_=6e4,m_=36e5,p_=1e3,Df=Symbol.for("constructDateFrom");function _t(t,n){return typeof t=="function"?t(n):t&&typeof t=="object"&&Df in t?t[Df](n):t instanceof Date?new t.constructor(n):new Date(n)}function dt(t,n){return _t(n||t,t)}function ho(t,n,r){const i=dt(t,r==null?void 0:r.in);return isNaN(n)?_t((r==null?void 0:r.in)||t,NaN):(n&&i.setDate(i.getDate()+n),i)}function Si(t,n,r){const i=dt(t,r==null?void 0:r.in);if(isNaN(n))return _t(t,NaN);if(!n)return i;const s=i.getDate(),o=_t(t,i.getTime());o.setMonth(i.getMonth()+n+1,0);const l=o.getDate();return s>=l?o:(i.setFullYear(o.getFullYear(),o.getMonth(),s),i)}let g_={};function Ri(){return g_}function rr(t,n){var c,a,f,u;const r=Ri(),i=(n==null?void 0:n.weekStartsOn)??((a=(c=n==null?void 0:n.locale)==null?void 0:c.options)==null?void 0:a.weekStartsOn)??r.weekStartsOn??((u=(f=r.locale)==null?void 0:f.options)==null?void 0:u.weekStartsOn)??0,s=dt(t,n==null?void 0:n.in),o=s.getDay(),l=(o<i?7:0)+o-i;return s.setDate(s.getDate()-l),s.setHours(0,0,0,0),s}function Mi(t,n){return rr(t,{...n,weekStartsOn:1})}function n2(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getFullYear(),s=_t(r,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=Mi(s),l=_t(r,0);l.setFullYear(i,0,4),l.setHours(0,0,0,0);const c=Mi(l);return r.getTime()>=o.getTime()?i+1:r.getTime()>=c.getTime()?i:i-1}function ca(t){const n=dt(t),r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return r.setUTCFullYear(n.getFullYear()),+t-+r}function ws(t,...n){const r=_t.bind(null,n.find(i=>typeof i=="object"));return n.map(r)}function Us(t,n){const r=dt(t,n==null?void 0:n.in);return r.setHours(0,0,0,0),r}function hu(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n),o=Us(i),l=Us(s),c=+o-ca(o),a=+l-ca(l);return Math.round((c-a)/f_)}function v_(t,n){const r=n2(t,n),i=_t(t,0);return i.setFullYear(r,0,4),i.setHours(0,0,0,0),Mi(i)}function b_(t,n,r){return Si(t,n*3,r)}function y_(t,n,r){return ho(t,n*7,r)}function r2(t,n,r){return Si(t,n*12,r)}function x_(t,n){let r,i=n==null?void 0:n.in;return t.forEach(s=>{!i&&typeof s=="object"&&(i=_t.bind(null,s));const o=dt(s,i);(!r||r<o||isNaN(+o))&&(r=o)}),_t(i,r||NaN)}function w_(t,n){let r,i=n==null?void 0:n.in;return t.forEach(s=>{!i&&typeof s=="object"&&(i=_t.bind(null,s));const o=dt(s,i);(!r||r>o||isNaN(+o))&&(r=o)}),_t(i,r||NaN)}function C_(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n);return+Us(i)==+Us(s)}function i2(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function s2(t){return!(!i2(t)&&typeof t!="number"||isNaN(+dt(t)))}function o2(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n),o=i.getFullYear()-s.getFullYear(),l=i.getMonth()-s.getMonth();return o*12+l}function Xc(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function a2(t,n){const[r,i]=ws(t,n.start,n.end);return{start:r,end:i}}function __(t,n){const{start:r,end:i}=a2(n==null?void 0:n.in,t);let s=+r>+i;const o=s?+r:+i,l=s?i:r;l.setHours(0,0,0,0),l.setDate(1);let c=1;const a=[];for(;+l<=o;)a.push(_t(r,l)),l.setMonth(l.getMonth()+c);return s?a.reverse():a}function Rf(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getMonth(),s=i-i%3;return r.setMonth(s,1),r.setHours(0,0,0,0),r}function Ui(t,n){const r=dt(t,n==null?void 0:n.in);return r.setDate(1),r.setHours(0,0,0,0),r}function Kc(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getFullYear();return r.setFullYear(i+1,0,0),r.setHours(23,59,59,999),r}function ua(t,n){const r=dt(t,n==null?void 0:n.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function S_(t,n){const{start:r,end:i}=a2(n==null?void 0:n.in,t);let s=+r>+i;const o=s?+r:+i,l=s?i:r;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const a=[];for(;+l<=o;)a.push(_t(r,l)),l.setFullYear(l.getFullYear()+c);return s?a.reverse():a}function da(t,n){var c,a,f,u;const r=Ri(),i=(n==null?void 0:n.weekStartsOn)??((a=(c=n==null?void 0:n.locale)==null?void 0:c.options)==null?void 0:a.weekStartsOn)??r.weekStartsOn??((u=(f=r.locale)==null?void 0:f.options)==null?void 0:u.weekStartsOn)??0,s=dt(t,n==null?void 0:n.in),o=s.getDay(),l=(o<i?-7:0)+6-(o-i);return s.setDate(s.getDate()+l),s.setHours(23,59,59,999),s}function k_(t,n){return da(t,{...n,weekStartsOn:1})}function Pf(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getMonth(),s=i-i%3+3;return r.setMonth(s,0),r.setHours(23,59,59,999),r}const E_={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},T_=(t,n,r)=>{let i;const s=E_[t];return typeof s=="string"?i=s:n===1?i=s.one:i=s.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+i:i+" ago":i};function nc(t){return(n={})=>{const r=n.width?String(n.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const N_={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},M_={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},A_={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},D_={date:nc({formats:N_,defaultWidth:"full"}),time:nc({formats:M_,defaultWidth:"full"}),dateTime:nc({formats:A_,defaultWidth:"full"})},R_={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},P_=(t,n,r,i)=>R_[t];function Ns(t){return(n,r)=>{const i=r!=null&&r.context?String(r.context):"standalone";let s;if(i==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=r!=null&&r.width?String(r.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=r!=null&&r.width?String(r.width):t.defaultWidth;s=t.values[c]||t.values[l]}const o=t.argumentCallback?t.argumentCallback(n):n;return s[o]}}const L_={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},I_={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},O_={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},B_={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},z_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},j_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},F_=(t,n)=>{const r=Number(t),i=r%100;if(i>20||i<10)switch(i%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},H_={ordinalNumber:F_,era:Ns({values:L_,defaultWidth:"wide"}),quarter:Ns({values:I_,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ns({values:O_,defaultWidth:"wide"}),day:Ns({values:B_,defaultWidth:"wide"}),dayPeriod:Ns({values:z_,defaultWidth:"wide",formattingValues:j_,defaultFormattingWidth:"wide"})};function Ms(t){return(n,r={})=>{const i=r.width,s=i&&t.matchPatterns[i]||t.matchPatterns[t.defaultMatchWidth],o=n.match(s);if(!o)return null;const l=o[0],c=i&&t.parsePatterns[i]||t.parsePatterns[t.defaultParseWidth],a=Array.isArray(c)?V_(c,m=>m.test(l)):$_(c,m=>m.test(l));let f;f=t.valueCallback?t.valueCallback(a):a,f=r.valueCallback?r.valueCallback(f):f;const u=n.slice(l.length);return{value:f,rest:u}}}function $_(t,n){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n(t[r]))return r}function V_(t,n){for(let r=0;r<t.length;r++)if(n(t[r]))return r}function W_(t){return(n,r={})=>{const i=n.match(t.matchPattern);if(!i)return null;const s=i[0],o=n.match(t.parsePattern);if(!o)return null;let l=t.valueCallback?t.valueCallback(o[0]):o[0];l=r.valueCallback?r.valueCallback(l):l;const c=n.slice(s.length);return{value:l,rest:c}}}const U_=/^(\d+)(th|st|nd|rd)?/i,q_=/\d+/i,Y_={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},G_={any:[/^b/i,/^(a|c)/i]},Z_={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},X_={any:[/1/i,/2/i,/3/i,/4/i]},K_={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Q_={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},J_={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},eS={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},tS={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},nS={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},rS={ordinalNumber:W_({matchPattern:U_,parsePattern:q_,valueCallback:t=>parseInt(t,10)}),era:Ms({matchPatterns:Y_,defaultMatchWidth:"wide",parsePatterns:G_,defaultParseWidth:"any"}),quarter:Ms({matchPatterns:Z_,defaultMatchWidth:"wide",parsePatterns:X_,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ms({matchPatterns:K_,defaultMatchWidth:"wide",parsePatterns:Q_,defaultParseWidth:"any"}),day:Ms({matchPatterns:J_,defaultMatchWidth:"wide",parsePatterns:eS,defaultParseWidth:"any"}),dayPeriod:Ms({matchPatterns:tS,defaultMatchWidth:"any",parsePatterns:nS,defaultParseWidth:"any"})},xi={code:"en-US",formatDistance:T_,formatLong:D_,formatRelative:P_,localize:H_,match:rS,options:{weekStartsOn:0,firstWeekContainsDate:1}};function iS(t,n){const r=dt(t,n==null?void 0:n.in);return hu(r,ua(r))+1}function cl(t,n){const r=dt(t,n==null?void 0:n.in),i=+Mi(r)-+v_(r);return Math.round(i/t2)+1}function mu(t,n){var u,m,y,_;const r=dt(t,n==null?void 0:n.in),i=r.getFullYear(),s=Ri(),o=(n==null?void 0:n.firstWeekContainsDate)??((m=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??s.firstWeekContainsDate??((_=(y=s.locale)==null?void 0:y.options)==null?void 0:_.firstWeekContainsDate)??1,l=_t((n==null?void 0:n.in)||t,0);l.setFullYear(i+1,0,o),l.setHours(0,0,0,0);const c=rr(l,n),a=_t((n==null?void 0:n.in)||t,0);a.setFullYear(i,0,o),a.setHours(0,0,0,0);const f=rr(a,n);return+r>=+c?i+1:+r>=+f?i:i-1}function sS(t,n){var c,a,f,u;const r=Ri(),i=(n==null?void 0:n.firstWeekContainsDate)??((a=(c=n==null?void 0:n.locale)==null?void 0:c.options)==null?void 0:a.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(f=r.locale)==null?void 0:f.options)==null?void 0:u.firstWeekContainsDate)??1,s=mu(t,n),o=_t((n==null?void 0:n.in)||t,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),rr(o,n)}function ul(t,n){const r=dt(t,n==null?void 0:n.in),i=+rr(r,n)-+sS(r,n);return Math.round(i/t2)+1}function Ct(t,n){const r=t<0?"-":"",i=Math.abs(t).toString().padStart(n,"0");return r+i}const Gr={y(t,n){const r=t.getFullYear(),i=r>0?r:1-r;return Ct(n==="yy"?i%100:i,n.length)},M(t,n){const r=t.getMonth();return n==="M"?String(r+1):Ct(r+1,2)},d(t,n){return Ct(t.getDate(),n.length)},a(t,n){const r=t.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,n){return Ct(t.getHours()%12||12,n.length)},H(t,n){return Ct(t.getHours(),n.length)},m(t,n){return Ct(t.getMinutes(),n.length)},s(t,n){return Ct(t.getSeconds(),n.length)},S(t,n){const r=n.length,i=t.getMilliseconds(),s=Math.trunc(i*Math.pow(10,r-3));return Ct(s,n.length)}},Hi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Lf={G:function(t,n,r){const i=t.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(i,{width:"abbreviated"});case"GGGGG":return r.era(i,{width:"narrow"});case"GGGG":default:return r.era(i,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){const i=t.getFullYear(),s=i>0?i:1-i;return r.ordinalNumber(s,{unit:"year"})}return Gr.y(t,n)},Y:function(t,n,r,i){const s=mu(t,i),o=s>0?s:1-s;if(n==="YY"){const l=o%100;return Ct(l,2)}return n==="Yo"?r.ordinalNumber(o,{unit:"year"}):Ct(o,n.length)},R:function(t,n){const r=n2(t);return Ct(r,n.length)},u:function(t,n){const r=t.getFullYear();return Ct(r,n.length)},Q:function(t,n,r){const i=Math.ceil((t.getMonth()+1)/3);switch(n){case"Q":return String(i);case"QQ":return Ct(i,2);case"Qo":return r.ordinalNumber(i,{unit:"quarter"});case"QQQ":return r.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(i,{width:"wide",context:"formatting"})}},q:function(t,n,r){const i=Math.ceil((t.getMonth()+1)/3);switch(n){case"q":return String(i);case"qq":return Ct(i,2);case"qo":return r.ordinalNumber(i,{unit:"quarter"});case"qqq":return r.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(i,{width:"wide",context:"standalone"})}},M:function(t,n,r){const i=t.getMonth();switch(n){case"M":case"MM":return Gr.M(t,n);case"Mo":return r.ordinalNumber(i+1,{unit:"month"});case"MMM":return r.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(i,{width:"wide",context:"formatting"})}},L:function(t,n,r){const i=t.getMonth();switch(n){case"L":return String(i+1);case"LL":return Ct(i+1,2);case"Lo":return r.ordinalNumber(i+1,{unit:"month"});case"LLL":return r.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(i,{width:"wide",context:"standalone"})}},w:function(t,n,r,i){const s=ul(t,i);return n==="wo"?r.ordinalNumber(s,{unit:"week"}):Ct(s,n.length)},I:function(t,n,r){const i=cl(t);return n==="Io"?r.ordinalNumber(i,{unit:"week"}):Ct(i,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Gr.d(t,n)},D:function(t,n,r){const i=iS(t);return n==="Do"?r.ordinalNumber(i,{unit:"dayOfYear"}):Ct(i,n.length)},E:function(t,n,r){const i=t.getDay();switch(n){case"E":case"EE":case"EEE":return r.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(i,{width:"short",context:"formatting"});case"EEEE":default:return r.day(i,{width:"wide",context:"formatting"})}},e:function(t,n,r,i){const s=t.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(n){case"e":return String(o);case"ee":return Ct(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(t,n,r,i){const s=t.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(n){case"c":return String(o);case"cc":return Ct(o,n.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(t,n,r){const i=t.getDay(),s=i===0?7:i;switch(n){case"i":return String(s);case"ii":return Ct(s,n.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(i,{width:"short",context:"formatting"});case"iiii":default:return r.day(i,{width:"wide",context:"formatting"})}},a:function(t,n,r){const s=t.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,n,r){const i=t.getHours();let s;switch(i===12?s=Hi.noon:i===0?s=Hi.midnight:s=i/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,n,r){const i=t.getHours();let s;switch(i>=17?s=Hi.evening:i>=12?s=Hi.afternoon:i>=4?s=Hi.morning:s=Hi.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){let i=t.getHours()%12;return i===0&&(i=12),r.ordinalNumber(i,{unit:"hour"})}return Gr.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Gr.H(t,n)},K:function(t,n,r){const i=t.getHours()%12;return n==="Ko"?r.ordinalNumber(i,{unit:"hour"}):Ct(i,n.length)},k:function(t,n,r){let i=t.getHours();return i===0&&(i=24),n==="ko"?r.ordinalNumber(i,{unit:"hour"}):Ct(i,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Gr.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Gr.s(t,n)},S:function(t,n){return Gr.S(t,n)},X:function(t,n,r){const i=t.getTimezoneOffset();if(i===0)return"Z";switch(n){case"X":return Of(i);case"XXXX":case"XX":return yi(i);case"XXXXX":case"XXX":default:return yi(i,":")}},x:function(t,n,r){const i=t.getTimezoneOffset();switch(n){case"x":return Of(i);case"xxxx":case"xx":return yi(i);case"xxxxx":case"xxx":default:return yi(i,":")}},O:function(t,n,r){const i=t.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+If(i,":");case"OOOO":default:return"GMT"+yi(i,":")}},z:function(t,n,r){const i=t.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+If(i,":");case"zzzz":default:return"GMT"+yi(i,":")}},t:function(t,n,r){const i=Math.trunc(+t/1e3);return Ct(i,n.length)},T:function(t,n,r){return Ct(+t,n.length)}};function If(t,n=""){const r=t>0?"-":"+",i=Math.abs(t),s=Math.trunc(i/60),o=i%60;return o===0?r+String(s):r+String(s)+n+Ct(o,2)}function Of(t,n){return t%60===0?(t>0?"-":"+")+Ct(Math.abs(t)/60,2):yi(t,n)}function yi(t,n=""){const r=t>0?"-":"+",i=Math.abs(t),s=Ct(Math.trunc(i/60),2),o=Ct(i%60,2);return r+s+n+o}const Bf=(t,n)=>{switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},l2=(t,n)=>{switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},oS=(t,n)=>{const r=t.match(/(P+)(p+)?/)||[],i=r[1],s=r[2];if(!s)return Bf(t,n);let o;switch(i){case"P":o=n.dateTime({width:"short"});break;case"PP":o=n.dateTime({width:"medium"});break;case"PPP":o=n.dateTime({width:"long"});break;case"PPPP":default:o=n.dateTime({width:"full"});break}return o.replace("{{date}}",Bf(i,n)).replace("{{time}}",l2(s,n))},Qc={p:l2,P:oS},aS=/^D+$/,lS=/^Y+$/,cS=["D","DD","YY","YYYY"];function c2(t){return aS.test(t)}function u2(t){return lS.test(t)}function Jc(t,n,r){const i=uS(t,n,r);if(console.warn(i),cS.includes(t))throw new RangeError(i)}function uS(t,n,r){const i=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${n}\`) for formatting ${i} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const dS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,hS=/^'([^]*?)'?$/,mS=/''/g,pS=/[a-zA-Z]/;function Kt(t,n,r){var u,m,y,_,S,E,d,h;const i=Ri(),s=(r==null?void 0:r.locale)??i.locale??xi,o=(r==null?void 0:r.firstWeekContainsDate)??((m=(u=r==null?void 0:r.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??i.firstWeekContainsDate??((_=(y=i.locale)==null?void 0:y.options)==null?void 0:_.firstWeekContainsDate)??1,l=(r==null?void 0:r.weekStartsOn)??((E=(S=r==null?void 0:r.locale)==null?void 0:S.options)==null?void 0:E.weekStartsOn)??i.weekStartsOn??((h=(d=i.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??0,c=dt(t,r==null?void 0:r.in);if(!s2(c))throw new RangeError("Invalid time value");let a=n.match(fS).map(v=>{const x=v[0];if(x==="p"||x==="P"){const g=Qc[x];return g(v,s.formatLong)}return v}).join("").match(dS).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const x=v[0];if(x==="'")return{isToken:!1,value:gS(v)};if(Lf[x])return{isToken:!0,value:v};if(x.match(pS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(a=s.localize.preprocessor(c,a));const f={firstWeekContainsDate:o,weekStartsOn:l,locale:s};return a.map(v=>{if(!v.isToken)return v.value;const x=v.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&u2(x)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&c2(x))&&Jc(x,n,String(t));const g=Lf[x[0]];return g(c,x,s.localize,f)}).join("")}function gS(t){const n=t.match(hS);return n?n[1].replace(mS,"'"):t}function vS(t,n){const r=dt(t,n==null?void 0:n.in),i=r.getFullYear(),s=r.getMonth(),o=_t(r,0);return o.setFullYear(i,s+1,0),o.setHours(0,0,0,0),o.getDate()}function bS(){return Object.assign({},Ri())}function yS(t,n){const r=dt(t,n==null?void 0:n.in).getDay();return r===0?7:r}function xS(t,n){return dt(t,n==null?void 0:n.in).getMonth()}function wS(t,n){return dt(t,n==null?void 0:n.in).getFullYear()}function CS(t,n){return+dt(t)>+dt(n)}function _S(t,n){return+dt(t)<+dt(n)}function SS(t,n){const r=kS(n)?new n(0):_t(n,0);return r.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),r.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),r}function kS(t){var n;return typeof t=="function"&&((n=t.prototype)==null?void 0:n.constructor)===t}const ES=10;class d2{constructor(){ze(this,"subPriority",0)}validate(n,r){return!0}}class TS extends d2{constructor(n,r,i,s,o){super(),this.value=n,this.validateValue=r,this.setValue=i,this.priority=s,o&&(this.subPriority=o)}validate(n,r){return this.validateValue(n,this.value,r)}set(n,r,i){return this.setValue(n,r,this.value,i)}}class NS extends d2{constructor(r,i){super();ze(this,"priority",ES);ze(this,"subPriority",-1);this.context=r||(s=>_t(i,s))}set(r,i){return i.timestampIsSet?r:_t(r,SS(r,this.context))}}let vt=class{run(n,r,i,s){const o=this.parse(n,r,i,s);return o?{setter:new TS(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(n,r,i){return!0}};class MS extends vt{constructor(){super(...arguments);ze(this,"priority",140);ze(this,"incompatibleTokens",["R","u","t","T"])}parse(r,i,s){switch(i){case"G":case"GG":case"GGG":return s.era(r,{width:"abbreviated"})||s.era(r,{width:"narrow"});case"GGGGG":return s.era(r,{width:"narrow"});case"GGGG":default:return s.era(r,{width:"wide"})||s.era(r,{width:"abbreviated"})||s.era(r,{width:"narrow"})}}set(r,i,s){return i.era=s,r.setFullYear(s,0,1),r.setHours(0,0,0,0),r}}const Vt={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},fr={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Wt(t,n){return t&&{value:n(t.value),rest:t.rest}}function Bt(t,n){const r=n.match(t);return r?{value:parseInt(r[0],10),rest:n.slice(r[0].length)}:null}function hr(t,n){const r=n.match(t);if(!r)return null;if(r[0]==="Z")return{value:0,rest:n.slice(1)};const i=r[1]==="+"?1:-1,s=r[2]?parseInt(r[2],10):0,o=r[3]?parseInt(r[3],10):0,l=r[5]?parseInt(r[5],10):0;return{value:i*(s*m_+o*h_+l*p_),rest:n.slice(r[0].length)}}function f2(t){return Bt(Vt.anyDigitsSigned,t)}function Ft(t,n){switch(t){case 1:return Bt(Vt.singleDigit,n);case 2:return Bt(Vt.twoDigits,n);case 3:return Bt(Vt.threeDigits,n);case 4:return Bt(Vt.fourDigits,n);default:return Bt(new RegExp("^\\d{1,"+t+"}"),n)}}function fa(t,n){switch(t){case 1:return Bt(Vt.singleDigitSigned,n);case 2:return Bt(Vt.twoDigitsSigned,n);case 3:return Bt(Vt.threeDigitsSigned,n);case 4:return Bt(Vt.fourDigitsSigned,n);default:return Bt(new RegExp("^-?\\d{1,"+t+"}"),n)}}function pu(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function h2(t,n){const r=n>0,i=r?n:1-n;let s;if(i<=50)s=t||100;else{const o=i+50,l=Math.trunc(o/100)*100,c=t>=o%100;s=t+l-(c?100:0)}return r?s:1-s}function m2(t){return t%400===0||t%4===0&&t%100!==0}class AS extends vt{constructor(){super(...arguments);ze(this,"priority",130);ze(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(r,i,s){const o=l=>({year:l,isTwoDigitYear:i==="yy"});switch(i){case"y":return Wt(Ft(4,r),o);case"yo":return Wt(s.ordinalNumber(r,{unit:"year"}),o);default:return Wt(Ft(i.length,r),o)}}validate(r,i){return i.isTwoDigitYear||i.year>0}set(r,i,s){const o=r.getFullYear();if(s.isTwoDigitYear){const c=h2(s.year,o);return r.setFullYear(c,0,1),r.setHours(0,0,0,0),r}const l=!("era"in i)||i.era===1?s.year:1-s.year;return r.setFullYear(l,0,1),r.setHours(0,0,0,0),r}}class DS extends vt{constructor(){super(...arguments);ze(this,"priority",130);ze(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(r,i,s){const o=l=>({year:l,isTwoDigitYear:i==="YY"});switch(i){case"Y":return Wt(Ft(4,r),o);case"Yo":return Wt(s.ordinalNumber(r,{unit:"year"}),o);default:return Wt(Ft(i.length,r),o)}}validate(r,i){return i.isTwoDigitYear||i.year>0}set(r,i,s,o){const l=mu(r,o);if(s.isTwoDigitYear){const a=h2(s.year,l);return r.setFullYear(a,0,o.firstWeekContainsDate),r.setHours(0,0,0,0),rr(r,o)}const c=!("era"in i)||i.era===1?s.year:1-s.year;return r.setFullYear(c,0,o.firstWeekContainsDate),r.setHours(0,0,0,0),rr(r,o)}}class RS extends vt{constructor(){super(...arguments);ze(this,"priority",130);ze(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(r,i){return fa(i==="R"?4:i.length,r)}set(r,i,s){const o=_t(r,0);return o.setFullYear(s,0,4),o.setHours(0,0,0,0),Mi(o)}}class PS extends vt{constructor(){super(...arguments);ze(this,"priority",130);ze(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(r,i){return fa(i==="u"?4:i.length,r)}set(r,i,s){return r.setFullYear(s,0,1),r.setHours(0,0,0,0),r}}class LS extends vt{constructor(){super(...arguments);ze(this,"priority",120);ze(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(r,i,s){switch(i){case"Q":case"QQ":return Ft(i.length,r);case"Qo":return s.ordinalNumber(r,{unit:"quarter"});case"QQQ":return s.quarter(r,{width:"abbreviated",context:"formatting"})||s.quarter(r,{width:"narrow",context:"formatting"});case"QQQQQ":return s.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(r,{width:"wide",context:"formatting"})||s.quarter(r,{width:"abbreviated",context:"formatting"})||s.quarter(r,{width:"narrow",context:"formatting"})}}validate(r,i){return i>=1&&i<=4}set(r,i,s){return r.setMonth((s-1)*3,1),r.setHours(0,0,0,0),r}}class IS extends vt{constructor(){super(...arguments);ze(this,"priority",120);ze(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(r,i,s){switch(i){case"q":case"qq":return Ft(i.length,r);case"qo":return s.ordinalNumber(r,{unit:"quarter"});case"qqq":return s.quarter(r,{width:"abbreviated",context:"standalone"})||s.quarter(r,{width:"narrow",context:"standalone"});case"qqqqq":return s.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(r,{width:"wide",context:"standalone"})||s.quarter(r,{width:"abbreviated",context:"standalone"})||s.quarter(r,{width:"narrow",context:"standalone"})}}validate(r,i){return i>=1&&i<=4}set(r,i,s){return r.setMonth((s-1)*3,1),r.setHours(0,0,0,0),r}}class OS extends vt{constructor(){super(...arguments);ze(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);ze(this,"priority",110)}parse(r,i,s){const o=l=>l-1;switch(i){case"M":return Wt(Bt(Vt.month,r),o);case"MM":return Wt(Ft(2,r),o);case"Mo":return Wt(s.ordinalNumber(r,{unit:"month"}),o);case"MMM":return s.month(r,{width:"abbreviated",context:"formatting"})||s.month(r,{width:"narrow",context:"formatting"});case"MMMMM":return s.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(r,{width:"wide",context:"formatting"})||s.month(r,{width:"abbreviated",context:"formatting"})||s.month(r,{width:"narrow",context:"formatting"})}}validate(r,i){return i>=0&&i<=11}set(r,i,s){return r.setMonth(s,1),r.setHours(0,0,0,0),r}}class BS extends vt{constructor(){super(...arguments);ze(this,"priority",110);ze(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(r,i,s){const o=l=>l-1;switch(i){case"L":return Wt(Bt(Vt.month,r),o);case"LL":return Wt(Ft(2,r),o);case"Lo":return Wt(s.ordinalNumber(r,{unit:"month"}),o);case"LLL":return s.month(r,{width:"abbreviated",context:"standalone"})||s.month(r,{width:"narrow",context:"standalone"});case"LLLLL":return s.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(r,{width:"wide",context:"standalone"})||s.month(r,{width:"abbreviated",context:"standalone"})||s.month(r,{width:"narrow",context:"standalone"})}}validate(r,i){return i>=0&&i<=11}set(r,i,s){return r.setMonth(s,1),r.setHours(0,0,0,0),r}}function zS(t,n,r){const i=dt(t,r==null?void 0:r.in),s=ul(i,r)-n;return i.setDate(i.getDate()-s*7),dt(i,r==null?void 0:r.in)}class jS extends vt{constructor(){super(...arguments);ze(this,"priority",100);ze(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(r,i,s){switch(i){case"w":return Bt(Vt.week,r);case"wo":return s.ordinalNumber(r,{unit:"week"});default:return Ft(i.length,r)}}validate(r,i){return i>=1&&i<=53}set(r,i,s,o){return rr(zS(r,s,o),o)}}function FS(t,n,r){const i=dt(t,r==null?void 0:r.in),s=cl(i,r)-n;return i.setDate(i.getDate()-s*7),i}class HS extends vt{constructor(){super(...arguments);ze(this,"priority",100);ze(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(r,i,s){switch(i){case"I":return Bt(Vt.week,r);case"Io":return s.ordinalNumber(r,{unit:"week"});default:return Ft(i.length,r)}}validate(r,i){return i>=1&&i<=53}set(r,i,s){return Mi(FS(r,s))}}const $S=[31,28,31,30,31,30,31,31,30,31,30,31],VS=[31,29,31,30,31,30,31,31,30,31,30,31];class WS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"subPriority",1);ze(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(r,i,s){switch(i){case"d":return Bt(Vt.date,r);case"do":return s.ordinalNumber(r,{unit:"date"});default:return Ft(i.length,r)}}validate(r,i){const s=r.getFullYear(),o=m2(s),l=r.getMonth();return o?i>=1&&i<=VS[l]:i>=1&&i<=$S[l]}set(r,i,s){return r.setDate(s),r.setHours(0,0,0,0),r}}class US extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"subpriority",1);ze(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(r,i,s){switch(i){case"D":case"DD":return Bt(Vt.dayOfYear,r);case"Do":return s.ordinalNumber(r,{unit:"date"});default:return Ft(i.length,r)}}validate(r,i){const s=r.getFullYear();return m2(s)?i>=1&&i<=366:i>=1&&i<=365}set(r,i,s){return r.setMonth(0,s),r.setHours(0,0,0,0),r}}function gu(t,n,r){var m,y,_,S;const i=Ri(),s=(r==null?void 0:r.weekStartsOn)??((y=(m=r==null?void 0:r.locale)==null?void 0:m.options)==null?void 0:y.weekStartsOn)??i.weekStartsOn??((S=(_=i.locale)==null?void 0:_.options)==null?void 0:S.weekStartsOn)??0,o=dt(t,r==null?void 0:r.in),l=o.getDay(),a=(n%7+7)%7,f=7-s,u=n<0||n>6?n-(l+f)%7:(a+f)%7-(l+f)%7;return ho(o,u,r)}class qS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(r,i,s){switch(i){case"E":case"EE":case"EEE":return s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"});case"EEEEE":return s.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"});case"EEEE":default:return s.day(r,{width:"wide",context:"formatting"})||s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"})}}validate(r,i){return i>=0&&i<=6}set(r,i,s,o){return r=gu(r,s,o),r.setHours(0,0,0,0),r}}class YS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(r,i,s,o){const l=c=>{const a=Math.floor((c-1)/7)*7;return(c+o.weekStartsOn+6)%7+a};switch(i){case"e":case"ee":return Wt(Ft(i.length,r),l);case"eo":return Wt(s.ordinalNumber(r,{unit:"day"}),l);case"eee":return s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"});case"eeeee":return s.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"});case"eeee":default:return s.day(r,{width:"wide",context:"formatting"})||s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"})}}validate(r,i){return i>=0&&i<=6}set(r,i,s,o){return r=gu(r,s,o),r.setHours(0,0,0,0),r}}class GS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(r,i,s,o){const l=c=>{const a=Math.floor((c-1)/7)*7;return(c+o.weekStartsOn+6)%7+a};switch(i){case"c":case"cc":return Wt(Ft(i.length,r),l);case"co":return Wt(s.ordinalNumber(r,{unit:"day"}),l);case"ccc":return s.day(r,{width:"abbreviated",context:"standalone"})||s.day(r,{width:"short",context:"standalone"})||s.day(r,{width:"narrow",context:"standalone"});case"ccccc":return s.day(r,{width:"narrow",context:"standalone"});case"cccccc":return s.day(r,{width:"short",context:"standalone"})||s.day(r,{width:"narrow",context:"standalone"});case"cccc":default:return s.day(r,{width:"wide",context:"standalone"})||s.day(r,{width:"abbreviated",context:"standalone"})||s.day(r,{width:"short",context:"standalone"})||s.day(r,{width:"narrow",context:"standalone"})}}validate(r,i){return i>=0&&i<=6}set(r,i,s,o){return r=gu(r,s,o),r.setHours(0,0,0,0),r}}function ZS(t,n,r){const i=dt(t,r==null?void 0:r.in),s=yS(i,r),o=n-s;return ho(i,o,r)}class XS extends vt{constructor(){super(...arguments);ze(this,"priority",90);ze(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(r,i,s){const o=l=>l===0?7:l;switch(i){case"i":case"ii":return Ft(i.length,r);case"io":return s.ordinalNumber(r,{unit:"day"});case"iii":return Wt(s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"}),o);case"iiiii":return Wt(s.day(r,{width:"narrow",context:"formatting"}),o);case"iiiiii":return Wt(s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"}),o);case"iiii":default:return Wt(s.day(r,{width:"wide",context:"formatting"})||s.day(r,{width:"abbreviated",context:"formatting"})||s.day(r,{width:"short",context:"formatting"})||s.day(r,{width:"narrow",context:"formatting"}),o)}}validate(r,i){return i>=1&&i<=7}set(r,i,s){return r=ZS(r,s),r.setHours(0,0,0,0),r}}class KS extends vt{constructor(){super(...arguments);ze(this,"priority",80);ze(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(r,i,s){switch(i){case"a":case"aa":case"aaa":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaaa":return s.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(r,{width:"wide",context:"formatting"})||s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"})}}set(r,i,s){return r.setHours(pu(s),0,0,0),r}}class QS extends vt{constructor(){super(...arguments);ze(this,"priority",80);ze(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(r,i,s){switch(i){case"b":case"bb":case"bbb":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbbb":return s.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(r,{width:"wide",context:"formatting"})||s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"})}}set(r,i,s){return r.setHours(pu(s),0,0,0),r}}class JS extends vt{constructor(){super(...arguments);ze(this,"priority",80);ze(this,"incompatibleTokens",["a","b","t","T"])}parse(r,i,s){switch(i){case"B":case"BB":case"BBB":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBBB":return s.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(r,{width:"wide",context:"formatting"})||s.dayPeriod(r,{width:"abbreviated",context:"formatting"})||s.dayPeriod(r,{width:"narrow",context:"formatting"})}}set(r,i,s){return r.setHours(pu(s),0,0,0),r}}class ek extends vt{constructor(){super(...arguments);ze(this,"priority",70);ze(this,"incompatibleTokens",["H","K","k","t","T"])}parse(r,i,s){switch(i){case"h":return Bt(Vt.hour12h,r);case"ho":return s.ordinalNumber(r,{unit:"hour"});default:return Ft(i.length,r)}}validate(r,i){return i>=1&&i<=12}set(r,i,s){const o=r.getHours()>=12;return o&&s<12?r.setHours(s+12,0,0,0):!o&&s===12?r.setHours(0,0,0,0):r.setHours(s,0,0,0),r}}class tk extends vt{constructor(){super(...arguments);ze(this,"priority",70);ze(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(r,i,s){switch(i){case"H":return Bt(Vt.hour23h,r);case"Ho":return s.ordinalNumber(r,{unit:"hour"});default:return Ft(i.length,r)}}validate(r,i){return i>=0&&i<=23}set(r,i,s){return r.setHours(s,0,0,0),r}}class nk extends vt{constructor(){super(...arguments);ze(this,"priority",70);ze(this,"incompatibleTokens",["h","H","k","t","T"])}parse(r,i,s){switch(i){case"K":return Bt(Vt.hour11h,r);case"Ko":return s.ordinalNumber(r,{unit:"hour"});default:return Ft(i.length,r)}}validate(r,i){return i>=0&&i<=11}set(r,i,s){return r.getHours()>=12&&s<12?r.setHours(s+12,0,0,0):r.setHours(s,0,0,0),r}}class rk extends vt{constructor(){super(...arguments);ze(this,"priority",70);ze(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(r,i,s){switch(i){case"k":return Bt(Vt.hour24h,r);case"ko":return s.ordinalNumber(r,{unit:"hour"});default:return Ft(i.length,r)}}validate(r,i){return i>=1&&i<=24}set(r,i,s){const o=s<=24?s%24:s;return r.setHours(o,0,0,0),r}}class ik extends vt{constructor(){super(...arguments);ze(this,"priority",60);ze(this,"incompatibleTokens",["t","T"])}parse(r,i,s){switch(i){case"m":return Bt(Vt.minute,r);case"mo":return s.ordinalNumber(r,{unit:"minute"});default:return Ft(i.length,r)}}validate(r,i){return i>=0&&i<=59}set(r,i,s){return r.setMinutes(s,0,0),r}}class sk extends vt{constructor(){super(...arguments);ze(this,"priority",50);ze(this,"incompatibleTokens",["t","T"])}parse(r,i,s){switch(i){case"s":return Bt(Vt.second,r);case"so":return s.ordinalNumber(r,{unit:"second"});default:return Ft(i.length,r)}}validate(r,i){return i>=0&&i<=59}set(r,i,s){return r.setSeconds(s,0),r}}class ok extends vt{constructor(){super(...arguments);ze(this,"priority",30);ze(this,"incompatibleTokens",["t","T"])}parse(r,i){const s=o=>Math.trunc(o*Math.pow(10,-i.length+3));return Wt(Ft(i.length,r),s)}set(r,i,s){return r.setMilliseconds(s),r}}class ak extends vt{constructor(){super(...arguments);ze(this,"priority",10);ze(this,"incompatibleTokens",["t","T","x"])}parse(r,i){switch(i){case"X":return hr(fr.basicOptionalMinutes,r);case"XX":return hr(fr.basic,r);case"XXXX":return hr(fr.basicOptionalSeconds,r);case"XXXXX":return hr(fr.extendedOptionalSeconds,r);case"XXX":default:return hr(fr.extended,r)}}set(r,i,s){return i.timestampIsSet?r:_t(r,r.getTime()-ca(r)-s)}}class lk extends vt{constructor(){super(...arguments);ze(this,"priority",10);ze(this,"incompatibleTokens",["t","T","X"])}parse(r,i){switch(i){case"x":return hr(fr.basicOptionalMinutes,r);case"xx":return hr(fr.basic,r);case"xxxx":return hr(fr.basicOptionalSeconds,r);case"xxxxx":return hr(fr.extendedOptionalSeconds,r);case"xxx":default:return hr(fr.extended,r)}}set(r,i,s){return i.timestampIsSet?r:_t(r,r.getTime()-ca(r)-s)}}class ck extends vt{constructor(){super(...arguments);ze(this,"priority",40);ze(this,"incompatibleTokens","*")}parse(r){return f2(r)}set(r,i,s){return[_t(r,s*1e3),{timestampIsSet:!0}]}}class uk extends vt{constructor(){super(...arguments);ze(this,"priority",20);ze(this,"incompatibleTokens","*")}parse(r){return f2(r)}set(r,i,s){return[_t(r,s),{timestampIsSet:!0}]}}const dk={G:new MS,y:new AS,Y:new DS,R:new RS,u:new PS,Q:new LS,q:new IS,M:new OS,L:new BS,w:new jS,I:new HS,d:new WS,D:new US,E:new qS,e:new YS,c:new GS,i:new XS,a:new KS,b:new QS,B:new JS,h:new ek,H:new tk,K:new nk,k:new rk,m:new ik,s:new sk,S:new ok,X:new ak,x:new lk,t:new ck,T:new uk},fk=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,hk=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,mk=/^'([^]*?)'?$/,pk=/''/g,gk=/\S/,vk=/[a-zA-Z]/;function bk(t,n,r,i){var d,h,v,x;const s=()=>_t(r,NaN),o=bS(),l=o.locale??xi,c=o.firstWeekContainsDate??((h=(d=o.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??1,a=o.weekStartsOn??((x=(v=o.locale)==null?void 0:v.options)==null?void 0:x.weekStartsOn)??0,f={firstWeekContainsDate:c,weekStartsOn:a,locale:l},u=[new NS(i==null?void 0:i.in,r)],m=n.match(hk).map(g=>{const b=g[0];if(b in Qc){const w=Qc[b];return w(g,l.formatLong)}return g}).join("").match(fk),y=[];for(let g of m){u2(g)&&Jc(g,n,t),c2(g)&&Jc(g,n,t);const b=g[0],w=dk[b];if(w){const{incompatibleTokens:k}=w;if(Array.isArray(k)){const T=y.find(D=>k.includes(D.token)||D.token===b);if(T)throw new RangeError(`The format string mustn't contain \`${T.fullToken}\` and \`${g}\` at the same time`)}else if(w.incompatibleTokens==="*"&&y.length>0)throw new RangeError(`The format string mustn't contain \`${g}\` and any other token at the same time`);y.push({token:b,fullToken:g});const N=w.run(t,g,l.match,f);if(!N)return s();u.push(N.setter),t=N.rest}else{if(b.match(vk))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");if(g==="''"?g="'":b==="'"&&(g=yk(g)),t.indexOf(g)===0)t=t.slice(g.length);else return s()}}if(t.length>0&&gk.test(t))return s();const _=u.map(g=>g.priority).sort((g,b)=>b-g).filter((g,b,w)=>w.indexOf(g)===b).map(g=>u.filter(b=>b.priority===g).sort((b,w)=>w.subPriority-b.subPriority)).map(g=>g[0]);let S=dt(r,i==null?void 0:i.in);if(isNaN(+S))return s();const E={};for(const g of _){if(!g.validate(S,f))return s();const b=g.set(S,E,f);Array.isArray(b)?(S=b[0],Object.assign(E,b[1])):S=b}return S}function yk(t){return t.match(mk)[1].replace(pk,"'")}function xk(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n);return i.getFullYear()===s.getFullYear()&&i.getMonth()===s.getMonth()}function wk(t,n,r){const[i,s]=ws(r==null?void 0:r.in,t,n);return i.getFullYear()===s.getFullYear()}function rc(t,n,r){return ho(t,-n,r)}function Ck(t,n,r){const i=dt(t,r==null?void 0:r.in),s=i.getFullYear(),o=i.getDate(),l=_t(t,0);l.setFullYear(s,n,15),l.setHours(0,0,0,0);const c=vS(l);return i.setMonth(n,Math.min(o,c)),i}function _k(t,n,r){const i=dt(t,r==null?void 0:r.in);return isNaN(+i)?_t(t,NaN):(i.setFullYear(n),i)}function zf(t,n,r){return Si(t,-1,r)}function jf(t,n,r){return b_(t,-1,r)}function Ff(t,n,r){return r2(t,-1,r)}const Hf=5,Sk=4;function kk(t,n){const r=n.startOfMonth(t),i=r.getDay()>0?r.getDay():7,s=n.addDays(t,-i+1),o=n.addDays(s,Hf*7-1);return n.getMonth(t)===n.getMonth(o)?Hf:Sk}function p2(t,n){const r=n.startOfMonth(t),i=r.getDay();return i===1?r:i===0?n.addDays(r,-1*6):n.addDays(r,-1*(i-1))}function Ek(t,n){const r=p2(t,n),i=kk(t,n);return n.addDays(r,i*7-1)}const g2={...xi,labels:{labelDayButton:(t,n,r,i)=>{let s;i&&typeof i.format=="function"?s=i.format.bind(i):s=(l,c)=>Kt(l,c,{locale:xi,...r});let o=s(t,"PPPP");return n.today&&(o=`Today, ${o}`),n.selected&&(o=`${o}, selected`),o},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:t=>`Week ${t}`,labelYearDropdown:"Choose the Year",labelGrid:(t,n,r)=>{let i;return r&&typeof r.format=="function"?i=r.format.bind(r):i=(s,o)=>Kt(s,o,{locale:xi,...n}),i(t,"LLLL yyyy")},labelGridcell:(t,n,r,i)=>{let s;i&&typeof i.format=="function"?s=i.format.bind(i):s=(l,c)=>Kt(l,c,{locale:xi,...r});let o=s(t,"PPPP");return n!=null&&n.today&&(o=`Today, ${o}`),o},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(t,n,r)=>{let i;return r&&typeof r.format=="function"?i=r.format.bind(r):i=(s,o)=>Kt(s,o,{locale:xi,...n}),i(t,"cccc")}}};class Tn{constructor(n,r){this.Date=Date,this.today=()=>{var i;return(i=this.overrides)!=null&&i.today?this.overrides.today():this.options.timeZone?rn.tz(this.options.timeZone):new this.Date},this.newDate=(i,s,o)=>{var l;return(l=this.overrides)!=null&&l.newDate?this.overrides.newDate(i,s,o):this.options.timeZone?new rn(i,s,o,this.options.timeZone):new Date(i,s,o)},this.addDays=(i,s)=>{var o;return(o=this.overrides)!=null&&o.addDays?this.overrides.addDays(i,s):ho(i,s)},this.addMonths=(i,s)=>{var o;return(o=this.overrides)!=null&&o.addMonths?this.overrides.addMonths(i,s):Si(i,s)},this.addWeeks=(i,s)=>{var o;return(o=this.overrides)!=null&&o.addWeeks?this.overrides.addWeeks(i,s):y_(i,s)},this.addYears=(i,s)=>{var o;return(o=this.overrides)!=null&&o.addYears?this.overrides.addYears(i,s):r2(i,s)},this.differenceInCalendarDays=(i,s)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarDays?this.overrides.differenceInCalendarDays(i,s):hu(i,s)},this.differenceInCalendarMonths=(i,s)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(i,s):o2(i,s)},this.eachMonthOfInterval=i=>{var s;return(s=this.overrides)!=null&&s.eachMonthOfInterval?this.overrides.eachMonthOfInterval(i):__(i)},this.eachYearOfInterval=i=>{var c;const s=(c=this.overrides)!=null&&c.eachYearOfInterval?this.overrides.eachYearOfInterval(i):S_(i),o=new Set(s.map(a=>this.getYear(a)));if(o.size===s.length)return s;const l=[];return o.forEach(a=>{l.push(new Date(a,0,1))}),l},this.endOfBroadcastWeek=i=>{var s;return(s=this.overrides)!=null&&s.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(i):Ek(i,this)},this.endOfISOWeek=i=>{var s;return(s=this.overrides)!=null&&s.endOfISOWeek?this.overrides.endOfISOWeek(i):k_(i)},this.endOfMonth=i=>{var s;return(s=this.overrides)!=null&&s.endOfMonth?this.overrides.endOfMonth(i):Xc(i)},this.endOfWeek=(i,s)=>{var o;return(o=this.overrides)!=null&&o.endOfWeek?this.overrides.endOfWeek(i,s):da(i,this.options)},this.endOfYear=i=>{var s;return(s=this.overrides)!=null&&s.endOfYear?this.overrides.endOfYear(i):Kc(i)},this.format=(i,s,o)=>{var c;const l=(c=this.overrides)!=null&&c.format?this.overrides.format(i,s,this.options):Kt(i,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=i=>{var s;return(s=this.overrides)!=null&&s.getISOWeek?this.overrides.getISOWeek(i):cl(i)},this.getMonth=(i,s)=>{var o;return(o=this.overrides)!=null&&o.getMonth?this.overrides.getMonth(i,this.options):xS(i,this.options)},this.getYear=(i,s)=>{var o;return(o=this.overrides)!=null&&o.getYear?this.overrides.getYear(i,this.options):wS(i,this.options)},this.getWeek=(i,s)=>{var o;return(o=this.overrides)!=null&&o.getWeek?this.overrides.getWeek(i,this.options):ul(i,this.options)},this.isAfter=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isAfter?this.overrides.isAfter(i,s):CS(i,s)},this.isBefore=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isBefore?this.overrides.isBefore(i,s):_S(i,s)},this.isDate=i=>{var s;return(s=this.overrides)!=null&&s.isDate?this.overrides.isDate(i):i2(i)},this.isSameDay=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isSameDay?this.overrides.isSameDay(i,s):C_(i,s)},this.isSameMonth=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isSameMonth?this.overrides.isSameMonth(i,s):xk(i,s)},this.isSameYear=(i,s)=>{var o;return(o=this.overrides)!=null&&o.isSameYear?this.overrides.isSameYear(i,s):wk(i,s)},this.max=i=>{var s;return(s=this.overrides)!=null&&s.max?this.overrides.max(i):x_(i)},this.min=i=>{var s;return(s=this.overrides)!=null&&s.min?this.overrides.min(i):w_(i)},this.setMonth=(i,s)=>{var o;return(o=this.overrides)!=null&&o.setMonth?this.overrides.setMonth(i,s):Ck(i,s)},this.setYear=(i,s)=>{var o;return(o=this.overrides)!=null&&o.setYear?this.overrides.setYear(i,s):_k(i,s)},this.startOfBroadcastWeek=(i,s)=>{var o;return(o=this.overrides)!=null&&o.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(i,this):p2(i,this)},this.startOfDay=i=>{var s;return(s=this.overrides)!=null&&s.startOfDay?this.overrides.startOfDay(i):Us(i)},this.startOfISOWeek=i=>{var s;return(s=this.overrides)!=null&&s.startOfISOWeek?this.overrides.startOfISOWeek(i):Mi(i)},this.startOfMonth=i=>{var s;return(s=this.overrides)!=null&&s.startOfMonth?this.overrides.startOfMonth(i):Ui(i)},this.startOfWeek=(i,s)=>{var o;return(o=this.overrides)!=null&&o.startOfWeek?this.overrides.startOfWeek(i,this.options):rr(i,this.options)},this.startOfYear=i=>{var s;return(s=this.overrides)!=null&&s.startOfYear?this.overrides.startOfYear(i):ua(i)},this.options={locale:g2,...n},this.overrides=r}getDigitMap(){const{numerals:n="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:n}),i={};for(let s=0;s<10;s++)i[s.toString()]=r.format(s);return i}replaceDigits(n){const r=this.getDigitMap();return n.replace(/\d/g,i=>r[i]||i)}formatNumber(n){return this.replaceDigits(n.toString())}getMonthYearOrder(){var r;const n=(r=this.options.locale)==null?void 0:r.code;return n&&Tn.yearFirstLocales.has(n)?"year-first":"month-first"}formatMonthYear(n){const{locale:r,timeZone:i,numerals:s}=this.options,o=r==null?void 0:r.code;if(o&&Tn.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:i,numberingSystem:s}).format(n)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(n,l)}}Tn.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Cr=new Tn;class v2{constructor(n,r,i=Cr){this.date=n,this.displayMonth=r,this.outside=!!(r&&!i.isSameMonth(n,r)),this.dateLib=i,this.isoDate=i.format(n,"yyyy-MM-dd"),this.displayMonthId=i.format(r,"yyyy-MM"),this.dateMonthId=i.format(n,"yyyy-MM")}isEqualTo(n){return this.dateLib.isSameDay(n.date,this.date)&&this.dateLib.isSameMonth(n.displayMonth,this.displayMonth)}}class Tk{constructor(n,r){this.date=n,this.weeks=r}}class Nk{constructor(n,r){this.days=r,this.weekNumber=n}}function Mk(t){return V.createElement("button",{...t})}function Ak(t){return V.createElement("span",{...t})}function Dk(t){const{size:n=24,orientation:r="left",className:i}=t;return V.createElement("svg",{className:i,width:n,height:n,viewBox:"0 0 24 24"},r==="up"&&V.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&V.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&V.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&V.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function Rk(t){const{day:n,modifiers:r,...i}=t;return V.createElement("td",{...i})}function Pk(t){const{day:n,modifiers:r,...i}=t,s=V.useRef(null);return V.useEffect(()=>{var o;r.focused&&((o=s.current)==null||o.focus())},[r.focused]),V.createElement("button",{ref:s,...i})}var $e;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})($e||($e={}));var It;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(It||(It={}));var Qn;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Qn||(Qn={}));var wn;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(wn||(wn={}));function Lk(t){const{options:n,className:r,components:i,classNames:s,...o}=t,l=[s[$e.Dropdown],r].join(" "),c=n==null?void 0:n.find(({value:a})=>a===o.value);return V.createElement("span",{"data-disabled":o.disabled,className:s[$e.DropdownRoot]},V.createElement(i.Select,{className:l,...o},n==null?void 0:n.map(({value:a,label:f,disabled:u})=>V.createElement(i.Option,{key:a,value:a,disabled:u},f))),V.createElement("span",{className:s[$e.CaptionLabel],"aria-hidden":!0},c==null?void 0:c.label,V.createElement(i.Chevron,{orientation:"down",size:18,className:s[$e.Chevron]})))}function Ik(t){return V.createElement("div",{...t})}function Ok(t){return V.createElement("div",{...t})}function Bk(t){const{calendarMonth:n,displayIndex:r,...i}=t;return V.createElement("div",{...i},t.children)}function zk(t){const{calendarMonth:n,displayIndex:r,...i}=t;return V.createElement("div",{...i})}function jk(t){return V.createElement("table",{...t})}function Fk(t){return V.createElement("div",{...t})}const b2=V.createContext(void 0);function mo(){const t=V.useContext(b2);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function Hk(t){const{components:n}=mo();return V.createElement(n.Dropdown,{...t})}function $k(t){const{onPreviousClick:n,onNextClick:r,previousMonth:i,nextMonth:s,...o}=t,{components:l,classNames:c,labels:{labelPrevious:a,labelNext:f}}=mo(),u=V.useCallback(y=>{s&&(r==null||r(y))},[s,r]),m=V.useCallback(y=>{i&&(n==null||n(y))},[i,n]);return V.createElement("nav",{...o},V.createElement(l.PreviousMonthButton,{type:"button",className:c[$e.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":a(i),onClick:m},V.createElement(l.Chevron,{disabled:i?void 0:!0,className:c[$e.Chevron],orientation:"left"})),V.createElement(l.NextMonthButton,{type:"button",className:c[$e.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":f(s),onClick:u},V.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[$e.Chevron]})))}function Vk(t){const{components:n}=mo();return V.createElement(n.Button,{...t})}function Wk(t){return V.createElement("option",{...t})}function Uk(t){const{components:n}=mo();return V.createElement(n.Button,{...t})}function qk(t){const{rootRef:n,...r}=t;return V.createElement("div",{...r,ref:n})}function Yk(t){return V.createElement("select",{...t})}function Gk(t){const{week:n,...r}=t;return V.createElement("tr",{...r})}function Zk(t){return V.createElement("th",{...t})}function Xk(t){return V.createElement("thead",{"aria-hidden":!0},V.createElement("tr",{...t}))}function Kk(t){const{week:n,...r}=t;return V.createElement("th",{...r})}function Qk(t){return V.createElement("th",{...t})}function Jk(t){return V.createElement("tbody",{...t})}function eE(t){const{components:n}=mo();return V.createElement(n.Dropdown,{...t})}const tE=Object.freeze(Object.defineProperty({__proto__:null,Button:Mk,CaptionLabel:Ak,Chevron:Dk,Day:Rk,DayButton:Pk,Dropdown:Lk,DropdownNav:Ik,Footer:Ok,Month:Bk,MonthCaption:zk,MonthGrid:jk,Months:Fk,MonthsDropdown:Hk,Nav:$k,NextMonthButton:Vk,Option:Wk,PreviousMonthButton:Uk,Root:qk,Select:Yk,Week:Gk,WeekNumber:Kk,WeekNumberHeader:Qk,Weekday:Zk,Weekdays:Xk,Weeks:Jk,YearsDropdown:eE},Symbol.toStringTag,{value:"Module"}));function Ir(t,n,r=!1,i=Cr){let{from:s,to:o}=t;const{differenceInCalendarDays:l,isSameDay:c}=i;return s&&o?(l(o,s)<0&&([s,o]=[o,s]),l(n,s)>=(r?1:0)&&l(o,n)>=(r?1:0)):!r&&o?c(o,n):!r&&s?c(s,n):!1}function vu(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function dl(t){return!!(t&&typeof t=="object"&&"from"in t)}function bu(t){return!!(t&&typeof t=="object"&&"after"in t)}function yu(t){return!!(t&&typeof t=="object"&&"before"in t)}function y2(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function x2(t,n){return Array.isArray(t)&&t.every(n.isDate)}function Or(t,n,r=Cr){const i=Array.isArray(n)?n:[n],{isSameDay:s,differenceInCalendarDays:o,isAfter:l}=r;return i.some(c=>{if(typeof c=="boolean")return c;if(r.isDate(c))return s(t,c);if(x2(c,r))return c.some(a=>s(t,a));if(dl(c))return Ir(c,t,!1,r);if(y2(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(vu(c)){const a=o(c.before,t),f=o(c.after,t),u=a>0,m=f<0;return l(c.before,c.after)?m&&u:u||m}return bu(c)?o(t,c.after)>0:yu(c)?o(c.before,t)>0:typeof c=="function"?c(t):!1})}function nE(t,n,r,i,s){const{disabled:o,hidden:l,modifiers:c,showOutsideDays:a,broadcastCalendar:f,today:u=s.today()}=n,{isSameDay:m,isSameMonth:y,startOfMonth:_,isBefore:S,endOfMonth:E,isAfter:d}=s,h=r&&_(r),v=i&&E(i),x={[It.focused]:[],[It.outside]:[],[It.disabled]:[],[It.hidden]:[],[It.today]:[]},g={};for(const b of t){const{date:w,displayMonth:k}=b,N=!!(k&&!y(w,k)),T=!!(h&&S(w,h)),D=!!(v&&d(w,v)),I=!!(o&&Or(w,o,s)),L=!!(l&&Or(w,l,s))||T||D||!f&&!a&&N||f&&a===!1&&N,R=m(w,u);N&&x.outside.push(b),I&&x.disabled.push(b),L&&x.hidden.push(b),R&&x.today.push(b),c&&Object.keys(c).forEach(P=>{const O=c==null?void 0:c[P];O&&Or(w,O,s)&&(g[P]?g[P].push(b):g[P]=[b])})}return b=>{const w={[It.focused]:!1,[It.disabled]:!1,[It.hidden]:!1,[It.outside]:!1,[It.today]:!1},k={};for(const N in x){const T=x[N];w[N]=T.some(D=>D===b)}for(const N in g)k[N]=g[N].some(T=>T===b);return{...w,...k}}}function rE(t,n,r={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[o])=>(r[o]?s.push(r[o]):n[It[o]]?s.push(n[It[o]]):n[Qn[o]]&&s.push(n[Qn[o]]),s),[n[$e.Day]])}function iE(t){return{...tE,...t}}function sE(t){const n={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([r,i])=>{r.startsWith("data-")&&(n[r]=i)}),n}function xu(){const t={};for(const n in $e)t[$e[n]]=`rdp-${$e[n]}`;for(const n in It)t[It[n]]=`rdp-${It[n]}`;for(const n in Qn)t[Qn[n]]=`rdp-${Qn[n]}`;for(const n in wn)t[wn[n]]=`rdp-${wn[n]}`;return t}function w2(t,n,r){return(r??new Tn(n)).formatMonthYear(t)}const oE=w2;function aE(t,n,r){return(r??new Tn(n)).format(t,"d")}function lE(t,n=Cr){return n.format(t,"LLLL")}function cE(t,n,r){return(r??new Tn(n)).format(t,"cccccc")}function uE(t,n=Cr){return t<10?n.formatNumber(`0${t.toLocaleString()}`):n.formatNumber(`${t.toLocaleString()}`)}function dE(){return""}function C2(t,n=Cr){return n.format(t,"yyyy")}const fE=C2,hE=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:w2,formatDay:aE,formatMonthCaption:oE,formatMonthDropdown:lE,formatWeekNumber:uE,formatWeekNumberHeader:dE,formatWeekdayName:cE,formatYearCaption:fE,formatYearDropdown:C2},Symbol.toStringTag,{value:"Module"}));function mE(t){return t!=null&&t.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t!=null&&t.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...hE,...t}}function wu(t,n,r,i){let s=(i??new Tn(r)).format(t,"PPPP");return n.today&&(s=`Today, ${s}`),n.selected&&(s=`${s}, selected`),s}const pE=wu;function Cu(t,n,r){return(r??new Tn(n)).formatMonthYear(t)}const gE=Cu;function _2(t,n,r,i){let s=(i??new Tn(r)).format(t,"PPPP");return n!=null&&n.today&&(s=`Today, ${s}`),s}function S2(t){return"Choose the Month"}function k2(){return""}const vE="Go to the Next Month";function E2(t,n){return vE}function T2(t){return"Go to the Previous Month"}function N2(t,n,r){return(r??new Tn(n)).format(t,"cccc")}function M2(t,n){return`Week ${t}`}function A2(t){return"Week Number"}function D2(t){return"Choose the Year"}const bE=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:gE,labelDay:pE,labelDayButton:wu,labelGrid:Cu,labelGridcell:_2,labelMonthDropdown:S2,labelNav:k2,labelNext:E2,labelPrevious:T2,labelWeekNumber:M2,labelWeekNumberHeader:A2,labelWeekday:N2,labelYearDropdown:D2},Symbol.toStringTag,{value:"Module"})),qn=(t,n,r)=>n||(r?typeof r=="function"?r:(...i)=>r:t);function yE(t,n){var i;const r=((i=n.locale)==null?void 0:i.labels)??{};return{...bE,...t??{},labelDayButton:qn(wu,t==null?void 0:t.labelDayButton,r.labelDayButton),labelMonthDropdown:qn(S2,t==null?void 0:t.labelMonthDropdown,r.labelMonthDropdown),labelNext:qn(E2,t==null?void 0:t.labelNext,r.labelNext),labelPrevious:qn(T2,t==null?void 0:t.labelPrevious,r.labelPrevious),labelWeekNumber:qn(M2,t==null?void 0:t.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:qn(D2,t==null?void 0:t.labelYearDropdown,r.labelYearDropdown),labelGrid:qn(Cu,t==null?void 0:t.labelGrid,r.labelGrid),labelGridcell:qn(_2,t==null?void 0:t.labelGridcell,r.labelGridcell),labelNav:qn(k2,t==null?void 0:t.labelNav,r.labelNav),labelWeekNumberHeader:qn(A2,t==null?void 0:t.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:qn(N2,t==null?void 0:t.labelWeekday,r.labelWeekday)}}function xE(t,n,r,i,s){const{startOfMonth:o,startOfYear:l,endOfYear:c,eachMonthOfInterval:a,getMonth:f}=s;return a({start:l(t),end:c(t)}).map(y=>{const _=i.formatMonthDropdown(y,s),S=f(y),E=n&&y<o(n)||r&&y>o(r)||!1;return{value:S,label:_,disabled:E}})}function wE(t,n={},r={}){let i={...n==null?void 0:n[$e.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{i={...i,...r==null?void 0:r[s]}}),i}function CE(t,n,r,i){const s=i??t.today(),o=r?t.startOfBroadcastWeek(s,t):n?t.startOfISOWeek(s):t.startOfWeek(s),l=[];for(let c=0;c<7;c++){const a=t.addDays(o,c);l.push(a)}return l}function _E(t,n,r,i,s=!1){if(!t||!n)return;const{startOfYear:o,endOfYear:l,eachYearOfInterval:c,getYear:a}=i,f=o(t),u=l(n),m=c({start:f,end:u});return s&&m.reverse(),m.map(y=>{const _=r.formatYearDropdown(y,i);return{value:a(y),label:_,disabled:!1}})}function SE(t,n={}){var c;const{weekStartsOn:r,locale:i}=n,s=r??((c=i==null?void 0:i.options)==null?void 0:c.weekStartsOn)??0,o=a=>{const f=typeof a=="number"||typeof a=="string"?new Date(a):a;return new rn(f.getFullYear(),f.getMonth(),f.getDate(),12,0,0,t)},l=a=>{const f=o(a);return new Date(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0,0)};return{today:()=>o(rn.tz(t)),newDate:(a,f,u)=>new rn(a,f,u,12,0,0,t),startOfDay:a=>o(a),startOfWeek:(a,f)=>{const u=o(a),m=(f==null?void 0:f.weekStartsOn)??s,y=(u.getDay()-m+7)%7;return u.setDate(u.getDate()-y),u},startOfISOWeek:a=>{const f=o(a),u=(f.getDay()-1+7)%7;return f.setDate(f.getDate()-u),f},startOfMonth:a=>{const f=o(a);return f.setDate(1),f},startOfYear:a=>{const f=o(a);return f.setMonth(0,1),f},endOfWeek:(a,f)=>{const u=o(a),_=((((f==null?void 0:f.weekStartsOn)??s)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+_),u},endOfISOWeek:a=>{const f=o(a),u=(7-f.getDay())%7;return f.setDate(f.getDate()+u),f},endOfMonth:a=>{const f=o(a);return f.setMonth(f.getMonth()+1,0),f},endOfYear:a=>{const f=o(a);return f.setMonth(11,31),f},eachMonthOfInterval:a=>{const f=o(a.start),u=o(a.end),m=[],y=new rn(f.getFullYear(),f.getMonth(),1,12,0,0,t),_=u.getFullYear()*12+u.getMonth();for(;y.getFullYear()*12+y.getMonth()<=_;)m.push(new rn(y,t)),y.setMonth(y.getMonth()+1,1);return m},addDays:(a,f)=>{const u=o(a);return u.setDate(u.getDate()+f),u},addWeeks:(a,f)=>{const u=o(a);return u.setDate(u.getDate()+f*7),u},addMonths:(a,f)=>{const u=o(a);return u.setMonth(u.getMonth()+f),u},addYears:(a,f)=>{const u=o(a);return u.setFullYear(u.getFullYear()+f),u},eachYearOfInterval:a=>{const f=o(a.start),u=o(a.end),m=[],y=new rn(f.getFullYear(),0,1,12,0,0,t);for(;y.getFullYear()<=u.getFullYear();)m.push(new rn(y,t)),y.setFullYear(y.getFullYear()+1,0,1);return m},getWeek:(a,f)=>{var m;const u=l(a);return ul(u,{weekStartsOn:(f==null?void 0:f.weekStartsOn)??s,firstWeekContainsDate:(f==null?void 0:f.firstWeekContainsDate)??((m=i==null?void 0:i.options)==null?void 0:m.firstWeekContainsDate)??1})},getISOWeek:a=>{const f=l(a);return cl(f)},differenceInCalendarDays:(a,f)=>{const u=l(a),m=l(f);return hu(u,m)},differenceInCalendarMonths:(a,f)=>{const u=l(a),m=l(f);return o2(u,m)}}}const po=t=>t instanceof HTMLElement?t:null,ic=t=>[...t.querySelectorAll("[data-animated-month]")??[]],kE=t=>po(t.querySelector("[data-animated-month]")),sc=t=>po(t.querySelector("[data-animated-caption]")),oc=t=>po(t.querySelector("[data-animated-weeks]")),EE=t=>po(t.querySelector("[data-animated-nav]")),TE=t=>po(t.querySelector("[data-animated-weekdays]"));function NE(t,n,{classNames:r,months:i,focused:s,dateLib:o}){const l=V.useRef(null),c=V.useRef(i),a=V.useRef(!1);V.useLayoutEffect(()=>{const f=c.current;if(c.current=i,!n||!t.current||!(t.current instanceof HTMLElement)||i.length===0||f.length===0||i.length!==f.length)return;const u=o.isSameMonth(i[0].date,f[0].date),m=o.isAfter(i[0].date,f[0].date),y=m?r[wn.caption_after_enter]:r[wn.caption_before_enter],_=m?r[wn.weeks_after_enter]:r[wn.weeks_before_enter],S=l.current,E=t.current.cloneNode(!0);if(E instanceof HTMLElement?(ic(E).forEach(x=>{if(!(x instanceof HTMLElement))return;const g=kE(x);g&&x.contains(g)&&x.removeChild(g);const b=sc(x);b&&b.classList.remove(y);const w=oc(x);w&&w.classList.remove(_)}),l.current=E):l.current=null,a.current||u||s)return;const d=S instanceof HTMLElement?ic(S):[],h=ic(t.current);if(h!=null&&h.every(v=>v instanceof HTMLElement)&&d&&d.every(v=>v instanceof HTMLElement)){a.current=!0,t.current.style.isolation="isolate";const v=EE(t.current);v&&(v.style.zIndex="1"),h.forEach((x,g)=>{const b=d[g];if(!b)return;x.style.position="relative",x.style.overflow="hidden";const w=sc(x);w&&w.classList.add(y);const k=oc(x);k&&k.classList.add(_);const N=()=>{a.current=!1,t.current&&(t.current.style.isolation=""),v&&(v.style.zIndex=""),w&&w.classList.remove(y),k&&k.classList.remove(_),x.style.position="",x.style.overflow="",x.contains(b)&&x.removeChild(b)};b.style.pointerEvents="none",b.style.position="absolute",b.style.overflow="hidden",b.setAttribute("aria-hidden","true");const T=TE(b);T&&(T.style.opacity="0");const D=sc(b);D&&(D.classList.add(m?r[wn.caption_before_exit]:r[wn.caption_after_exit]),D.addEventListener("animationend",N));const I=oc(b);I&&I.classList.add(m?r[wn.weeks_before_exit]:r[wn.weeks_after_exit]),x.insertBefore(b,x.firstChild)})}})}function ME(t,n,r,i){const s=t[0],o=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:a}=r??{},{addDays:f,differenceInCalendarDays:u,differenceInCalendarMonths:m,endOfBroadcastWeek:y,endOfISOWeek:_,endOfMonth:S,endOfWeek:E,isAfter:d,startOfBroadcastWeek:h,startOfISOWeek:v,startOfWeek:x}=i,g=a?h(s,i):l?v(s):x(s),b=a?y(o):l?_(S(o)):E(S(o)),w=n&&(a?y(n):l?_(n):E(n)),k=w&&d(b,w)?w:b,N=u(k,g),T=m(o,s)+1,D=[];for(let R=0;R<=N;R++){const P=f(g,R);D.push(P)}const L=(a?35:42)*T;if(c&&D.length<L){const R=L-D.length;for(let P=0;P<R;P++){const O=f(D[D.length-1],1);D.push(O)}}return D}function AE(t){const n=[];return t.reduce((r,i)=>{const s=i.weeks.reduce((o,l)=>o.concat(l.days.slice()),n.slice());return r.concat(s.slice())},n.slice())}function DE(t,n,r,i){const{numberOfMonths:s=1}=r,o=[];for(let l=0;l<s;l++){const c=i.addMonths(t,l);if(n&&c>n)break;o.push(c)}return o}function $f(t,n,r,i){const{month:s,defaultMonth:o,today:l=i.today(),numberOfMonths:c=1}=t;let a=s||o||l;const{differenceInCalendarMonths:f,addMonths:u,startOfMonth:m}=i;if(r&&f(r,a)<c-1){const y=-1*(c-1);a=u(r,y)}return n&&f(a,n)<0&&(a=n),m(a)}function RE(t,n,r,i){const{addDays:s,endOfBroadcastWeek:o,endOfISOWeek:l,endOfMonth:c,endOfWeek:a,getISOWeek:f,getWeek:u,startOfBroadcastWeek:m,startOfISOWeek:y,startOfWeek:_}=i,S=t.reduce((E,d)=>{const h=r.broadcastCalendar?m(d,i):r.ISOWeek?y(d):_(d),v=r.broadcastCalendar?o(d):r.ISOWeek?l(c(d)):a(c(d)),x=n.filter(k=>k>=h&&k<=v),g=r.broadcastCalendar?35:42;if(r.fixedWeeks&&x.length<g){const k=n.filter(N=>{const T=g-x.length;return N>v&&N<=s(v,T)});x.push(...k)}const b=x.reduce((k,N)=>{const T=r.ISOWeek?f(N):u(N),D=k.find(L=>L.weekNumber===T),I=new v2(N,d,i);return D?D.days.push(I):k.push(new Nk(T,[I])),k},[]),w=new Tk(d,b);return E.push(w),E},[]);return r.reverseMonths?S.reverse():S}function PE(t,n){let{startMonth:r,endMonth:i}=t;const{startOfYear:s,startOfDay:o,startOfMonth:l,endOfMonth:c,addYears:a,endOfYear:f,newDate:u,today:m}=n,{fromYear:y,toYear:_,fromMonth:S,toMonth:E}=t;!r&&S&&(r=S),!r&&y&&(r=n.newDate(y,0,1)),!i&&E&&(i=E),!i&&_&&(i=u(_,11,31));const d=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return r?r=l(r):y?r=u(y,0,1):!r&&d&&(r=s(a(t.today??m(),-100))),i?i=c(i):_?i=u(_,11,31):!i&&d&&(i=f(t.today??m())),[r&&o(r),i&&o(i)]}function LE(t,n,r,i){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:o=1}=r,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:a}=i,f=s?o:1,u=l(t);if(!n)return c(u,f);if(!(a(n,t)<o))return c(u,f)}function IE(t,n,r,i){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:o}=r,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:a}=i,f=s?o??1:1,u=l(t);if(!n)return c(u,-f);if(!(a(u,n)<=0))return c(u,-f)}function OE(t){const n=[];return t.reduce((r,i)=>r.concat(i.weeks.slice()),n.slice())}function fl(t,n){const[r,i]=V.useState(t);return[n===void 0?r:n,i]}function BE(t,n){var g;const[r,i]=PE(t,n),{startOfMonth:s,endOfMonth:o}=n,l=$f(t,r,i,n),[c,a]=fl(l,t.month?l:void 0);V.useEffect(()=>{const b=$f(t,r,i,n);a(b)},[t.timeZone]);const{months:f,weeks:u,days:m,previousMonth:y,nextMonth:_}=V.useMemo(()=>{const b=DE(c,i,{numberOfMonths:t.numberOfMonths},n),w=ME(b,t.endMonth?o(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},n),k=RE(b,w,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},n),N=OE(k),T=AE(k),D=IE(c,r,t,n),I=LE(c,i,t,n);return{months:k,weeks:N,days:T,previousMonth:D,nextMonth:I}},[n,c.getTime(),i==null?void 0:i.getTime(),r==null?void 0:r.getTime(),t.disableNavigation,t.broadcastCalendar,(g=t.endMonth)==null?void 0:g.getTime(),t.fixedWeeks,t.ISOWeek,t.numberOfMonths,t.pagedNavigation,t.reverseMonths]),{disableNavigation:S,onMonthChange:E}=t,d=b=>u.some(w=>w.days.some(k=>k.isEqualTo(b))),h=b=>{if(S)return;let w=s(b);r&&w<s(r)&&(w=s(r)),i&&w>s(i)&&(w=s(i)),a(w),E==null||E(w)};return{months:f,weeks:u,days:m,navStart:r,navEnd:i,previousMonth:y,nextMonth:_,goToMonth:h,goToDay:b=>{d(b)||h(b.date)}}}var ar;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(ar||(ar={}));function Vf(t){return!t[It.disabled]&&!t[It.hidden]&&!t[It.outside]}function zE(t,n,r,i){let s,o=-1;for(const l of t){const c=n(l);Vf(c)&&(c[It.focused]&&o<ar.FocusedModifier?(s=l,o=ar.FocusedModifier):i!=null&&i.isEqualTo(l)&&o<ar.LastFocused?(s=l,o=ar.LastFocused):r(l.date)&&o<ar.Selected?(s=l,o=ar.Selected):c[It.today]&&o<ar.Today&&(s=l,o=ar.Today))}return s||(s=t.find(l=>Vf(n(l)))),s}function jE(t,n,r,i,s,o,l){const{ISOWeek:c,broadcastCalendar:a}=o,{addDays:f,addMonths:u,addWeeks:m,addYears:y,endOfBroadcastWeek:_,endOfISOWeek:S,endOfWeek:E,max:d,min:h,startOfBroadcastWeek:v,startOfISOWeek:x,startOfWeek:g}=l;let w={day:f,week:m,month:u,year:y,startOfWeek:k=>a?v(k,l):c?x(k):g(k),endOfWeek:k=>a?_(k):c?S(k):E(k)}[t](r,n==="after"?1:-1);return n==="before"&&i?w=d([i,w]):n==="after"&&s&&(w=h([s,w])),w}function R2(t,n,r,i,s,o,l,c=0){if(c>365)return;const a=jE(t,n,r.date,i,s,o,l),f=!!(o.disabled&&Or(a,o.disabled,l)),u=!!(o.hidden&&Or(a,o.hidden,l)),m=a,y=new v2(a,m,l);return!f&&!u?y:R2(t,n,y,i,s,o,l,c+1)}function FE(t,n,r,i,s){const{autoFocus:o}=t,[l,c]=V.useState(),a=zE(n.days,r,i||(()=>!1),l),[f,u]=V.useState(o?a:void 0);return{isFocusTarget:E=>!!(a!=null&&a.isEqualTo(E)),setFocused:u,focused:f,blur:()=>{c(f),u(void 0)},moveFocus:(E,d)=>{if(!f)return;const h=R2(E,d,f,n.navStart,n.navEnd,t,s);h&&(t.disableNavigation&&!n.days.some(x=>x.isEqualTo(h))||(n.goToDay(h),u(h)))}}}function HE(t,n){const{selected:r,required:i,onSelect:s}=t,[o,l]=fl(r,s?r:void 0),c=s?r:o,{isSameDay:a}=n,f=_=>(c==null?void 0:c.some(S=>a(S,_)))??!1,{min:u,max:m}=t;return{selected:c,select:(_,S,E)=>{let d=[...c??[]];if(f(_)){if((c==null?void 0:c.length)===u||i&&(c==null?void 0:c.length)===1)return;d=c==null?void 0:c.filter(h=>!a(h,_))}else(c==null?void 0:c.length)===m?d=[_]:d=[...d,_];return s||l(d),s==null||s(d,_,S,E),d},isSelected:f}}function $E(t,n,r=0,i=0,s=!1,o=Cr){const{from:l,to:c}=n||{},{isSameDay:a,isAfter:f,isBefore:u}=o;let m;if(!l&&!c)m={from:t,to:r>0?void 0:t};else if(l&&!c)a(l,t)?r===0?m={from:l,to:t}:s?m={from:l,to:void 0}:m=void 0:u(t,l)?m={from:t,to:l}:m={from:l,to:t};else if(l&&c)if(a(l,t)&&a(c,t))s?m={from:l,to:c}:m=void 0;else if(a(l,t))m={from:l,to:r>0?void 0:t};else if(a(c,t))m={from:t,to:r>0?void 0:t};else if(u(t,l))m={from:t,to:c};else if(f(t,l))m={from:l,to:t};else if(f(t,c))m={from:l,to:t};else throw new Error("Invalid range");if(m!=null&&m.from&&(m!=null&&m.to)){const y=o.differenceInCalendarDays(m.to,m.from);i>0&&y>i?m={from:t,to:void 0}:r>1&&y<r&&(m={from:t,to:void 0})}return m}function VE(t,n,r=Cr){const i=Array.isArray(n)?n:[n];let s=t.from;const o=r.differenceInCalendarDays(t.to,t.from),l=Math.min(o,6);for(let c=0;c<=l;c++){if(i.includes(s.getDay()))return!0;s=r.addDays(s,1)}return!1}function Wf(t,n,r=Cr){return Ir(t,n.from,!1,r)||Ir(t,n.to,!1,r)||Ir(n,t.from,!1,r)||Ir(n,t.to,!1,r)}function WE(t,n,r=Cr){const i=Array.isArray(n)?n:[n];if(i.filter(c=>typeof c!="function").some(c=>typeof c=="boolean"?c:r.isDate(c)?Ir(t,c,!1,r):x2(c,r)?c.some(a=>Ir(t,a,!1,r)):dl(c)?c.from&&c.to?Wf(t,{from:c.from,to:c.to},r):!1:y2(c)?VE(t,c.dayOfWeek,r):vu(c)?r.isAfter(c.before,c.after)?Wf(t,{from:r.addDays(c.after,1),to:r.addDays(c.before,-1)},r):Or(t.from,c,r)||Or(t.to,c,r):bu(c)||yu(c)?Or(t.from,c,r)||Or(t.to,c,r):!1))return!0;const l=i.filter(c=>typeof c=="function");if(l.length){let c=t.from;const a=r.differenceInCalendarDays(t.to,t.from);for(let f=0;f<=a;f++){if(l.some(u=>u(c)))return!0;c=r.addDays(c,1)}}return!1}function UE(t,n){const{disabled:r,excludeDisabled:i,selected:s,required:o,onSelect:l}=t,[c,a]=fl(s,l?s:void 0),f=l?s:c;return{selected:f,select:(y,_,S)=>{const{min:E,max:d}=t,h=y?$E(y,f,E,d,o,n):void 0;return i&&r&&(h!=null&&h.from)&&h.to&&WE({from:h.from,to:h.to},r,n)&&(h.from=y,h.to=void 0),l||a(h),l==null||l(h,y,_,S),h},isSelected:y=>f&&Ir(f,y,!1,n)}}function qE(t,n){const{selected:r,required:i,onSelect:s}=t,[o,l]=fl(r,s?r:void 0),c=s?r:o,{isSameDay:a}=n;return{selected:c,select:(m,y,_)=>{let S=m;return!i&&c&&c&&a(m,c)&&(S=void 0),s||l(S),s==null||s(S,m,y,_),S},isSelected:m=>c?a(c,m):!1}}function YE(t,n){const r=qE(t,n),i=HE(t,n),s=UE(t,n);switch(t.mode){case"single":return r;case"multiple":return i;case"range":return s;default:return}}function Ln(t,n){return t instanceof rn&&t.timeZone===n?t:new rn(t,n)}function $i(t,n,r){return Ln(t,n)}function Uf(t,n,r){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?$i(t,n):Array.isArray(t)?t.map(i=>i instanceof Date?$i(i,n):i):dl(t)?{...t,from:t.from?Ln(t.from,n):t.from,to:t.to?Ln(t.to,n):t.to}:vu(t)?{before:$i(t.before,n),after:$i(t.after,n)}:bu(t)?{after:$i(t.after,n)}:yu(t)?{before:$i(t.before,n)}:t}function ac(t,n,r){return t&&(Array.isArray(t)?t.map(i=>Uf(i,n)):Uf(t,n))}function GE(t){var yt;let n=t;const r=n.timeZone;if(r&&(n={...t,timeZone:r},n.today&&(n.today=Ln(n.today,r)),n.month&&(n.month=Ln(n.month,r)),n.defaultMonth&&(n.defaultMonth=Ln(n.defaultMonth,r)),n.startMonth&&(n.startMonth=Ln(n.startMonth,r)),n.endMonth&&(n.endMonth=Ln(n.endMonth,r)),n.mode==="single"&&n.selected?n.selected=Ln(n.selected,r):n.mode==="multiple"&&n.selected?n.selected=(yt=n.selected)==null?void 0:yt.map(Ue=>Ln(Ue,r)):n.mode==="range"&&n.selected&&(n.selected={from:n.selected.from?Ln(n.selected.from,r):n.selected.from,to:n.selected.to?Ln(n.selected.to,r):n.selected.to}),n.disabled!==void 0&&(n.disabled=ac(n.disabled,r)),n.hidden!==void 0&&(n.hidden=ac(n.hidden,r)),n.modifiers)){const Ue={};Object.keys(n.modifiers).forEach(rt=>{var He;Ue[rt]=ac((He=n.modifiers)==null?void 0:He[rt],r)}),n.modifiers=Ue}const{components:i,formatters:s,labels:o,dateLib:l,locale:c,classNames:a}=V.useMemo(()=>{const Ue={...g2,...n.locale},rt=n.broadcastCalendar?1:n.weekStartsOn,He=n.noonSafe&&n.timeZone?SE(n.timeZone,{weekStartsOn:rt,locale:Ue}):void 0,Ye=n.dateLib&&He?{...He,...n.dateLib}:n.dateLib??He,ht=new Tn({locale:Ue,weekStartsOn:rt,firstWeekContainsDate:n.firstWeekContainsDate,useAdditionalWeekYearTokens:n.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:n.useAdditionalDayOfYearTokens,timeZone:n.timeZone,numerals:n.numerals},Ye);return{dateLib:ht,components:iE(n.components),formatters:mE(n.formatters),labels:yE(n.labels,ht.options),locale:Ue,classNames:{...xu(),...n.classNames}}},[n.locale,n.broadcastCalendar,n.weekStartsOn,n.firstWeekContainsDate,n.useAdditionalWeekYearTokens,n.useAdditionalDayOfYearTokens,n.timeZone,n.numerals,n.dateLib,n.noonSafe,n.components,n.formatters,n.labels,n.classNames]);n.today||(n={...n,today:l.today()});const{captionLayout:f,mode:u,navLayout:m,numberOfMonths:y=1,onDayBlur:_,onDayClick:S,onDayFocus:E,onDayKeyDown:d,onDayMouseEnter:h,onDayMouseLeave:v,onNextClick:x,onPrevClick:g,showWeekNumber:b,styles:w}=n,{formatCaption:k,formatDay:N,formatMonthDropdown:T,formatWeekNumber:D,formatWeekNumberHeader:I,formatWeekdayName:L,formatYearDropdown:R}=s,P=BE(n,l),{days:O,months:U,navStart:H,navEnd:B,previousMonth:j,nextMonth:F,goToMonth:Y}=P,q=nE(O,n,H,B,l),{isSelected:G,select:$,selected:Z}=YE(n,l)??{},{blur:ee,focused:te,isFocusTarget:se,moveFocus:ie,setFocused:ae}=FE(n,P,q,G??(()=>!1),l),{labelDayButton:de,labelGridcell:be,labelGrid:ce,labelMonthDropdown:pe,labelNav:Se,labelPrevious:Re,labelNext:Fe,labelWeekday:Ie,labelWeekNumber:Xe,labelWeekNumberHeader:X,labelYearDropdown:re}=o,oe=V.useMemo(()=>CE(l,n.ISOWeek,n.broadcastCalendar,n.today),[l,n.ISOWeek,n.broadcastCalendar,n.today]),xe=u!==void 0||S!==void 0,ve=V.useCallback(()=>{j&&(Y(j),g==null||g(j))},[j,Y,g]),ue=V.useCallback(()=>{F&&(Y(F),x==null||x(F))},[Y,F,x]),fe=V.useCallback((Ue,rt)=>He=>{He.preventDefault(),He.stopPropagation(),ae(Ue),!rt.disabled&&($==null||$(Ue.date,rt,He),S==null||S(Ue.date,rt,He))},[$,S,ae]),De=V.useCallback((Ue,rt)=>He=>{ae(Ue),E==null||E(Ue.date,rt,He)},[E,ae]),he=V.useCallback((Ue,rt)=>He=>{ee(),_==null||_(Ue.date,rt,He)},[ee,_]),Oe=V.useCallback((Ue,rt)=>He=>{const Ye={ArrowLeft:[He.shiftKey?"month":"day",n.dir==="rtl"?"after":"before"],ArrowRight:[He.shiftKey?"month":"day",n.dir==="rtl"?"before":"after"],ArrowDown:[He.shiftKey?"year":"week","after"],ArrowUp:[He.shiftKey?"year":"week","before"],PageUp:[He.shiftKey?"year":"month","before"],PageDown:[He.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ye[He.key]){He.preventDefault(),He.stopPropagation();const[ht,ot]=Ye[He.key];ie(ht,ot)}d==null||d(Ue.date,rt,He)},[ie,d,n.dir]),Ve=V.useCallback((Ue,rt)=>He=>{h==null||h(Ue.date,rt,He)},[h]),We=V.useCallback((Ue,rt)=>He=>{v==null||v(Ue.date,rt,He)},[v]),mt=V.useCallback(Ue=>rt=>{const He=Number(rt.target.value),Ye=l.setMonth(l.startOfMonth(Ue),He);Y(Ye)},[l,Y]),nt=V.useCallback(Ue=>rt=>{const He=Number(rt.target.value),Ye=l.setYear(l.startOfMonth(Ue),He);Y(Ye)},[l,Y]),{className:ft,style:bt}=V.useMemo(()=>({className:[a[$e.Root],n.className].filter(Boolean).join(" "),style:{...w==null?void 0:w[$e.Root],...n.style}}),[a,n.className,n.style,w]),xt=sE(n),qe=V.useRef(null);NE(qe,!!n.animate,{classNames:a,months:U,focused:te,dateLib:l});const wt={dayPickerProps:n,selected:Z,select:$,isSelected:G,months:U,nextMonth:F,previousMonth:j,goToMonth:Y,getModifiers:q,components:i,classNames:a,styles:w,labels:o,formatters:s};return V.createElement(b2.Provider,{value:wt},V.createElement(i.Root,{rootRef:n.animate?qe:void 0,className:ft,style:bt,dir:n.dir,id:n.id,lang:n.lang,nonce:n.nonce,title:n.title,role:n.role,"aria-label":n["aria-label"],"aria-labelledby":n["aria-labelledby"],...xt},V.createElement(i.Months,{className:a[$e.Months],style:w==null?void 0:w[$e.Months]},!n.hideNavigation&&!m&&V.createElement(i.Nav,{"data-animated-nav":n.animate?"true":void 0,className:a[$e.Nav],style:w==null?void 0:w[$e.Nav],"aria-label":Se(),onPreviousClick:ve,onNextClick:ue,previousMonth:j,nextMonth:F}),U.map((Ue,rt)=>V.createElement(i.Month,{"data-animated-month":n.animate?"true":void 0,className:a[$e.Month],style:w==null?void 0:w[$e.Month],key:rt,displayIndex:rt,calendarMonth:Ue},m==="around"&&!n.hideNavigation&&rt===0&&V.createElement(i.PreviousMonthButton,{type:"button",className:a[$e.PreviousMonthButton],tabIndex:j?void 0:-1,"aria-disabled":j?void 0:!0,"aria-label":Re(j),onClick:ve,"data-animated-button":n.animate?"true":void 0},V.createElement(i.Chevron,{disabled:j?void 0:!0,className:a[$e.Chevron],orientation:n.dir==="rtl"?"right":"left"})),V.createElement(i.MonthCaption,{"data-animated-caption":n.animate?"true":void 0,className:a[$e.MonthCaption],style:w==null?void 0:w[$e.MonthCaption],calendarMonth:Ue,displayIndex:rt},f!=null&&f.startsWith("dropdown")?V.createElement(i.DropdownNav,{className:a[$e.Dropdowns],style:w==null?void 0:w[$e.Dropdowns]},(()=>{const He=f==="dropdown"||f==="dropdown-months"?V.createElement(i.MonthsDropdown,{key:"month",className:a[$e.MonthsDropdown],"aria-label":pe(),classNames:a,components:i,disabled:!!n.disableNavigation,onChange:mt(Ue.date),options:xE(Ue.date,H,B,s,l),style:w==null?void 0:w[$e.Dropdown],value:l.getMonth(Ue.date)}):V.createElement("span",{key:"month"},T(Ue.date,l)),Ye=f==="dropdown"||f==="dropdown-years"?V.createElement(i.YearsDropdown,{key:"year",className:a[$e.YearsDropdown],"aria-label":re(l.options),classNames:a,components:i,disabled:!!n.disableNavigation,onChange:nt(Ue.date),options:_E(H,B,s,l,!!n.reverseYears),style:w==null?void 0:w[$e.Dropdown],value:l.getYear(Ue.date)}):V.createElement("span",{key:"year"},R(Ue.date,l));return l.getMonthYearOrder()==="year-first"?[Ye,He]:[He,Ye]})(),V.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},k(Ue.date,l.options,l))):V.createElement(i.CaptionLabel,{className:a[$e.CaptionLabel],role:"status","aria-live":"polite"},k(Ue.date,l.options,l))),m==="around"&&!n.hideNavigation&&rt===y-1&&V.createElement(i.NextMonthButton,{type:"button",className:a[$e.NextMonthButton],tabIndex:F?void 0:-1,"aria-disabled":F?void 0:!0,"aria-label":Fe(F),onClick:ue,"data-animated-button":n.animate?"true":void 0},V.createElement(i.Chevron,{disabled:F?void 0:!0,className:a[$e.Chevron],orientation:n.dir==="rtl"?"left":"right"})),rt===y-1&&m==="after"&&!n.hideNavigation&&V.createElement(i.Nav,{"data-animated-nav":n.animate?"true":void 0,className:a[$e.Nav],style:w==null?void 0:w[$e.Nav],"aria-label":Se(),onPreviousClick:ve,onNextClick:ue,previousMonth:j,nextMonth:F}),V.createElement(i.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":ce(Ue.date,l.options,l)||void 0,className:a[$e.MonthGrid],style:w==null?void 0:w[$e.MonthGrid]},!n.hideWeekdays&&V.createElement(i.Weekdays,{"data-animated-weekdays":n.animate?"true":void 0,className:a[$e.Weekdays],style:w==null?void 0:w[$e.Weekdays]},b&&V.createElement(i.WeekNumberHeader,{"aria-label":X(l.options),className:a[$e.WeekNumberHeader],style:w==null?void 0:w[$e.WeekNumberHeader],scope:"col"},I()),oe.map(He=>V.createElement(i.Weekday,{"aria-label":Ie(He,l.options,l),className:a[$e.Weekday],key:String(He),style:w==null?void 0:w[$e.Weekday],scope:"col"},L(He,l.options,l)))),V.createElement(i.Weeks,{"data-animated-weeks":n.animate?"true":void 0,className:a[$e.Weeks],style:w==null?void 0:w[$e.Weeks]},Ue.weeks.map(He=>V.createElement(i.Week,{className:a[$e.Week],key:He.weekNumber,style:w==null?void 0:w[$e.Week],week:He},b&&V.createElement(i.WeekNumber,{week:He,style:w==null?void 0:w[$e.WeekNumber],"aria-label":Xe(He.weekNumber,{locale:c}),className:a[$e.WeekNumber],scope:"row",role:"rowheader"},D(He.weekNumber,l)),He.days.map(Ye=>{const{date:ht}=Ye,ot=q(Ye);if(ot[It.focused]=!ot.hidden&&!!(te!=null&&te.isEqualTo(Ye)),ot[Qn.selected]=(G==null?void 0:G(ht))||ot.selected,dl(Z)){const{from:vn,to:Ae}=Z;ot[Qn.range_start]=!!(vn&&Ae&&l.isSameDay(ht,vn)),ot[Qn.range_end]=!!(vn&&Ae&&l.isSameDay(ht,Ae)),ot[Qn.range_middle]=Ir(Z,ht,!0,l)}const kt=wE(ot,w,n.modifiersStyles),$n=rE(ot,a,n.modifiersClassNames),gn=!xe&&!ot.hidden?be(ht,ot,l.options,l):void 0;return V.createElement(i.Day,{key:`${Ye.isoDate}_${Ye.displayMonthId}`,day:Ye,modifiers:ot,className:$n.join(" "),style:kt,role:"gridcell","aria-selected":ot.selected||void 0,"aria-label":gn,"data-day":Ye.isoDate,"data-month":Ye.outside?Ye.dateMonthId:void 0,"data-selected":ot.selected||void 0,"data-disabled":ot.disabled||void 0,"data-hidden":ot.hidden||void 0,"data-outside":Ye.outside||void 0,"data-focused":ot.focused||void 0,"data-today":ot.today||void 0},!ot.hidden&&xe?V.createElement(i.DayButton,{className:a[$e.DayButton],style:w==null?void 0:w[$e.DayButton],type:"button",day:Ye,modifiers:ot,disabled:!ot.focused&&ot.disabled||void 0,"aria-disabled":ot.focused&&ot.disabled||void 0,tabIndex:se(Ye)?0:-1,"aria-label":de(ht,ot,l.options,l),onClick:fe(Ye,ot),onBlur:he(Ye,ot),onFocus:De(Ye,ot),onKeyDown:Oe(Ye,ot),onMouseEnter:Ve(Ye,ot),onMouseLeave:We(Ye,ot)},N(ht,l.options,l)):!ot.hidden&&N(Ye.date,l.options,l))})))))))),n.footer&&V.createElement(i.Footer,{className:a[$e.Footer],style:w==null?void 0:w[$e.Footer],role:"status","aria-live":"polite"},n.footer)))}function ha({className:t,classNames:n,showOutsideDays:r=!0,captionLayout:i="label",buttonVariant:s="ghost",formatters:o,components:l,...c}){const a=xu();return p.jsx(GE,{showOutsideDays:r,className:Q("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:i,formatters:{formatMonthDropdown:f=>f.toLocaleString("default",{month:"short"}),...o},classNames:{root:Q("w-fit",a.root),months:Q("flex gap-4 flex-col md:flex-row relative",a.months),month:Q("flex flex-col w-full gap-4",a.month),nav:Q("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",a.nav),button_previous:Q(ts({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_previous),button_next:Q(ts({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_next),month_caption:Q("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",a.month_caption),dropdowns:Q("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",a.dropdowns),dropdown_root:Q("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",a.dropdown_root),dropdown:Q("absolute bg-popover inset-0 opacity-0",a.dropdown),caption_label:Q("select-none font-medium",i==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",a.caption_label),table:"w-full border-collapse",weekdays:Q("flex",a.weekdays),weekday:Q("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",a.weekday),week:Q("flex w-full mt-2",a.week),week_number_header:Q("select-none w-(--cell-size)",a.week_number_header),week_number:Q("text-[0.8rem] select-none text-muted-foreground",a.week_number),day:Q("relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",c.showWeekNumber?"[&:nth-child(2)[data-selected=true]_button]:rounded-l-md":"[&:first-child[data-selected=true]_button]:rounded-l-md",a.day),range_start:Q("rounded-l-md bg-accent",a.range_start),range_middle:Q("rounded-none",a.range_middle),range_end:Q("rounded-r-md bg-accent",a.range_end),today:Q("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",a.today),outside:Q("text-muted-foreground aria-selected:text-muted-foreground",a.outside),disabled:Q("text-muted-foreground opacity-50",a.disabled),hidden:Q("invisible",a.hidden),...n},components:{Root:({className:f,rootRef:u,...m})=>p.jsx("div",{"data-slot":"calendar",ref:u,className:Q(f),...m}),Chevron:({className:f,orientation:u,...m})=>u==="left"?p.jsx(Ai,{className:Q("size-4",f),...m}):u==="right"?p.jsx(In,{className:Q("size-4",f),...m}):p.jsx(Ma,{className:Q("size-4",f),...m}),DayButton:ZE,WeekNumber:({children:f,...u})=>p.jsx("td",{...u,children:p.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:f})}),...l},...c})}function ZE({className:t,day:n,modifiers:r,...i}){const s=xu(),o=C.useRef(null);return C.useEffect(()=>{var l;r.focused&&((l=o.current)==null||l.focus())},[r.focused]),p.jsx(Ke,{ref:o,variant:"ghost",size:"icon","data-day":n.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:Q("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",s.day,t),...i})}const lc=t=>{if(t){if(t instanceof Date)return isNaN(t.getTime())?void 0:t;if(typeof t=="string")try{if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[r,i,s]=t.split("-").map(Number),o=new Date(r,i-1,s,12,0,0);return isNaN(o.getTime())?void 0:o}if(t.includes("T")){const r=new Date(t);if(!isNaN(r.getTime()))return new Date(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),12,0,0)}const n=new Date(t);return isNaN(n.getTime())?void 0:n}catch{return}}},XE=(t,n)=>{if(t)return n?new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())).toISOString():Kt(t,"yyyy-MM-dd")},_u=C.forwardRef(({date:t,onDateChange:n,placeholder:r="yyyy-mm-dd",className:i,sendUTC:s=!1,label:o,description:l,error:c,required:a,clearable:f=!0,minDate:u,maxDate:m,...y},_)=>{const[S,E]=C.useState(!1),[d,h]=C.useState(new Date),[v,x]=C.useState(""),[g,b]=C.useState(""),w=C.useId(),k=C.useMemo(()=>lc(t),[t]),N=C.useMemo(()=>lc(u),[u]),T=C.useMemo(()=>lc(m),[m]);C.useEffect(()=>{k?(x(Kt(k,"yyyy-MM-dd")),b("")):t||(x(""),b(""))},[t,k]),C.useEffect(()=>{S&&h(k||new Date)},[S,k]);const D=H=>{n==null||n(XE(H,s))},I=H=>{if(!H){n==null||n(void 0),E(!1);return}b(""),D(H),E(!1)},L=H=>{const j=H.target.value.replace(/[^\d-]/g,"").slice(0,10);if(x(j),j===""){b(""),n==null||n(void 0);return}if(/^\d{4}-\d{2}-\d{2}$/.test(j)){const F=bk(j,"yyyy-MM-dd",new Date);if(!s2(F)){b("Invalid date");return}if(N){const Y=new Date(N.getFullYear(),N.getMonth(),N.getDate());if(F<Y){b(`Date must be on or after ${Kt(Y,"yyyy-MM-dd")}`);return}}if(T){const Y=new Date(T.getFullYear(),T.getMonth(),T.getDate());if(F>Y){b(`Date must be on or before ${Kt(Y,"yyyy-MM-dd")}`);return}}b(""),h(new Date(F.getFullYear(),F.getMonth(),1)),D(new Date(F.getFullYear(),F.getMonth(),F.getDate(),12))}else b(""),n==null||n(void 0)},R=H=>{const B=v;if(/^\d$/.test(H.key)&&(B.length===4||B.length===7)){H.preventDefault();const j=B+"-"+H.key;x(j.slice(0,10)),L({target:{value:j.slice(0,10)}})}},P=H=>{H.stopPropagation(),H.preventDefault(),x(""),b(""),n==null||n(void 0)},O=H=>{if(N){const B=new Date(N.getFullYear(),N.getMonth(),N.getDate());if(new Date(H.getFullYear(),H.getMonth(),H.getDate())<B)return!0}if(T){const B=new Date(T.getFullYear(),T.getMonth(),T.getDate());if(new Date(H.getFullYear(),H.getMonth(),H.getDate())>B)return!0}return!1},U=c||g;return p.jsxs("div",{className:"space-y-2 relative",children:[o&&p.jsxs(br,{htmlFor:w,className:Q(U&&"text-destructive"),children:[o,a&&p.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsxs("div",{className:"relative flex-1",children:[p.jsx(ni,{ref:_,id:w,type:"text",value:v,onChange:L,onKeyDown:R,placeholder:r,className:Q("pr-8",U&&"border-destructive focus-visible:ring-destructive",i)}),f&&v&&p.jsx("button",{type:"button",onClick:P,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,"aria-label":"Clear date",children:p.jsx(er,{className:"h-3.5 w-3.5"})})]}),p.jsxs(du,{open:S,onOpenChange:E,children:[p.jsx(fu,{asChild:!0,children:p.jsx(Ke,{type:"button",variant:"outline",size:"icon",className:Q("shrink-0",U&&"border-destructive"),"aria-label":"Open date picker",children:p.jsx(ea,{className:"h-4 w-4"})})}),p.jsxs(ll,{className:"w-auto p-0",align:"end",children:[p.jsx(ha,{mode:"single",selected:k,onSelect:I,month:d,onMonthChange:h,captionLayout:"dropdown",fromYear:1900,toYear:2030,disabled:O,...y}),p.jsxs("div",{className:"border-t p-3 flex gap-2",children:[p.jsx(Ke,{type:"button",variant:"outline",size:"sm",className:"flex-1 cursor-pointer",onClick:()=>{const H=new Date;O(H)||I(new Date(H.getFullYear(),H.getMonth(),H.getDate(),12))},disabled:O(new Date),children:"Today"}),p.jsx(Ke,{type:"button",variant:"outline",size:"sm",className:"flex-1 cursor-pointer",onClick:()=>{const H=new Date;H.setDate(H.getDate()+1),O(H)||I(new Date(H.getFullYear(),H.getMonth(),H.getDate(),12))},disabled:O(new Date(new Date().setDate(new Date().getDate()+1))),children:"Tomorrow"})]})]})]})]}),l&&!U&&p.jsx("p",{className:"text-sm text-muted-foreground",children:l}),U&&p.jsx("p",{className:"text-sm text-destructive",children:U})]})});_u.displayName="DatePicker";const Su=C.forwardRef(({dateRange:t,onDateRangeChange:n,placeholder:r="Pick a date range",className:i,clearable:s=!0,sendUTC:o=!1,popoverContentClassName:l,showExtendedPresets:c=!1,presets:a,...f},u)=>{const[m,y]=C.useState(!1),[_,S]=C.useState(null),[E,d]=C.useState("from"),[h,v]=C.useState(new Date),[x,g]=C.useState(Si(new Date,1)),b=B=>{if(B){if(B instanceof Date)return B;if(typeof B=="string"){const j=B.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(j){const[,F,Y,q]=j;return new Date(Number(F),Number(Y)-1,Number(q))}return new Date(B)}}},w=(B,j)=>{const F=Ui(B||new Date),Y=j?Ui(j):Si(F,1),q=Y.getTime()===F.getTime()?Si(F,1):Y;return{left:F,right:q}};C.useEffect(()=>{if(m){let B,j;t!=null&&t.from?(B=b(t.from),j=t.to?b(t.to):void 0,S({from:B,to:j})):S(null),d("from");const{left:F,right:Y}=w(B,j);v(F),g(Y)}},[m]);const k=B=>{B.stopPropagation(),n==null||n({from:void 0,to:void 0}),S(null),d("from")},N=()=>{if(!(t!=null&&t.from))return r;const B=b(t.from);if(t.to){const j=b(t.to);return`${Kt(B,"LLL dd, y")} - ${Kt(j,"LLL dd, y")}`}return Kt(B,"LLL dd, y")},T=B=>{if(!B||!B.from)return{from:void 0,to:void 0};if(o){const j=new Date(Date.UTC(B.from.getFullYear(),B.from.getMonth(),B.from.getDate(),0,0,0)).toISOString(),F=B.to?new Date(Date.UTC(B.to.getFullYear(),B.to.getMonth(),B.to.getDate(),0,0,0)).toISOString():void 0;return{from:j,to:F}}return{from:B.from?Kt(B.from,"yyyy-MM-dd"):void 0,to:B.to?Kt(B.to,"yyyy-MM-dd"):void 0}},D=(B,j)=>{j&&(S(F=>({...F,[E]:j})),E==="from"&&!(_!=null&&_.to)&&d("to"))},I=()=>{if(!(_!=null&&_.from))return;const B=T(_);n==null||n(B),y(!1),S(null),d("from")},L=(B,j)=>{S({from:B,to:j}),d("from");const{left:F,right:Y}=w(B,j);v(F),g(Y)},R=_||(t!=null&&t.from?{from:b(t.from),to:t.to?b(t.to):void 0}:void 0),P=!!(_!=null&&_.from),O=_!=null&&_.from&&(_!=null&&_.to)?`Apply: ${Kt(_.from,"MMM dd")} – ${Kt(_.to,"MMM dd")}`:_!=null&&_.from?`Apply: ${Kt(_.from,"MMM dd")}`:"Apply",U=C.useMemo(()=>{const B=new Date,j=rc(B,1),F=[{label:"Today",from:B,to:B},{label:"Yesterday",from:j,to:j},{label:"This Week",from:rr(B,{weekStartsOn:0}),to:da(B,{weekStartsOn:0})},{label:"Last Week",from:rr(rc(B,7),{weekStartsOn:0}),to:da(rc(B,7),{weekStartsOn:0})},{label:"This Month",from:Ui(B),to:Xc(B)},{label:"Last Month",from:Ui(zf(B)),to:Xc(zf(B))}];return c?[...F,{label:"This Quarter",from:Rf(B),to:Pf(B)},{label:"Last Quarter",from:Rf(jf(B)),to:Pf(jf(B))},{label:"This Year",from:ua(B),to:Kc(B)},{label:"Last Year",from:ua(Ff(B)),to:Kc(Ff(B))}]:F},[c]),H=a??U;return p.jsx("div",{className:Q("grid gap-2 relative",i),children:p.jsxs(du,{open:m,onOpenChange:y,children:[p.jsx(fu,{asChild:!0,children:p.jsxs(Ke,{ref:u,id:"date-range",variant:"outline",className:Q("w-full justify-between text-left font-normal",!(t!=null&&t.from)&&"text-muted-foreground"),...f,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(ea,{className:"h-4 w-4"}),N()]}),s&&(t==null?void 0:t.from)&&p.jsx(er,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-foreground",onClick:k})]})}),p.jsx(ll,{className:Q("w-auto p-0 z-[100]",l),align:"start",onOpenAutoFocus:B=>B.preventDefault(),children:p.jsxs("div",{className:"flex",children:[p.jsxs("div",{className:"flex flex-col gap-1 border-r p-3 min-w-[140px] max-h-[420px] overflow-y-auto",children:[p.jsx("div",{className:"text-sm font-medium mb-1 text-muted-foreground",children:"Quick Select"}),H.map(B=>p.jsx(Ke,{variant:"ghost",size:"sm",className:"justify-start font-normal cursor-pointer",onClick:()=>L(B.from,B.to),children:B.label},B.label))]}),p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b",children:[p.jsxs("button",{type:"button",onClick:()=>d("from"),className:"flex-1 text-left cursor-pointer",children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"From"}),p.jsx("div",{className:Q("text-sm rounded-md border px-3 py-1.5 transition-colors",E==="from"?"border-primary ring-1 ring-primary":"border-input",!(_!=null&&_.from)&&"text-muted-foreground border-dashed"),children:_!=null&&_.from?Kt(_.from,"LLL dd, y"):"Select date"})]}),p.jsxs("button",{type:"button",onClick:()=>d("to"),className:"flex-1 text-left cursor-pointer",children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"To"}),p.jsx("div",{className:Q("text-sm rounded-md border px-3 py-1.5 transition-colors",E==="to"?"border-primary ring-1 ring-primary":"border-input",!(_!=null&&_.to)&&"text-muted-foreground border-dashed"),children:_!=null&&_.to?Kt(_.to,"LLL dd, y"):"Select date"})]})]}),p.jsxs("div",{className:"flex gap-4 p-3",children:[p.jsx(ha,{mode:"range",captionLayout:"dropdown",numberOfMonths:1,month:h,onMonthChange:v,selected:R,onSelect:D,className:"p-0"}),p.jsx(ha,{mode:"range",captionLayout:"dropdown",numberOfMonths:1,month:x,onMonthChange:g,selected:R,onSelect:D,className:"p-0"})]}),p.jsx("div",{className:"flex items-center justify-end gap-2 border-t px-4 py-3",children:p.jsxs("div",{className:"flex gap-2",children:[p.jsx(Ke,{variant:"outline",size:"sm",className:"cursor-pointer",onClick:()=>{S(null),d("from"),y(!1)},children:"Cancel"}),p.jsx(Ke,{size:"sm",disabled:!P,className:"cursor-pointer",onClick:I,children:O})]})})]})]})})]})})});Su.displayName="DateRangePicker";var hl={},ku={};const P2={name:"blockquote",display:"command",add:function(t,n){const r=t.context;r.blockquote={targetButton:n,tag:t.util.createElement("BLOCKQUOTE")}},active:function(t){if(!t)this.util.removeClass(this.context.blockquote.targetButton,"active");else if(/blockquote/i.test(t.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0;return!1},action:function(){const t=this.util.getParentElement(this.getSelectionNode(),"blockquote");t?this.detachRangeFormatElement(t,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},L2={name:"align",display:"submenu",add:function(t,n){const r=t.icons,i=t.context;i.align={targetButton:n,_itemMenu:null,_alignList:null,currentAlign:"",defaultDir:t.options.rtl?"right":"left",icons:{justify:r.align_justify,left:r.align_left,right:r.align_right,center:r.align_center}};let s=this.setSubmenu(t),o=i.align._itemMenu=s.querySelector("ul");o.addEventListener("click",this.pickup.bind(t)),i.align._alignList=o.querySelectorAll("li button"),t.initMenuTarget(this.name,n,s),s=null,o=null},setSubmenu:function(t){const n=t.lang,r=t.icons,i=t.util.createElement("DIV"),s=t.options.alignItems;let o="";for(let l=0,c,a;l<s.length;l++)c=s[l],a=n.toolbar["align"+c.charAt(0).toUpperCase()+c.slice(1)],o+='<li><button type="button" class="se-btn-list se-btn-align" data-value="'+c+'" title="'+a+'" aria-label="'+a+'"><span class="se-list-icon">'+r["align_"+c]+"</span>"+a+"</button></li>";return i.className="se-submenu se-list-layer se-list-align",i.innerHTML='<div class="se-list-inner"><ul class="se-list-basic">'+o+"</ul></div>",i},active:function(t){const n=this.context.align,r=n.targetButton,i=r.firstElementChild;if(!t)this.util.changeElement(i,n.icons[n.defaultDir]),r.removeAttribute("data-focus");else if(this.util.isFormatElement(t)){const s=t.style.textAlign;if(s)return this.util.changeElement(i,n.icons[s]||n.icons[n.defaultDir]),r.setAttribute("data-focus",s),!0}return!1},on:function(){const t=this.context.align,n=t._alignList,r=t.targetButton.getAttribute("data-focus")||t.defaultDir;if(r!==t.currentAlign){for(let i=0,s=n.length;i<s;i++)r===n[i].getAttribute("data-value")?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active");t.currentAlign=r}},exchangeDir:function(){const t=this.options.rtl?"right":"left";if(!this.context.align||this.context.align.defaultDir===t)return;this.context.align.defaultDir=t;let n=this.context.align._itemMenu,r=n.querySelector('[data-value="left"]'),i=n.querySelector('[data-value="right"]');if(r&&i){const s=r.parentElement,o=i.parentElement;s.appendChild(i),o.appendChild(r)}},pickup:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=null;for(;!r&&!/UL/i.test(n.tagName);)r=n.getAttribute("data-value"),n=n.parentNode;if(!r)return;const i=this.context.align.defaultDir,s=this.getSelectedElements();for(let o=0,l=s.length;o<l;o++)this.util.setStyle(s[o],"textAlign",r===i?"":r);this.effectNode=null,this.submenuOff(),this.focus(),this.history.push(!1)}},I2={name:"font",display:"submenu",add:function(t,n){const r=t.context;r.font={targetText:n.querySelector(".txt"),targetTooltip:n.parentNode.querySelector(".se-tooltip-text"),_fontList:null,currentFont:""};let i=this.setSubmenu(t);i.querySelector(".se-list-inner").addEventListener("click",this.pickup.bind(t)),r.font._fontList=i.querySelectorAll("ul li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.lang,r=t.util.createElement("DIV");r.className="se-submenu se-list-layer se-list-font-family";let i,s,o,l,c=t.options.font,a='<div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="default_value se-btn-list" title="'+n.toolbar.default+'" aria-label="'+n.toolbar.default+'">('+n.toolbar.default+")</button></li>";for(o=0,l=c.length;o<l;o++)i=c[o],s=i.split(",")[0],a+='<li><button type="button" class="se-btn-list" data-value="'+i+'" data-txt="'+s+'" title="'+s+'" aria-label="'+s+'" style="font-family:'+i+';">'+s+"</button></li>";return a+="</ul></div>",r.innerHTML=a,r},active:function(t){const n=this.context.font.targetText,r=this.context.font.targetTooltip;if(t){if(t.style&&t.style.fontFamily.length>0){const i=t.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(n,i),this.util.changeTxt(r,this.lang.toolbar.font+" ("+i+")"),!0}}else{const i=this.hasFocus?this.wwComputedStyle.fontFamily:this.lang.toolbar.font;this.util.changeTxt(n,i),this.util.changeTxt(r,this.hasFocus?this.lang.toolbar.font+(i?" ("+i+")":""):i)}return!1},on:function(){const t=this.context.font,n=t._fontList,r=t.targetText.textContent;if(r!==t.currentFont){for(let i=0,s=n.length;i<s;i++)r===(n[i].getAttribute("data-value")||"").replace(/'|"/g,"")?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active");t.currentFont=r}},pickup:function(t){if(!/^BUTTON$/i.test(t.target.tagName))return!1;t.preventDefault(),t.stopPropagation();let n=t.target.getAttribute("data-value");if(n){const r=this.util.createElement("SPAN");/[\s\d\W]/.test(n)&&!/^['"].*['"]$/.test(n)&&(n='"'+n+'"'),r.style.fontFamily=n,this.nodeChange(r,["font-family"],null,null)}else this.nodeChange(null,["font-family"],["span"],!0);this.submenuOff()}},O2={name:"fontSize",display:"submenu",add:function(t,n){const r=t.context;r.fontSize={targetText:n.querySelector(".txt"),_sizeList:null,currentSize:""};let i=this.setSubmenu(t),s=i.querySelector("ul");s.addEventListener("click",this.pickup.bind(t)),r.fontSize._sizeList=s.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null,s=null},setSubmenu:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-submenu se-list-layer se-list-font-size";const s=n.fontSize?n.fontSize:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72];let o='<div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="default_value se-btn-list" title="'+r.toolbar.default+'" aria-label="'+r.toolbar.default+'">('+r.toolbar.default+")</button></li>";for(let l=0,c=n.fontSizeUnit,a=s.length,f;l<a;l++)f=s[l],o+='<li><button type="button" class="se-btn-list" data-value="'+f+c+'" title="'+f+c+'" aria-label="'+f+c+'" style="font-size:'+f+c+';">'+f+"</button></li>";return o+="</ul></div>",i.innerHTML=o,i},active:function(t){if(!t)this.util.changeTxt(this.context.fontSize.targetText,this.hasFocus?this._convertFontSize.call(this,this.options.fontSizeUnit,this.wwComputedStyle.fontSize):this.lang.toolbar.fontSize);else if(t.style&&t.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,this._convertFontSize.call(this,this.options.fontSizeUnit,t.style.fontSize)),!0;return!1},on:function(){const t=this.context.fontSize,n=t._sizeList,r=t.targetText.textContent;if(r!==t.currentSize){for(let i=0,s=n.length;i<s;i++)r===n[i].getAttribute("data-value")?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active");t.currentSize=r}},pickup:function(t){if(!/^BUTTON$/i.test(t.target.tagName))return!1;t.preventDefault(),t.stopPropagation();const n=t.target.getAttribute("data-value");if(n){const r=this.util.createElement("SPAN");r.style.fontSize=n,this.nodeChange(r,["font-size"],null,null)}else this.nodeChange(null,["font-size"],["span"],!0);this.submenuOff()}},B2={name:"colorPicker",add:function(t){const n=t.context;n.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]},n.colorPicker.colorListHTML=this.createColorList(t,this._makeColorList)},createColorList:function(t,n){const r=t.options,i=t.lang,s=!r.colorList||r.colorList.length===0?["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"]:r.colorList;let o=[],l='<div class="se-list-inner">';for(let c=0,a=s.length,f;c<a;c++)f=s[c],f&&(typeof f=="string"&&(o.push(f),c<a-1)||(o.length>0&&(l+='<div class="se-selector-color">'+n(o)+"</div>",o=[]),typeof f=="object"&&(l+='<div class="se-selector-color">'+n(f)+"</div>")));return l+='<form class="se-form-group"><input type="text" maxlength="9" class="_se_color_picker_input se-color-input"/><button type="submit" class="se-btn-primary _se_color_picker_submit" title="'+i.dialogBox.submitButton+'" aria-label="'+i.dialogBox.submitButton+'">'+t.icons.checked+'</button><button type="button" class="se-btn _se_color_picker_remove" title="'+i.toolbar.removeFormat+'" aria-label="'+i.toolbar.removeFormat+'">'+t.icons.erase+"</button></form></div>",l},_makeColorList:function(t){let n="";n+='<ul class="se-color-pallet">';for(let r=0,i=t.length,s;r<i;r++)s=t[r],typeof s=="string"&&(n+='<li><button type="button" data-value="'+s+'" title="'+s+'" aria-label="'+s+'" style="background-color:'+s+';"></button></li>');return n+="</ul>",n},init:function(t,n){const r=this.plugins.colorPicker;let i=n||r.getColorInNode.call(this,t)||this.context.colorPicker._defaultColor;i=r.isHexColor(i)?i:r.rgb2hex(i)||i;const s=this.context.colorPicker._colorList;if(s)for(let o=0,l=s.length;o<l;o++)i.toLowerCase()===s[o].getAttribute("data-value").toLowerCase()?this.util.addClass(s[o],"active"):this.util.removeClass(s[o],"active");r.setInputText.call(this,r.colorName2hex.call(this,i))},setCurrentColor:function(t){this.context.colorPicker._currentColor=t,this.context.colorPicker._colorInput.style.borderColor=t},setInputText:function(t){t=/^#/.test(t)?t:"#"+t,this.context.colorPicker._colorInput.value=t,this.plugins.colorPicker.setCurrentColor.call(this,t)},getColorInNode:function(t){let n="";const r=this.context.colorPicker._styleProperty;for(;t&&!this.util.isWysiwygDiv(t)&&n.length===0;)t.nodeType===1&&t.style[r]&&(n=t.style[r]),t=t.parentNode;return n},isHexColor:function(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)},rgb2hex:function(t){const n=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return n&&n.length===4?"#"+("0"+parseInt(n[1],10).toString(16)).slice(-2)+("0"+parseInt(n[2],10).toString(16)).slice(-2)+("0"+parseInt(n[3],10).toString(16)).slice(-2):""},colorName2hex:function(t){if(/^#/.test(t))return t;var n=this.util.createElement("div");n.style.display="none",n.style.color=t;var r=this._w.getComputedStyle(this._d.body.appendChild(n)).color.match(/\d+/g).map(function(i){return parseInt(i,10)});return this.util.removeItem(n),r.length>=3?"#"+((1<<24)+(r[0]<<16)+(r[1]<<8)+r[2]).toString(16).substr(1):!1}},z2={name:"fontColor",display:"submenu",add:function(t,n){t.addModule([B2]);const r=t.context;r.fontColor={previewEl:null,colorInput:null,colorList:null};let i=this.setSubmenu(t);r.fontColor.colorInput=i.querySelector("._se_color_picker_input"),r.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(t)),i.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(t)),i.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(t)),i.addEventListener("click",this.pickup.bind(t)),r.fontColor.colorList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.context.colorPicker.colorListHTML,r=t.util.createElement("DIV");return r.className="se-submenu se-list-layer",r.innerHTML=n,r},on:function(){const t=this.context.colorPicker,n=this.context.fontColor;t._colorInput=n.colorInput;const r=this.wwComputedStyle.color;t._defaultColor=r?this.plugins.colorPicker.isHexColor(r)?r:this.plugins.colorPicker.rgb2hex(r):"#333333",t._styleProperty="color",t._colorList=n.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(t){this.plugins.colorPicker.setCurrentColor.call(this,t.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(t){t.preventDefault(),t.stopPropagation(),this.plugins.fontColor.applyColor.call(this,t.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(t){if(!t)return;const n=this.util.createElement("SPAN");n.style.color=t,this.nodeChange(n,["color"],null,null),this.submenuOff()}},j2={name:"hiliteColor",display:"submenu",add:function(t,n){t.addModule([B2]);const r=t.context;r.hiliteColor={previewEl:null,colorInput:null,colorList:null};let i=this.setSubmenu(t);r.hiliteColor.colorInput=i.querySelector("._se_color_picker_input"),r.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(t)),i.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(t)),i.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(t)),i.addEventListener("click",this.pickup.bind(t)),r.hiliteColor.colorList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.context.colorPicker.colorListHTML,r=t.util.createElement("DIV");return r.className="se-submenu se-list-layer",r.innerHTML=n,r},on:function(){const t=this.context.colorPicker,n=this.context.hiliteColor;t._colorInput=n.colorInput;const r=this.wwComputedStyle.backgroundColor;t._defaultColor=r?this.plugins.colorPicker.isHexColor(r)?r:this.plugins.colorPicker.rgb2hex(r):"#ffffff",t._styleProperty="backgroundColor",t._colorList=n.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(t){this.plugins.colorPicker.setCurrentColor.call(this,t.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(t){t.preventDefault(),t.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,t.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(t){if(!t)return;const n=this.util.createElement("SPAN");n.style.backgroundColor=t,this.nodeChange(n,["background-color"],null,null),this.submenuOff()}},F2={name:"horizontalRule",display:"submenu",add:function(t,n){t.context.horizontalRule={currentHR:null};let r=this.setSubmenu(t);r.querySelector("ul").addEventListener("click",this.horizontalRulePick.bind(t)),t.initMenuTarget(this.name,n,r),r=null},setSubmenu:function(t){const n=t.lang,r=t.util.createElement("DIV"),i=t.options.hrItems||[{name:n.toolbar.hr_solid,class:"__se__solid"},{name:n.toolbar.hr_dashed,class:"__se__dashed"},{name:n.toolbar.hr_dotted,class:"__se__dotted"}];let s="";for(let o=0,l=i.length;o<l;o++)s+='<li><button type="button" class="se-btn-list btn_line" data-command="horizontalRule" data-value="'+i[o].class+'" title="'+i[o].name+'" aria-label="'+i[o].name+'"><hr'+(i[o].class?' class="'+i[o].class+'"':"")+(i[o].style?' style="'+i[o].style+'"':"")+"/></button></li>";return r.className="se-submenu se-list-layer se-list-line",r.innerHTML='<div class="se-list-inner"><ul class="se-list-basic">'+s+"</ul></div>",r},active:function(t){if(!t)this.util.hasClass(this.context.horizontalRule.currentHR,"on")&&this.controllersOff();else if(/HR/i.test(t.nodeName))return this.context.horizontalRule.currentHR=t,this.util.hasClass(t,"on")||(this.util.addClass(t,"on"),this.controllersOn("hr",this.util.removeClass.bind(this.util,t,"on"))),!0;return!1},appendHr:function(t){return this.focus(),this.insertComponent(t.cloneNode(!1),!1,!0,!1)},horizontalRulePick:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=n.getAttribute("data-command");for(;!r&&!/UL/i.test(n.tagName);)n=n.parentNode,r=n.getAttribute("data-command");if(!r)return;const i=this.plugins.horizontalRule.appendHr.call(this,n.firstElementChild);i&&(this.setRange(i,0,i,0),this.submenuOff())}},H2={name:"list",display:"submenu",add:function(t,n){const r=t.context;r.list={targetButton:n,_list:null,currentList:"",icons:{bullets:t.icons.list_bullets,number:t.icons.list_number}};let i=this.setSubmenu(t),s=i.querySelector("ul");s.addEventListener("click",this.pickup.bind(t)),r.list._list=s.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null,s=null},setSubmenu:function(t){const n=t.lang,r=t.util.createElement("DIV");return r.className="se-submenu se-list-layer",r.innerHTML='<div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="se-btn-list se-tooltip" data-command="OL" title="'+n.toolbar.orderList+'" aria-label="'+n.toolbar.orderList+'">'+t.icons.list_number+'</button></li><li><button type="button" class="se-btn-list se-tooltip" data-command="UL" title="'+n.toolbar.unorderList+'" aria-label="'+n.toolbar.unorderList+'">'+t.icons.list_bullets+"</button></li></ul></div>",r},active:function(t){const n=this.context.list.targetButton,r=n.firstElementChild,i=this.util;if(i.isList(t)){const s=t.nodeName;return n.setAttribute("data-focus",s),i.addClass(n,"active"),/UL/i.test(s)?i.changeElement(r,this.context.list.icons.bullets):i.changeElement(r,this.context.list.icons.number),!0}else n.removeAttribute("data-focus"),i.changeElement(r,this.context.list.icons.number),i.removeClass(n,"active");return!1},on:function(){const t=this.context.list,n=t._list,r=t.targetButton.getAttribute("data-focus")||"";if(r!==t.currentList){for(let i=0,s=n.length;i<s;i++)r===n[i].getAttribute("data-command")?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active");t.currentList=r}},editList:function(t,n,r){let i=this.getRange(),s=n||this.getSelectedElementsAndComponents(!1);if(s.length===0&&(n||(i=this.getRange_addLine(i,null),s=this.getSelectedElementsAndComponents(!1),s.length===0)))return;const o=this.util;o.sortByDepth(s,!0);let l=s[0],c=s[s.length-1],a=(o.isListCell(l)||o.isComponent(l))&&!l.previousElementSibling?l.parentNode.previousElementSibling:l.previousElementSibling,f=(o.isListCell(c)||o.isComponent(c))&&!c.nextElementSibling?c.parentNode.nextElementSibling:c.nextElementSibling;const u=i.collapsed,m={sc:i.startContainer,so:i.startContainer===i.endContainer&&o.onlyZeroWidthSpace(i.startContainer)&&i.startOffset===0&&i.endOffset===1?i.endOffset:i.startOffset,ec:i.endContainer,eo:i.endOffset};let y=null,_=!0;for(let S=0,E=s.length;S<E;S++)if(!o.isList(o.getRangeFormatElement(s[S],(function(d){return this.getRangeFormatElement(d)&&d!==s[S]}).bind(o)))){_=!1;break}if(_&&(!a||l.tagName!==a.tagName||t!==a.tagName.toUpperCase())&&(!f||c.tagName!==f.tagName||t!==f.tagName.toUpperCase())){if(r){for(let x=0,g=s.length;x<g;x++)for(let b=x-1;b>=0;b--)if(s[b].contains(s[x])){s.splice(x,1),x--,g--;break}}const S=o.getRangeFormatElement(l),E=S&&S.tagName===t;let d,h;const v=(function(x){return!this.isComponent(x)}).bind(o);E||(h=o.createElement(t));for(let x=0,g=s.length,b,w;x<g;x++)w=o.getRangeFormatElement(s[x],v),!(!w||!o.isList(w))&&(b?b!==w?(r&&o.isListCell(w.parentNode)?this.plugins.list._detachNested.call(this,d.f):y=this.detachRangeFormatElement(d.f[0].parentNode,d.f,h,!1,!0),w=s[x].parentNode,E||(h=o.createElement(t)),b=w,d={r:b,f:[o.getParentElement(s[x],"LI")]}):d.f.push(o.getParentElement(s[x],"LI")):(b=w,d={r:b,f:[o.getParentElement(s[x],"LI")]}),x===g-1&&(r&&o.isListCell(w.parentNode)?this.plugins.list._detachNested.call(this,d.f):y=this.detachRangeFormatElement(d.f[0].parentNode,d.f,h,!1,!0)))}else{const S=a&&a.parentNode,E=f&&f.parentNode;a=S&&!o.isWysiwygDiv(S)&&S.nodeName===t?S:a,f=E&&!o.isWysiwygDiv(E)&&E.nodeName===t?E:f;const d=a&&a.tagName===t,h=f&&f.tagName===t;let v=d?a:o.createElement(t),x=null,g=null,b=null;const w=(function(k){return!this.isComponent(k)&&!this.isList(k)}).bind(o);for(let k=0,N=s.length,T,D,I,L,R,P,O,U,H;k<N;k++){if(D=s[k],D.childNodes.length===0&&!o._isIgnoreNodeChange(D)){o.removeItem(D);continue}if(L=s[k+1],R=D.parentNode,P=L?L.parentNode:null,I=o.isListCell(D),H=o.isRangeFormatElement(R)?R:null,O=I&&!o.isWysiwygDiv(R)?R.parentNode:R,U=I&&!o.isWysiwygDiv(R)?!L||o.isListCell(O)?R:R.nextSibling:D.nextSibling,T=o.createElement("LI"),o.copyFormatAttributes(T,D),k===0&&m.sc===D&&(m.sc=T),k===N-1&&m.ec===D&&(m.ec=T),o.isComponent(D)){const B=/^HR$/i.test(D.nodeName);B||(T.innerHTML="<br>"),T.innerHTML+=D.outerHTML,B&&(T.innerHTML+="<br>")}else{const B=D.childNodes;for(;B[0];)T.appendChild(B[0])}v.appendChild(T),(!L||O!==P||o.isRangeFormatElement(U))&&(x||(x=v),(!d||!L||O!==P)&&!(L&&o.isList(P)&&P===R)&&v.parentNode!==O&&O.insertBefore(v,U)),o.removeItem(D),d&&g===null&&(g=v.children.length-1),L&&(o.getRangeFormatElement(P,w)!==o.getRangeFormatElement(R,w)||o.isList(P)&&o.isList(R)&&o.getElementDepth(P)!==o.getElementDepth(R))&&(v=o.createElement(t)),H&&H.children.length===0&&o.removeItem(H)}g&&(x=x.children[g]),h&&(b=v.children.length-1,v.innerHTML+=f.innerHTML,v.children[b],o.removeItem(f))}return this.effectNode=null,u&&y||m},_detachNested:function(t){const n=t[0],r=t[t.length-1],i=r.nextElementSibling,s=n.parentNode,o=s.parentNode.nextElementSibling,l=s.parentNode.parentNode;for(let a=0,f=t.length;a<f;a++)l.insertBefore(t[a],o);if(i&&s.children.length>0){const a=s.cloneNode(!1),f=s.childNodes,u=this.util.getPositionIndex(i);for(;f[u];)a.appendChild(f[u]);r.appendChild(a)}s.children.length===0&&this.util.removeItem(s),this.util.mergeSameTags(l);const c=this.util.getEdgeChildNodes(n,r);return{cc:n.parentNode,sc:c.sc,ec:c.ec}},editInsideList:function(t,n){n=n||this.getSelectedElements().filter((function(l){return this.isListCell(l)}).bind(this.util));const r=n.length;if(r===0||!t&&!this.util.isListCell(n[0].previousElementSibling)&&!this.util.isListCell(n[r-1].nextElementSibling))return{sc:n[0],so:0,ec:n[r-1],eo:1};let i=n[0].parentNode,s=n[r-1],o=null;if(t){if(i!==s.parentNode&&this.util.isList(s.parentNode.parentNode)&&s.nextElementSibling)for(s=s.nextElementSibling;s;)n.push(s),s=s.nextElementSibling;o=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),n,!0)}else{let l=this.util.createElement(i.nodeName),c=n[0].previousElementSibling,a=s.nextElementSibling;const f={s:null,e:null,sl:i,el:i};for(let y=0,_=r,S;y<_;y++)S=n[y],S.parentNode!==i&&(this.plugins.list._insiedList.call(this,i,l,c,a,f),i=S.parentNode,l=this.util.createElement(i.nodeName)),c=S.previousElementSibling,a=S.nextElementSibling,l.appendChild(S);this.plugins.list._insiedList.call(this,i,l,c,a,f);const u=this.util.getNodeFromPath(f.s,f.sl),m=this.util.getNodeFromPath(f.e,f.el);o={sc:u,so:0,ec:m,eo:m.textContent.length}}return o},_insiedList:function(t,n,r,i,s){let o=!1;if(r&&n.tagName===r.tagName){const l=n.children;for(;l[0];)r.appendChild(l[0]);n=r,o=!0}if(i&&n.tagName===i.tagName){const l=i.children;for(;l[0];)n.appendChild(l[0]);const c=i.nextElementSibling;i.parentNode.removeChild(i),i=c}if(!o){this.util.isListCell(r)&&(t=r,i=null),t.insertBefore(n,i),s.s||(s.s=this.util.getNodePath(n.firstElementChild.firstChild,t,null),s.sl=t);const l=t.contains(s.sl)?this.util.getNodePath(s.sl,t):null;s.e=this.util.getNodePath(n.lastElementChild.firstChild,t,null),s.el=t,this.util.mergeSameTags(t,[s.s,s.e,l],!1),this.util.mergeNestedTags(t),l&&(s.sl=this.util.getNodeFromPath(l,t))}return n},pickup:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r="";for(;!r&&!/^UL$/i.test(n.tagName);)r=n.getAttribute("data-command"),n=n.parentNode;if(!r)return;const i=this.plugins.list.editList.call(this,r,null,!1);i&&this.setRange(i.sc,i.so,i.ec,i.eo),this.submenuOff(),this.history.push(!1)}},$2={name:"table",display:"submenu",add:function(t,n){const r=t.context;let i=r.table={_element:null,_tdElement:null,_trElement:null,_trElements:null,_tableXY:[],_maxWidth:!0,_fixedColumn:!1,_rtl:t.options.rtl,cellControllerTop:t.options.tableCellControllerPosition==="top",resizeText:null,headerButton:null,mergeButton:null,splitButton:null,splitMenu:null,maxText:t.lang.controller.maxSize,minText:t.lang.controller.minSize,_physical_cellCnt:0,_logical_cellCnt:0,_rowCnt:0,_rowIndex:0,_physical_cellIndex:0,_logical_cellIndex:0,_current_colSpan:0,_current_rowSpan:0,icons:{expansion:t.icons.expansion,reduction:t.icons.reduction}},s=this.setSubmenu(t),o=s.querySelector(".se-controller-table-picker");i.tableHighlight=s.querySelector(".se-table-size-highlighted"),i.tableUnHighlight=s.querySelector(".se-table-size-unhighlighted"),i.tableDisplay=s.querySelector(".se-table-size-display"),t.options.rtl&&(i.tableHighlight.style.left=10*18-13+"px");let l=this.setController_table(t);i.tableController=l,i.resizeButton=l.querySelector("._se_table_resize"),i.resizeText=l.querySelector("._se_table_resize > span > span"),i.columnFixedButton=l.querySelector("._se_table_fixed_column"),i.headerButton=l.querySelector("._se_table_header");let c=this.setController_tableEditor(t,i.cellControllerTop);i.resizeDiv=c,i.splitMenu=c.querySelector(".se-btn-group-sub"),i.mergeButton=c.querySelector("._se_table_merge_button"),i.splitButton=c.querySelector("._se_table_split_button"),i.insertRowAboveButton=c.querySelector("._se_table_insert_row_a"),i.insertRowBelowButton=c.querySelector("._se_table_insert_row_b"),o.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(t,i)),o.addEventListener("click",this.appendTable.bind(t)),c.addEventListener("click",this.onClick_tableController.bind(t)),l.addEventListener("click",this.onClick_tableController.bind(t)),t.initMenuTarget(this.name,n,s),r.element.relative.appendChild(c),r.element.relative.appendChild(l),s=null,o=null,c=null,l=null,i=null},setSubmenu:function(t){const n=t.util.createElement("DIV");return n.className="se-submenu se-selector-table",n.innerHTML='<div class="se-table-size"><div class="se-table-size-picker se-controller-table-picker"></div><div class="se-table-size-highlighted"></div><div class="se-table-size-unhighlighted"></div></div><div class="se-table-size-display">1 x 1</div>',n},setController_table:function(t){const n=t.lang,r=t.icons,i=t.util.createElement("DIV");return i.className="se-controller se-controller-table",i.innerHTML='<div><div class="se-btn-group"><button type="button" data-command="resize" class="se-btn se-tooltip _se_table_resize">'+r.expansion+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.maxSize+'</span></span></button><button type="button" data-command="layout" class="se-btn se-tooltip _se_table_fixed_column">'+r.fixed_column_width+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.fixedColumnWidth+'</span></span></button><button type="button" data-command="header" class="se-btn se-tooltip _se_table_header">'+r.table_header+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.tableHeader+'</span></span></button><button type="button" data-command="remove" class="se-btn se-tooltip">'+r.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.remove+"</span></span></button></div></div>",i},setController_tableEditor:function(t,n){const r=t.lang,i=t.icons,s=t.util.createElement("DIV");return s.className="se-controller se-controller-table-cell",s.innerHTML=(n?"":'<div class="se-arrow se-arrow-up"></div>')+'<div class="se-btn-group"><button type="button" data-command="insert" data-value="row" data-option="up" class="se-btn se-tooltip _se_table_insert_row_a">'+i.insert_row_above+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.insertRowAbove+'</span></span></button><button type="button" data-command="insert" data-value="row" data-option="down" class="se-btn se-tooltip _se_table_insert_row_b">'+i.insert_row_below+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.insertRowBelow+'</span></span></button><button type="button" data-command="delete" data-value="row" class="se-btn se-tooltip">'+i.delete_row+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.deleteRow+'</span></span></button><button type="button" data-command="merge" class="_se_table_merge_button se-btn se-tooltip" disabled>'+i.merge_cell+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.mergeCells+'</span></span></button></div><div class="se-btn-group" style="padding-top: 0;"><button type="button" data-command="insert" data-value="cell" data-option="left" class="se-btn se-tooltip">'+i.insert_column_left+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.insertColumnBefore+'</span></span></button><button type="button" data-command="insert" data-value="cell" data-option="right" class="se-btn se-tooltip">'+i.insert_column_right+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.insertColumnAfter+'</span></span></button><button type="button" data-command="delete" data-value="cell" class="se-btn se-tooltip">'+i.delete_column+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.deleteColumn+'</span></span></button><button type="button" data-command="onsplit" class="_se_table_split_button se-btn se-tooltip">'+i.split_cell+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+r.controller.splitCells+'</span></span></button><div class="se-btn-group-sub sun-editor-common se-list-layer se-table-split"><div class="se-list-inner"><ul class="se-list-basic"><li class="se-btn-list" data-command="split" data-value="vertical" style="line-height:32px;" title="'+r.controller.VerticalSplit+'" aria-label="'+r.controller.VerticalSplit+'">'+r.controller.VerticalSplit+'</li><li class="se-btn-list" data-command="split" data-value="horizontal" style="line-height:32px;" title="'+r.controller.HorizontalSplit+'" aria-label="'+r.controller.HorizontalSplit+'">'+r.controller.HorizontalSplit+"</li></ul></div></div></div>",s},appendTable:function(){const t=this.util.createElement("TABLE"),n=this.plugins.table.createCells,r=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],s="<tbody>";for(;i>0;)s+="<tr>"+n.call(this,"td",r)+"</tr>",--i;if(s+="</tbody>",t.innerHTML=s,this.insertComponent(t,!1,!0,!1)){const l=t.querySelector("td div");this.setRange(l,0,l,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(t,n,r){if(t=t.toLowerCase(),r){const i=this.util.createElement(t);return i.innerHTML="<div><br></div>",i}else{let i="";for(;n>0;)i+="<"+t+"><div><br></div></"+t+">",n--;return i}},onMouseMove_tablePicker:function(t,n){n.stopPropagation();let r=this._w.Math.ceil(n.offsetX/18),i=this._w.Math.ceil(n.offsetY/18);r=r<1?1:r,i=i<1?1:i,t._rtl&&(t.tableHighlight.style.left=r*18-13+"px",r=11-r),t.tableHighlight.style.width=r+"em",t.tableHighlight.style.height=i+"em",this.util.changeTxt(t.tableDisplay,r+" x "+i),t._tableXY=[r,i]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const t=this.context.table.tableHighlight.style,n=this.context.table.tableUnHighlight.style;t.width="1em",t.height="1em",n.width="10em",n.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const t=this.context.table,n=this.plugins.table;if(n._removeEvents.call(this),n._selectedTable){const r=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let i=0,s=r.length;i<s;i++)this.util.removeClass(r[i],"se-table-selected-cell")}n._toggleEditor.call(this,!0),t._element=null,t._tdElement=null,t._trElement=null,t._trElements=null,t._tableXY=[],t._maxWidth=!0,t._fixedColumn=!1,t._physical_cellCnt=0,t._logical_cellCnt=0,t._rowCnt=0,t._rowIndex=0,t._physical_cellIndex=0,t._logical_cellIndex=0,t._current_colSpan=0,t._current_rowSpan=0,n._shift=!1,n._selectedCells=null,n._selectedTable=null,n._ref=null,n._fixedCell=null,n._selectedCell=null,n._fixedCellName=null},call_controller_tableEdit:function(t){const n=this.plugins.table,r=this.context.table;if(!this.getSelection().isCollapsed&&!n._selectedCell){this.controllersOff(),this.util.removeClass(t,"se-table-selected-cell");return}const i=r._element||this.plugins.table._selectedTable||this.util.getParentElement(t,"TABLE");r._maxWidth=this.util.hasClass(i,"se-table-size-100")||i.style.width==="100%"||!i.style.width&&!this.util.hasClass(i,"se-table-size-auto"),r._fixedColumn=this.util.hasClass(i,"se-table-layout-fixed")||i.style.tableLayout==="fixed",n.setTableStyle.call(this,r._maxWidth?"width|column":"width"),n.setPositionControllerTop.call(this,i),n.setPositionControllerDiv.call(this,t,n._shift),n._shift||this.controllersOn(r.resizeDiv,r.tableController,n.init.bind(this),t,"table")},setPositionControllerTop:function(t){this.setControllerPosition(this.context.table.tableController,t,"top",{left:0,top:0})},setPositionControllerDiv:function(t,n){const r=this.context.table,i=r.resizeDiv;this.plugins.table.setCellInfo.call(this,t,n),r.cellControllerTop?this.setControllerPosition(i,r._element,"top",{left:r.tableController.offsetWidth,top:0}):this.setControllerPosition(i,t,"bottom",{left:0,top:0})},setCellInfo:function(t,n){const r=this.context.table,i=r._element=this.plugins.table._selectedTable||this.util.getParentElement(t,"TABLE");if(/THEAD/i.test(i.firstElementChild.nodeName)?this.util.addClass(r.headerButton,"active"):this.util.removeClass(r.headerButton,"active"),n||r._physical_cellCnt===0){r._tdElement!==t&&(r._tdElement=t,r._trElement=t.parentNode);const s=r._trElements=i.rows,o=t.cellIndex;let l=0;for(let u=0,m=s[0].cells,y=s[0].cells.length;u<y;u++)l+=m[u].colSpan;const c=r._rowIndex=r._trElement.rowIndex;r._rowCnt=s.length,r._physical_cellCnt=r._trElement.cells.length,r._logical_cellCnt=l,r._physical_cellIndex=o,r._current_colSpan=r._tdElement.colSpan-1,r._current_rowSpan-r._trElement.cells[o].rowSpan-1;let a=[],f=[];for(let u=0,m,y;u<=c;u++){m=s[u].cells,y=0;for(let _=0,S=m.length,E,d,h,v;_<S;_++){if(E=m[_],d=E.colSpan-1,h=E.rowSpan-1,v=_+y,f.length>0)for(let x=0,g;x<f.length;x++)g=f[x],!(g.row>u)&&(v>=g.index?(y+=g.cs,v+=g.cs,g.rs-=1,g.row=u+1,g.rs<1&&(f.splice(x,1),x--)):_===S-1&&(g.rs-=1,g.row=u+1,g.rs<1&&(f.splice(x,1),x--)));if(u===c&&_===o){r._logical_cellIndex=v;break}h>0&&a.push({index:v,cs:d+1,rs:h,row:-1}),y+=d}f=f.concat(a).sort(function(_,S){return _.index-S.index}),a=[]}a=null,f=null}},editTable:function(t,n){const r=this.plugins.table,i=this.context.table,s=i._element,o=t==="row";if(o){const l=i._trElement.parentNode;if(/^THEAD$/i.test(l.nodeName)){if(n==="up")return;if(!l.nextElementSibling||!/^TBODY$/i.test(l.nextElementSibling.nodeName)){s.innerHTML+="<tbody><tr>"+r.createCells.call(this,"td",i._logical_cellCnt,!1)+"</tr></tbody>";return}}}if(r._ref){const l=i._tdElement,c=r._selectedCells;if(o)if(n)r.setCellInfo.call(this,n==="up"?c[0]:c[c.length-1],!0),r.editRow.call(this,n,l);else{let a=c[0].parentNode;const f=[c[0]];for(let u=1,m=c.length,y;u<m;u++)y=c[u],a!==y.parentNode&&(f.push(y),a=y.parentNode);for(let u=0,m=f.length;u<m;u++)r.setCellInfo.call(this,f[u],!0),r.editRow.call(this,n)}else{const a=c[0].parentNode;if(n){let f=null;for(let u=0,m=c.length-1;u<m;u++)if(a!==c[u+1].parentNode){f=c[u];break}r.setCellInfo.call(this,n==="left"?c[0]:f||c[0],!0),r.editCell.call(this,n,l)}else{const f=[c[0]];for(let u=1,m=c.length,y;u<m&&(y=c[u],a===y.parentNode);u++)f.push(y);for(let u=0,m=f.length;u<m;u++)r.setCellInfo.call(this,f[u],!0),r.editCell.call(this,n)}}n||r.init.call(this)}else r[o?"editRow":"editCell"].call(this,n);if(!n){const l=s.children;for(let c=0;c<l.length;c++)l[c].children.length===0&&(this.util.removeItem(l[c]),c--);s.children.length===0&&this.util.removeItem(s)}},editRow:function(t,n){const r=this.context.table,i=!t,s=t==="up",o=r._rowIndex,l=i||s?o:o+r._current_rowSpan+1,c=i?-1:1,a=r._trElements;let f=r._logical_cellCnt;for(let u=0,m=o+(i?-1:0),y;u<=m;u++){if(y=a[u].cells,y.length===0)return;for(let _=0,S=y.length,E,d;_<S;_++)E=y[_].rowSpan,d=y[_].colSpan,!(E<2&&d<2)&&E+u>l&&l>u&&(y[_].rowSpan=E+c,f-=d)}if(i){const u=a[o+1];if(u){const m=[];let y=a[o].cells,_=0;for(let S=0,E=y.length,d,h;S<E;S++)d=y[S],h=S+_,_+=d.colSpan-1,d.rowSpan>1&&(d.rowSpan-=1,m.push({cell:d.cloneNode(!1),index:h}));if(m.length>0){let S=m.shift();y=u.cells,_=0;for(let E=0,d=y.length,h,v;E<d&&(h=y[E],v=E+_,_+=h.colSpan-1,!(v>=S.index&&(E--,_--,_+=S.cell.colSpan-1,u.insertBefore(S.cell,h),S=m.shift(),!S)));E++);if(S){u.appendChild(S.cell);for(let E=0,d=m.length;E<d;E++)u.appendChild(m[E].cell)}}}r._element.deleteRow(l)}else{const u=r._element.insertRow(l);u.innerHTML=this.plugins.table.createCells.call(this,"td",f,!1)}i?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,n||r._tdElement,!0)},editCell:function(t,n){const r=this.context.table,i=this.util,s=!t,o=t==="left",l=r._current_colSpan,c=s||o?r._logical_cellIndex:r._logical_cellIndex+l+1,a=r._trElements;let f=[],u=[],m=0;const y=[],_=[];for(let S=0,E=r._rowCnt,d,h,v,x,g,b;S<E;S++){d=a[S],h=c,g=!1,v=d.cells,b=0;for(let w=0,k,N=v.length,T,D,I;w<N&&(k=v[w],!!k);w++)if(T=k.rowSpan-1,D=k.colSpan-1,s){if(I=w+b,u.length>0){const L=!v[w+1];for(let R=0,P;R<u.length;R++)P=u[R],!(P.row>S)&&(I>=P.index?(b+=P.cs,I=w+b,P.rs-=1,P.row=S+1,P.rs<1&&(u.splice(R,1),R--)):L&&(P.rs-=1,P.row=S+1,P.rs<1&&(u.splice(R,1),R--)))}T>0&&f.push({rs:T,cs:D+1,index:I,row:-1}),I>=h&&I+D<=h+l?y.push(k):I<=h+l&&I+D>=h?k.colSpan-=i.getOverlapRangeAtIndex(c,c+l,I,I+D):T>0&&(I<h||I+D>h+l)&&_.push({cell:k,i:S,rs:S+T}),b+=D}else{if(w>=h)break;if(D>0){if(m<1&&D+w>=h){k.colSpan+=1,h=null,m=T+1;break}h-=D}if(!g){for(let L=0,R;L<u.length;L++)R=u[L],h-=R.cs,R.rs-=1,R.rs<1&&(u.splice(L,1),L--);g=!0}}if(u=u.concat(f).sort(function(w,k){return w.index-k.index}),f=[],!s){if(m>0){m-=1;continue}h!==null&&v.length>0&&(x=this.plugins.table.createCells.call(this,v[0].nodeName,0,!0),x=d.insertBefore(x,v[h]))}}if(s){let S,E;for(let d=0,h=y.length,v;d<h;d++)v=y[d].parentNode,i.removeItem(y[d]),v.cells.length===0&&(S||(S=i.getArrayIndex(a,v)),E=i.getArrayIndex(a,v),i.removeItem(v));for(let d=0,h=_.length,v;d<h;d++)v=_[d],v.cell.rowSpan=i.getOverlapRangeAtIndex(S,E,v.i,v.rs);this.controllersOff()}else this.plugins.table.setPositionControllerDiv.call(this,n||r._tdElement,!0)},_closeSplitMenu:null,openSplitMenu:function(){this.util.addClass(this.context.table.splitButton,"on"),this.context.table.splitMenu.style.display="inline-table",this.plugins.table._closeSplitMenu=(function(){this.util.removeClass(this.context.table.splitButton,"on"),this.context.table.splitMenu.style.display="none",this.removeDocEvent("click",this.plugins.table._closeSplitMenu),this.plugins.table._closeSplitMenu=null}).bind(this),this.addDocEvent("click",this.plugins.table._closeSplitMenu)},splitCells:function(t){const n=this.util,r=t==="vertical",i=this.context.table,s=i._tdElement,o=i._trElements,l=i._trElement,c=i._logical_cellIndex,a=i._rowIndex,f=this.plugins.table.createCells.call(this,s.nodeName,0,!0);if(r){const u=s.colSpan;if(f.rowSpan=s.rowSpan,u>1)f.colSpan=this._w.Math.floor(u/2),s.colSpan=u-f.colSpan,l.insertBefore(f,s.nextElementSibling);else{let m=[],y=[];for(let _=0,S=i._rowCnt,E,d;_<S;_++){E=o[_].cells,d=0;for(let h=0,v=E.length,x,g,b,w;h<v;h++){if(x=E[h],g=x.colSpan-1,b=x.rowSpan-1,w=h+d,y.length>0)for(let k=0,N;k<y.length;k++)N=y[k],!(N.row>_)&&(w>=N.index?(d+=N.cs,w+=N.cs,N.rs-=1,N.row=_+1,N.rs<1&&(y.splice(k,1),k--)):h===v-1&&(N.rs-=1,N.row=_+1,N.rs<1&&(y.splice(k,1),k--)));if(w<=c&&b>0&&m.push({index:w,cs:g+1,rs:b,row:-1}),x!==s&&w<=c&&w+g>=c+u-1){x.colSpan+=1;break}if(w>c)break;d+=g}y=y.concat(m).sort(function(h,v){return h.index-v.index}),m=[]}l.insertBefore(f,s.nextElementSibling)}}else{const u=s.rowSpan;if(f.colSpan=s.colSpan,u>1){f.rowSpan=this._w.Math.floor(u/2);const m=u-f.rowSpan,y=[],_=n.getArrayIndex(o,l)+m;for(let h=0,v,x;h<_;h++){v=o[h].cells,x=0;for(let g=0,b=v.length,w,k,N;g<b&&(N=g+x,!(N>=c));g++)w=v[g],k=w.rowSpan-1,k>0&&k+h>=_&&N<c&&y.push({index:N,cs:w.colSpan}),x+=w.colSpan-1}const S=o[_],E=S.cells;let d=y.shift();for(let h=0,v=E.length,x=0,g,b,w,k;h<v;h++){if(w=h+x,g=E[h],b=g.colSpan-1,k=w+b+1,d&&k>=d.index&&(x+=d.cs,k+=d.cs,d=y.shift()),k>=c||h===v-1){S.insertBefore(f,g.nextElementSibling);break}x+=b}s.rowSpan=m}else{f.rowSpan=s.rowSpan;const m=n.createElement("TR");m.appendChild(f);for(let S=0,E;S<a;S++){if(E=o[S].cells,E.length===0)return;for(let d=0,h=E.length;d<h;d++)S+E[d].rowSpan-1>=a&&(E[d].rowSpan+=1)}const y=i._physical_cellIndex,_=l.cells;for(let S=0,E=_.length;S<E;S++)S!==y&&(_[S].rowSpan+=1);l.parentNode.insertBefore(m,l.nextElementSibling)}}this.focusEdge(s),this.plugins.table.setPositionControllerDiv.call(this,s,!0)},mergeCells:function(){const t=this.plugins.table,n=this.context.table,r=this.util,i=t._ref,s=t._selectedCells,o=s[0];let l=null,c=null,a=i.ce-i.cs+1,f=i.re-i.rs+1,u="",m=null;for(let y=1,_=s.length,S,E;y<_;y++){S=s[y],m!==S.parentNode&&(m=S.parentNode),E=S.children;for(let d=0,h=E.length;d<h;d++)r.isFormatElement(E[d])&&r.onlyZeroWidthSpace(E[d].textContent)&&r.removeItem(E[d]);u+=S.innerHTML,r.removeItem(S),m.cells.length===0&&(l?c=m:l=m,f-=1)}if(l){const y=n._trElements,_=r.getArrayIndex(y,l),S=r.getArrayIndex(y,c||l),E=[];for(let d=0,h;d<=S;d++){if(h=y[d].cells,h.length===0){E.push(y[d]);continue}for(let v=0,x=h.length,g,b;v<x;v++)g=h[v],b=g.rowSpan-1,b>0&&d+b>=_&&(g.rowSpan-=r.getOverlapRangeAtIndex(_,S,d,d+b))}for(let d=0,h=E.length;d<h;d++)r.removeItem(E[d])}o.innerHTML+=u,o.colSpan=a,o.rowSpan=f,this.controllersOff(),t.setActiveButton.call(this,!0,!1),t.call_controller_tableEdit.call(this,o),r.addClass(o,"se-table-selected-cell"),this.focusEdge(o)},toggleHeader:function(){const t=this.util,n=this.context.table.headerButton,r=t.hasClass(n,"active"),i=this.context.table._element;if(r)t.removeItem(i.querySelector("thead"));else{const s=t.createElement("THEAD");s.innerHTML="<tr>"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"</tr>",i.insertBefore(s,i.firstElementChild)}t.toggleClass(n,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(t){const n=this.context.table,r=n._element;let i,s,o,l;t.indexOf("width")>-1&&(i=n.resizeButton.firstElementChild,s=n.resizeText,n._maxWidth?(o=n.icons.reduction,l=n.minText,n.columnFixedButton.style.display="block",this.util.removeClass(r,"se-table-size-auto"),this.util.addClass(r,"se-table-size-100")):(o=n.icons.expansion,l=n.maxText,n.columnFixedButton.style.display="none",this.util.removeClass(r,"se-table-size-100"),this.util.addClass(r,"se-table-size-auto")),this.util.changeElement(i,o),this.util.changeTxt(s,l)),t.indexOf("column")>-1&&(n._fixedColumn?(this.util.removeClass(r,"se-table-layout-auto"),this.util.addClass(r,"se-table-layout-fixed"),this.util.addClass(n.columnFixedButton,"active")):(this.util.removeClass(r,"se-table-layout-fixed"),this.util.addClass(r,"se-table-layout-auto"),this.util.removeClass(n.columnFixedButton,"active")))},setActiveButton:function(t,n){const r=this.context.table;/^TH$/i.test(t.nodeName)?(r.insertRowAboveButton.setAttribute("disabled",!0),r.insertRowBelowButton.setAttribute("disabled",!0)):(r.insertRowAboveButton.removeAttribute("disabled"),r.insertRowBelowButton.removeAttribute("disabled")),!n||t===n?(r.splitButton.removeAttribute("disabled"),r.mergeButton.setAttribute("disabled",!0)):(r.splitButton.setAttribute("disabled",!0),r.mergeButton.removeAttribute("disabled"))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(t){this.context.element.wysiwyg.setAttribute("contenteditable",t),t?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(t){t.stopPropagation();const n=this.plugins.table;n._shift?n._initBind&&(this._wd.removeEventListener("touchmove",n._initBind),n._initBind=null):(n._removeEvents.call(this),n._toggleEditor.call(this,!0)),!(!n._fixedCell||!n._selectedTable)&&(n.setActiveButton.call(this,n._fixedCell,n._selectedCell),n.call_controller_tableEdit.call(this,n._selectedCell||n._fixedCell),n._selectedCells=n._selectedTable.querySelectorAll(".se-table-selected-cell"),n._selectedCell&&n._fixedCell&&this.focusEdge(n._selectedCell),n._shift||(n._fixedCell=null,n._selectedCell=null,n._fixedCellName=null))},_onCellMultiSelect:function(t){this._antiBlur=!0;const n=this.plugins.table,r=this.util.getParentElement(t.target,this.util.isCell);if(n._shift)r===n._fixedCell?n._toggleEditor.call(this,!0):n._toggleEditor.call(this,!1);else if(!n._ref){if(r===n._fixedCell)return;n._toggleEditor.call(this,!1)}!r||r===n._selectedCell||n._fixedCellName!==r.nodeName||n._selectedTable!==this.util.getParentElement(r,"TABLE")||(n._selectedCell=r,n._setMultiCells.call(this,n._fixedCell,r))},_setMultiCells:function(t,n){const r=this.plugins.table,i=r._selectedTable.rows,s=this.util,o=r._selectedTable.querySelectorAll(".se-table-selected-cell");for(let u=0,m=o.length;u<m;u++)s.removeClass(o[u],"se-table-selected-cell");if(t===n&&(s.addClass(t,"se-table-selected-cell"),!r._shift))return;let l=!0,c=[],a=[];const f=r._ref={_i:0,cs:null,ce:null,rs:null,re:null};for(let u=0,m=i.length,y,_;u<m;u++){y=i[u].cells,_=0;for(let S=0,E=y.length,d,h,v,x;S<E;S++){if(d=y[S],v=d.colSpan-1,x=d.rowSpan-1,h=S+_,c.length>0)for(let g=0,b;g<c.length;g++)b=c[g],!(b.row>u)&&(h>=b.index?(_+=b.cs,h+=b.cs,b.rs-=1,b.row=u+1,b.rs<1&&(c.splice(g,1),g--)):S===E-1&&(b.rs-=1,b.row=u+1,b.rs<1&&(c.splice(g,1),g--)));if(l){if((d===t||d===n)&&(f.cs=f.cs!==null&&f.cs<h?f.cs:h,f.ce=f.ce!==null&&f.ce>h+v?f.ce:h+v,f.rs=f.rs!==null&&f.rs<u?f.rs:u,f.re=f.re!==null&&f.re>u+x?f.re:u+x,f._i+=1),f._i===2){l=!1,c=[],a=[],u=-1;break}}else if(s.getOverlapRangeAtIndex(f.cs,f.ce,h,h+v)&&s.getOverlapRangeAtIndex(f.rs,f.re,u,u+x)){const g=f.cs<h?f.cs:h,b=f.ce>h+v?f.ce:h+v,w=f.rs<u?f.rs:u,k=f.re>u+x?f.re:u+x;if(f.cs!==g||f.ce!==b||f.rs!==w||f.re!==k){f.cs=g,f.ce=b,f.rs=w,f.re=k,u=-1,c=[],a=[];break}s.addClass(d,"se-table-selected-cell")}x>0&&a.push({index:h,cs:v+1,rs:x,row:-1}),_+=d.colSpan-1}c=c.concat(a).sort(function(S,E){return S.index-E.index}),a=[]}},_removeEvents:function(){const t=this.plugins.table;t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null),t._bindOnSelect&&(this._wd.removeEventListener("mousedown",t._bindOnSelect),this._wd.removeEventListener("mousemove",t._bindOnSelect),t._bindOnSelect=null),t._bindOffSelect&&(this._wd.removeEventListener("mouseup",t._bindOffSelect),t._bindOffSelect=null),t._bindOffShift&&(this._wd.removeEventListener("keyup",t._bindOffShift),t._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(t,n){const r=this.plugins.table;r._removeEvents.call(this),this.controllersOff(),r._shift=n,r._fixedCell=t,r._fixedCellName=t.nodeName,r._selectedTable=this.util.getParentElement(t,"TABLE");const i=r._selectedTable.querySelectorAll(".se-table-selected-cell");for(let s=0,o=i.length;s<o;s++)this.util.removeClass(i[s],"se-table-selected-cell");this.util.addClass(t,"se-table-selected-cell"),r._bindOnSelect=r._onCellMultiSelect.bind(this),r._bindOffSelect=r._offCellMultiSelect.bind(this),n?(r._bindOffShift=(function(){this.controllersOn(this.context.table.resizeDiv,this.context.table.tableController,this.plugins.table.init.bind(this),t,"table"),r._ref||this.controllersOff()}).bind(this),this._wd.addEventListener("keyup",r._bindOffShift,!1),this._wd.addEventListener("mousedown",r._bindOnSelect,!1)):this._wd.addEventListener("mousemove",r._bindOnSelect,!1),this._wd.addEventListener("mouseup",r._bindOffSelect,!1),r._initBind=r.init.bind(this),this._wd.addEventListener("touchmove",r._initBind,!1)},onClick_tableController:function(t){t.stopPropagation();const n=t.target.getAttribute("data-command")?t.target:t.target.parentNode;if(n.getAttribute("disabled"))return;const r=n.getAttribute("data-command"),i=n.getAttribute("data-value"),s=n.getAttribute("data-option"),o=this.plugins.table;if(typeof o._closeSplitMenu=="function"&&(o._closeSplitMenu(),r==="onsplit")||!r)return;t.preventDefault();const l=this.context.table;switch(r){case"insert":case"delete":o.editTable.call(this,i,s);break;case"header":o.toggleHeader.call(this);break;case"onsplit":o.openSplitMenu.call(this);break;case"split":o.splitCells.call(this,i);break;case"merge":o.mergeCells.call(this);break;case"resize":l._maxWidth=!l._maxWidth,o.setTableStyle.call(this,"width"),o.setPositionControllerTop.call(this,l._element),o.setPositionControllerDiv.call(this,l._tdElement,o._shift);break;case"layout":l._fixedColumn=!l._fixedColumn,o.setTableStyle.call(this,"column"),o.setPositionControllerTop.call(this,l._element),o.setPositionControllerDiv.call(this,l._tdElement,o._shift);break;case"remove":const c=l._element.parentNode;this.util.removeItem(l._element),this.controllersOff(),c!==this.context.element.wysiwyg&&this.util.removeItemAllParents(c,function(a){return a.childNodes.length===0},null),this.focus()}this.history.push(!1)}},V2={name:"formatBlock",display:"submenu",add:function(t,n){const r=t.context;r.formatBlock={targetText:n.querySelector(".txt"),targetTooltip:n.parentNode.querySelector(".se-tooltip-text"),_formatList:null,currentFormat:""};let i=this.setSubmenu(t);i.querySelector("ul").addEventListener("click",this.pickUp.bind(t)),r.formatBlock._formatList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.options,r=t.lang.toolbar,i=t.util.createElement("DIV");i.className="se-submenu se-list-layer se-list-format";const s=["p","div","blockquote","pre","h1","h2","h3","h4","h5","h6"],o=!n.formats||n.formats.length===0?s:n.formats;let l='<div class="se-list-inner"><ul class="se-list-basic">';for(let c=0,a=o.length,f,u,m,y,_,S,E;c<a;c++)f=o[c],typeof f=="string"&&s.indexOf(f)>-1?(u=f.toLowerCase(),m=u==="blockquote"?"range":u==="pre"?"free":"replace",_=/^h/.test(u)?u.match(/\d+/)[0]:"",y=r["tag_"+(_?"h":u)]+_,E="",S=""):(u=f.tag.toLowerCase(),m=f.command,y=f.name||u,E=f.class,S=E?' class="'+E+'"':""),l+='<li><button type="button" class="se-btn-list" data-command="'+m+'" data-value="'+u+'" data-class="'+E+'" title="'+y+'" aria-label="'+y+'"><'+u+S+">"+y+"</"+u+"></button></li>";return l+="</ul></div>",i.innerHTML=l,i},active:function(t){let n=this.lang.toolbar.formats;const r=this.context.formatBlock.targetText;if(!t)this.util.changeTxt(r,n);else if(this.util.isFormatElement(t)){const s=this.context.formatBlock._formatList,o=t.nodeName.toLowerCase(),l=(t.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let c=0,a=s.length,f;c<a;c++)if(f=s[c],o===f.getAttribute("data-value")&&l===f.getAttribute("data-class")){n=f.title;break}return this.util.changeTxt(r,n),r.setAttribute("data-value",o),r.setAttribute("data-class",l),!0}return!1},on:function(){const t=this.context.formatBlock,n=t._formatList,r=t.targetText,i=(r.getAttribute("data-value")||"")+(r.getAttribute("data-class")||"");if(i!==t.currentFormat){for(let s=0,o=n.length,l;s<o;s++)l=n[s],i===l.getAttribute("data-value")+l.getAttribute("data-class")?this.util.addClass(l,"active"):this.util.removeClass(l,"active");t.currentFormat=i}},pickUp:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=null,i=null,s=null,o="";for(;!r&&!/UL/i.test(n.tagName);){if(r=n.getAttribute("data-command"),i=n.getAttribute("data-value"),o=n.getAttribute("data-class"),r){s=n.firstChild;break}n=n.parentNode}if(r){if(r==="range"){const l=s.cloneNode(!1);this.applyRangeFormatElement(l)}else{let l=this.getRange(),c=this.getSelectedElementsAndComponents(!1);if(c.length===0&&(l=this.getRange_addLine(l,null),c=this.getSelectedElementsAndComponents(!1),c.length===0))return;const a=l.startOffset,f=l.endOffset,u=this.util;let m=c[0],y=c[c.length-1];const _=u.getNodePath(l.startContainer,m,null,null),S=u.getNodePath(l.endContainer,y,null,null),E=this.detachList(c,!1);E.sc&&(m=E.sc),E.ec&&(y=E.ec),this.setRange(u.getNodeFromPath(_,m),a,u.getNodeFromPath(S,y),f);const d=this.getSelectedElementsAndComponents(!1);if(r==="free"){const h=d.length-1;let v=d[h].parentNode,x=s.cloneNode(!1);const g=x;for(let b=h,w,k,N,T,D,I,L=!0;b>=0;b--)if(w=d[b],w!==(d[b+1]?d[b+1].parentNode:null)){if(I=u.isComponent(w),k=I?"":w.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),N=u.getParentElement(w,function(R){return R.parentNode===v}),(v!==w.parentNode||I)&&(u.isFormatElement(v)?(v.parentNode.insertBefore(x,v.nextSibling),v=v.parentNode):(v.insertBefore(x,N?N.nextSibling:null),v=w.parentNode),T=x.nextSibling,T&&x.nodeName===T.nodeName&&u.isSameAttributes(x,T)&&(x.innerHTML+="<BR>"+T.innerHTML,u.removeItem(T)),x=s.cloneNode(!1),L=!0),D=x.innerHTML,x.innerHTML=(L||!k||!D||/<br>$/i.test(k)?k:k+"<BR>")+D,b===0){v.insertBefore(x,w),T=w.nextSibling,T&&x.nodeName===T.nodeName&&u.isSameAttributes(x,T)&&(x.innerHTML+="<BR>"+T.innerHTML,u.removeItem(T));const R=x.previousSibling;R&&x.nodeName===R.nodeName&&u.isSameAttributes(x,R)&&(R.innerHTML+="<BR>"+x.innerHTML,u.removeItem(x))}I||u.removeItem(w),k&&(L=!1)}this.setRange(g,0,g,0)}else{for(let h=0,v=d.length,x,g;h<v;h++)x=d[h],(x.nodeName.toLowerCase()!==i.toLowerCase()||(x.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()!==o)&&!u.isComponent(x)&&(g=s.cloneNode(!1),u.copyFormatAttributes(g,x),g.innerHTML=x.innerHTML,x.parentNode.replaceChild(g,x)),h===0&&(m=g||x),h===v-1&&(y=g||x),g=null;this.setRange(u.getNodeFromPath(_,m),a,u.getNodeFromPath(S,y),f)}this.history.push(!1)}this.submenuOff()}}},W2={name:"lineHeight",display:"submenu",add:function(t,n){const r=t.context;r.lineHeight={_sizeList:null,currentSize:-1};let i=this.setSubmenu(t),s=i.querySelector("ul");s.addEventListener("click",this.pickup.bind(t)),r.lineHeight._sizeList=s.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null,s=null},setSubmenu:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-submenu se-list-layer";const s=n.lineHeights?n.lineHeights:[{text:"1",value:1},{text:"1.15",value:1.15},{text:"1.5",value:1.5},{text:"2",value:2}];let o='<div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="default_value se-btn-list" title="'+r.toolbar.default+'" aria-label="'+r.toolbar.default+'">('+r.toolbar.default+")</button></li>";for(let l=0,c=s.length,a;l<c;l++)a=s[l],o+='<li><button type="button" class="se-btn-list" data-value="'+a.value+'" title="'+a.text+'" aria-label="'+a.text+'">'+a.text+"</button></li>";return o+="</ul></div>",i.innerHTML=o,i},on:function(){const t=this.context.lineHeight,n=t._sizeList,r=this.util.getFormatElement(this.getSelectionNode()),i=r?r.style.lineHeight+"":"";if(i!==t.currentSize){for(let s=0,o=n.length;s<o;s++)i===n[s].getAttribute("data-value")?this.util.addClass(n[s],"active"):this.util.removeClass(n[s],"active");t.currentSize=i}},pickup:function(t){if(!/^BUTTON$/i.test(t.target.tagName))return!1;t.preventDefault(),t.stopPropagation();const n=t.target.getAttribute("data-value")||"",r=this.getSelectedElements();for(let i=0,s=r.length;i<s;i++)r[i].style.lineHeight=n;this.submenuOff(),this.history.push(!1)}},U2={name:"template",display:"submenu",add:function(t,n){const r=t.context;r.template={selectedIndex:-1};let i=this.setSubmenu(t);i.querySelector("ul").addEventListener("click",this.pickup.bind(t)),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.options.templates;if(!n||n.length===0)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const r=t.util.createElement("DIV");r.className="se-list-layer";let i='<div class="se-submenu se-list-inner"><ul class="se-list-basic">';for(let s=0,o=n.length,l;s<o;s++)l=n[s],i+='<li><button type="button" class="se-btn-list" data-value="'+s+'" title="'+l.name+'" aria-label="'+l.name+'">'+l.name+"</button></li>";return i+="</ul></div>",r.innerHTML=i,r},pickup:function(t){if(!/^BUTTON$/i.test(t.target.tagName))return!1;t.preventDefault(),t.stopPropagation(),this.context.template.selectedIndex=t.target.getAttribute("data-value")*1;const n=this.options.templates[this.context.template.selectedIndex];if(n.html)this.setContents(n.html);else throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.submenuOff()}},q2={name:"paragraphStyle",display:"submenu",add:function(t,n){const r=t.context;r.paragraphStyle={_classList:null};let i=this.setSubmenu(t);i.querySelector("ul").addEventListener("click",this.pickUp.bind(t)),r.paragraphStyle._classList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null},setSubmenu:function(t){const n=t.options,r=t.util.createElement("DIV");r.className="se-submenu se-list-layer se-list-format";const i=t.lang.menu,s={spaced:{name:i.spaced,class:"__se__p-spaced",_class:""},bordered:{name:i.bordered,class:"__se__p-bordered",_class:""},neon:{name:i.neon,class:"__se__p-neon",_class:""}},o=!n.paragraphStyles||n.paragraphStyles.length===0?["spaced","bordered","neon"]:n.paragraphStyles;let l='<div class="se-list-inner"><ul class="se-list-basic">';for(let c=0,a=o.length,f,u,m,y;c<a;c++){if(f=o[c],typeof f=="string"){const _=s[f.toLowerCase()];if(!_)continue;f=_}u=f.name,m=f.class?' class="'+f.class+'"':"",y=f._class,l+='<li><button type="button" class="se-btn-list'+(y?" "+y:"")+'" data-value="'+f.class+'" title="'+u+'" aria-label="'+u+'"><div'+m+">"+u+"</div></button></li>"}return l+="</ul></div>",r.innerHTML=l,r},on:function(){const n=this.context.paragraphStyle._classList,r=this.util.getFormatElement(this.getSelectionNode());for(let i=0,s=n.length;i<s;i++)this.util.hasClass(r,n[i].getAttribute("data-value"))?this.util.addClass(n[i],"active"):this.util.removeClass(n[i],"active")},pickUp:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=null;for(;!/^UL$/i.test(n.tagName)&&(r=n.getAttribute("data-value"),!r);)n=n.parentNode;if(!r)return;let i=this.getSelectedElements();if(i.length===0&&(this.getRange_addLine(this.getRange(),null),i=this.getSelectedElements(),i.length===0))return;const s=this.util.hasClass(n,"active")?this.util.removeClass.bind(this.util):this.util.addClass.bind(this.util);for(let o=0,l=i.length;o<l;o++)s(i[o],r);this.submenuOff(),this.history.push(!1)}},Y2={name:"textStyle",display:"submenu",add:function(t,n){const r=t.context;r.textStyle={_styleList:null};let i=this.setSubmenu(t),s=i.querySelector("ul");s.addEventListener("click",this.pickup.bind(t)),r.textStyle._styleList=i.querySelectorAll("li button"),t.initMenuTarget(this.name,n,i),i=null,s=null},setSubmenu:function(t){const n=t.options,r=t.util.createElement("DIV");r.className="se-submenu se-list-layer se-list-format";const i={code:{name:t.lang.menu.code,class:"__se__t-code",tag:"code"},translucent:{name:t.lang.menu.translucent,style:"opacity: 0.5;",tag:"span"},shadow:{name:t.lang.menu.shadow,class:"__se__t-shadow",tag:"span"}},s=n.textStyles?n.textStyles:t._w.Object.keys(i);let o='<div class="se-list-inner"><ul class="se-list-basic">';for(let l=0,c=s.length,a,f,u,m,y,_,S;l<c;l++){if(a=s[l],m="",_="",y=[],typeof a=="string"){const E=i[a.toLowerCase()];if(!E)continue;a=E}u=a.name,f=a.tag||"span",S=a._class,a.style&&(m+=' style="'+a.style+'"',_+=a.style.replace(/:[^;]+(;|$)\s*/g,","),y.push("style")),a.class&&(m+=' class="'+a.class+'"',_+="."+a.class.trim().replace(/\s+/g,",."),y.push("class")),_=_.replace(/,$/,""),o+='<li><button type="button" class="se-btn-list'+(S?" "+S:"")+'" data-command="'+f+'" data-value="'+_+'" title="'+u+'" aria-label="'+u+'"><'+f+m+">"+u+"</"+f+"></button></li>"}return o+="</ul></div>",r.innerHTML=o,r},on:function(){const t=this.util,r=this.context.textStyle._styleList,i=this.getSelectionNode();for(let s=0,o=r.length,l,c,a;s<o;s++){l=r[s],c=l.getAttribute("data-value").split(",");for(let f=0,u,m;f<c.length;f++){for(u=i,a=!1;u&&!t.isFormatElement(u)&&!t.isComponent(u);){if(u.nodeName.toLowerCase()===l.getAttribute("data-command").toLowerCase()&&(m=c[f],/^\./.test(m)?t.hasClass(u,m.replace(/^\./,"")):u.style[m])){a=!0;break}u=u.parentNode}if(!a)break}a?t.addClass(l,"active"):t.removeClass(l,"active")}},pickup:function(t){t.preventDefault(),t.stopPropagation();let n=t.target,r=null,i=null;for(;!r&&!/UL/i.test(n.tagName);){if(r=n.getAttribute("data-command"),r){i=n.firstChild;break}n=n.parentNode}if(!r)return;const s=i.style.cssText.replace(/:.+(;|$)/g,",").split(",");s.pop();const o=i.classList;for(let a=0,f=o.length;a<f;a++)s.push("."+o[a]);const l=this.util.hasClass(n,"active")?null:i.cloneNode(!1),c=l?null:[i.nodeName];this.nodeChange(l,s,c,!0),this.submenuOff()}};var G2={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"dialog",add:function(s){const o=s.context;o.dialog={kind:"",updateModal:!1,_closeSignal:!1};let l=s.util.createElement("DIV");l.className="se-dialog sun-editor-common";let c=s.util.createElement("DIV");c.className="se-dialog-back",c.style.display="none";let a=s.util.createElement("DIV");a.className="se-dialog-inner",a.style.display="none",l.appendChild(c),l.appendChild(a),o.dialog.modalArea=l,o.dialog.back=c,o.dialog.modal=a,o.dialog.modal.addEventListener("mousedown",this._onMouseDown_dialog.bind(s)),o.dialog.modal.addEventListener("click",this._onClick_dialog.bind(s)),o.element.relative.appendChild(l),l=null,c=null,a=null},_onMouseDown_dialog:function(s){/se-dialog-inner/.test(s.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},_onClick_dialog:function(s){(/close/.test(s.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(s,o){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=(function(c){/27/.test(c.keyCode)&&this.plugins.dialog.close.call(this)}).bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=o,this.options.popupDisplay==="full"?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=s,this.modalForm=this.context[s].modal;const l=this.context[s].focusElement;typeof this.plugins[s].on=="function"&&this.plugins[s].on.call(this,o),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",l&&l.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const s=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,typeof this.plugins[s].init=="function"&&this.plugins[s].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"dialog",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(G2);var KE=G2.exports;const go=Di(KE),QE={name:"selectMenu",add:function(t){t.context.selectMenu={caller:{},callerContext:null}},setForm:function(){return'<div class="se-select-list"></div>'},createList:function(t,n,r){t.form.innerHTML="<ul>"+r+"</ul>",t.items=n,t.menus=t.form.querySelectorAll("li")},initEvent:function(t,n){const r=n.querySelector(".se-select-list"),i=this.context.selectMenu.caller[t]={form:r,items:[],menus:[],index:-1,item:null,clickMethod:null,callerName:t};r.addEventListener("mousedown",this.plugins.selectMenu.onMousedown_list),r.addEventListener("mousemove",this.plugins.selectMenu.onMouseMove_list.bind(this,i)),r.addEventListener("click",this.plugins.selectMenu.onClick_list.bind(this,i))},onMousedown_list:function(t){t.preventDefault(),t.stopPropagation()},onMouseMove_list:function(t,n){this.util.addClass(t.form,"__se_select-menu-mouse-move");const r=n.target.getAttribute("data-index");r&&(t.index=r*1)},onClick_list:function(t,n){const r=n.target.getAttribute("data-index");r&&t.clickMethod.call(this,t.items[r])},moveItem:function(t,n){this.util.removeClass(t.form,"__se_select-menu-mouse-move"),n=t.index+n;const r=t.menus,i=r.length,s=t.index=n>=i?0:n<0?i-1:n;for(let o=0;o<i;o++)o===s?this.util.addClass(r[o],"active"):this.util.removeClass(r[o],"active");t.item=t.items[s]},getItem:function(t,n){return n=!n||n<0?t.index:n,t.items[n]},on:function(t,n){const r=this.context.selectMenu.caller[t];this.context.selectMenu.callerContext=r,r.clickMethod=n,r.callerName=t},open:function(t,n){const r=t.form;r.style.visibility="hidden",r.style.display="block",n(r),r.style.visibility=""},close:function(t){t.form.style.display="none",t.items=[],t.menus=[],t.index=-1,t.item=null},init:function(t){t&&(t.items=[],t.menus=[],t.index=-1,t.item=null,t.callerName="",this.context.selectMenu.callerContext=null)}},Z2={name:"anchor",add:function(t){t.addModule([QE]),t.context.anchor={caller:{},forms:this.setDialogForm(t),host:(t._w.location.origin+t._w.location.pathname).replace(/\/$/,""),callerContext:null}},setDialogForm:function(t){const n=t.lang,r=t.options.linkRel,i=(t.options.linkRelDefault.default||"").split(" "),s=t.icons,o=t.util.createElement("DIV");let l='<div class="se-dialog-body"><div class="se-dialog-form"><label>'+n.dialogBox.linkBox.url+'</label><div class="se-dialog-form-files"><input class="se-input-form se-input-url" type="text" placeholder="'+(t.options.protocol||"")+'" /><button type="button" class="se-btn se-dialog-files-edge-button _se_bookmark_button" title="'+n.dialogBox.linkBox.bookmark+'" aria-label="'+n.dialogBox.linkBox.bookmark+'">'+s.bookmark+"</button>"+t.plugins.selectMenu.setForm()+'</div><div class="se-anchor-preview-form"><span class="se-svg se-anchor-preview-icon _se_anchor_bookmark_icon">'+s.bookmark+'</span><span class="se-svg se-anchor-preview-icon _se_anchor_download_icon">'+s.download+'</span><pre class="se-link-preview"></pre></div></div><div class="se-dialog-form"><label>'+n.dialogBox.linkBox.text+'</label><input class="se-input-form _se_anchor_text" type="text" /></div><div class="se-dialog-form-footer"><label><input type="checkbox" class="se-dialog-btn-check _se_anchor_check" /> '+n.dialogBox.linkBox.newWindowCheck+'</label><label><input type="checkbox" class="se-dialog-btn-check _se_anchor_download" /> '+n.dialogBox.linkBox.downloadLinkCheck+"</label>";if(r.length>0){l+='<div class="se-anchor-rel"><button type="button" class="se-btn se-btn-select se-anchor-rel-btn"><rel></button><div class="se-anchor-rel-wrapper"><pre class="se-link-preview se-anchor-rel-preview"></pre></div><div class="se-list-layer"><div class="se-list-inner"><ul class="se-list-basic se-list-checked">';for(let c=0,a=r.length,f;c<a;c++)f=r[c],l+='<li><button type="button" class="se-btn-list'+(i.indexOf(f)>-1?" se-checked":"")+'" data-command="'+f+'" title="'+f+'" aria-label="'+f+'"><span class="se-svg">'+s.checked+"</span>"+f+"</button></li>";l+="</ul></div></div></div>"}return l+="</div></div>",o.innerHTML=l,o},initEvent:function(t,n){const r=this.plugins.anchor,i=this.context.anchor.caller[t]={modal:n,urlInput:null,linkDefaultRel:this.options.linkRelDefault,defaultRel:this.options.linkRelDefault.default||"",currentRel:[],linkAnchor:null,linkValue:"",_change:!1,callerName:t};typeof i.linkDefaultRel.default=="string"&&(i.linkDefaultRel.default=i.linkDefaultRel.default.trim()),typeof i.linkDefaultRel.check_new_window=="string"&&(i.linkDefaultRel.check_new_window=i.linkDefaultRel.check_new_window.trim()),typeof i.linkDefaultRel.check_bookmark=="string"&&(i.linkDefaultRel.check_bookmark=i.linkDefaultRel.check_bookmark.trim()),i.urlInput=n.querySelector(".se-input-url"),i.anchorText=n.querySelector("._se_anchor_text"),i.newWindowCheck=n.querySelector("._se_anchor_check"),i.downloadCheck=n.querySelector("._se_anchor_download"),i.download=n.querySelector("._se_anchor_download_icon"),i.preview=n.querySelector(".se-link-preview"),i.bookmark=n.querySelector("._se_anchor_bookmark_icon"),i.bookmarkButton=n.querySelector("._se_bookmark_button"),this.plugins.selectMenu.initEvent.call(this,t,n);const s=this.context.selectMenu.caller[t];this.options.linkRel.length>0&&(i.relButton=n.querySelector(".se-anchor-rel-btn"),i.relList=n.querySelector(".se-list-layer"),i.relPreview=n.querySelector(".se-anchor-rel-preview"),i.relButton.addEventListener("click",r.onClick_relButton.bind(this,i)),i.relList.addEventListener("click",r.onClick_relList.bind(this,i))),i.newWindowCheck.addEventListener("change",r.onChange_newWindowCheck.bind(this,i)),i.downloadCheck.addEventListener("change",r.onChange_downloadCheck.bind(this,i)),i.anchorText.addEventListener("input",r.onChangeAnchorText.bind(this,i)),i.urlInput.addEventListener("input",r.onChangeUrlInput.bind(this,i)),i.urlInput.addEventListener("keydown",r.onKeyDownUrlInput.bind(this,s)),i.urlInput.addEventListener("focus",r.onFocusUrlInput.bind(this,i,s)),i.urlInput.addEventListener("blur",r.onBlurUrlInput.bind(this,s)),i.bookmarkButton.addEventListener("click",r.onClick_bookmarkButton.bind(this,i))},on:function(t,n){const r=this.plugins.anchor;if(!n)r.init.call(this,t),t.anchorText.value=this.getSelection().toString().trim(),t.newWindowCheck.checked=this.options.linkTargetNewWindow;else if(t.linkAnchor){this.context.dialog.updateModal=!0;const i=t.linkAnchor.getAttribute("href");t.linkValue=t.preview.textContent=t.urlInput.value=r.selfPathBookmark.call(this,i)?i.substr(i.lastIndexOf("#")):i,t.anchorText.value=t.linkAnchor.textContent,t.newWindowCheck.checked=!!/_blank/i.test(t.linkAnchor.target),t.downloadCheck.checked=t.linkAnchor.download}this.context.anchor.callerContext=t,r.setRel.call(this,t,n&&t.linkAnchor?t.linkAnchor.rel:t.defaultRel),r.setLinkPreview.call(this,t,t.linkValue),this.plugins.selectMenu.on.call(this,t.callerName,this.plugins.anchor.setHeaderBookmark)},selfPathBookmark:function(t){const n=this._w.location.href.replace(/\/$/,"");return t.indexOf("#")===0||t.indexOf(n)===0&&t.indexOf("#")===(n.indexOf("#")===-1?n.length:n.substr(0,n.indexOf("#")).length)},_closeRelMenu:null,toggleRelList:function(t,n){if(!n)this.plugins.anchor._closeRelMenu&&this.plugins.anchor._closeRelMenu();else{const r=t.relButton,i=t.relList;this.util.addClass(r,"active"),i.style.visibility="hidden",i.style.display="block",this.options.rtl?i.style.left=r.offsetLeft-i.offsetWidth-1+"px":i.style.left=r.offsetLeft+r.offsetWidth+1+"px",i.style.top=r.offsetTop+r.offsetHeight/2-i.offsetHeight/2+"px",i.style.visibility="",this.plugins.anchor._closeRelMenu=(function(s,o,l){l&&(s.relButton.contains(l.target)||s.relList.contains(l.target))||(this.util.removeClass(o,"active"),s.relList.style.display="none",this.modalForm.removeEventListener("click",this.plugins.anchor._closeRelMenu),this.plugins.anchor._closeRelMenu=null)}).bind(this,t,r),this.modalForm.addEventListener("click",this.plugins.anchor._closeRelMenu)}},onClick_relButton:function(t,n){this.plugins.anchor.toggleRelList.call(this,t,!this.util.hasClass(n.target,"active"))},onClick_relList:function(t,n){const r=n.target,i=r.getAttribute("data-command");if(!i)return;const s=t.currentRel,o=this.util.toggleClass(r,"se-checked"),l=s.indexOf(i);o?l===-1&&s.push(i):l>-1&&s.splice(l,1),t.relPreview.title=t.relPreview.textContent=s.join(" ")},setRel:function(t,n){const r=t.relList,i=t.currentRel=n?n.split(" "):[];if(!r)return;const s=r.querySelectorAll("button");for(let o=0,l=s.length,c;o<l;o++)c=s[o].getAttribute("data-command"),i.indexOf(c)>-1?this.util.addClass(s[o],"se-checked"):this.util.removeClass(s[o],"se-checked");t.relPreview.title=t.relPreview.textContent=i.join(" ")},createHeaderList:function(t,n,r){const i=this.util.getListChildren(this.context.element.wysiwyg,function(c){return/h[1-6]/i.test(c.nodeName)});if(i.length===0)return;const s=new this._w.RegExp("^"+r.replace(/^#/,""),"i"),o=[];let l="";for(let c=0,a=i.length,f;c<a;c++)f=i[c],s.test(f.textContent)&&(o.push(f),l+='<li class="se-select-item" data-index="'+c+'">'+f.textContent+"</li>");o.length===0?this.plugins.selectMenu.close.call(this,n):(this.plugins.selectMenu.createList(n,o,l),this.plugins.selectMenu.open.call(this,n,this.plugins.anchor._setMenuListPosition.bind(this,t)))},_setMenuListPosition:function(t,n){n.style.top=t.urlInput.offsetHeight+1+"px"},onKeyDownUrlInput:function(t,n){switch(n.keyCode){case 38:n.preventDefault(),n.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,t,-1);break;case 40:n.preventDefault(),n.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,t,1);break;case 13:t.index>-1&&(n.preventDefault(),n.stopPropagation(),this.plugins.anchor.setHeaderBookmark.call(this,this.plugins.selectMenu.getItem(t,null)));break}},setHeaderBookmark:function(t){const n=this.context.anchor.callerContext,r=t.id||"h_"+this._w.Math.random().toString().replace(/.+\./,"");t.id=r,n.urlInput.value="#"+r,(!n.anchorText.value.trim()||!n._change)&&(n.anchorText.value=t.textContent),this.plugins.anchor.setLinkPreview.call(this,n,n.urlInput.value),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext),this.context.anchor.callerContext.urlInput.focus()},onChangeAnchorText:function(t,n){t._change=!!n.target.value.trim()},onChangeUrlInput:function(t,n){const r=n.target.value.trim();this.plugins.anchor.setLinkPreview.call(this,t,r),this.plugins.anchor.selfPathBookmark.call(this,r)?this.plugins.anchor.createHeaderList.call(this,t,this.context.selectMenu.callerContext,r):this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)},onFocusUrlInput:function(t,n){const r=t.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,r)&&this.plugins.anchor.createHeaderList.call(this,t,n,r)},onBlurUrlInput:function(t){this.plugins.selectMenu.close.call(this,t)},setLinkPreview:function(t,n){const r=t.preview,i=this.options.linkProtocol,s=this.options.linkNoPrefix,o=/^(mailto\:|tel\:|sms\:|https*\:\/\/|#)/.test(n)||n.indexOf(i)===0,l=i?this._w.RegExp("^"+this.util.escapeStringRegexp(n.substr(0,i.length))).test(i):!1;n=t.linkValue=r.textContent=n?s?n:i&&!o&&!l?i+n:o?n:/^www\./.test(n)?"http://"+n:this.context.anchor.host+(/^\//.test(n)?"":"/")+n:"",this.plugins.anchor.selfPathBookmark.call(this,n)?(t.bookmark.style.display="block",this.util.addClass(t.bookmarkButton,"active")):(t.bookmark.style.display="none",this.util.removeClass(t.bookmarkButton,"active")),!this.plugins.anchor.selfPathBookmark.call(this,n)&&t.downloadCheck.checked?t.download.style.display="block":t.download.style.display="none"},setCtx:function(t,n){t&&(n.linkAnchor=t,n.linkValue=t.href,n.currentRel=t.rel.split(" "))},updateAnchor:function(t,n,r,i,s){!this.plugins.anchor.selfPathBookmark.call(this,n)&&i.downloadCheck.checked?t.setAttribute("download",r||n):t.removeAttribute("download"),i.newWindowCheck.checked?t.target="_blank":t.removeAttribute("target");const o=i.currentRel.join(" ");o?t.rel=o:t.removeAttribute("rel"),t.href=n,s?t.children.length===0&&(t.textContent=""):t.textContent=r},createAnchor:function(t,n){if(t.linkValue.length===0)return null;const r=t.linkValue,i=t.anchorText,s=i.value.length===0?r:i.value,o=t.linkAnchor||this.util.createElement("A");return this.plugins.anchor.updateAnchor.call(this,o,r,s,t,n),t.linkValue=t.preview.textContent=t.urlInput.value=t.anchorText.value="",o},onClick_bookmarkButton:function(t){let n=t.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,n)?(n=n.substr(1),t.bookmark.style.display="none",this.util.removeClass(t.bookmarkButton,"active"),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)):(n="#"+n,t.bookmark.style.display="block",this.util.addClass(t.bookmarkButton,"active"),t.downloadCheck.checked=!1,t.download.style.display="none",this.plugins.anchor.createHeaderList.call(this,t,this.context.selectMenu.callerContext,n)),t.urlInput.value=n,this.plugins.anchor.setLinkPreview.call(this,t,n),t.urlInput.focus()},onChange_newWindowCheck:function(t,n){typeof t.linkDefaultRel.check_new_window=="string"&&(n.target.checked?this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relMerge.call(this,t,t.linkDefaultRel.check_new_window)):this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relDelete.call(this,t,t.linkDefaultRel.check_new_window)))},onChange_downloadCheck:function(t,n){n.target.checked?(t.download.style.display="block",t.bookmark.style.display="none",this.util.removeClass(t.bookmarkButton,"active"),t.linkValue=t.preview.textContent=t.urlInput.value=t.urlInput.value.replace(/^\#+/,""),typeof t.linkDefaultRel.check_bookmark=="string"&&this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relMerge.call(this,t,t.linkDefaultRel.check_bookmark))):(t.download.style.display="none",typeof t.linkDefaultRel.check_bookmark=="string"&&this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relDelete.call(this,t,t.linkDefaultRel.check_bookmark)))},_relMerge:function(t,n){const r=t.currentRel;if(!n)return r.join(" ");if(/^only\:/.test(n))return n=n.replace(/^only\:/,"").trim(),t.currentRel=n.split(" "),n;const i=n.split(" ");for(let s=0,o=i.length,l;s<o;s++)l=r.indexOf(i[s]),l===-1&&r.push(i[s]);return r.join(" ")},_relDelete:function(t,n){if(!n)return t.currentRel.join(" ");/^only\:/.test(n)&&(n=n.replace(/^only\:/,"").trim());const r=t.currentRel.join(" ").replace(this._w.RegExp(n+"\\s*"),"");return t.currentRel=r.split(" "),r},init:function(t){t.linkAnchor=null,t.linkValue=t.preview.textContent=t.urlInput.value="",t.anchorText.value="",t.newWindowCheck.checked=!1,t.downloadCheck.checked=!1,t._change=!1,this.plugins.anchor.setRel.call(this,t,t.defaultRel),t.relList&&this.plugins.anchor.toggleRelList.call(this,t,!1),this.context.anchor.callerContext=null,this.plugins.selectMenu.init.call(this,this.context.selectMenu.callerContext)}},X2={name:"link",display:"dialog",add:function(t){t.addModule([go,Z2]);const n=t.context,r=n.link={focusElement:null,_linkAnchor:null,anchorCtx:null};let i=this.setDialog(t);r.modal=i;let s=this.setController_LinkButton(t);r.linkController=s,i.querySelector("form").addEventListener("submit",this.submit.bind(t)),s.addEventListener("click",this.onClick_linkController.bind(t)),n.dialog.modal.appendChild(i),n.element.relative.appendChild(s),t.plugins.anchor.initEvent.call(t,"link",i),r.focusElement=n.anchor.caller.link.urlInput,i=null,s=null},setDialog:function(t){const n=t.lang,r=t.util.createElement("DIV"),i=t.icons;r.className="se-dialog-content",r.style.display="none";let s='<form><div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" title="'+n.dialogBox.close+'" aria-label="'+n.dialogBox.close+'">'+i.cancel+'</button><span class="se-modal-title">'+n.dialogBox.linkBox.title+"</span></div>"+t.context.anchor.forms.innerHTML+'<div class="se-dialog-footer"><button type="submit" class="se-btn-primary" title="'+n.dialogBox.submitButton+'" aria-label="'+n.dialogBox.submitButton+'"><span>'+n.dialogBox.submitButton+"</span></button></div></form>";return r.innerHTML=s,r},setController_LinkButton:function(t){const n=t.lang,r=t.icons,i=t.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='<div class="se-arrow se-arrow-up"></div><div class="link-content"><span><a target="_blank" href=""></a> </span><div class="se-btn-group"><button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">'+r.edit+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.edit+'</span></span></button><button type="button" data-command="unlink" tabindex="-1" class="se-btn se-tooltip">'+r.unlink+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.unlink+'</span></span></button><button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">'+r.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.remove+"</span></span></button></div></div>",i},open:function(){this.plugins.dialog.open.call(this,"link",this.currentControllerName==="link")},submit:function(t){this.showLoading(),t.preventDefault(),t.stopPropagation();try{const n=this.plugins.anchor.createAnchor.call(this,this.context.anchor.caller.link,!1);if(n===null)return;if(this.context.dialog.updateModal){const r=this.context.link._linkAnchor.childNodes[0];this.setRange(r,0,r,r.textContent.length)}else{const r=this.getSelectedElements();if(r.length>1){const i=this.util.createElement(r[0].nodeName);if(i.appendChild(n),!this.insertNode(i,null,!0))return}else if(!this.insertNode(n,null,!0))return;this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(t){if(!t)this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();else if(this.util.isAnchor(t)&&t.getAttribute("data-image-link")===null)return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,t),!0;return!1},on:function(t){this.plugins.anchor.on.call(this,this.context.anchor.caller.link,t)},call_controller:function(t){this.editLink=this.context.link._linkAnchor=this.context.anchor.caller.link.linkAnchor=t;const n=this.context.link.linkController,r=n.querySelector("a");r.href=t.href,r.title=t.textContent,r.textContent=t.textContent,this.util.addClass(t,"on"),this.setControllerPosition(n,t,"bottom",{left:0,top:0}),this.controllersOn(n,t,"link",this.util.removeClass.bind(this.util,this.context.link._linkAnchor,"on"))},onClick_linkController:function(t){t.stopPropagation();const n=t.target.getAttribute("data-command")||t.target.parentNode.getAttribute("data-command");if(n){if(t.preventDefault(),/update/.test(n))this.plugins.dialog.open.call(this,"link",!0);else if(/unlink/.test(n)){const r=this.util.getChildElement(this.context.link._linkAnchor,function(s){return s.childNodes.length===0||s.nodeType===3},!1),i=this.util.getChildElement(this.context.link._linkAnchor,function(s){return s.childNodes.length===0||s.nodeType===3},!0);this.setRange(r,0,i,i.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.anchor.caller.link.linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){this.context.link.linkController.style.display="none",this.plugins.anchor.init.call(this,this.context.anchor.caller.link)}};var K2={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"component",set_container:function(s,o){const l=this.util.createElement("DIV");return l.className="se-component "+o,l.appendChild(s),l},set_cover:function(s){const o=this.util.createElement("FIGURE");return o.appendChild(s),o},create_caption:function(){const s=this.util.createElement("FIGCAPTION");return s.innerHTML="<div>"+this.lang.dialogBox.caption+"</div>",s}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(K2);var JE=K2.exports;const Eu=Di(JE);var Q2={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"resizing",add:function(s){const o=s.icons,l=s.context;l.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:o.align_justify,left:o.align_left,right:o.align_right,center:o.align_center}};let c=this.setController_resize(s);l.resizing.resizeContainer=c,l.resizing.resizeDiv=c.querySelector(".se-modal-resize"),l.resizing.resizeDot=c.querySelector(".se-resize-dot"),l.resizing.resizeDisplay=c.querySelector(".se-resize-display");let a=this.setController_button(s);l.resizing.resizeButton=a;let f=l.resizing.resizeHandles=l.resizing.resizeDot.querySelectorAll("span");l.resizing.resizeButtonGroup=a.querySelector("._se_resizing_btn_group"),l.resizing.rotationButtons=a.querySelectorAll("._se_resizing_btn_group ._se_rotation"),l.resizing.percentageButtons=a.querySelectorAll("._se_resizing_btn_group ._se_percentage"),l.resizing.alignMenu=a.querySelector(".se-resizing-align-list"),l.resizing.alignMenuList=l.resizing.alignMenu.querySelectorAll("button"),l.resizing.alignButton=a.querySelector("._se_resizing_align_button"),l.resizing.autoSizeButton=a.querySelector("._se_resizing_btn_group ._se_auto_size"),l.resizing.captionButton=a.querySelector("._se_resizing_caption_button"),c.addEventListener("mousedown",function(u){u.preventDefault()}),f[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),f[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(s)),a.addEventListener("click",this.onClick_resizeButton.bind(s)),l.element.relative.appendChild(c),l.element.relative.appendChild(a),c=null,a=null,f=null},setController_resize:function(s){const o=s.util.createElement("DIV");return o.className="se-controller se-resizing-container",o.style.display="none",o.innerHTML='<div class="se-modal-resize"></div><div class="se-resize-dot"><span class="tl"></span><span class="tr"></span><span class="bl"></span><span class="br"></span><span class="lw"></span><span class="th"></span><span class="rw"></span><span class="bh"></span><div class="se-resize-display"></div></div>',o},setController_button:function(s){const o=s.lang,l=s.icons,c=s.util.createElement("DIV");return c.className="se-controller se-controller-resizing",c.innerHTML='<div class="se-arrow se-arrow-up"></div><div class="se-btn-group _se_resizing_btn_group"><button type="button" data-command="percent" data-value="1" class="se-tooltip _se_percentage"><span>100%</span><span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.resize100+'</span></span></button><button type="button" data-command="percent" data-value="0.75" class="se-tooltip _se_percentage"><span>75%</span><span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.resize75+'</span></span></button><button type="button" data-command="percent" data-value="0.5" class="se-tooltip _se_percentage"><span>50%</span><span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.resize50+'</span></span></button><button type="button" data-command="auto" class="se-btn se-tooltip _se_auto_size">'+l.auto_size+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.autoSize+'</span></span></button><button type="button" data-command="rotate" data-value="-90" class="se-btn se-tooltip _se_rotation">'+l.rotate_left+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.rotateLeft+'</span></span></button><button type="button" data-command="rotate" data-value="90" class="se-btn se-tooltip _se_rotation">'+l.rotate_right+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.rotateRight+'</span></span></button></div><div class="se-btn-group" style="padding-top: 0;"><button type="button" data-command="mirror" data-value="h" class="se-btn se-tooltip">'+l.mirror_horizontal+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.mirrorHorizontal+'</span></span></button><button type="button" data-command="mirror" data-value="v" class="se-btn se-tooltip">'+l.mirror_vertical+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.mirrorVertical+'</span></span></button><button type="button" data-command="onalign" class="se-btn se-tooltip _se_resizing_align_button">'+l.align_justify+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.toolbar.align+'</span></span></button><div class="se-btn-group-sub sun-editor-common se-list-layer se-resizing-align-list"><div class="se-list-inner"><ul class="se-list-basic"><li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="basic">'+l.align_justify+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.basic+'</span></span></button></li><li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="left">'+l.align_left+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.left+'</span></span></button></li><li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="center">'+l.align_center+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.center+'</span></span></button></li><li><button type="button" class="se-btn-list se-tooltip" data-command="align" data-value="right">'+l.align_right+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.right+'</span></span></button></li></ul></div></div><button type="button" data-command="caption" class="se-btn se-tooltip _se_resizing_caption_button">'+l.caption+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.caption+'</span></span></button><button type="button" data-command="revert" class="se-btn se-tooltip">'+l.revert+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.dialogBox.revertButton+'</span></span></button><button type="button" data-command="update" class="se-btn se-tooltip">'+l.modify+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.edit+'</span></span></button><button type="button" data-command="delete" class="se-btn se-tooltip">'+l.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+o.controller.remove+"</span></span></button></div>",c},_module_getSizeX:function(s,o,l,c){return o||(o=s._element),l||(l=s._cover),c||(c=s._container),o?/%$/.test(o.style.width)?(c&&this.util.getNumber(c.style.width,2)||100)+"%":o.style.width:""},_module_getSizeY:function(s,o,l,c){return o||(o=s._element),l||(l=s._cover),c||(c=s._container),!c||!l?o&&o.style.height||"":this.util.getNumber(l.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?l.style.height:!/%$/.test(o.style.height)||!/%$/.test(o.style.width)?o.style.height:(c&&this.util.getNumber(c.style.height,2)||100)+"%"},_module_setModifyInputSize:function(s,o){const l=s._onlyPercentage&&this.context.resizing._rotateVertical;s.proportion.checked=s._proportionChecked=s._element.getAttribute("data-proportion")!=="false";let c=l?"":this.plugins.resizing._module_getSizeX.call(this,s);if(c===s._defaultSizeX&&(c=""),s._onlyPercentage&&(c=this.util.getNumber(c,2)),s.inputX.value=c,o.setInputSize.call(this,"x"),!s._onlyPercentage){let a=l?"":this.plugins.resizing._module_getSizeY.call(this,s);a===s._defaultSizeY&&(a=""),s._onlyPercentage&&(a=this.util.getNumber(a,2)),s.inputY.value=a}s.inputX.disabled=!!l,s.inputY.disabled=!!l,s.proportion.disabled=!!l,o.setRatio.call(this)},_module_setInputSize:function(s,o){if(s._onlyPercentage){o==="x"&&s.inputX.value>100&&(s.inputX.value=100);return}if(s.proportion.checked&&s._ratio&&/\d/.test(s.inputX.value)&&/\d/.test(s.inputY.value)){const l=s.inputX.value.replace(/\d+|\./g,"")||s.sizeUnit,c=s.inputY.value.replace(/\d+|\./g,"")||s.sizeUnit;if(l!==c)return;const a=l==="%"?2:0;o==="x"?s.inputY.value=this.util.getNumber(s._ratioY*this.util.getNumber(s.inputX.value,a),a)+c:s.inputX.value=this.util.getNumber(s._ratioX*this.util.getNumber(s.inputY.value,a),a)+l}},_module_setRatio:function(s){const o=s.inputX.value,l=s.inputY.value;if(s.proportion.checked&&/\d+/.test(o)&&/\d+/.test(l)){const c=o.replace(/\d+|\./g,"")||s.sizeUnit,a=l.replace(/\d+|\./g,"")||s.sizeUnit;if(c!==a)s._ratio=!1;else if(!s._ratio){const f=this.util.getNumber(o,0),u=this.util.getNumber(l,0);s._ratio=!0,s._ratioX=f/u,s._ratioY=u/f}}else s._ratio=!1},_module_sizeRevert:function(s){s._onlyPercentage?s.inputX.value=s._origin_w>100?100:s._origin_w:(s.inputX.value=s._origin_w,s.inputY.value=s._origin_h)},_module_saveCurrentSize:function(s){const o=this.plugins.resizing._module_getSizeX.call(this,s),l=this.plugins.resizing._module_getSizeY.call(this,s);s._element.setAttribute("width",o.replace("px","")),s._element.setAttribute("height",l.replace("px","")),s._element.setAttribute("data-size",o+","+l),s._videoRatio&&(s._videoRatio=l)},call_controller_resize:function(s,o){const l=this.context.resizing,c=this.context[o];l._resize_plugin=o;const a=l.resizeContainer,f=l.resizeDiv,u=this.util.getOffset(s,this.context.element.wysiwygFrame),m=l._rotateVertical=/^(90|270)$/.test(Math.abs(s.getAttribute("data-rotate")).toString()),y=m?s.offsetHeight:s.offsetWidth,_=m?s.offsetWidth:s.offsetHeight,S=u.top,E=u.left-this.context.element.wysiwygFrame.scrollLeft;a.style.top=S+"px",a.style.left=E+"px",a.style.width=y+"px",a.style.height=_+"px",f.style.top="0px",f.style.left="0px",f.style.width=y+"px",f.style.height=_+"px";let d=s.getAttribute("data-align")||"basic";d=d==="none"?"basic":d;const h=this.util.getParentElement(s,this.util.isComponent),v=this.util.getParentElement(s,"FIGURE"),x=this.plugins.resizing._module_getSizeX.call(this,c,s,v,h)||"auto",g=c._onlyPercentage&&o==="image"?"":", "+(this.plugins.resizing._module_getSizeY.call(this,c,s,v,h)||"auto");this.util.changeTxt(l.resizeDisplay,this.lang.dialogBox[d]+" ("+x+g+")"),l.resizeButtonGroup.style.display=c._resizing?"":"none";const b=c._resizing&&!c._resizeDotHide&&!c._onlyPercentage?"flex":"none",w=l.resizeHandles;for(let L=0,R=w.length;L<R;L++)w[L].style.display=b;if(c._resizing){const L=l.rotationButtons;L[0].style.display=L[1].style.display=c._rotation?"":"none"}if(c._alignHide)l.alignButton.style.display="none";else{l.alignButton.style.display="";const L=l.alignMenuList;this.util.changeElement(l.alignButton.firstElementChild,l.alignIcons[d]);for(let R=0,P=L.length;R<P;R++)L[R].getAttribute("data-value")===d?this.util.addClass(L[R],"on"):this.util.removeClass(L[R],"on")}const k=l.percentageButtons,N=/%$/.test(s.style.width)&&/%$/.test(h.style.width)?this.util.getNumber(h.style.width,0)/100+"":"";for(let L=0,R=k.length;L<R;L++)k[L].getAttribute("data-value")===N?this.util.addClass(k[L],"active"):this.util.removeClass(k[L],"active");c._captionShow?(l.captionButton.style.display="",this.util.getChildElement(s.parentNode,"figcaption")?(this.util.addClass(l.captionButton,"active"),c._captionChecked=!0):(this.util.removeClass(l.captionButton,"active"),c._captionChecked=!1)):l.captionButton.style.display="none",a.style.display="block";const T={left:0,top:50};this.options.iframe&&(T.left-=this.context.element.wysiwygFrame.parentElement.offsetLeft,T.top-=this.context.element.wysiwygFrame.parentElement.offsetTop),this.setControllerPosition(l.resizeButton,a,"bottom",T);const D=function(){this.util.setDisabledButtons.call(this.util,!1,this.resizingDisabledButtons),this.history._resetCachingButton()};this.controllersOn(a,l.resizeButton,D.bind(this),s,o),this.util.setDisabledButtons(!0,this.resizingDisabledButtons),l._resize_w=y,l._resize_h=_;const I=(s.getAttribute("origin-size")||"").split(",");return l._origin_w=I[0]||s.naturalWidth,l._origin_h=I[1]||s.naturalHeight,{w:y,h:_,t:S,l:E}},_closeAlignMenu:null,openAlignMenu:function(){const s=this.context.resizing.alignButton;this.util.addClass(s,"on"),this.context.resizing.alignMenu.style.top=s.offsetTop+s.offsetHeight+"px",this.context.resizing.alignMenu.style.left=s.offsetLeft-s.offsetWidth/2+"px",this.context.resizing.alignMenu.style.display="block",this.plugins.resizing._closeAlignMenu=(function(){this.util.removeClass(this.context.resizing.alignButton,"on"),this.context.resizing.alignMenu.style.display="none",this.removeDocEvent("click",this.plugins.resizing._closeAlignMenu),this.plugins.resizing._closeAlignMenu=null}).bind(this),this.addDocEvent("click",this.plugins.resizing._closeAlignMenu)},onClick_resizeButton:function(s){s.stopPropagation();const o=s.target,l=o.getAttribute("data-command")||o.parentNode.getAttribute("data-command");if(!l)return;const c=o.getAttribute("data-value")||o.parentNode.getAttribute("data-value"),a=this.context.resizing._resize_plugin,f=this.context[a],u=f._element,m=this.plugins[a];if(s.preventDefault(),!(typeof this.plugins.resizing._closeAlignMenu=="function"&&(this.plugins.resizing._closeAlignMenu(),l==="onalign"))){switch(l){case"auto":this.plugins.resizing.resetTransform.call(this,u),m.setAutoSize.call(this),this.selectComponent(u,a);break;case"percent":let y=this.plugins.resizing._module_getSizeY.call(this,f);if(this.context.resizing._rotateVertical){const b=u.getAttribute("data-percentage");b&&(y=b.split(",")[1])}this.plugins.resizing.resetTransform.call(this,u),m.setPercentSize.call(this,c*100,this.util.getNumber(y,0)===null||!/%$/.test(y)?"":y),this.selectComponent(u,a);break;case"mirror":const _=u.getAttribute("data-rotate")||"0";let S=u.getAttribute("data-rotateX")||"",E=u.getAttribute("data-rotateY")||"";c==="h"&&!this.context.resizing._rotateVertical||c==="v"&&this.context.resizing._rotateVertical?E=E?"":"180":S=S?"":"180",u.setAttribute("data-rotateX",S),u.setAttribute("data-rotateY",E),this.plugins.resizing._setTransForm(u,_,S,E);break;case"rotate":const d=this.context.resizing,h=u.getAttribute("data-rotate")*1+c*1,v=this._w.Math.abs(h)>=360?0:h;u.setAttribute("data-rotate",v),d._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(v).toString()),this.plugins.resizing.setTransformSize.call(this,u,null,null),this.selectComponent(u,a);break;case"onalign":this.plugins.resizing.openAlignMenu.call(this);return;case"align":const x=c==="basic"?"none":c;m.setAlign.call(this,x,null,null,null),this.selectComponent(u,a);break;case"caption":const g=!f._captionChecked;if(m.openModify.call(this,!0),f._captionChecked=f.captionCheckEl.checked=g,m.update_image.call(this,!1,!1,!1),g){const b=this.util.getChildElement(f._caption,function(w){return w.nodeType===3});b?this.setRange(b,0,b,b.textContent.length):f._caption.focus(),this.controllersOff()}else this.selectComponent(u,a),m.openModify.call(this,!0);break;case"revert":m.setOriginSize.call(this),this.selectComponent(u,a);break;case"update":m.openModify.call(this),this.controllersOff();break;case"delete":m.destroy.call(this);break}this.history.push(!1)}},resetTransform:function(s){const o=(s.getAttribute("data-size")||s.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,s.style.maxWidth="",s.style.transform="",s.style.transformOrigin="",s.setAttribute("data-rotate",""),s.setAttribute("data-rotateX",""),s.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,o[0]?o[0]:"auto",o[1]?o[1]:"",!0)},setTransformSize:function(s,o,l){let c=s.getAttribute("data-percentage");const a=this.context.resizing._rotateVertical,f=s.getAttribute("data-rotate")*1;let u="";if(c&&!a)c=c.split(","),c[0]==="auto"&&c[1]==="auto"?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,c[0],c[1]);else{const m=this.util.getParentElement(s,"FIGURE"),y=o||s.offsetWidth,_=l||s.offsetHeight,S=(a?_:y)+"px",E=(a?y:_)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,y+"px",_+"px",!0),m.style.width=S,m.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":E,a){let d=y/2+"px "+y/2+"px 0",h=_/2+"px "+_/2+"px 0";u=f===90||f===-270?h:d}}s.style.transformOrigin=u,this.plugins.resizing._setTransForm(s,f.toString(),s.getAttribute("data-rotateX")||"",s.getAttribute("data-rotateY")||""),a?s.style.maxWidth="none":s.style.maxWidth="",this.plugins.resizing.setCaptionPosition.call(this,s)},_setTransForm:function(s,o,l,c){let a=(s.offsetWidth-s.offsetHeight)*(/-/.test(o)?1:-1),f="";if(/[1-9]/.test(o)&&(l||c))switch(f=l?"Y":"X",o){case"90":f=l&&c?"X":c?f:"";break;case"270":a*=-1,f=l&&c?"Y":l?f:"";break;case"-90":f=l&&c?"Y":l?f:"";break;case"-270":a*=-1,f=l&&c?"X":c?f:"";break;default:f=""}o%180===0&&(s.style.maxWidth=""),s.style.transform="rotate("+o+"deg)"+(l?" rotateX("+l+"deg)":"")+(c?" rotateY("+c+"deg)":"")+(f?" translate"+f+"("+a+"px)":"")},setCaptionPosition:function(s){const o=this.util.getChildElement(this.util.getParentElement(s,"FIGURE"),"FIGCAPTION");o&&(o.style.marginTop=(this.context.resizing._rotateVertical?s.offsetWidth-s.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(s){s.stopPropagation(),s.preventDefault();const o=this.context.resizing,l=o._resize_direction=s.target.classList[0];o._resizeClientX=s.clientX,o._resizeClientY=s.clientY,this.context.element.resizeBackground.style.display="block",o.resizeButton.style.display="none",o.resizeDiv.style.float=/l/.test(l)?"right":/r/.test(l)?"left":"none";const c=(function(u){if(u.type==="keydown"&&u.keyCode!==27)return;const m=o._isChange;o._isChange=!1,this.removeDocEvent("mousemove",a),this.removeDocEvent("mouseup",c),this.removeDocEvent("keydown",c),u.type==="keydown"?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,l),m&&this.history.push(!1))}).bind(this),a=this.plugins.resizing.resizing_element.bind(this,o,l,this.context[o._resize_plugin]);this.addDocEvent("mousemove",a),this.addDocEvent("mouseup",c),this.addDocEvent("keydown",c)},resizing_element:function(s,o,l,c){const a=c.clientX,f=c.clientY;let u=l._element_w,m=l._element_h;const y=l._element_w+(/r/.test(o)?a-s._resizeClientX:s._resizeClientX-a),_=l._element_h+(/b/.test(o)?f-s._resizeClientY:s._resizeClientY-f),S=l._element_h/l._element_w*y;/t/.test(o)&&(s.resizeDiv.style.top=l._element_h-(/h/.test(o)?_:S)+"px"),/l/.test(o)&&(s.resizeDiv.style.left=l._element_w-y+"px"),/r|l/.test(o)&&(s.resizeDiv.style.width=y+"px",u=y),/^(t|b)[^h]$/.test(o)?(s.resizeDiv.style.height=S+"px",m=S):/^(t|b)h$/.test(o)&&(s.resizeDiv.style.height=_+"px",m=_),s._resize_w=u,s._resize_h=m,this.util.changeTxt(s.resizeDisplay,this._w.Math.round(u)+" x "+this._w.Math.round(m)),s._isChange=!0},cancel_controller_resize:function(s){const o=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let l=this._w.Math.round(o?this.context.resizing._resize_h:this.context.resizing._resize_w),c=this._w.Math.round(o?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!o&&!/%$/.test(l)){const u=this.context.element.wysiwygFrame.clientWidth-32-2;this.util.getNumber(l,0)>u&&(c=this._w.Math.round(c/l*u),l=u)}const a=this.context.resizing._resize_plugin;this.plugins[a].setSize.call(this,l,c,!1,s),o&&this.plugins.resizing.setTransformSize.call(this,this.context[this.context.resizing._resize_plugin]._element,l,c),this.selectComponent(this.context[a]._element,a)}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(Q2);var eT=Q2.exports;const J2=Di(eT);var ev={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"fileManager",_xmlHttp:null,_checkMediaComponent:function(s){return/IMG|IFRAME|VIDEO|AUDIO/i.test(s.tagName)?/FIGURE/i.test(s.parentElement.nodeName)||/FIGURE/i.test(s.parentElement.parentElement.nodeName):!0},upload:function(s,o,l,c,a){this.showLoading();const f=this.plugins.fileManager,u=f._xmlHttp=this.util.getXMLHttpRequest();if(u.onreadystatechange=f._callBackUpload.bind(this,u,c,a),u.open("post",s,!0),o!==null&&typeof o=="object"&&this._w.Object.keys(o).length>0)for(let m in o)u.setRequestHeader(m,o[m]);u.send(l)},_callBackUpload:function(s,o,l){if(s.readyState===4)if(s.status===200)try{o(s)}catch(c){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+c.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const c=s.responseText?JSON.parse(s.responseText):s;if(typeof l!="function"||l("",c,this)){const a="[SUNEDITOR.fileManager.upload.serverException] status: "+s.status+", response: "+(c.errorMessage||s.responseText);throw this.functions.noticeOpen(a),Error(a)}}},checkInfo:function(s,o,l,c,a){let f=[];for(let h=0,v=o.length;h<v;h++)f=f.concat([].slice.call(this.context.element.wysiwyg.querySelectorAll(o[h]+':not([data-se-embed="true"])')));const u=this.plugins.fileManager,m=this.context[s],y=m._infoList,_=u.setInfo.bind(this);if(f.length===y.length)if(this._componentsInfoReset){for(let h=0,v=f.length;h<v;h++)_(s,f[h],l,null,a);return}else{let h=!1;for(let v=0,x=y.length,g;v<x;v++)if(g=y[v],f.filter(function(b){return g.src===b.src&&g.index.toString()===b.getAttribute("data-index")}).length===0){h=!0;break}if(!h)return}const S=a?this.context.resizing._resize_plugin:"";a&&(this.context.resizing._resize_plugin=s);const E=[],d=[];for(let h=0,v=y.length;h<v;h++)d[h]=y[h].index;for(m.__updateTags=f;f.length>0;){const h=f.shift();!this.util.getParentElement(h,this.util.isMediaComponent)||!u._checkMediaComponent(h)?(E.push(m._infoIndex),c(h)):!h.getAttribute("data-index")||d.indexOf(h.getAttribute("data-index")*1)<0?(E.push(m._infoIndex),h.removeAttribute("data-index"),_(s,h,l,null,a)):E.push(h.getAttribute("data-index")*1)}for(let h=0,v;h<y.length;h++)v=y[h].index,!(E.indexOf(v)>-1)&&(y.splice(h,1),typeof l=="function"&&l(null,v,"delete",null,0,this),h--);a&&(this.context.resizing._resize_plugin=S)},setInfo:function(s,o,l,c,a){const f=a?this.context.resizing._resize_plugin:"";a&&(this.context.resizing._resize_plugin=s);const u=this.plugins[s],m=this.context[s],y=m._infoList;let _=o.getAttribute("data-index"),S=null,E="";if(c||(c={name:o.getAttribute("data-file-name")||(typeof o.src=="string"?o.src.split("/").pop():""),size:o.getAttribute("data-file-size")||0}),!_||this._componentsInfoInit)E="create",_=m._infoIndex++,o.setAttribute("data-index",_),o.setAttribute("data-file-name",c.name),o.setAttribute("data-file-size",c.size),S={src:o.src,index:_*1,name:c.name,size:c.size},y.push(S);else{E="update",_*=1;for(let d=0,h=y.length;d<h;d++)if(_===y[d].index){S=y[d];break}S||(_=m._infoIndex++,S={index:_},y.push(S)),S.src=o.src,S.name=o.getAttribute("data-file-name"),S.size=o.getAttribute("data-file-size")*1}if(S.element=o,S.delete=u.destroy.bind(this,o),S.select=(function(d){d.scrollIntoView(!0),this._w.setTimeout(u.select.bind(this,d))}).bind(this,o),a){if(!o.getAttribute("origin-size")&&o.naturalWidth&&o.setAttribute("origin-size",o.naturalWidth+","+o.naturalHeight),!o.getAttribute("data-origin")){const d=this.util.getParentElement(o,this.util.isMediaComponent),h=this.util.getParentElement(o,"FIGURE"),v=this.plugins.resizing._module_getSizeX.call(this,m,o,h,d),x=this.plugins.resizing._module_getSizeY.call(this,m,o,h,d);o.setAttribute("data-origin",v+","+x),o.setAttribute("data-size",v+","+x)}if(!o.style.width){const d=(o.getAttribute("data-size")||o.getAttribute("data-origin")||"").split(",");u.onModifyMode.call(this,o,null),u.applySize.call(this,d[0],d[1])}this.context.resizing._resize_plugin=f}typeof l=="function"&&l(o,_,E,S,--m._uploadFileLength<0?0:m._uploadFileLength,this)},deleteInfo:function(s,o,l){if(o>=0){const c=this.context[s]._infoList;for(let a=0,f=c.length;a<f;a++)if(o===c[a].index){c.splice(a,1),typeof l=="function"&&l(null,o,"delete",null,0,this);return}}},resetInfo:function(s,o){const l=this.context[s];if(typeof o=="function"){const c=l._infoList;for(let a=0,f=c.length;a<f;a++)o(null,c[a].index,"delete",null,0,this)}l._infoList=[],l._infoIndex=0}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"fileManager",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(ev);var tT=ev.exports;const Tu=Di(tT),tv={name:"image",display:"dialog",add:function(t){t.addModule([go,Z2,Eu,J2,Tu]);const n=t.options,r=t.context,i=r.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,sizeUnit:n._imageSizeUnit,_linkElement:"",_altText:"",_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_src:{_linkValue:""},svgDefaultSize:"30%",base64RenderIndex:0,_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:n.imageWidth==="auto"?"":n.imageWidth,_origin_h:n.imageHeight==="auto"?"":n.imageHeight,_proportionChecked:!0,_resizing:n.imageResizing,_resizeDotHide:!n.imageHeightShow,_rotation:n.imageRotation,_alignHide:!n.imageAlignShow,_onlyPercentage:n.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let s=this.setDialog(t);i.modal=s,i.imgInputFile=s.querySelector("._se_image_file"),i.imgUrlFile=s.querySelector("._se_image_url"),i.focusElement=i.imgInputFile||i.imgUrlFile,i.altText=s.querySelector("._se_image_alt"),i.captionCheckEl=s.querySelector("._se_image_check_caption"),i.previewSrc=s.querySelector("._se_tab_content_image .se-link-preview"),s.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(t)),s.querySelector("form").addEventListener("submit",this.submit.bind(t)),i.imgInputFile&&s.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(i.imgInputFile,i.imgUrlFile,i.previewSrc)),i.imgUrlFile&&i.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(i.previewSrc,i._v_src,n.linkProtocol)),i.imgInputFile&&i.imgUrlFile&&i.imgInputFile.addEventListener("change",this._fileInputChange.bind(i));const o=s.querySelector(".__se__gallery");o&&o.addEventListener("click",this._openGallery.bind(t)),i.proportion={},i.inputX={},i.inputY={},n.imageResizing&&(i.proportion=s.querySelector("._se_image_check_proportion"),i.inputX=s.querySelector("._se_image_size_x"),i.inputY=s.querySelector("._se_image_size_y"),i.inputX.value=n.imageWidth,i.inputY.value=n.imageHeight,i.inputX.addEventListener("keyup",this.setInputSize.bind(t,"x")),i.inputY.addEventListener("keyup",this.setInputSize.bind(t,"y")),i.inputX.addEventListener("change",this.setRatio.bind(t)),i.inputY.addEventListener("change",this.setRatio.bind(t)),i.proportion.addEventListener("change",this.setRatio.bind(t)),s.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(t))),r.dialog.modal.appendChild(s),t.plugins.anchor.initEvent.call(t,"image",s.querySelector("._se_tab_content_url")),i.anchorCtx=t.context.anchor.caller.image,s=null},setDialog:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-dialog-content se-dialog-image",i.style.display="none";let s='<div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" class="close" title="'+r.dialogBox.close+'" aria-label="'+r.dialogBox.close+'">'+t.icons.cancel+'</button><span class="se-modal-title">'+r.dialogBox.imageBox.title+'</span></div><div class="se-dialog-tabs"><button type="button" class="_se_tab_link active" data-tab-link="image">'+r.toolbar.image+'</button><button type="button" class="_se_tab_link" data-tab-link="url">'+r.toolbar.link+'</button></div><form method="post" enctype="multipart/form-data"><div class="_se_tab_content _se_tab_content_image"><div class="se-dialog-body"><div style="border-bottom: 1px dashed #ccc;">';if(n.imageFileInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.imageBox.file+'</label><div class="se-dialog-form-files"><input class="se-input-form _se_image_file" type="file" accept="'+n.imageAccept+'"'+(n.imageMultipleFile?' multiple="multiple"':"")+'/><button type="button" class="se-btn se-dialog-files-edge-button se-file-remove" title="'+r.controller.remove+'" aria-label="'+r.controller.remove+'">'+t.icons.cancel+"</button></div></div>"),n.imageUrlInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.imageBox.url+'</label><div class="se-dialog-form-files"><input class="se-input-form se-input-url _se_image_url" type="text" />'+(n.imageGalleryUrl&&t.plugins.imageGallery?'<button type="button" class="se-btn se-dialog-files-edge-button __se__gallery" title="'+r.toolbar.imageGallery+'" aria-label="'+r.toolbar.imageGallery+'">'+t.icons.image_gallery+"</button>":"")+'</div><pre class="se-link-preview"></pre></div>'),s+='</div><div class="se-dialog-form"><label>'+r.dialogBox.imageBox.altText+'</label><input class="se-input-form _se_image_alt" type="text" /></div>',n.imageResizing){const o=n.imageSizeOnlyPercentage,l=o?' style="display: none !important;"':"",c=n.imageHeightShow?"":' style="display: none !important;"';s+='<div class="se-dialog-form">',o||!n.imageHeightShow?s+='<div class="se-dialog-size-text"><label class="size-w">'+r.dialogBox.size+"</label></div>":s+='<div class="se-dialog-size-text"><label class="size-w">'+r.dialogBox.width+'</label><label class="se-dialog-size-x"> </label><label class="size-h">'+r.dialogBox.height+"</label></div>",s+='<input class="se-input-control _se_image_size_x" placeholder="auto"'+(o?' type="number" min="1"':'type="text"')+(o?' max="100"':"")+' /><label class="se-dialog-size-x"'+c+">"+(o?"%":"x")+'</label><input type="text" class="se-input-control _se_image_size_y" placeholder="auto"'+l+(o?' max="100"':"")+c+"/><label"+l+c+'><input type="checkbox" class="se-dialog-btn-check _se_image_check_proportion" checked/> '+r.dialogBox.proportion+'</label><button type="button" title="'+r.dialogBox.revertButton+'" aria-label="'+r.dialogBox.revertButton+'" class="se-btn se-dialog-btn-revert" style="float: right;">'+t.icons.revert+"</button></div>"}return s+='<div class="se-dialog-form se-dialog-form-footer"><label><input type="checkbox" class="se-dialog-btn-check _se_image_check_caption" /> '+r.dialogBox.caption+'</label></div></div></div><div class="_se_tab_content _se_tab_content_url" style="display: none">'+t.context.anchor.forms.innerHTML+'</div><div class="se-dialog-footer"><div'+(n.imageAlignShow?"":' style="display: none"')+'><label><input type="radio" name="suneditor_image_radio" class="se-dialog-btn-radio" value="none" checked>'+r.dialogBox.basic+'</label><label><input type="radio" name="suneditor_image_radio" class="se-dialog-btn-radio" value="left">'+r.dialogBox.left+'</label><label><input type="radio" name="suneditor_image_radio" class="se-dialog-btn-radio" value="center">'+r.dialogBox.center+'</label><label><input type="radio" name="suneditor_image_radio" class="se-dialog-btn-radio" value="right">'+r.dialogBox.right+'</label></div><button type="submit" class="se-btn-primary" title="'+r.dialogBox.submitButton+'" aria-label="'+r.dialogBox.submitButton+'"><span>'+r.dialogBox.submitButton+"</span></button></div></form>",i.innerHTML=s,i},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(t,n){this.value="",t&&(t.removeAttribute("disabled"),n.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(t){this.altText.value=t.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-value")||t.src,this.imgUrlFile.focus()},_onLinkPreview:function(t,n,r){const i=r.target.value.trim();t._linkValue=this.textContent=i?n&&i.indexOf("://")===-1&&i.indexOf("#")!==0?n+i:i.indexOf("://")===-1?"/"+i:i:""},fileTags:["img"],select:function(t){this.plugins.image.onModifyMode.call(this,t,this.plugins.resizing.call_controller_resize.call(this,t,"image"))},destroy:function(t){const n=t||this.context.image._element,r=this.util.getParentElement(n,this.util.isMediaComponent)||n,i=n.getAttribute("data-index")*1;if(typeof this.functions.onImageDeleteBefore=="function"&&this.functions.onImageDeleteBefore(n,r,i,this)===!1)return;let s=r.previousElementSibling||r.nextElementSibling;const o=r.parentNode;this.util.removeItem(r),this.plugins.image.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,function(l){return l.childNodes.length===0},null),this.focusEdge(s),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(t){const n=this.context.image;t?n.imgInputFile&&this.options.imageMultipleFile&&n.imgInputFile.removeAttribute("multiple"):(n.inputX.value=n._origin_w=this.options.imageWidth===n._defaultSizeX?"":this.options.imageWidth,n.inputY.value=n._origin_h=this.options.imageHeight===n._defaultSizeY?"":this.options.imageHeight,n.imgInputFile&&this.options.imageMultipleFile&&n.imgInputFile.setAttribute("multiple","multiple")),this.plugins.anchor.on.call(this,n.anchorCtx,t)},open:function(){this.plugins.dialog.open.call(this,"image",this.currentControllerName==="image")},openTab:function(t){const n=this.context.image.modal,r=t==="init"?n.querySelector("._se_tab_link"):t.target;if(!/^BUTTON$/i.test(r.tagName))return!1;const i=r.getAttribute("data-tab-link"),s="_se_tab_content";let o,l,c;for(l=n.getElementsByClassName(s),o=0;o<l.length;o++)l[o].style.display="none";for(c=n.getElementsByClassName("_se_tab_link"),o=0;o<c.length;o++)this.util.removeClass(c[o],"active");return n.querySelector("."+s+"_"+i).style.display="block",this.util.addClass(r,"active"),i==="image"&&this.context.image.focusElement?this.context.image.focusElement.focus():i==="url"&&this.context.anchor.caller.image.urlInput.focus(),!1},submit:function(t){const n=this.context.image,r=this.plugins.image;t.preventDefault(),t.stopPropagation(),n._altText=n.altText.value,n._align=n.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,n._captionChecked=n.captionCheckEl.checked,n._resizing&&(n._proportionChecked=n.proportion.checked);try{this.context.dialog.updateModal&&r.update_image.call(this,!1,!0,!1),n.imgInputFile&&n.imgInputFile.files.length>0?(this.showLoading(),r.submitAction.call(this,this.context.image.imgInputFile.files)):n.imgUrlFile&&n._v_src._linkValue.length>0&&(this.showLoading(),r.onRender_imgUrl.call(this,n._v_src._linkValue))}catch(i){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+i.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(t){if(t.length===0)return;let n=0,r=[];for(let c=0,a=t.length;c<a;c++)/image/i.test(t[c].type)&&(r.push(t[c]),n+=t[c].size);const i=this.options.imageUploadSizeLimit;if(i>0){let c=0;const a=this.context.image._infoList;for(let f=0,u=a.length;f<u;f++)c+=a[f].size*1;if(n+c>i){this.closeLoading();const f="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";(typeof this.functions.onImageUploadError!="function"||this.functions.onImageUploadError(f,{limitSize:i,currentSize:c,uploadSize:n},this))&&this.functions.noticeOpen(f);return}}const s=this.context.image;s._uploadFileLength=r.length;const l={anchor:this.plugins.anchor.createAnchor.call(this,s.anchorCtx,!0),inputWidth:s.inputX.value,inputHeight:s.inputY.value,align:s._align,isUpdate:this.context.dialog.updateModal,alt:s._altText,element:s._element};if(typeof this.functions.onImageUploadBefore=="function"){const c=this.functions.onImageUploadBefore(r,l,this,(function(a){a&&this._w.Array.isArray(a.result)?this.plugins.image.register.call(this,l,a):this.plugins.image.upload.call(this,l,a)}).bind(this));if(typeof c>"u")return;if(!c){this.closeLoading();return}this._w.Array.isArray(c)&&c.length>0&&(r=c)}this.plugins.image.upload.call(this,l,r)},error:function(t,n){if(this.closeLoading(),typeof this.functions.onImageUploadError!="function"||this.functions.onImageUploadError(t,n,this))throw this.functions.noticeOpen(t),Error("[SUNEDITOR.plugin.image.error] response: "+t)},upload:function(t,n){if(!n){this.closeLoading();return}if(typeof n=="string"){this.plugins.image.error.call(this,n,null);return}const r=this.options.imageUploadUrl,i=this.context.dialog.updateModal?1:n.length;if(typeof r=="string"&&r.length>0){const s=new FormData;for(let o=0;o<i;o++)s.append("file-"+o,n[o]);this.plugins.fileManager.upload.call(this,r,this.options.imageUploadHeader,s,this.plugins.image.callBack_imgUpload.bind(this,t),this.functions.onImageUploadError)}else this.plugins.image.setup_reader.call(this,n,t.anchor,t.inputWidth,t.inputHeight,t.align,t.alt,i,t.isUpdate)},callBack_imgUpload:function(t,n){if(typeof this.functions.imageUploadHandler=="function")this.functions.imageUploadHandler(n,t,this);else{const r=JSON.parse(n.responseText);r.errorMessage?this.plugins.image.error.call(this,r.errorMessage,r):this.plugins.image.register.call(this,t,r)}},register:function(t,n){const r=n.result;for(let i=0,s=r.length,o;i<s;i++)if(o={name:r[i].name,size:r[i].size},t.isUpdate){this.plugins.image.update_src.call(this,r[i].url,t.element,o);break}else this.plugins.image.create_image.call(this,r[i].url,t.anchor,t.inputWidth,t.inputHeight,t.align,o,t.alt);this.closeLoading()},setup_reader:function(t,n,r,i,s,o,l,c){try{if(l===0){this.closeLoading(),console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");return}this.context.image.base64RenderIndex=l;const a=this._w.FileReader,f=[l];this.context.image.inputX.value=r,this.context.image.inputY.value=i;for(let u=0,m,y;u<l;u++)m=new a,y=t[u],m.onload=(function(_,S,E,d,h){f[h]={result:_.result,file:d},--this.context.image.base64RenderIndex===0&&(this.plugins.image.onRender_imgBase64.call(this,S,f,E,n,r,i,s,o),this.closeLoading())}).bind(this,m,c,this.context.image._element,y,u),m.readAsDataURL(y)}catch(a){throw this.closeLoading(),Error('[SUNEDITOR.image.setup_reader.fail] cause : "'+a.message+'"')}},onRender_imgBase64:function(t,n,r,i,s,o,l,c){const a=this.plugins.image.update_src,f=this.plugins.image.create_image;for(let u=0,m=n.length;u<m;u++)t?(this.context.image._element.setAttribute("data-file-name",n[u].file.name),this.context.image._element.setAttribute("data-file-size",n[u].file.size),a.call(this,n[u].result,r,n[u].file)):f.call(this,n[u].result,i,s,o,l,n[u].file,c)},onRender_imgUrl:function(t){if(t||(t=this.context.image._v_src._linkValue),!t)return!1;const n=this.context.image;try{const r={name:t.split("/").pop(),size:0};this.context.dialog.updateModal?this.plugins.image.update_src.call(this,t,n._element,r):this.plugins.image.create_image.call(this,t,this.plugins.anchor.createAnchor.call(this,n.anchorCtx,!0),n.inputX.value,n.inputY.value,n._align,r,n._altText)}catch(r){throw Error('[SUNEDITOR.image.URLRendering.fail] cause : "'+r.message+'"')}finally{this.closeLoading()}},onRender_link:function(t,n){return n?(n.setAttribute("data-image-link","image"),t.setAttribute("data-image-link",n.href),n.appendChild(t),n):t},setInputSize:function(t,n){if(n&&n.keyCode===32){n.preventDefault();return}this.plugins.resizing._module_setInputSize.call(this,this.context.image,t)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},checkFileInfo:function(){const t=this.plugins.image,n=this.context.image,r=(function(i){t.onModifyMode.call(this,i,null),t.openModify.call(this,!0),n.inputX.value=n._origin_w,n.inputY.value=n._origin_h;const s=this.util.getFormatElement(i);s&&(n._align=s.style.textAlign||s.style.float),this.util.isAnchor(i.parentNode)&&!n.anchorCtx.linkValue&&(n.anchorCtx.linkValue=" "),t.update_image.call(this,!0,!1,!0),t.init.call(this)}).bind(this);this.plugins.fileManager.checkInfo.call(this,"image",["img"],this.functions.onImageUpload,r,!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"image",this.functions.onImageUpload)},create_image:function(t,n,r,i,s,o,l){const c=this.plugins.image,a=this.context.image;this.context.resizing._resize_plugin="image";let f=this.util.createElement("IMG");f.src=t,f.alt=l,f.setAttribute("data-rotate","0"),n=c.onRender_link.call(this,f,n?n.cloneNode(!1):null),a._resizing&&f.setAttribute("data-proportion",a._proportionChecked);const u=this.plugins.component.set_cover.call(this,n),m=this.plugins.component.set_container.call(this,u,"se-image-container");a._captionChecked&&(a._caption=this.plugins.component.create_caption.call(this),u.appendChild(a._caption)),a._element=f,a._cover=u,a._container=m,c.applySize.call(this,r,i),c.setAlign.call(this,s,f,u,m),f.onload=c._image_create_onload.bind(this,f,a.svgDefaultSize,m),this.insertComponent(m,!0,!0,!this.options.mediaAutoSelect)&&this.plugins.fileManager.setInfo.call(this,"image",f,this.functions.onImageUpload,o,!0),this.context.resizing._resize_plugin=""},_image_create_onload:function(t,n,r){if(t.offsetWidth===0&&this.plugins.image.applySize.call(this,n,""),this.options.mediaAutoSelect)this.selectComponent(t,"image");else{const i=this.appendFormatTag(r,null);i&&this.setRange(i,0,i,0)}this.history.push(!1)},update_image:function(t,n,r){const i=this.context.image;let s=i._element,o=i._cover,l=i._container,c=!1;o===null&&(c=!0,s=i._element.cloneNode(!0),o=this.plugins.component.set_cover.call(this,s)),l===null?(o=o.cloneNode(!0),s=o.querySelector("img"),c=!0,l=this.plugins.component.set_container.call(this,o,"se-image-container")):c&&(l.innerHTML="",l.appendChild(o),i._cover=o,i._element=s,c=!1);let a;const f=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;/%$/.test(s.style.width)?a=f!==l.style.width||u!==l.style.height:a=f!==s.style.width||u!==s.style.height,s.alt=i._altText;let m=!1;i._captionChecked?i._caption||(i._caption=this.plugins.component.create_caption.call(this),o.appendChild(i._caption),m=!0):i._caption&&(this.util.removeItem(i._caption),i._caption=null,m=!0);let y=null;const _=this.plugins.anchor.createAnchor.call(this,i.anchorCtx,!0);if(_)i._linkElement!==_||c&&!l.contains(_)?(i._linkElement=_.cloneNode(!1),o.insertBefore(this.plugins.image.onRender_link.call(this,s,i._linkElement),i._caption),y=i._element):i._linkElement.setAttribute("data-image-link","image");else if(i._linkElement!==null){const E=s;if(E.setAttribute("data-image-link",""),o.contains(i._linkElement)){const d=E.cloneNode(!0);o.removeChild(i._linkElement),o.insertBefore(d,i._caption),i._element=s=d}}let S=null;if(c){const E=i._element.parentNode;if(S=this.util.isRangeFormatElement(E)||this.util.isWysiwygDiv(E)?i._element:E||i._element,this.util.getParentElement(i._element,this.util.isNotCheckingNode))S=y?_:i._element,S.parentNode.replaceChild(l,S);else if(this.util.isListCell(S)){const d=this.util.getParentElement(i._element,function(h){return h.parentNode===S});S.insertBefore(l,d),this.util.removeItem(i._element),this.util.removeEmptyNode(d,null,!0)}else if(this.util.isFormatElement(S)){const d=this.util.getParentElement(i._element,function(h){return h.parentNode===S});S=this.util.splitElement(S,d),S.parentNode.insertBefore(l,S),this.util.removeItem(i._element),this.util.removeEmptyNode(S,null,!0),S.children.length===0&&(S.innerHTML=this.util.htmlRemoveWhiteSpace(S.innerHTML))}else if(this.util.isFormatElement(S.parentNode)){const d=S.parentNode;d.parentNode.insertBefore(l,S.previousSibling?d.nextElementSibling:d),i.__updateTags.map(function(h){return S.contains(h)}).length===0&&this.util.removeItem(S)}else S=this.util.isFigures(S.parentNode)?S.parentNode:S,S.parentNode.replaceChild(l,S);s=l.querySelector("img"),i._element=s,i._cover=o,i._container=l}y&&(c?(this.util.removeItem(y),this.util.getListChildren(_,function(E){return/IMG/i.test(E.tagName)}).length===0&&this.util.removeItem(_)):this.util.removeItem(_)),(m||!i._onlyPercentage&&a)&&!t&&(/\d+/.test(s.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,s):this.plugins.resizing.setTransformSize.call(this,s,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0))),i._resizing&&(s.setAttribute("data-proportion",i._proportionChecked),a&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,s,null,null),t&&this.plugins.fileManager.setInfo.call(this,"image",s,this.functions.onImageUpload,null,!0),n&&this.selectComponent(s,"image"),r||this.history.push(!1)},update_src:function(t,n,r){n.src=t,this._w.setTimeout(this.plugins.fileManager.setInfo.bind(this,"image",n,this.functions.onImageUpload,r,!0)),this.selectComponent(n,"image")},onModifyMode:function(t,n){if(!t)return;const r=this.context.image;r._linkElement=r.anchorCtx.linkAnchor=this.util.isAnchor(t.parentNode)?t.parentNode:null,r._element=t,r._cover=this.util.getParentElement(t,"FIGURE"),r._container=this.util.getParentElement(t,this.util.isMediaComponent),r._caption=this.util.getChildElement(r._cover,"FIGCAPTION"),r._align=t.getAttribute("data-align")||t.style.float||"none",t.style.float="",this.plugins.anchor.setCtx(r._linkElement,r.anchorCtx),n&&(r._element_w=n.w,r._element_h=n.h,r._element_t=n.t,r._element_l=n.l);let i=r._element.getAttribute("data-size")||r._element.getAttribute("data-origin"),s,o;i?(i=i.split(","),s=i[0],o=i[1]):n&&(s=n.w,o=n.h),r._origin_w=s||t.style.width||t.width||"",r._origin_h=o||t.style.height||t.height||""},openModify:function(t){const n=this.context.image;n.imgUrlFile&&(n._v_src._linkValue=n.previewSrc.textContent=n.imgUrlFile.value=n._element.src),n._altText=n.altText.value=n._element.alt,(n.modal.querySelector('input[name="suneditor_image_radio"][value="'+n._align+'"]')||n.modal.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,n._align=n.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,n._captionChecked=n.captionCheckEl.checked=!!n._caption,n._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,n,this.plugins.image),t||this.plugins.dialog.open.call(this,"image",!0)},applySize:function(t,n){const r=this.context.image;return t||(t=r.inputX.value||this.options.imageWidth),n||(n=r.inputY.value||this.options.imageHeight),r._onlyPercentage&&t||/%$/.test(t)?(this.plugins.image.setPercentSize.call(this,t,n),!0):((!t||t==="auto")&&(!n||n==="auto")?this.plugins.image.setAutoSize.call(this):this.plugins.image.setSize.call(this,t,n,!1),!1)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},setSize:function(t,n,r,i){const s=this.context.image,o=/^(rw|lw)$/.test(i)&&/\d+/.test(s._element.style.height);/^(th|bh)$/.test(i)&&/\d+/.test(s._element.style.width)||(s._element.style.width=this.util.isNumber(t)?t+s.sizeUnit:t,this.plugins.image.cancelPercentAttr.call(this)),o||(s._element.style.height=this.util.isNumber(n)?n+s.sizeUnit:/%$/.test(n)?"":n),s._align==="center"&&this.plugins.image.setAlign.call(this,null,null,null,null),r||s._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,s)},setAutoSize:function(){const t=this.context.image;t._caption&&(t._caption.style.marginTop=""),this.plugins.resizing.resetTransform.call(this,t._element),this.plugins.image.cancelPercentAttr.call(this),t._element.style.maxWidth="",t._element.style.width="",t._element.style.height="",t._cover.style.width="",t._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),t._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,t)},setOriginSize:function(){const t=this.context.image;t._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,t._element),this.plugins.image.cancelPercentAttr.call(this);const n=(t._element.getAttribute("data-origin")||"").split(","),r=n[0],i=n[1];n&&(t._onlyPercentage||/%$/.test(r)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,r,i):this.plugins.image.setSize.call(this,r,i),this.plugins.resizing._module_saveCurrentSize.call(this,t))},setPercentSize:function(t,n){const r=this.context.image;n=n&&!/%$/.test(n)&&!this.util.getNumber(n,0)?this.util.isNumber(n)?n+"%":n:this.util.isNumber(n)?n+r.sizeUnit:n||"";const i=/%$/.test(n);r._container.style.width=this.util.isNumber(t)?t+"%":t,r._container.style.height="",r._cover.style.width="100%",r._cover.style.height=i?n:"",r._element.style.width="100%",r._element.style.height=i?"":n,r._element.style.maxWidth="",r._align==="center"&&this.plugins.image.setAlign.call(this,null,null,null,null),r._element.setAttribute("data-percentage",t+","+n),this.plugins.resizing.setCaptionPosition.call(this,r._element),this.plugins.resizing._module_saveCurrentSize.call(this,r)},cancelPercentAttr:function(){const t=this.context.image;t._cover.style.width="",t._cover.style.height="",t._container.style.width="",t._container.style.height="",this.util.removeClass(t._container,this.context.image._floatClassRegExp),this.util.addClass(t._container,"__se__float-"+t._align),t._align==="center"&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(t,n,r,i){const s=this.context.image;t||(t=s._align),n||(n=s._element),r||(r=s._cover),i||(i=s._container),/%$/.test(n.style.width)&&t==="center"?(i.style.minWidth="100%",r.style.width=i.style.width):(i.style.minWidth="",r.style.width=this.context.resizing._rotateVertical?n.style.height||n.offsetHeight:!n.style.width||n.style.width==="auto"?"":n.style.width||"100%"),this.util.hasClass(i,"__se__float-"+t)||(this.util.removeClass(i,s._floatClassRegExp),this.util.addClass(i,"__se__float-"+t)),n.setAttribute("data-align",t)},init:function(){const t=this.context.image;t.imgInputFile&&(t.imgInputFile.value=""),t.imgUrlFile&&(t._v_src._linkValue=t.previewSrc.textContent=t.imgUrlFile.value=""),t.imgInputFile&&t.imgUrlFile&&(t.imgUrlFile.removeAttribute("disabled"),t.previewSrc.style.textDecoration=""),t.altText.value="",t.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,t.captionCheckEl.checked=!1,t._element=null,this.plugins.image.openTab.call(this,"init"),t._resizing&&(t.inputX.value=this.options.imageWidth===t._defaultSizeX?"":this.options.imageWidth,t.inputY.value=this.options.imageHeight===t._defaultSizeY?"":this.options.imageHeight,t.proportion.checked=!0,t._ratio=!1,t._ratioX=1,t._ratioY=1),this.plugins.anchor.init.call(this,t.anchorCtx)}},nv={name:"video",display:"dialog",add:function(t){t.addModule([go,Eu,J2,Tu]);const n=t.options,r=t.context,i=r.video={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,sizeUnit:n._videoSizeUnit,_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_youtubeQuery:n.youtubeQuery,_vimeoQuery:n.vimeoQuery,_videoRatio:n.videoRatio*100+"%",_defaultRatio:n.videoRatio*100+"%",_linkValue:"",_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"100%",_defaultSizeY:n.videoRatio*100+"%",_origin_w:n.videoWidth==="100%"?"":n.videoWidth,_origin_h:n.videoHeight==="56.25%"?"":n.videoHeight,_proportionChecked:!0,_resizing:n.videoResizing,_resizeDotHide:!n.videoHeightShow,_rotation:n.videoRotation,_alignHide:!n.videoAlignShow,_onlyPercentage:n.videoSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!1};let s=this.setDialog(t);i.modal=s,i.videoInputFile=s.querySelector("._se_video_file"),i.videoUrlFile=s.querySelector(".se-input-url"),i.focusElement=i.videoUrlFile||i.videoInputFile,i.preview=s.querySelector(".se-link-preview"),s.querySelector("form").addEventListener("submit",this.submit.bind(t)),i.videoInputFile&&s.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(i.videoInputFile,i.videoUrlFile,i.preview)),i.videoInputFile&&i.videoUrlFile&&i.videoInputFile.addEventListener("change",this._fileInputChange.bind(i)),i.videoUrlFile&&i.videoUrlFile.addEventListener("input",this._onLinkPreview.bind(i.preview,i,n.linkProtocol)),i.proportion={},i.videoRatioOption={},i.inputX={},i.inputY={},n.videoResizing&&(i.proportion=s.querySelector("._se_video_check_proportion"),i.videoRatioOption=s.querySelector(".se-video-ratio"),i.inputX=s.querySelector("._se_video_size_x"),i.inputY=s.querySelector("._se_video_size_y"),i.inputX.value=n.videoWidth,i.inputY.value=n.videoHeight,i.inputX.addEventListener("keyup",this.setInputSize.bind(t,"x")),i.inputY.addEventListener("keyup",this.setInputSize.bind(t,"y")),i.inputX.addEventListener("change",this.setRatio.bind(t)),i.inputY.addEventListener("change",this.setRatio.bind(t)),i.proportion.addEventListener("change",this.setRatio.bind(t)),i.videoRatioOption.addEventListener("change",this.setVideoRatio.bind(t)),s.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(t))),r.dialog.modal.appendChild(s),s=null},setDialog:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-dialog-content",i.style.display="none";let s='<form method="post" enctype="multipart/form-data"><div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" title="'+r.dialogBox.close+'" aria-label="'+r.dialogBox.close+'">'+t.icons.cancel+'</button><span class="se-modal-title">'+r.dialogBox.videoBox.title+'</span></div><div class="se-dialog-body">';if(n.videoFileInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.videoBox.file+'</label><div class="se-dialog-form-files"><input class="se-input-form _se_video_file" type="file" accept="'+n.videoAccept+'"'+(n.videoMultipleFile?' multiple="multiple"':"")+'/><button type="button" data-command="filesRemove" class="se-btn se-dialog-files-edge-button se-file-remove" title="'+r.controller.remove+'" aria-label="'+r.controller.remove+'">'+t.icons.cancel+"</button></div></div>"),n.videoUrlInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.videoBox.url+'</label><input class="se-input-form se-input-url" type="text" /><pre class="se-link-preview"></pre></div>'),n.videoResizing){const o=n.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=n.videoRatio,c=n.videoSizeOnlyPercentage,a=c?' style="display: none !important;"':"",f=n.videoHeightShow?"":' style="display: none !important;"',u=n.videoRatioShow?"":' style="display: none !important;"',m=!c&&!n.videoHeightShow&&!n.videoRatioShow?' style="display: none !important;"':"";s+='<div class="se-dialog-form"><div class="se-dialog-size-text"><label class="size-w">'+r.dialogBox.width+'</label><label class="se-dialog-size-x"> </label><label class="size-h"'+f+">"+r.dialogBox.height+'</label><label class="size-h"'+u+">("+r.dialogBox.ratio+')</label></div><input class="se-input-control _se_video_size_x" placeholder="100%"'+(c?' type="number" min="1"':'type="text"')+(c?' max="100"':"")+'/><label class="se-dialog-size-x"'+m+">"+(c?"%":"x")+'</label><input class="se-input-control _se_video_size_y" placeholder="'+n.videoRatio*100+'%"'+(c?' type="number" min="1"':'type="text"')+(c?' max="100"':"")+f+'/><select class="se-input-select se-video-ratio" title="'+r.dialogBox.ratio+'" aria-label="'+r.dialogBox.ratio+'"'+u+">",f||(s+='<option value=""> - </option>');for(let y=0,_=o.length;y<_;y++)s+='<option value="'+o[y].value+'"'+(l.toString()===o[y].value.toString()?" selected":"")+">"+o[y].name+"</option>";s+='</select><button type="button" title="'+r.dialogBox.revertButton+'" aria-label="'+r.dialogBox.revertButton+'" class="se-btn se-dialog-btn-revert" style="float: right;">'+t.icons.revert+'</button></div><div class="se-dialog-form se-dialog-form-footer"'+a+m+'><label><input type="checkbox" class="se-dialog-btn-check _se_video_check_proportion" checked/> '+r.dialogBox.proportion+"</label></div>"}return s+='</div><div class="se-dialog-footer"><div'+(n.videoAlignShow?"":' style="display: none"')+'><label><input type="radio" name="suneditor_video_radio" class="se-dialog-btn-radio" value="none" checked>'+r.dialogBox.basic+'</label><label><input type="radio" name="suneditor_video_radio" class="se-dialog-btn-radio" value="left">'+r.dialogBox.left+'</label><label><input type="radio" name="suneditor_video_radio" class="se-dialog-btn-radio" value="center">'+r.dialogBox.center+'</label><label><input type="radio" name="suneditor_video_radio" class="se-dialog-btn-radio" value="right">'+r.dialogBox.right+'</label></div><button type="submit" class="se-btn-primary" title="'+r.dialogBox.submitButton+'" aria-label="'+r.dialogBox.submitButton+'"><span>'+r.dialogBox.submitButton+"</span></button></div></form>",i.innerHTML=s,i},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(t,n){this.value="",t&&(t.removeAttribute("disabled"),n.style.textDecoration="")},_onLinkPreview:function(t,n,r){const i=r.target.value.trim();/^<iframe.*\/iframe>$/.test(i)?(t._linkValue=i,this.textContent='<IFrame :src=".."></IFrame>'):t._linkValue=this.textContent=i?n&&i.indexOf("://")===-1&&i.indexOf("#")!==0?n+i:i.indexOf("://")===-1?"/"+i:i:""},_setTagAttrs:function(t){t.setAttribute("controls",!0);const n=this.options.videoTagAttrs;if(n)for(let r in n)this.util.hasOwn(n,r)&&t.setAttribute(r,n[r])},createVideoTag:function(){const t=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,t),t},_setIframeAttrs:function(t){t.frameBorder="0",t.allowFullscreen=!0;const n=this.options.videoIframeAttrs;if(n)for(let r in n)this.util.hasOwn(n,r)&&t.setAttribute(r,n[r])},createIframeTag:function(){const t=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,t),t},fileTags:["iframe","video"],select:function(t){this.plugins.video.onModifyMode.call(this,t,this.plugins.resizing.call_controller_resize.call(this,t,"video"))},destroy:function(t){const n=t||this.context.video._element,r=this.context.video._container,i=n.getAttribute("data-index")*1;if(typeof this.functions.onVideoDeleteBefore=="function"&&this.functions.onVideoDeleteBefore(n,r,i,this)===!1)return;let s=r.previousElementSibling||r.nextElementSibling;const o=r.parentNode;this.util.removeItem(r),this.plugins.video.init.call(this),this.controllersOff(),o!==this.context.element.wysiwyg&&this.util.removeItemAllParents(o,function(l){return l.childNodes.length===0},null),this.focusEdge(s),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(t){const n=this.context.video;t?n.videoInputFile&&this.options.videoMultipleFile&&n.videoInputFile.removeAttribute("multiple"):(n.inputX.value=n._origin_w=this.options.videoWidth===n._defaultSizeX?"":this.options.videoWidth,n.inputY.value=n._origin_h=this.options.videoHeight===n._defaultSizeY?"":this.options.videoHeight,n.proportion.disabled=!0,n.videoInputFile&&this.options.videoMultipleFile&&n.videoInputFile.setAttribute("multiple","multiple")),n._resizing&&this.plugins.video.setVideoRatioSelect.call(this,n._origin_h||n._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video",this.currentControllerName==="video")},setVideoRatio:function(t){const n=this.context.video,r=t.target.options[t.target.selectedIndex].value;n._defaultSizeY=n._videoRatio=r?r*100+"%":n._defaultSizeY,n.inputY.placeholder=r?r*100+"%":"",n.inputY.value=""},setInputSize:function(t,n){if(n&&n.keyCode===32){n.preventDefault();return}const r=this.context.video;this.plugins.resizing._module_setInputSize.call(this,r,t),t==="y"&&this.plugins.video.setVideoRatioSelect.call(this,n.target.value||r._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(t){const n=this.context.video,r=this.plugins.video;t.preventDefault(),t.stopPropagation(),n._align=n.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{n.videoInputFile&&n.videoInputFile.files.length>0?(this.showLoading(),r.submitAction.call(this,this.context.video.videoInputFile.files)):n.videoUrlFile&&n._linkValue.length>0&&(this.showLoading(),r.setup_url.call(this,n._linkValue))}catch(i){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+i.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(t){if(t.length===0)return;let n=0,r=[];for(let l=0,c=t.length;l<c;l++)/video/i.test(t[l].type)&&(r.push(t[l]),n+=t[l].size);const i=this.options.videoUploadSizeLimit;if(i>0){let l=0;const c=this.context.video._infoList;for(let a=0,f=c.length;a<f;a++)l+=c[a].size*1;if(n+l>i){this.closeLoading();const a="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";(typeof this.functions.onVideoUploadError!="function"||this.functions.onVideoUploadError(a,{limitSize:i,currentSize:l,uploadSize:n},this))&&this.functions.noticeOpen(a);return}}const s=this.context.video;s._uploadFileLength=r.length;const o={inputWidth:s.inputX.value,inputHeight:s.inputY.value,align:s._align,isUpdate:this.context.dialog.updateModal,element:s._element};if(typeof this.functions.onVideoUploadBefore=="function"){const l=this.functions.onVideoUploadBefore(r,o,this,(function(c){c&&this._w.Array.isArray(c.result)?this.plugins.video.register.call(this,o,c):this.plugins.video.upload.call(this,o,c)}).bind(this));if(typeof l>"u")return;if(!l){this.closeLoading();return}typeof l=="object"&&l.length>0&&(r=l)}this.plugins.video.upload.call(this,o,r)},error:function(t,n){if(this.closeLoading(),typeof this.functions.onVideoUploadError!="function"||this.functions.onVideoUploadError(t,n,this))throw this.functions.noticeOpen(t),Error("[SUNEDITOR.plugin.video.error] response: "+t)},upload:function(t,n){if(!n){this.closeLoading();return}if(typeof n=="string"){this.plugins.video.error.call(this,n,null);return}const r=this.options.videoUploadUrl,i=this.context.dialog.updateModal?1:n.length;if(typeof r=="string"&&r.length>0){const s=new FormData;for(let o=0;o<i;o++)s.append("file-"+o,n[o]);this.plugins.fileManager.upload.call(this,r,this.options.videoUploadHeader,s,this.plugins.video.callBack_videoUpload.bind(this,t),this.functions.onVideoUploadError)}else throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.')},callBack_videoUpload:function(t,n){if(typeof this.functions.videoUploadHandler=="function")this.functions.videoUploadHandler(n,t,this);else{const r=JSON.parse(n.responseText);r.errorMessage?this.plugins.video.error.call(this,r.errorMessage,r):this.plugins.video.register.call(this,t,r)}},register:function(t,n){const r=n.result,i=this.plugins.video.createVideoTag.call(this);for(let s=0,o=r.length,l;s<o;s++)l={name:r[s].name,size:r[s].size},this.plugins.video.create_video.call(this,t.isUpdate?t.element:i.cloneNode(!1),r[s].url,t.inputWidth,t.inputHeight,t.align,l,t.isUpdate);this.closeLoading()},setup_url:function(t){try{const n=this.context.video;if(t||(t=n._linkValue),!t||/^<iframe.*\/iframe>$/.test(t)&&(t=new this._w.DOMParser().parseFromString(t,"text/html").querySelector("iframe").src,t.length===0))return!1;if(/youtu\.?be/.test(t)){if(/^http/.test(t)||(t="https://"+t),t=t.replace("watch?v=",""),/^\/\/.+\/embed\//.test(t)||(t=t.replace(t.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),n._youtubeQuery.length>0)if(/\?/.test(t)){const r=t.split("?");t=r[0]+"?"+n._youtubeQuery+"&"+r[1]}else t+="?"+n._youtubeQuery}else if(/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1),n._vimeoQuery.length>0))if(/\?/.test(t)){const r=t.split("?");t=r[0]+"?"+n._vimeoQuery+"&"+r[1]}else t+="?"+n._vimeoQuery;this.plugins.video.create_video.call(this,this.plugins.video[!/embed|iframe|player|\/e\/|\.php|\.html?/.test(t)&&!/vimeo\.com/.test(t)?"createVideoTag":"createIframeTag"].call(this),t,n.inputX.value,n.inputY.value,n._align,null,this.context.dialog.updateModal)}catch(n){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+n.message+'"')}finally{this.closeLoading()}},create_video:function(t,n,r,i,s,o,l){this.context.resizing._resize_plugin="video";const c=this.context.video;let a=null,f=null,u=!1;if(l){if(t=c._element,t.src!==n){u=!0;const E=/youtu\.?be/.test(n),d=/vimeo\.com/.test(n);if((E||d)&&!/^iframe$/i.test(t.nodeName)){const h=this.plugins.video.createIframeTag.call(this);h.src=n,t.parentNode.replaceChild(h,t),c._element=t=h}else if(!E&&!d&&!/^video$/i.test(t.nodeName)){const h=this.plugins.video.createVideoTag.call(this);h.src=n,t.parentNode.replaceChild(h,t),c._element=t=h}else t.src=n}f=c._container,a=this.util.getParentElement(t,"FIGURE")}else u=!0,t.src=n,c._element=t,a=this.plugins.component.set_cover.call(this,t),f=this.plugins.component.set_container.call(this,a,"se-video-container");c._cover=a,c._container=f;const m=this.plugins.resizing._module_getSizeX.call(this,c)!==(r||c._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,c)!==(i||c._videoRatio),y=!l||m;c._resizing&&(this.context.video._proportionChecked=c.proportion.checked,t.setAttribute("data-proportion",c._proportionChecked));let _=!1;y&&(_=this.plugins.video.applySize.call(this)),_&&s==="center"||this.plugins.video.setAlign.call(this,null,t,a,f);let S=!0;if(l)c._resizing&&this.context.resizing._rotateVertical&&y&&this.plugins.resizing.setTransformSize.call(this,t,null,null);else if(S=this.insertComponent(f,!1,!0,!this.options.mediaAutoSelect),!this.options.mediaAutoSelect){const E=this.appendFormatTag(f,null);E&&this.setRange(E,0,E,0)}S&&(u&&this.plugins.fileManager.setInfo.call(this,"video",t,this.functions.onVideoUpload,o,!0),l&&(this.selectComponent(t,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(t){if(!t)return;const n=this.context.video;/^video$/i.test(t.nodeName)?this.plugins.video._setTagAttrs.call(this,t):this.plugins.video._setIframeAttrs.call(this,t);const r=t.parentNode;let i=this.util.isRangeFormatElement(r)||this.util.isWysiwygDiv(r)?t:r||t;const s=t;n._element=t=t.cloneNode(!0);const o=n._cover=this.plugins.component.set_cover.call(this,t),l=n._container=this.plugins.component.set_container.call(this,o,"se-video-container");try{const c=i.querySelector("figcaption");let a=null;c&&(a=this.util.createElement("DIV"),a.innerHTML=c.innerHTML,this.util.removeItem(c));const f=(t.getAttribute("data-size")||t.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,f[0]||s.style.width||s.width||"",f[1]||s.style.height||s.height||"");const u=this.util.getFormatElement(s);if(u&&(n._align=u.style.textAlign||u.style.float),this.plugins.video.setAlign.call(this,null,t,o,l),this.util.getParentElement(s,this.util.isNotCheckingNode))s.parentNode.replaceChild(l,s);else if(this.util.isListCell(i)){const m=this.util.getParentElement(s,function(y){return y.parentNode===i});i.insertBefore(l,m),this.util.removeItem(s),this.util.removeEmptyNode(m,null,!0)}else if(this.util.isFormatElement(i)){const m=this.util.getParentElement(s,function(y){return y.parentNode===i});i=this.util.splitElement(i,m),i.parentNode.insertBefore(l,i),this.util.removeItem(s),this.util.removeEmptyNode(i,null,!0),i.children.length===0&&(i.innerHTML=this.util.htmlRemoveWhiteSpace(i.innerHTML))}else i.parentNode.replaceChild(l,i);a&&i.parentNode.insertBefore(a,l.nextElementSibling)}catch(c){console.warn("[SUNEDITOR.video.error] Maybe the video tag is nested.",c)}this.plugins.fileManager.setInfo.call(this,"video",t,this.functions.onVideoUpload,null,!0),this.plugins.video.init.call(this)},onModifyMode:function(t,n){const r=this.context.video;r._element=t,r._cover=this.util.getParentElement(t,"FIGURE"),r._container=this.util.getParentElement(t,this.util.isMediaComponent),r._align=t.style.float||t.getAttribute("data-align")||"none",t.style.float="",n&&(r._element_w=n.w,r._element_h=n.h,r._element_t=n.t,r._element_l=n.l);let i=r._element.getAttribute("data-size")||r._element.getAttribute("data-origin"),s,o;i?(i=i.split(","),s=i[0],o=i[1]):n&&(s=n.w,o=n.h),r._origin_w=s||t.style.width||t.width||"",r._origin_h=o||t.style.height||t.height||""},openModify:function(t){const n=this.context.video;if(n.videoUrlFile&&(n._linkValue=n.preview.textContent=n.videoUrlFile.value=n._element.src||(n._element.querySelector("source")||"").src||""),(n.modal.querySelector('input[name="suneditor_video_radio"][value="'+n._align+'"]')||n.modal.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,n._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,n,this.plugins.video);const r=n._videoRatio=this.plugins.resizing._module_getSizeY.call(this,n);this.plugins.video.setVideoRatioSelect.call(this,r)||(n.inputY.value=n._onlyPercentage?this.util.getNumber(r,2):r)}t||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(t){let n=!1;const r=this.context.video,i=r.videoRatioOption.options;/%$/.test(t)||r._onlyPercentage?t=this.util.getNumber(t,2)/100+"":(!this.util.isNumber(t)||t*1>=1)&&(t=""),r.inputY.placeholder="";for(let s=0,o=i.length;s<o;s++)i[s].value===t?(n=i[s].selected=!0,r.inputY.placeholder=t?t*100+"%":""):i[s].selected=!1;return n},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"video",["iframe","video"],this.functions.onVideoUpload,this.plugins.video._update_videoCover.bind(this),!0)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"video",this.functions.onVideoUpload)},applySize:function(t,n){const r=this.context.video;return t||(t=r.inputX.value||this.options.videoWidth),n||(n=r.inputY.value||this.options.videoHeight),r._onlyPercentage||/%$/.test(t)||!t?(this.plugins.video.setPercentSize.call(this,t||"100%",n||(/%$/.test(r._videoRatio)?r._videoRatio:r._defaultRatio)),!0):((!t||t==="auto")&&(!n||n==="auto")?this.plugins.video.setAutoSize.call(this):this.plugins.video.setSize.call(this,t,n||r._videoRatio||r._defaultRatio,!1),!1)},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.video)},setSize:function(t,n,r,i){const s=this.context.video,o=/^(rw|lw)$/.test(i),l=/^(th|bh)$/.test(i);l||(t=this.util.getNumber(t,0)),o||(n=this.util.isNumber(n)?n+s.sizeUnit:n||""),t=t?t+s.sizeUnit:"",l||(s._element.style.width=t),o||(s._cover.style.paddingBottom=s._cover.style.height=n),!l&&!/%$/.test(t)&&(s._cover.style.width=t,s._container.style.width=""),!o&&!/%$/.test(n)?s._element.style.height=n:s._element.style.height="",r||s._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,s)},setAutoSize:function(){this.plugins.video.setPercentSize.call(this,100,this.context.video._defaultRatio)},setOriginSize:function(t){const n=this.context.video;n._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,n._element),this.plugins.video.cancelPercentAttr.call(this);const r=((t?n._element.getAttribute("data-size"):"")||n._element.getAttribute("data-origin")||"").split(",");if(r){const i=r[0],s=r[1];n._onlyPercentage||/%$/.test(i)&&(/%$/.test(s)||!/\d/.test(s))?this.plugins.video.setPercentSize.call(this,i,s):this.plugins.video.setSize.call(this,i,s),this.plugins.resizing._module_saveCurrentSize.call(this,n)}},setPercentSize:function(t,n){const r=this.context.video;n=n&&!/%$/.test(n)&&!this.util.getNumber(n,0)?this.util.isNumber(n)?n+"%":n:this.util.isNumber(n)?n+r.sizeUnit:n||r._defaultRatio,r._container.style.width=this.util.isNumber(t)?t+"%":t,r._container.style.height="",r._cover.style.width="100%",r._cover.style.height=n,r._cover.style.paddingBottom=n,r._element.style.width="100%",r._element.style.height="100%",r._element.style.maxWidth="",r._align==="center"&&this.plugins.video.setAlign.call(this,null,null,null,null),r._element.setAttribute("data-percentage",t+","+n),this.plugins.resizing._module_saveCurrentSize.call(this,r)},cancelPercentAttr:function(){const t=this.context.video;t._cover.style.width="",t._cover.style.height="",t._cover.style.paddingBottom="",t._container.style.width="",t._container.style.height="",this.util.removeClass(t._container,this.context.video._floatClassRegExp),this.util.addClass(t._container,"__se__float-"+t._align),t._align==="center"&&this.plugins.video.setAlign.call(this,null,null,null,null)},setAlign:function(t,n,r,i){const s=this.context.video;t||(t=s._align),n||(n=s._element),r||(r=s._cover),i||(i=s._container),/%$/.test(n.style.width)&&t==="center"?(i.style.minWidth="100%",r.style.width=i.style.width,r.style.height=r.style.height,r.style.paddingBottom=/%$/.test(r.style.height)?this.util.getNumber(this.util.getNumber(r.style.height,2)/100*this.util.getNumber(r.style.width,2),2)+"%":r.style.height):(i.style.minWidth="",r.style.width=this.context.resizing._rotateVertical?n.style.height||n.offsetHeight:n.style.width||"100%",r.style.paddingBottom=r.style.height),this.util.hasClass(i,"__se__float-"+t)||(this.util.removeClass(i,s._floatClassRegExp),this.util.addClass(i,"__se__float-"+t)),n.setAttribute("data-align",t)},init:function(){const t=this.context.video;t.videoInputFile&&(t.videoInputFile.value=""),t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=""),t.videoInputFile&&t.videoUrlFile&&(t.videoUrlFile.removeAttribute("disabled"),t.preview.style.textDecoration=""),t._origin_w=this.options.videoWidth,t._origin_h=this.options.videoHeight,t.modal.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,t._resizing&&(t.inputX.value=this.options.videoWidth===t._defaultSizeX?"":this.options.videoWidth,t.inputY.value=this.options.videoHeight===t._defaultSizeY?"":this.options.videoHeight,t.proportion.checked=!0,t.proportion.disabled=!0,this.plugins.video.setVideoRatioSelect.call(this,t._defaultRatio))}},rv={name:"audio",display:"dialog",add:function(t){t.addModule([go,Eu,Tu]);const n=t.context,r=n.audio={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,targetSelect:null,_origin_w:t.options.audioWidth,_origin_h:t.options.audioHeight,_linkValue:"",_element:null,_cover:null,_container:null};let i=this.setDialog(t);r.modal=i,r.audioInputFile=i.querySelector("._se_audio_files"),r.audioUrlFile=i.querySelector(".se-input-url"),r.focusElement=r.audioInputFile||r.audioUrlFile,r.preview=i.querySelector(".se-link-preview");let s=this.setController(t);r.controller=s,i.querySelector("form").addEventListener("submit",this.submit.bind(t)),r.audioInputFile&&i.querySelector(".se-dialog-files-edge-button").addEventListener("click",this._removeSelectedFiles.bind(r.audioInputFile,r.audioUrlFile,r.preview)),r.audioInputFile&&r.audioUrlFile&&r.audioInputFile.addEventListener("change",this._fileInputChange.bind(r)),s.addEventListener("click",this.onClick_controller.bind(t)),r.audioUrlFile&&r.audioUrlFile.addEventListener("input",this._onLinkPreview.bind(r.preview,r,t.options.linkProtocol)),n.dialog.modal.appendChild(i),n.element.relative.appendChild(s),i=null,s=null},setDialog:function(t){const n=t.options,r=t.lang,i=t.util.createElement("DIV");i.className="se-dialog-content",i.style.display="none";let s='<form method="post" enctype="multipart/form-data"><div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" title="'+r.dialogBox.close+'" aria-label="'+r.dialogBox.close+'">'+t.icons.cancel+'</button><span class="se-modal-title">'+r.dialogBox.audioBox.title+'</span></div><div class="se-dialog-body">';return n.audioFileInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.audioBox.file+'</label><div class="se-dialog-form-files"><input class="se-input-form _se_audio_files" type="file" accept="'+n.audioAccept+'"'+(n.audioMultipleFile?' multiple="multiple"':"")+'/><button type="button" data-command="filesRemove" class="se-btn se-dialog-files-edge-button se-file-remove" title="'+r.controller.remove+'" aria-label="'+r.controller.remove+'">'+t.icons.cancel+"</button></div></div>"),n.audioUrlInput&&(s+='<div class="se-dialog-form"><label>'+r.dialogBox.audioBox.url+'</label><input class="se-input-form se-input-url" type="text" /><pre class="se-link-preview"></pre></div>'),s+='</div><div class="se-dialog-footer"><button type="submit" class="se-btn-primary" title="'+r.dialogBox.submitButton+'" aria-label="'+r.dialogBox.submitButton+'"><span>'+r.dialogBox.submitButton+"</span></button></div></form>",i.innerHTML=s,i},setController:function(t){const n=t.lang,r=t.icons,i=t.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='<div class="se-arrow se-arrow-up"></div><div class="link-content"><div class="se-btn-group"><button type="button" data-command="update" tabindex="-1" class="se-tooltip">'+r.edit+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.edit+'</span></span></button><button type="button" data-command="delete" tabindex="-1" class="se-tooltip">'+r.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.remove+"</span></span></button></div></div>",i},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(t,n){this.value="",t&&(t.removeAttribute("disabled"),n.style.textDecoration="")},_createAudioTag:function(){const t=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,t);const n=this.context.audio._origin_w,r=this.context.audio._origin_h;return t.setAttribute("origin-size",n+","+r),t.style.cssText=(n?"width:"+n+"; ":"")+(r?"height:"+r+";":""),t},_setTagAttrs:function(t){t.setAttribute("controls",!0);const n=this.options.audioTagAttrs;if(n)for(let r in n)this.util.hasOwn(n,r)&&t.setAttribute(r,n[r])},_onLinkPreview:function(t,n,r){const i=r.target.value.trim();t._linkValue=this.textContent=i?n&&i.indexOf("://")===-1&&i.indexOf("#")!==0?n+i:i.indexOf("://")===-1?"/"+i:i:""},fileTags:["audio"],select:function(t){this.plugins.audio.onModifyMode.call(this,t)},destroy:function(t){t=t||this.context.audio._element;const n=this.util.getParentElement(t,this.util.isComponent)||t,r=t.getAttribute("data-index")*1;if(typeof this.functions.onAudioDeleteBefore=="function"&&this.functions.onAudioDeleteBefore(t,n,r,this)===!1)return;const i=n.previousElementSibling||n.nextElementSibling,s=n.parentNode;this.util.removeItem(n),this.plugins.audio.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,function(o){return o.childNodes.length===0},null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",r,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(t){const n=this.context.audio;t?n._element?(this.context.dialog.updateModal=!0,n._linkValue=n.preview.textContent=n.audioUrlFile.value=n._element.src,n.audioInputFile&&this.options.audioMultipleFile&&n.audioInputFile.removeAttribute("multiple")):n.audioInputFile&&this.options.audioMultipleFile&&n.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),n.audioInputFile&&this.options.audioMultipleFile&&n.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio",this.currentControllerName==="audio")},submit:function(t){const n=this.context.audio;t.preventDefault(),t.stopPropagation();try{n.audioInputFile&&n.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,n.audioInputFile.files)):n.audioUrlFile&&n._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,n._linkValue))}catch(r){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+r.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(t){if(t.length===0)return;let n=0,r=[];for(let l=0,c=t.length;l<c;l++)/audio/i.test(t[l].type)&&(r.push(t[l]),n+=t[l].size);const i=this.options.audioUploadSizeLimit;if(i>0){let l=0;const c=this.context.audio._infoList;for(let a=0,f=c.length;a<f;a++)l+=c[a].size*1;if(n+l>i){this.closeLoading();const a="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";(typeof this.functions.onAudioUploadError!="function"||this.functions.onAudioUploadError(a,{limitSize:i,currentSize:l,uploadSize:n},this))&&this.functions.noticeOpen(a);return}}const s=this.context.audio;s._uploadFileLength=r.length;const o={isUpdate:this.context.dialog.updateModal,element:s._element};if(typeof this.functions.onAudioUploadBefore=="function"){const l=this.functions.onAudioUploadBefore(r,o,this,(function(c){c&&this._w.Array.isArray(c.result)?this.plugins.audio.register.call(this,o,c):this.plugins.audio.upload.call(this,o,c)}).bind(this));if(typeof l>"u")return;if(!l){this.closeLoading();return}typeof l=="object"&&l.length>0&&(r=l)}this.plugins.audio.upload.call(this,o,r)},error:function(t,n){if(this.closeLoading(),typeof this.functions.onAudioUploadError!="function"||this.functions.onAudioUploadError(t,n,this))throw this.functions.noticeOpen(t),Error("[SUNEDITOR.plugin.audio.exception] response: "+t)},upload:function(t,n){if(!n){this.closeLoading();return}if(typeof n=="string"){this.plugins.audio.error.call(this,n,null);return}const r=this.options.audioUploadUrl,i=this.context.dialog.updateModal?1:n.length,s=new FormData;for(let o=0;o<i;o++)s.append("file-"+o,n[o]);this.plugins.fileManager.upload.call(this,r,this.options.audioUploadHeader,s,this.plugins.audio.callBack_upload.bind(this,t),this.functions.onAudioUploadError)},callBack_upload:function(t,n){if(typeof this.functions.audioUploadHandler=="function")this.functions.audioUploadHandler(n,t,this);else{const r=JSON.parse(n.responseText);r.errorMessage?this.plugins.audio.error.call(this,r.errorMessage,r):this.plugins.audio.register.call(this,t,r)}},register:function(t,n){const r=n.result;for(let i=0,s=r.length,o,l;i<s;i++)t.isUpdate?l=t.element:l=this.plugins.audio._createAudioTag.call(this),o={name:r[i].name,size:r[i].size},this.plugins.audio.create_audio.call(this,l,r[i].url,o,t.isUpdate);this.closeLoading()},setupUrl:function(t){try{if(t.length===0)return!1;this.plugins.audio.create_audio.call(this,this.plugins.audio._createAudioTag.call(this),t,null,this.context.dialog.updateModal)}catch(n){throw Error('[SUNEDITOR.audio.audio.fail] cause : "'+n.message+'"')}finally{this.closeLoading()}},create_audio:function(t,n,r,i){const s=this.context.audio;if(i)if(s._element&&(t=s._element),t&&t.src!==n)t.src=n,this.selectComponent(t,"audio");else{this.selectComponent(t,"audio");return}else{t.src=n;const o=this.plugins.component.set_cover.call(this,t),l=this.plugins.component.set_container.call(this,o,"");if(!this.insertComponent(l,!1,!0,!this.options.mediaAutoSelect)){this.focus();return}if(!this.options.mediaAutoSelect){const c=this.appendFormatTag(l,null);c&&this.setRange(c,0,c,0)}}this.plugins.fileManager.setInfo.call(this,"audio",t,this.functions.onAudioUpload,r,!1),i&&this.history.push(!1)},updateCover:function(t){const n=this.context.audio;this.plugins.audio._setTagAttrs.call(this,t);const r=t.parentNode;let i=this.util.isRangeFormatElement(r)||this.util.isWysiwygDiv(r)?t:r||t;const s=t;n._element=t=t.cloneNode(!1);const o=this.plugins.component.set_cover.call(this,t),l=this.plugins.component.set_container.call(this,o,"se-audio-container");try{if(this.util.getParentElement(s,this.util.isNotCheckingNode))s.parentNode.replaceChild(l,s);else if(this.util.isListCell(i)){const c=this.util.getParentElement(s,function(a){return a.parentNode===i});i.insertBefore(l,c),this.util.removeItem(s),this.util.removeEmptyNode(c,null,!0)}else if(this.util.isFormatElement(i)){const c=this.util.getParentElement(s,function(a){return a.parentNode===i});i=this.util.splitElement(i,c),i.parentNode.insertBefore(l,i),this.util.removeItem(s),this.util.removeEmptyNode(i,null,!0),i.children.length===0&&(i.innerHTML=this.util.htmlRemoveWhiteSpace(i.innerHTML))}else i.parentNode.replaceChild(l,i)}catch(c){console.warn("[SUNEDITOR.audio.error] Maybe the audio tag is nested.",c)}this.plugins.fileManager.setInfo.call(this,"audio",t,this.functions.onAudioUpload,null,!1),this.plugins.audio.init.call(this)},onModifyMode:function(t){const n=this.context.audio;this.setControllerPosition(n.controller,t,"bottom",{left:0,top:0}),this.controllersOn(n.controller,t,this.plugins.audio.onControllerOff.bind(this,t),"audio"),this.util.addClass(t,"active"),n._element=t,n._cover=this.util.getParentElement(t,"FIGURE"),n._container=this.util.getParentElement(t,this.util.isComponent)},openModify:function(t){if(this.context.audio.audioUrlFile){const n=this.context.audio;n._linkValue=n.preview.textContent=n.audioUrlFile.value=n._element.src}t||this.plugins.dialog.open.call(this,"audio",!0)},onClick_controller:function(t){t.stopPropagation();const n=t.target.getAttribute("data-command");n&&(t.preventDefault(),/update/.test(n)?this.plugins.audio.openModify.call(this,!1):this.plugins.audio.destroy.call(this,this.context.audio._element),this.controllersOff())},onControllerOff:function(t){this.util.removeClass(t,"active"),this.context.audio.controller.style.display="none"},init:function(){if(this.context.dialog.updateModal)return;const t=this.context.audio;t.audioInputFile&&(t.audioInputFile.value=""),t.audioUrlFile&&(t._linkValue=t.preview.textContent=t.audioUrlFile.value=""),t.audioInputFile&&t.audioUrlFile&&(t.audioUrlFile.removeAttribute("disabled"),t.preview.style.textDecoration=""),t._element=null}},qf="https://katex.org/docs/supported.html",iv={name:"math",display:"dialog",add:function(t){t.addModule([go]);const n=t.context;n.math={focusElement:null,previewElement:null,fontSizeElement:null,defaultFontSize:"",_mathExp:null};let r=this.setDialog(t);n.math.modal=r,n.math.focusElement=r.querySelector(".se-math-exp"),n.math.previewElement=r.querySelector(".se-math-preview"),n.math.fontSizeElement=r.querySelector(".se-math-size"),n.math.focusElement.addEventListener("paste",function(s){typeof t.functions.onPasteMath=="function"&&t.functions.onPasteMath(s,t)},!1),n.math.focusElement.addEventListener(t.util.isIE?"textinput":"input",this._renderMathExp.bind(t,n.math),!1),n.math.fontSizeElement.addEventListener("change",(function(s){this.fontSize=s.target.value}).bind(n.math.previewElement.style),!1);let i=this.setController_MathButton(t);n.math.mathController=i,n.math._mathExp=null,r.querySelector("form").addEventListener("submit",this.submit.bind(t),!1),i.addEventListener("click",this.onClick_mathController.bind(t)),n.math.previewElement.style.fontSize=n.math.defaultFontSize,n.dialog.modal.appendChild(r),n.element.relative.appendChild(i),r=null,i=null},setDialog:function(t){const n=t.lang,r=t.util.createElement("DIV"),i=t.options.mathFontSize;let s=i[0].value;r.className="se-dialog-content",r.style.display="none";let o='<form><div class="se-dialog-header"><button type="button" data-command="close" class="se-btn se-dialog-close" title="'+n.dialogBox.close+'" aria-label="'+n.dialogBox.close+'">'+t.icons.cancel+'</button><span class="se-modal-title">'+n.dialogBox.mathBox.title+'</span></div><div class="se-dialog-body"><div class="se-dialog-form"><label>'+n.dialogBox.mathBox.inputLabel+' (<a href="'+qf+'" target="_blank">KaTeX</a>)</label><textarea class="se-input-form se-math-exp" type="text"></textarea></div><div class="se-dialog-form"><label>'+n.dialogBox.mathBox.fontSizeLabel+'</label><select class="se-input-select se-math-size">';for(let l=0,c=i.length,a;l<c;l++)a=i[l],a.default&&(s=a.value),o+='<option value="'+a.value+'"'+(a.default?" selected":"")+">"+a.text+"</option>";return o+='</select></div><div class="se-dialog-form"><label>'+n.dialogBox.mathBox.previewLabel+'</label><p class="se-math-preview"></p></div></div><div class="se-dialog-footer"><button type="submit" class="se-btn-primary" title="'+n.dialogBox.submitButton+'" aria-label="'+n.dialogBox.submitButton+'"><span>'+n.dialogBox.submitButton+"</span></button></div></form>",t.context.math.defaultFontSize=s,r.innerHTML=o,r},setController_MathButton:function(t){const n=t.lang,r=t.util.createElement("DIV");return r.className="se-controller se-controller-link",r.innerHTML='<div class="se-arrow se-arrow-up"></div><div class="link-content"><div class="se-btn-group"><button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">'+t.icons.edit+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.edit+'</span></span></button><button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">'+t.icons.delete+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+n.controller.remove+"</span></span></button></div></div>",r},open:function(){this.plugins.dialog.open.call(this,"math",this.currentControllerName==="math")},managedTags:function(){return{className:"katex",method:function(t){if(!t.getAttribute("data-exp")||!this.options.katex)return;const n=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(t.getAttribute("data-exp"))));t.innerHTML=n.querySelector(".katex").innerHTML,t.setAttribute("contenteditable",!1)}}},_renderer:function(t){let n="";try{this.util.removeClass(this.context.math.focusElement,"se-error"),n=this.options.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0})}catch(r){this.util.addClass(this.context.math.focusElement,"se-error"),n='<span class="se-math-katex-error">Katex syntax error. (Refer <a href="'+qf+'" target="_blank">KaTeX</a>)</span>',console.warn("[SUNEDITOR.math.Katex.error] ",r)}return n},_renderMathExp:function(t,n){t.previewElement.innerHTML=this.plugins.math._renderer.call(this,n.target.value)},submit:function(t){this.showLoading(),t.preventDefault(),t.stopPropagation();const n=(function(){if(this.context.math.focusElement.value.trim().length===0)return!1;const r=this.context.math,i=r.focusElement.value,s=r.previewElement.querySelector(".katex");if(!s)return!1;if(s.className="__se__katex "+s.className,s.setAttribute("contenteditable",!1),s.setAttribute("data-exp",this.util.HTMLEncoder(i)),s.setAttribute("data-font-size",r.fontSizeElement.value),s.style.fontSize=r.fontSizeElement.value,this.context.dialog.updateModal){const o=this.util.getParentElement(r._mathExp,".katex");o.parentNode.replaceChild(s,o),this.setRange(s,0,s,1)}else{const o=this.getSelectedElements();if(o.length>1){const c=this.util.createElement(o[0].nodeName);if(c.appendChild(s),!this.insertNode(c,null,!0))return!1}else if(!this.insertNode(s,null,!0))return!1;const l=this.util.createTextNode(this.util.zeroWidthSpace);s.parentNode.insertBefore(l,s.nextSibling),this.setRange(s,0,s,1)}return r.focusElement.value="",r.fontSizeElement.value="1em",r.previewElement.style.fontSize="1em",r.previewElement.innerHTML="",!0}).bind(this);try{n()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch{this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(t){if(!t)this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();else if(t.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(t,0,t,1),this.plugins.math.call_controller.call(this,t)),!0;return!1},on:function(t){if(!t)this.plugins.math.init.call(this);else{const n=this.context.math;if(n._mathExp){const r=this.util.HTMLDecoder(n._mathExp.getAttribute("data-exp")),i=n._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,n.focusElement.value=r,n.fontSizeElement.value=i,n.previewElement.innerHTML=this.plugins.math._renderer.call(this,r),n.previewElement.style.fontSize=i}}},call_controller:function(t){this.context.math._mathExp=t;const n=this.context.math.mathController;this.setControllerPosition(n,t,"bottom",{left:0,top:0}),this.controllersOn(n,t,"math")},onClick_mathController:function(t){t.stopPropagation();const n=t.target.getAttribute("data-command")||t.target.parentNode.getAttribute("data-command");n&&(t.preventDefault(),/update/.test(n)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const t=this.context.math;t.mathController.style.display="none",t._mathExp=null,t.focusElement.value="",t.previewElement.innerHTML=""}};var sv={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_MODULES a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={name:"fileBrowser",_xmlHttp:null,_loading:null,add:function(s){const o=s.context;o.fileBrowser={_closeSignal:!1,area:null,header:null,tagArea:null,body:null,list:null,tagElements:null,items:[],selectedTags:[],selectorHandler:null,contextPlugin:"",columnSize:4};let l=s.util.createElement("DIV");l.className="se-file-browser sun-editor-common";let c=s.util.createElement("DIV");c.className="se-file-browser-back";let a=s.util.createElement("DIV");a.className="se-file-browser-inner",a.innerHTML=this.set_browser(s),l.appendChild(c),l.appendChild(a),this._loading=l.querySelector(".se-loading-box"),o.fileBrowser.area=l,o.fileBrowser.header=a.querySelector(".se-file-browser-header"),o.fileBrowser.titleArea=a.querySelector(".se-file-browser-title"),o.fileBrowser.tagArea=a.querySelector(".se-file-browser-tags"),o.fileBrowser.body=a.querySelector(".se-file-browser-body"),o.fileBrowser.list=a.querySelector(".se-file-browser-list"),o.fileBrowser.tagArea.addEventListener("click",this.onClickTag.bind(s)),o.fileBrowser.list.addEventListener("click",this.onClickFile.bind(s)),a.addEventListener("mousedown",this._onMouseDown_browser.bind(s)),a.addEventListener("click",this._onClick_browser.bind(s)),o.element.relative.appendChild(l),l=null,c=null,a=null},set_browser:function(s){const o=s.lang;return'<div class="se-file-browser-content"><div class="se-file-browser-header"><button type="button" data-command="close" class="se-btn se-file-browser-close" class="close" title="'+o.dialogBox.close+'" aria-label="'+o.dialogBox.close+'">'+s.icons.cancel+'</button><span class="se-file-browser-title"></span><div class="se-file-browser-tags"></div></div><div class="se-file-browser-body"><div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div><div class="se-file-browser-list"></div></div></div>'},_onMouseDown_browser:function(s){/se-file-browser-inner/.test(s.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(s){s.stopPropagation(),(/close/.test(s.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(s,o){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=(function(f){/27/.test(f.keyCode)&&this.plugins.fileBrowser.close.call(this)}).bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const l=this.context.fileBrowser;l.contextPlugin=s,l.selectorHandler=o;const c=this.context[s],a=c.listClass;this.util.hasClass(l.list,a)||(l.list.className="se-file-browser-list "+a),this.options.popupDisplay==="full"?l.area.style.position="fixed":l.area.style.position="absolute",l.titleArea.textContent=c.title,l.area.style.display="block",this.context[s].directData?this.plugins.fileBrowser._drawListItem.call(this,this.context[s].directData,!0):this.plugins.fileBrowser._drawFileList.call(this,this.context[s].url,this.context[s].header)},_bindClose:null,close:function(){const s=this.plugins.fileBrowser;s._xmlHttp&&s._xmlHttp.abort(),s._bindClose&&(this._d.removeEventListener("keydown",s._bindClose),s._bindClose=null);const o=this.context.fileBrowser;o.area.style.display="none",o.selectorHandler=null,o.selectedTags=[],o.items=[],o.list.innerHTML=o.tagArea.innerHTML=o.titleArea.textContent="",typeof this.plugins[o.contextPlugin].init=="function"&&this.plugins[o.contextPlugin].init.call(this),o.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(s,o){const l=this.plugins.fileBrowser,c=l._xmlHttp=this.util.getXMLHttpRequest();if(c.onreadystatechange=l._callBackGet.bind(this,c),c.open("get",s,!0),o!==null&&typeof o=="object"&&this._w.Object.keys(o).length>0)for(let a in o)c.setRequestHeader(a,o[a]);c.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(s){if(s.readyState===4){if(this.plugins.fileBrowser._xmlHttp=null,s.status===200)try{const o=JSON.parse(s.responseText);o.result.length>0?this.plugins.fileBrowser._drawListItem.call(this,o.result,!0):o.nullMessage&&(this.context.fileBrowser.list.innerHTML=o.nullMessage)}catch(o){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+o.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),s.status!==0){const o=s.responseText?JSON.parse(s.responseText):s,l="[SUNEDITOR.fileBrowser.get.serverException] status: "+s.status+", response: "+(o.errorMessage||s.responseText);throw Error(l)}}},_drawListItem:function(s,o){const l=this.context.fileBrowser,c=this.context[l.contextPlugin],a=[],f=s.length,u=c.columnSize||l.columnSize,m=u<=1?1:Math.round(f/u)||1,y=c.itemTemplateHandler;let _="",S='<div class="se-file-item-column">',E=1;for(let d=0,h,v;d<f;d++)if(h=s[d],v=h.tag?typeof h.tag=="string"?h.tag.split(","):h.tag:[],v=h.tag=v.map(function(x){return x.trim()}),S+=y(h),(d+1)%m===0&&E<u&&d+1<f&&(E++,S+='</div><div class="se-file-item-column">'),o&&v.length>0)for(let x=0,g=v.length,b;x<g;x++)b=v[x],b&&a.indexOf(b)===-1&&(a.push(b),_+='<a title="'+b+'" aria-label="'+b+'">'+b+"</a>");S+="</div>",l.list.innerHTML=S,o&&(l.items=s,l.tagArea.innerHTML=_,l.tagElements=l.tagArea.querySelectorAll("A"))},onClickTag:function(s){const o=s.target;if(!this.util.isAnchor(o))return;const l=o.textContent,c=this.plugins.fileBrowser,a=this.context.fileBrowser,f=a.tagArea.querySelector('a[title="'+l+'"]'),u=a.selectedTags,m=u.indexOf(l);m>-1?(u.splice(m,1),this.util.removeClass(f,"on")):(u.push(l),this.util.addClass(f,"on")),c._drawListItem.call(this,u.length===0?a.items:a.items.filter(function(y){return y.tag.some(function(_){return u.indexOf(_)>-1})}),!1)},onClickFile:function(s){s.preventDefault(),s.stopPropagation();const o=this.context.fileBrowser,l=o.list;let c=s.target,a=null;if(c===l)return;for(;l!==c.parentNode&&(a=c.getAttribute("data-command"),!a);)c=c.parentNode;if(!a)return;(o.selectorHandler||this.context[o.contextPlugin].selectorHandler)(c,c.parentNode.querySelector(".__se__img_name").textContent),this.plugins.fileBrowser.close.call(this)}};return typeof r>"u"&&(n.SUNEDITOR_MODULES||Object.defineProperty(n,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:i})),i})})(sv);var nT=sv.exports;const rT=Di(nT),ov={name:"imageGallery",add:function(t){t.addModule([rT]);const n=t.context;n.imageGallery={title:t.lang.toolbar.imageGallery,directData:t.options.imageGalleryData,url:t.options.imageGalleryUrl,header:t.options.imageGalleryHeader,listClass:"se-image-list",itemTemplateHandler:this.drawItems,selectorHandler:this.setImage.bind(t),columnSize:4}},open:function(t){this.plugins.fileBrowser.open.call(this,"imageGallery",t)},drawItems:function(t){const n=t.src.split("/").pop();return'<div class="se-file-item-img"><img src="'+(t.thumbnail||t.src)+'" alt="'+(t.alt||n)+'" data-command="pick" data-value="'+(t.src||t.thumbnail)+'"><div class="se-file-img-name se-file-name-back"></div><div class="se-file-img-name __se__img_name">'+(t.name||n)+"</div></div>"},setImage:function(t,n){this.callPlugin("image",(function(){const r={name:n,size:0};this.plugins.image.create_image.call(this,t.getAttribute("data-value"),null,this.context.image._origin_w,this.context.image._origin_h,"none",r,t.alt)}).bind(this),null)}},av={blockquote:P2,align:L2,font:I2,fontSize:O2,fontColor:z2,hiliteColor:j2,horizontalRule:F2,list:H2,table:$2,formatBlock:V2,lineHeight:W2,template:U2,paragraphStyle:q2,textStyle:Y2,link:X2,image:tv,video:nv,audio:rv,math:iv,imageGallery:ov},iT=Object.freeze(Object.defineProperty({__proto__:null,align:L2,audio:rv,blockquote:P2,default:av,font:I2,fontColor:z2,fontSize:O2,formatBlock:V2,hiliteColor:j2,horizontalRule:F2,image:tv,imageGallery:ov,lineHeight:W2,link:X2,list:H2,math:iv,paragraphStyle:q2,table:$2,template:U2,textStyle:Y2,video:nv},Symbol.toStringTag,{value:"Module"})),sT=Cg(iT),Yf={rtl:{italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10.5 15.8" xml:space="preserve"><g><path d="M0.3,0.1c0.3,0,0.5,0,0.7,0c1,0.1,1.7,0.1,2.2,0.1H4L7.2,0l0.2,1.1H7c-0.5,0-1,0.1-1.5,0.3v0.4l0.3,1.9L6,4.4L6.3,6 l0.1,0.4l0.1,0.5c0.1,0.2,0.1,0.4,0.2,0.7s0.1,0.6,0.2,0.9L7,9.1l0.6,2.8l0.3,1.4c0.1,0.4,0.2,0.7,0.4,1c0.4,0.2,0.8,0.3,1.2,0.4 l0.8,0.2l0.2,0.9l-1.1,0c-0.9-0.1-1.5-0.1-1.8-0.1h-2c-0.9,0.1-1.4,0.2-1.5,0.2c-0.1,0-0.2,0-0.3,0H3.4c-0.1,0-0.2,0-0.2,0 l-0.1-0.4c0-0.2-0.1-0.4-0.1-0.6l0.7-0.1c0.4,0,0.8-0.1,1.2-0.2c0-0.1,0-0.2,0-0.3l-0.1-0.5l-0.4-2.4L4,9.6L3.4,6.4 C3.2,5.7,3,4.7,2.7,3.3c0-0.3-0.1-0.5-0.1-0.8C2.5,2.1,2.4,1.9,2.3,1.6C2,1.4,1.6,1.3,1.3,1.2C0.9,1.2,0.5,1.1,0.2,0.9L0,0.4L0,0 L0.3,0.1L0.3,0.1z"/></g></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 12.4" xml:space="preserve"><g><g><path d="M15.5,10.1L15.5,10.1c0.1,0,0.3,0.1,0.3,0.3v1.7c0,0.1,0,0.1-0.1,0.2c-0.1,0.1-0.1,0.1-0.2,0.1l-15.2,0 c-0.1,0-0.1,0-0.2-0.1C0,12.2,0,12.2,0,12.1l0-1.7c0-0.1,0-0.1,0.1-0.2c0.1-0.1,0.1-0.1,0.2-0.1C0.3,10.1,15.5,10.1,15.5,10.1z M9.8,6.7c0.1,0,0.1,0,0.2,0.1C10.1,6.9,10.1,7,10.1,7v1.7c0,0.1,0,0.2-0.1,0.2C10,9,9.9,9,9.8,9L0.3,9C0.2,9,0.1,9,0.1,8.9 C0,8.9,0,8.8,0,8.7V7C0,7,0,6.9,0.1,6.8c0.1-0.1,0.1-0.1,0.2-0.1C0.3,6.7,9.8,6.7,9.8,6.7z M0.3,3.4h9.6h0c0.1,0,0.3,0.1,0.3,0.3 v1.7v0c0,0.1-0.1,0.3-0.3,0.3H0.3c-0.1,0-0.1,0-0.2-0.1C0,5.5,0,5.4,0,5.3V3.6c0-0.1,0-0.1,0.1-0.2C0.1,3.4,0.2,3.4,0.3,3.4 L0.3,3.4z M0.3,0l15.2,0c0.1,0,0.1,0,0.2,0.1c0.1,0.1,0.1,0.1,0.1,0.2V2c0,0.1,0,0.2-0.1,0.2c-0.1,0.1-0.1,0.1-0.2,0.1H0.3 c-0.1,0-0.1,0-0.2-0.1C0,2.1,0,2,0,2l0-1.7c0-0.1,0-0.1,0.1-0.2C0.1,0,0.2,0,0.3,0z"/></g><path d="M13.1,3.5L15.7,6c0.1,0.1,0.1,0.3,0,0.4l-2.5,2.5C13.1,9,13,9,12.9,9c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2V3.7 c0-0.1,0-0.2,0.1-0.2c0.1-0.1,0.1-0.1,0.2-0.1C13,3.4,13.1,3.4,13.1,3.5z"/></g></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 12.4" xml:space="preserve"><g><g><path d="M15.5,10.1L15.5,10.1c0.1,0,0.3,0.1,0.3,0.3v1.7c0,0.1,0,0.1-0.1,0.2c-0.1,0.1-0.1,0.1-0.2,0.1l-15.2,0 c-0.1,0-0.1,0-0.2-0.1C0,12.2,0,12.2,0,12.1l0-1.7c0-0.1,0-0.1,0.1-0.2c0.1-0.1,0.1-0.1,0.2-0.1C0.3,10.1,15.5,10.1,15.5,10.1z M9.8,6.7c0.1,0,0.1,0,0.2,0.1C10.1,6.9,10.1,7,10.1,7v1.7c0,0.1,0,0.2-0.1,0.2C10,9,9.9,9,9.8,9L0.3,9C0.2,9,0.1,9,0.1,8.9 C0,8.9,0,8.8,0,8.7V7C0,7,0,6.9,0.1,6.8c0.1-0.1,0.1-0.1,0.2-0.1C0.3,6.7,9.8,6.7,9.8,6.7z M0.3,3.4h9.6h0c0.1,0,0.3,0.1,0.3,0.3 v1.7v0c0,0.1-0.1,0.3-0.3,0.3H0.3c-0.1,0-0.1,0-0.2-0.1C0,5.5,0,5.4,0,5.3V3.6c0-0.1,0-0.1,0.1-0.2C0.1,3.4,0.2,3.4,0.3,3.4 L0.3,3.4z M0.3,0l15.2,0c0.1,0,0.1,0,0.2,0.1c0.1,0.1,0.1,0.1,0.1,0.2V2c0,0.1,0,0.2-0.1,0.2c-0.1,0.1-0.1,0.1-0.2,0.1H0.3 c-0.1,0-0.1,0-0.2-0.1C0,2.1,0,2,0,2l0-1.7c0-0.1,0-0.1,0.1-0.2C0.1,0,0.2,0,0.3,0z"/></g><path d="M15.5,3.4c0.1,0,0.1,0,0.2,0.1c0.1,0.1,0.1,0.1,0.1,0.2v5.1c0,0.1,0,0.1-0.1,0.2C15.6,9,15.5,9,15.5,9 c-0.1,0-0.1,0-0.2-0.1l-2.5-2.5c-0.1-0.1-0.1-0.3,0-0.4l2.5-2.5C15.3,3.4,15.4,3.4,15.5,3.4z"/></g></svg>',list_bullets:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 12.4" xml:space="preserve"><g><path d="M12.4,10.7c0,0.9,0.8,1.7,1.7,1.7c0.9,0,1.7-0.8,1.7-1.7C15.7,9.8,15,9,14.1,9c-0.4,0-0.9,0.2-1.2,0.5 C12.5,9.8,12.4,10.2,12.4,10.7C12.4,10.7,12.4,10.7,12.4,10.7z M12.4,6.2c0,0.9,0.8,1.7,1.7,1.7c0.4,0,0.9-0.2,1.2-0.5 c0.3-0.3,0.4-0.7,0.4-1.1c0-0.9-0.7-1.7-1.6-1.7C13.1,4.6,12.4,5.3,12.4,6.2C12.4,6.2,12.4,6.2,12.4,6.2z M0,9.8v1.7 c0,0.1,0,0.1,0.1,0.2c0.1,0.1,0.1,0.1,0.2,0.1l10.7,0c0,0,0,0,0,0c0.1,0,0.3-0.1,0.3-0.3V9.8c0-0.1,0-0.1-0.1-0.2 C11.1,9.6,11,9.6,11,9.6l-10.7,0c-0.1,0-0.1,0-0.2,0.1C0,9.7,0,9.8,0,9.8L0,9.8z M12.9,2.9c0.3,0.3,0.7,0.5,1.2,0.5 c0.4,0,0.9-0.2,1.2-0.5c0.7-0.7,0.7-1.7,0-2.4C14.9,0.2,14.5,0,14.1,0c-0.4,0-0.9,0.2-1.2,0.5c-0.3,0.3-0.5,0.7-0.5,1.2 C12.4,2.1,12.5,2.6,12.9,2.9z M0,5.3V7c0,0.1,0,0.1,0.1,0.2c0.1,0.1,0.1,0.1,0.2,0.1H11c0.1,0,0.1,0,0.2-0.1 c0.1-0.1,0.1-0.1,0.1-0.2V5.3c0,0,0,0,0,0c0-0.1-0.1-0.3-0.3-0.3H0.3c-0.1,0-0.1,0-0.2,0.1C0,5.2,0,5.3,0,5.3L0,5.3z M0,0.8v1.7 c0,0.1,0,0.1,0.1,0.2c0.1,0.1,0.1,0.1,0.2,0.1h10.7c0.1,0,0.1,0,0.2-0.1c0,0,0.1-0.1,0.1-0.2V0.8c0-0.1,0-0.1-0.1-0.2 c0-0.1-0.1-0.1-0.2-0.1H0.3c-0.1,0-0.1,0-0.2,0.1C0,0.7,0,0.8,0,0.8L0,0.8z"/></g></svg>',list_number:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 15.7" xml:space="preserve"><g><path d="M0,11.5l0,1.7c0,0.1,0,0.1,0.1,0.2c0.1,0.1,0.1,0.1,0.2,0.1H11c0.1,0,0.2,0,0.2-0.1c0.1-0.1,0.1-0.1,0.1-0.2v-1.7 c0-0.1,0-0.1-0.1-0.2c-0.1-0.1-0.1-0.1-0.2-0.1H0.3c-0.1,0-0.2,0-0.2,0.1C0,11.4,0,11.4,0,11.5L0,11.5z M0,8.7c0,0.1,0,0.1,0.1,0.2 C0.1,8.9,0.2,9,0.3,9H11c0.1,0,0.2,0,0.2-0.1c0.1-0.1,0.1-0.1,0.1-0.2V7c0-0.1,0-0.1-0.1-0.2c-0.1-0.1-0.1-0.1-0.2-0.1l-10.7,0 c-0.1,0-0.2,0-0.2,0.1C0,6.8,0,6.9,0,7C0,7,0,8.7,0,8.7z M0,2.5v1.7c0,0.1,0,0.1,0.1,0.2c0,0,0.1,0.1,0.2,0.1l10.7,0 c0.1,0,0.2,0,0.2-0.1c0.1-0.1,0.1-0.1,0.1-0.2V2.4c0-0.1,0-0.1-0.1-0.2c-0.1,0-0.1,0-0.2,0H0.3c-0.1,0-0.1,0-0.2,0 C0,2.3,0,2.4,0,2.5L0,2.5z"/></g><path d="M15.6,14.2c0-0.3-0.1-0.6-0.3-0.8c-0.2-0.2-0.4-0.4-0.7-0.4l0.9-1v-0.8h-2.9v1.3h0.9v-0.5h0.9l0,0c-0.1,0.1-0.2,0.2-0.3,0.3 s-0.2,0.3-0.4,0.5l-0.3,0.3l0.2,0.5c0.6,0,0.9,0.1,0.9,0.5c0,0.1-0.1,0.3-0.2,0.4c-0.1,0.1-0.3,0.1-0.4,0.1c-0.3,0-0.7-0.1-0.9-0.3 l-0.5,0.8c0.4,0.4,0.9,0.6,1.5,0.6c0.4,0,0.9-0.1,1.2-0.4C15.5,15.1,15.6,14.7,15.6,14.2z"/><path d="M15.6,8.7h-0.9v0.5h-1.1c0-0.2,0.2-0.4,0.4-0.5c0.2-0.2,0.4-0.3,0.7-0.4c0.3-0.2,0.5-0.3,0.7-0.6c0.2-0.2,0.3-0.5,0.3-0.8 c0-0.4-0.2-0.8-0.5-1c-0.6-0.4-1.4-0.5-2-0.1c-0.3,0.2-0.5,0.4-0.6,0.7L13.3,7c0.1-0.3,0.4-0.5,0.7-0.5c0.1,0,0.3,0,0.3,0.1 c0.1,0.1,0.1,0.2,0.1,0.3c0,0.2-0.1,0.3-0.2,0.4c-0.2,0.1-0.3,0.3-0.5,0.4c-0.2,0.1-0.4,0.3-0.6,0.4c-0.2,0.2-0.4,0.4-0.5,0.6 c-0.1,0.2-0.2,0.5-0.2,0.8c0,0.2,0,0.3,0,0.5h3.2L15.6,8.7L15.6,8.7z"/><path d="M15.6,3.6h-1V0h-0.9l-1.2,1.1l0.6,0.7c0.2-0.1,0.3-0.3,0.4-0.5l0,0v2.2h-0.9v0.9h3L15.6,3.6L15.6,3.6z"/></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 15.7" xml:space="preserve"><g><path d="M7.4,9.9l3.1,3.1c0.3,0.3,0.8,0.5,1.3,0.5c0.5,0,0.9-0.2,1.3-0.5c0,0,0,0,0,0c0.7-0.7,0.7-1.9,0-2.6L9.9,7.3 c0-0.1,0-0.2,0-0.3C9.9,7,10,7,10.1,7l2.2-0.2c0.1,0,0.1,0,0.2,0.1l2.1,2.1c0.4,0.4,0.7,0.8,0.9,1.3c0.2,0.5,0.3,1,0.3,1.5 c0,0.5-0.1,1-0.3,1.5c-0.8,2-3.2,3-5.2,2.2c-0.5-0.2-0.9-0.5-1.3-0.9l-2.1-2.1c-0.1,0-0.1-0.1-0.1-0.2L7,10.1C7,10,7,9.9,7.1,9.9 C7.2,9.8,7.3,9.9,7.4,9.9z M1.2,1.1C1.6,0.7,2,0.4,2.5,0.3c1-0.4,2.1-0.4,3.1,0C6,0.4,6.5,0.7,6.8,1.1L9,3.2C9,3.3,9.1,3.3,9,3.4 L8.8,5.6c0,0.1-0.1,0.2-0.2,0.2c-0.1,0.1-0.2,0.1-0.3,0L5.3,2.7C5,2.3,4.5,2.1,4,2.1c-0.5,0-0.9,0.2-1.3,0.5c0,0,0,0,0,0 C2,3.4,2,4.5,2.7,5.2l3.1,3.2c0.1,0.1,0.1,0.2,0,0.3c0,0.1-0.1,0.1-0.2,0.1L3.5,9C3.4,9,3.4,9,3.3,8.9L1.2,6.8c0,0,0,0,0,0 C-0.4,5.2-0.4,2.7,1.2,1.1L1.2,1.1z M14.3,6h-2.6c0,0,0,0,0,0c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0.1-0.3l2.5-0.7 c0.1,0,0.1,0,0.2,0c0.1,0,0.1,0.1,0.1,0.2l0.1,0.8c0,0.1,0,0.1-0.1,0.2C14.5,6,14.4,6,14.3,6L14.3,6z M10.2,4.1 c0,0.1-0.1,0.2-0.2,0.2l0,0c0,0,0,0,0,0C9.8,4.2,9.7,4.1,9.8,4L9.7,1.4c0-0.1,0-0.1,0.1-0.2c0.1,0,0.1,0,0.2,0h0.8 c0.1,0,0.1,0,0.2,0.1c0,0.1,0,0.1,0,0.2L10.2,4.1L10.2,4.1z M1.5,9.7h1.3h1.3c0.1,0,0.2,0.1,0.2,0.2c0,0.1,0,0.2-0.1,0.3l-2.5,0.6 H1.6c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.1-0.2L1.2,9.9c0-0.1,0-0.1,0.1-0.2c0-0.1,0.1-0.1,0.2-0.1L1.5,9.7z M5.6,11.6 C5.6,11.6,5.6,11.6,5.6,11.6c0-0.1,0.1-0.2,0.3-0.1c0,0,0,0,0,0c0.1,0,0.2,0.1,0.2,0.2v2.6c0,0.1,0,0.1-0.1,0.2 c0,0-0.1,0.1-0.2,0.1L5,14.5c-0.1,0-0.1,0-0.2-0.1c0-0.1,0-0.1,0-0.2L5.6,11.6L5.6,11.6z"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 15.7" xml:space="preserve"><g><path d="M14.6,14.6c1.6-1.6,1.6-4.1,0-5.7l0,0l-3.1-3.1l-1.2,1.6l2.9,2.9c0.4,0.4,0.6,0.9,0.6,1.5c0,1.1-0.9,2.1-2.1,2.1l0,0 c-0.6,0-1.1-0.2-1.5-0.6l-0.4-0.4l-1.7,1l0.8,0.8C10.4,16.2,13,16.2,14.6,14.6L14.6,14.6L14.6,14.6z M3.6,6C3,5.9,2.6,5.5,2.3,5 S1.9,4,2.1,3.4C2.3,2.9,2.6,2.5,3,2.2C3.5,2,4.1,1.9,4.6,2l3.3,1.4l0.5-2L5.1,0.1C4-0.1,2.9,0,2,0.5C1.1,1.1,0.4,1.9,0.2,3 C-0.1,4,0,5.1,0.6,6C1.1,6.9,1.9,7.6,3,7.8l5.4,2l0.5-2L6.2,6.9L3.6,6z"/></g></svg>'},redo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.59 14.18"><g><path d="M11.58,18.48a6.84,6.84,0,1,1,6.85-6.85s0,.26,0,.67a8,8,0,0,1-.22,1.44l.91-.55a.51.51,0,0,1,.36,0,.45.45,0,0,1,.29.22.47.47,0,0,1,.06.36.45.45,0,0,1-.22.29L17.42,15.3l-.12,0h-.25l-.12-.06-.09-.09-.06-.07,0-.06-.87-2.12a.43.43,0,0,1,0-.37.49.49,0,0,1,.27-.26.41.41,0,0,1,.36,0,.53.53,0,0,1,.27.26l.44,1.09a6.51,6.51,0,0,0,.24-1.36,4.58,4.58,0,0,0,0-.64,5.83,5.83,0,0,0-1.73-4.17,5.88,5.88,0,0,0-8.34,0,5.9,5.9,0,0,0,4.17,10.06.51.51,0,0,1,.33.15.48.48,0,0,1,0,.68.53.53,0,0,1-.33.12Z" transform="translate(-4.48 -4.54)"/></g></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.59 14.18"><g><path d="M5,14a.43.43,0,0,1-.22-.29.46.46,0,0,1,.06-.36.43.43,0,0,1,.29-.22.56.56,0,0,1,.36,0l.91.55a8.27,8.27,0,0,1-.22-1.45,5.07,5.07,0,0,1,0-.67A6.85,6.85,0,1,1,13,18.47a.44.44,0,0,1-.33-.13.48.48,0,0,1,0-.68.51.51,0,0,1,.33-.15A5.89,5.89,0,0,0,17.15,7.45a5.88,5.88,0,0,0-8.33,0,5.84,5.84,0,0,0-1.73,4.17s0,.25,0,.65a6.49,6.49,0,0,0,.24,1.37l.44-1.09a.57.57,0,0,1,.27-.26.41.41,0,0,1,.36,0,.53.53,0,0,1,.27.26.43.43,0,0,1,0,.37L7.82,15l0,.09-.09.09-.1.07-.06,0H7.28l-.13,0-1.09-.63c-.65-.36-1-.57-1.1-.63Z" transform="translate(-4.49 -4.53)"/></g></svg>',bold:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.76 15.75"><g><path d="M6.4,3.76V19.5h6.76a5.55,5.55,0,0,0,2-.32,4.93,4.93,0,0,0,1.52-1,4.27,4.27,0,0,0,1.48-3.34,3.87,3.87,0,0,0-.69-2.37,5.74,5.74,0,0,0-.71-.83,3.44,3.44,0,0,0-1.1-.65,3.6,3.6,0,0,0,1.58-1.36,3.66,3.66,0,0,0,.53-1.93,3.7,3.7,0,0,0-1.21-2.87,4.65,4.65,0,0,0-3.25-1.1H6.4Zm2.46,6.65V5.57h3.52a4.91,4.91,0,0,1,1.36.15,2.3,2.3,0,0,1,.85.45,2.06,2.06,0,0,1,.74,1.71,2.3,2.3,0,0,1-.78,1.92,2.54,2.54,0,0,1-.86.46,4.7,4.7,0,0,1-1.32.15H8.86Zm0,7.27V12.15H12.7a4.56,4.56,0,0,1,1.38.17,3.43,3.43,0,0,1,.95.49,2.29,2.29,0,0,1,.92,2,2.73,2.73,0,0,1-.83,2.1,2.66,2.66,0,0,1-.83.58,3.25,3.25,0,0,1-1.26.2H8.86Z" transform="translate(-6.4 -3.75)"/></g></svg>',underline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9.78 15.74"><g><path d="M14.64,3.76h2.52v7.72a4.51,4.51,0,0,1-.59,2.31,3.76,3.76,0,0,1-1.71,1.53,6.12,6.12,0,0,1-2.64.53,5,5,0,0,1-3.57-1.18,4.17,4.17,0,0,1-1.27-3.24V3.76H9.9v7.3a3,3,0,0,0,.55,2,2.3,2.3,0,0,0,1.83.65,2.26,2.26,0,0,0,1.8-.65,3.09,3.09,0,0,0,.55-2V3.76Zm2.52,13.31V19.5H7.39V17.08h9.77Z" transform="translate(-7.38 -3.76)"/></g></svg>',italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10.49 15.76"><g><path d="M17.16,3.79l.37,0-.06.38-.14.52A10,10,0,0,1,16.21,5a9.37,9.37,0,0,0-1,.32,6.68,6.68,0,0,0-.25.89c-.06.31-.11.59-.14.85-.3,1.36-.52,2.41-.68,3.14l-.61,3.18L13.1,15l-.43,2.4-.12.46a.62.62,0,0,0,0,.28c.44.1.85.17,1.23.22l.68.11a4.51,4.51,0,0,1-.08.6l-.09.42a.92.92,0,0,0-.23,0l-.43,0a1.37,1.37,0,0,1-.29,0c-.13,0-.63-.08-1.49-.16l-2,0c-.28,0-.87,0-1.78.12L7,19.5l.17-.88.8-.2A6.61,6.61,0,0,0,9.19,18,2.62,2.62,0,0,0,9.61,17l.28-1.41.58-2.75.12-.66c.05-.3.11-.58.17-.86s.12-.51.17-.69l.12-.48.12-.43.31-1.6.15-.65.31-1.91V5.14a3.86,3.86,0,0,0-1.48-.29l-.38,0,.2-1.06,3.24.14.75,0c.45,0,1.18,0,2.18-.09.23,0,.46,0,.71,0Z" transform="translate(-7.04 -3.76)"/></g></svg>',strike:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.9"><g><path d="M12.94,13a4.27,4.27,0,0,1,1.32.58,1.46,1.46,0,0,1,.55,1.2,1.87,1.87,0,0,1-.88,1.64,4.17,4.17,0,0,1-2.35.59,4.44,4.44,0,0,1-2.74-.71,2.72,2.72,0,0,1-1-2.17H5.57a4.56,4.56,0,0,0,1.55,3.7,7,7,0,0,0,4.47,1.23,6,6,0,0,0,4.07-1.3,4.24,4.24,0,0,0,1.52-3.37,4,4,0,0,0-.26-1.4h-4ZM6.37,10.24A3.27,3.27,0,0,1,6,8.68a4,4,0,0,1,1.48-3.3,5.92,5.92,0,0,1,3.88-1.21,5.58,5.58,0,0,1,3.91,1.24,4.36,4.36,0,0,1,1.45,3.17H14.44a2.12,2.12,0,0,0-.91-1.81,4.45,4.45,0,0,0-2.44-.55,3.69,3.69,0,0,0-2,.51A1.64,1.64,0,0,0,8.3,8.22a1.3,1.3,0,0,0,.48,1.11,7,7,0,0,0,2.1.78l.28.06.28.08H6.37Zm13.09.68a.73.73,0,0,1,.49.21.66.66,0,0,1,.2.48.64.64,0,0,1-.2.48.71.71,0,0,1-.49.19H5.1a.67.67,0,0,1-.49-.19.66.66,0,0,1-.2-.48.64.64,0,0,1,.2-.48.73.73,0,0,1,.49-.21H19.46Z" transform="translate(-4.41 -4.17)"/></g></svg>',subscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 14.61"><g><path d="M15.38,4.33H12.74L11.19,7c-.28.46-.51.87-.69,1.21L10.07,9h0l-.44-.8c-.22-.4-.45-.81-.71-1.23L7.34,4.33H4.68L8.26,10,4.4,16.08H7.1l1.69-2.83c.38-.63.72-1.22,1-1.78l.25-.46h0l.49.92c.24.45.48.89.74,1.32L13,16.08h2.61L11.84,10l1.77-2.84,1.77-2.85Zm4.77,13.75H17v-.15c0-.4.05-.64.16-.72a4.42,4.42,0,0,1,1.16-.31,3.3,3.3,0,0,0,1.54-.56A1.84,1.84,0,0,0,20.15,15a1.78,1.78,0,0,0-.44-1.41A2.8,2.8,0,0,0,18,13.25a2.71,2.71,0,0,0-1.69.37,1.83,1.83,0,0,0-.44,1.43v.23H17v-.23q0-.63.18-.78a1.62,1.62,0,0,1,.88-.15,1.59,1.59,0,0,1,.88.15q.18.15.18.75t-.18.75a3.58,3.58,0,0,1-1.18.33,3.33,3.33,0,0,0-1.52.51,1.57,1.57,0,0,0-.32,1.18v1.15h4.27v-.86Z" transform="translate(-4.4 -4.33)"/></g></svg>',superscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.42"><g><path d="M12,13.14l3.61-5.81H12.94L11.33,10c-.28.46-.51.88-.69,1.25l-.45.83h0l-.45-.85c-.22-.41-.45-.82-.71-1.24L7.4,7.33H4.68l3.66,5.81L4.4,19.33H7.14l1.74-2.87q.58-1,1-1.83l.25-.48h0l.51.94.75,1.37,1.72,2.87h2.67l-1.92-3.09c-1.12-1.8-1.76-2.83-1.92-3.1Zm4.84-4.41h0l0,.15h3.27v.86H15.77V8.58a1.66,1.66,0,0,1,.33-1.22,3.51,3.51,0,0,1,1.56-.51,3.68,3.68,0,0,0,1.21-.34c.13-.1.19-.36.19-.77S19,5.07,18.87,5A1.63,1.63,0,0,0,18,4.8a1.58,1.58,0,0,0-.91.17c-.13.11-.19.38-.19.8V6H15.78V5.76a1.87,1.87,0,0,1,.45-1.47A2.84,2.84,0,0,1,18,3.91a2.8,2.8,0,0,1,1.72.38,1.84,1.84,0,0,1,.45,1.44,1.91,1.91,0,0,1-.34,1.35,3.24,3.24,0,0,1-1.58.57A3.69,3.69,0,0,0,17,8c-.12.1-.17.35-.17.76Z" transform="translate(-4.4 -3.91)"/></g></svg>',erase:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.76"><g><path d="M13.69,17.2h6.46v1.31H8.56L4.41,14.37,14,4.75l6.06,6.06L16.89,14l-3.2,3.19Zm-4.61,0h2.77L14.09,15,9.88,10.75,6.25,14.38l1.41,1.41c.84.82,1.31,1.29,1.42,1.41Z" transform="translate(-4.41 -4.75)"/></g></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M4.68,14.45a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V9.1a.27.27,0,0,1,.08-.19.28.28,0,0,1,.2-.08.25.25,0,0,1,.19.07l2.54,2.54a.29.29,0,0,1,0,.4L4.88,14.36a.24.24,0,0,1-.2.09Zm15.19,1.12a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87Zm0-3.38a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm0-3.37a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm.2-3.29a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M19.87,15.57a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87ZM7.5,14.45a.25.25,0,0,1-.2-.09L4.76,11.84a.29.29,0,0,1,0-.4L7.3,8.9a.29.29,0,0,1,.4,0,.31.31,0,0,1,.07.2v5.06a.32.32,0,0,1-.08.21.26.26,0,0,1-.19.08ZM19.87,8.82a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm0,3.37a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm.2-6.66a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',expansion:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M11.8,13.06l-5.1,5.1H9.51V19.5H4.41V14.4H5.75v2.81L8.3,14.66q2.25-2.23,2.55-2.55Zm8.35-9.3v5.1H18.81V6.05l-5.1,5.1-1-1,5.1-5.1H15.05V3.76Z" transform="translate(-4.41 -3.76)"/></g></svg>',reduction:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M14.91,10h2.87v1.38H12.55V6.12h1.38V9l5.24-5.24.48.49.49.48ZM6.77,11.92H12v5.23H10.62V14.26L5.37,19.5l-1-1L9.63,13.3H6.77Z" transform="translate(-4.4 -3.76)"/></g></svg>',code_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 11.8"><g><path d="M8.09,7.94a.76.76,0,0,1,.53.22.72.72,0,0,1,.21.52.76.76,0,0,1-.22.54L6.18,11.63l2.43,2.44a.69.69,0,0,1,.2.51.66.66,0,0,1-.21.51.75.75,0,0,1-.51.22.63.63,0,0,1-.51-.21h0L4.63,12.15a.7.7,0,0,1-.22-.53.67.67,0,0,1,.25-.55L7.57,8.16a.82.82,0,0,1,.52-.22Zm12.05,3.69a.7.7,0,0,1-.23.52L17,15.1h0a.66.66,0,0,1-.51.21.73.73,0,0,1-.51-.22.75.75,0,0,1-.22-.51.63.63,0,0,1,.21-.51l2.43-2.44L15.92,9.22a.73.73,0,0,1-.22-.53A.74.74,0,0,1,17,8.18h0l2.91,2.91a.67.67,0,0,1,.27.54Zm-5.9-5.9a.73.73,0,0,1,.61.32.71.71,0,0,1,.07.68L11,17a1,1,0,0,1-.22.32.6.6,0,0,1-.35.16.75.75,0,0,1-.69-.26.69.69,0,0,1-.12-.72L13.56,6.23a.75.75,0,0,1,.26-.35.74.74,0,0,1,.42-.15Z" transform="translate(-4.41 -5.73)"/></g></svg>',preview:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.65 15.66"><g><path d="M16.19,14.43l2.49,2.49a.73.73,0,0,1,.21.52.67.67,0,0,1-.22.51.7.7,0,0,1-.52.22.69.69,0,0,1-.51-.21l-2.49-2.48a5.17,5.17,0,0,1-1.34.69,4.64,4.64,0,0,1-1.48.24,4.78,4.78,0,1,1,0-9.56,4.79,4.79,0,0,1,1.84.36,4.9,4.9,0,0,1,1.56,1,4.77,4.77,0,0,1,.46,6.18ZM10,14a3.3,3.3,0,0,0,2.34.93A3.37,3.37,0,0,0,14.7,14a3.3,3.3,0,0,0-1.08-5.41,3.47,3.47,0,0,0-2.56,0A3,3,0,0,0,10,9.28,3.31,3.31,0,0,0,10,14ZM16,4a3.86,3.86,0,0,1,2.77,1.14A3.9,3.9,0,0,1,20,7.85v4a.77.77,0,0,1-.22.53.7.7,0,0,1-.52.21.72.72,0,0,1-.74-.74v-4a2.46,2.46,0,0,0-.72-1.73A2.37,2.37,0,0,0,16,5.45H8.53A2.42,2.42,0,0,0,6.08,7.89v7.52a2.41,2.41,0,0,0,.71,1.73,2.46,2.46,0,0,0,1.74.72h4.08a.73.73,0,0,1,0,1.46H8.53a3.85,3.85,0,0,1-2.78-1.14A3.93,3.93,0,0,1,4.6,15.4V7.87A3.94,3.94,0,0,1,5.76,5.09,3.88,3.88,0,0,1,8.54,4H16Z" transform="translate(-4.45 -3.8)"/></g></svg>',print:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16.05 16.04"><g><path d="M19.76,15.84a1.29,1.29,0,0,0,.39-.92V8.35A2.05,2.05,0,0,0,19.57,7a1.93,1.93,0,0,0-1.38-.57H6.37a1.95,1.95,0,0,0-2,2v6.56a1.23,1.23,0,0,0,.38.92,1.35,1.35,0,0,0,.93.38h2V14.9l-2,0V8.35a.67.67,0,0,1,.18-.47.62.62,0,0,1,.48-.19H18.18a.6.6,0,0,1,.46.19.66.66,0,0,1,.18.47V14.9h-2v1.32h2A1.35,1.35,0,0,0,19.76,15.84ZM17.52,7.69V5.06a1.31,1.31,0,0,0-.38-.92,1.34,1.34,0,0,0-.94-.38H8.34A1.3,1.3,0,0,0,7,5.06V7.69H8.34V5.06h7.87V7.69h1.31ZM8.34,12.93h7.87l0,5.26H8.34V12.93Zm7.87,5.26v0Zm.65,1.31a.6.6,0,0,0,.46-.19.72.72,0,0,0,.2-.47V12.29a.74.74,0,0,0-.2-.47.6.6,0,0,0-.46-.19H7.68a.6.6,0,0,0-.46.19.72.72,0,0,0-.2.47v6.55a.74.74,0,0,0,.2.47.6.6,0,0,0,.46.19h9.18ZM16.67,9.28a.7.7,0,0,0-.94,0,.63.63,0,0,0-.18.46.67.67,0,0,0,.18.47.68.68,0,0,0,.94,0,.66.66,0,0,0,.18-.47A.58.58,0,0,0,16.67,9.28Z" transform="translate(-4.25 -3.61)"/></g></svg>',template:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.27 15.64"><g><path d="M18.18,19.16a1,1,0,0,0,1-1V5.73a1,1,0,0,0-1-1h-2v1h2V18.19H6.37V5.73h2v-1h-2A.94.94,0,0,0,5.68,5a1,1,0,0,0-.29.7V18.18a.94.94,0,0,0,.29.69,1,1,0,0,0,.69.29H18.18ZM9.82,10.31h4.92a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.49.49,0,0,0-.15-.35.47.47,0,0,0-.35-.15H9.82a.49.49,0,0,0-.35.15.47.47,0,0,0-.15.35.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15Zm5.9,4.92H8.83a.49.49,0,0,0-.35.15.47.47,0,0,0-.15.35.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15h6.89a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.51.51,0,0,0-.5-.5ZM7.36,12.77a.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15h8.85a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.49.49,0,0,0-.15-.35.47.47,0,0,0-.35-.15H7.85a.49.49,0,0,0-.35.15.52.52,0,0,0-.14.35Z" transform="translate(-5.14 -3.77)"/><path d="M14.24,6.71a1,1,0,0,0,1-1,1,1,0,0,0-1-1,1,1,0,0,0-1-1h-2a.94.94,0,0,0-.69.28,1,1,0,0,0-.29.7A.94.94,0,0,0,9.62,5a.91.91,0,0,0-.29.69,1,1,0,0,0,.29.7,1,1,0,0,0,.69.29h3.93Z" transform="translate(-5.14 -3.77)"/></g></svg>',line_height:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 13.56"><g><path d="M4.4,4.88V8.26a2,2,0,0,0,.5.39s.1,0,.18-.12a.62.62,0,0,0,.17-.28c.06-.19.13-.44.21-.74s.14-.52.19-.66a.58.58,0,0,1,.21-.3,2.41,2.41,0,0,1,.63-.21,3.83,3.83,0,0,1,.88-.12,9.15,9.15,0,0,1,1.31.06.16.16,0,0,1,.11,0,.26.26,0,0,1,.06.14,4,4,0,0,1,0,.49v2l.05,3.77c0,1.41,0,2.68-.05,3.81a1.79,1.79,0,0,1-.11.49,10.68,10.68,0,0,1-1.4.45,1.12,1.12,0,0,0-.69.43v.31l0,.22.61,0c.85-.08,1.54-.12,2.06-.12a19.76,19.76,0,0,1,2.09.08,15.08,15.08,0,0,0,1.64.08,1.4,1.4,0,0,0,.29,0,1.58,1.58,0,0,0,0-.26l-.05-.43a2.26,2.26,0,0,0-.43-.17l-.77-.22-.15,0a2.55,2.55,0,0,1-.78-.28,2.56,2.56,0,0,1-.11-.75l0-1.29,0-3.15V7.53a10.51,10.51,0,0,1,.06-1.2,3.83,3.83,0,0,1,.6,0l1.88,0a2.18,2.18,0,0,1,.38,0,.45.45,0,0,1,.23.17.9.9,0,0,1,.05.25c0,.16.06.35.1.58a3.33,3.33,0,0,0,.14.55A6.39,6.39,0,0,0,15,9a2.91,2.91,0,0,0,.6-.15,2.77,2.77,0,0,0,0-.46l0-.51,0-2.95-.25,0-.38,0L15,4.94a.71.71,0,0,1-.18.15.45.45,0,0,1-.25.07l-.29,0H8.75l-.15,0H7.45a17,17,0,0,1-1.86,0L5.36,5l-.25-.13ZM19.75,16.14h-.69v-9h.69A.4.4,0,0,0,20.13,7c.06-.11,0-.24-.1-.39L18.92,5.15a.52.52,0,0,0-.86,0L17,6.58c-.12.15-.16.28-.1.39s.18.16.38.16h.69v9h-.69a.4.4,0,0,0-.38.16c-.06.11,0,.24.1.39l1.11,1.43a.52.52,0,0,0,.86,0L20,16.69c.12-.15.16-.28.1-.39a.4.4,0,0,0-.38-.16Z" transform="translate(-4.4 -4.86)"/></g></svg>',paragraph_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.74"><g><path d="M18.18,3.76v2h-2V19.5h-2V5.73h-2V19.5h-2V11.63a3.94,3.94,0,0,1,0-7.87h7.87Z" transform="translate(-6.37 -3.76)"/></g></svg>',text_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13.76 15.74"><g><path d="M17.68,6.71a2.22,2.22,0,0,0,1.06-.22.74.74,0,0,0,.42-.7.73.73,0,0,0-.08-.33.67.67,0,0,0-.17-.22,1,1,0,0,0-.31-.15L18.26,5l-.45-.09A15.27,15.27,0,0,0,13.26,5V4.74c0-.66-.63-1-1.92-1-.24,0-.43.15-.59.46a4,4,0,0,0-.36,1.14h0v0a26.45,26.45,0,0,1-3.5.35A2,2,0,0,0,5.77,6a.84.84,0,0,0-.37.79,2.14,2.14,0,0,0,.41,1.29,1.23,1.23,0,0,0,1.05.63,16.62,16.62,0,0,0,3.29-.45l-.34,3.35c-.16,1.61-.29,2.9-.37,3.86s-.12,1.66-.12,2.09l0,.65a5.15,5.15,0,0,0,.05.6,1.28,1.28,0,0,0,.16.54.34.34,0,0,0,.28.18,1.16,1.16,0,0,0,.79-.46,3.66,3.66,0,0,0,.68-1,22.08,22.08,0,0,0,1-4.33q.49-3.1.78-6.15a24.69,24.69,0,0,1,4.62-.84Z" transform="translate(-5.4 -3.76)"/></g></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M18.53,19.5l.2-.05A1.78,1.78,0,0,0,20.13,18l0-.09V7.14a2,2,0,0,0-.28-.64A3.18,3.18,0,0,0,19.43,6c-.5-.52-1-1-1.55-1.54A2.59,2.59,0,0,0,17.37,4a1.83,1.83,0,0,0-.61-.25H6l-.21,0a1.78,1.78,0,0,0-1.4,1.49l0,.1V17.87a2.49,2.49,0,0,0,.09.37,1.79,1.79,0,0,0,1.44,1.23l.09,0Zm-6.25-.6H6.92a.61.61,0,0,1-.68-.48.78.78,0,0,1,0-.22V12.3a.62.62,0,0,1,.69-.68H17.64a.62.62,0,0,1,.69.69V18.2a.64.64,0,0,1-.71.69H12.28ZM12,9.81H8.15a.63.63,0,0,1-.72-.71v-4a.64.64,0,0,1,.72-.72h7.66a.64.64,0,0,1,.72.72v4a.65.65,0,0,1-.74.72ZM13.5,5V9.18h1.78V5Z" transform="translate(-4.41 -3.76)"/></g></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 475.082 475.081"><g><path d="M164.45,219.27h-63.954c-7.614,0-14.087-2.664-19.417-7.994c-5.327-5.33-7.994-11.801-7.994-19.417v-9.132c0-20.177,7.139-37.401,21.416-51.678c14.276-14.272,31.503-21.411,51.678-21.411h18.271c4.948,0,9.229-1.809,12.847-5.424c3.616-3.617,5.424-7.898,5.424-12.847V54.819c0-4.948-1.809-9.233-5.424-12.85c-3.617-3.612-7.898-5.424-12.847-5.424h-18.271c-19.797,0-38.684,3.858-56.673,11.563c-17.987,7.71-33.545,18.132-46.68,31.267c-13.134,13.129-23.553,28.688-31.262,46.677C3.855,144.039,0,162.931,0,182.726v200.991c0,15.235,5.327,28.171,15.986,38.834c10.66,10.657,23.606,15.985,38.832,15.985h109.639c15.225,0,28.167-5.328,38.828-15.985c10.657-10.663,15.987-23.599,15.987-38.834V274.088c0-15.232-5.33-28.168-15.994-38.832C192.622,224.6,179.675,219.27,164.45,219.27z"/><path d="M459.103,235.256c-10.656-10.656-23.599-15.986-38.828-15.986h-63.953c-7.61,0-14.089-2.664-19.41-7.994c-5.332-5.33-7.994-11.801-7.994-19.417v-9.132c0-20.177,7.139-37.401,21.409-51.678c14.271-14.272,31.497-21.411,51.682-21.411h18.267c4.949,0,9.233-1.809,12.848-5.424c3.613-3.617,5.428-7.898,5.428-12.847V54.819c0-4.948-1.814-9.233-5.428-12.85c-3.614-3.612-7.898-5.424-12.848-5.424h-18.267c-19.808,0-38.691,3.858-56.685,11.563c-17.984,7.71-33.537,18.132-46.672,31.267c-13.135,13.129-23.559,28.688-31.265,46.677c-7.707,17.987-11.567,36.879-11.567,56.674v200.991c0,15.235,5.332,28.171,15.988,38.834c10.657,10.657,23.6,15.985,38.828,15.985h109.633c15.229,0,28.171-5.328,38.827-15.985c10.664-10.663,15.985-23.599,15.985-38.834V274.088C475.082,258.855,469.76,245.92,459.103,235.256z"/></g></svg>',arrow_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 8.67"><g><path d="M18.79,7.52a.8.8,0,0,1,.56-.23.82.82,0,0,1,.79.79.8.8,0,0,1-.23.56l-7.07,7.07a.79.79,0,0,1-.57.25.77.77,0,0,1-.57-.25h0L4.64,8.65a.8.8,0,0,1-.23-.57.82.82,0,0,1,.79-.79.8.8,0,0,1,.56.23L12.28,14l3.26-3.26,3.25-3.26Z" transform="translate(-4.41 -7.29)"/></g></svg>',align_justify:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm0,5.9H20.15v-2H4.41v2Zm0,3.94H20.15v-2H4.41v2Zm0,3.93h7.87v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm11.8,3.94H4.41v2H16.22v-2Zm-11.8,5.9H18.18v-2H4.41v2Zm0,3.93h9.84v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm3.93,5.9H20.15v-2H8.34v2Zm-2,3.94H20.14v-2H6.37v2Zm3.94,3.93h9.84v-2H10.31v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm2,3.94v2H18.18v-2H6.37Zm-1,5.9H19.16v-2H5.39v2Zm2,3.93H17.2v-2H7.36v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',font_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.61"><g><path d="M18.5,15.57,14.28,4.32h-3.4L6.65,15.57h3l.8-2.26h4.23l.8,2.26h3ZM14,11.07H11.14L12.54,7,13.25,9c.41,1.18.64,1.86.7,2ZM4.41,16.69v2.24H20.15V16.69H4.41Z" transform="translate(-4.41 -4.32)"/></g></svg>',highlight_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.66 15.74"><g><path d="M12.32,9.31,13.38,13H11.21l.52-1.83q.46-1.61.54-1.83ZM4.44,3.76H20.1V19.5H4.44V3.76ZM14.71,17.32h2.63L13.7,6H10.89L7.26,17.32H9.89l.63-2.24h3.55l.32,1.12c.18.65.29,1,.32,1.12Z" transform="translate(-4.44 -3.76)"/></g></svg>',list_bullets:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.37"><g><path d="M7.77,16.12a1.59,1.59,0,0,0-.49-1.18,1.62,1.62,0,0,0-1.19-.49,1.68,1.68,0,1,0,0,3.36,1.67,1.67,0,0,0,1.68-1.69Zm0-4.48A1.67,1.67,0,0,0,6.09,10,1.68,1.68,0,0,0,4.9,12.82a1.62,1.62,0,0,0,1.19.49,1.67,1.67,0,0,0,1.68-1.67Zm12.38,3.64a.27.27,0,0,0-.08-.19.28.28,0,0,0-.2-.09H9.19a.28.28,0,0,0-.2.08.29.29,0,0,0-.08.19V17a.27.27,0,0,0,.28.28H19.87a.27.27,0,0,0,.19-.08.24.24,0,0,0,.08-.2V15.28ZM7.77,7.13a1.63,1.63,0,0,0-.49-1.2,1.61,1.61,0,0,0-1.19-.49,1.61,1.61,0,0,0-1.19.49,1.71,1.71,0,0,0,0,2.4,1.62,1.62,0,0,0,1.19.49,1.61,1.61,0,0,0,1.19-.49,1.63,1.63,0,0,0,.49-1.2Zm12.38,3.66a.28.28,0,0,0-.08-.2.29.29,0,0,0-.19-.08H9.19a.27.27,0,0,0-.28.28v1.69a.27.27,0,0,0,.08.19.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08.25.25,0,0,0,.08-.19V10.79Zm0-4.5a.27.27,0,0,0-.08-.19A.25.25,0,0,0,19.88,6H9.19A.28.28,0,0,0,9,6.1a.26.26,0,0,0-.08.19V8A.27.27,0,0,0,9,8.17a.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08A.25.25,0,0,0,20.14,8V6.29Z" transform="translate(-4.41 -5.44)"/></g></svg>',list_number:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.69 15.74"><g><path d="M7.66,18a1.24,1.24,0,0,0-.26-.78,1.17,1.17,0,0,0-.72-.42l.85-1V15H4.58v1.34h.94v-.46l.85,0h0c-.11.11-.22.23-.32.35s-.23.27-.37.47L5.39,17l.23.51c.61-.05.92.11.92.49a.42.42,0,0,1-.18.37.79.79,0,0,1-.45.12A1.41,1.41,0,0,1,5,18.15l-.51.77A2.06,2.06,0,0,0,6,19.5a1.8,1.8,0,0,0,1.2-.41A1.38,1.38,0,0,0,7.66,18Zm0-5.54H6.75V13H5.63A.72.72,0,0,1,6,12.51a5.45,5.45,0,0,1,.66-.45,2.71,2.71,0,0,0,.67-.57,1.19,1.19,0,0,0,.31-.81,1.29,1.29,0,0,0-.45-1,1.86,1.86,0,0,0-2-.11,1.51,1.51,0,0,0-.62.7l.74.52A.87.87,0,0,1,6,10.28a.51.51,0,0,1,.35.12.42.42,0,0,1,.13.33.55.55,0,0,1-.21.4,3,3,0,0,1-.5.38c-.19.13-.39.27-.58.42a2,2,0,0,0-.5.6,1.63,1.63,0,0,0-.21.81,3.89,3.89,0,0,0,.05.48h3.2V12.44Zm12.45,2.82a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2V17a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V15.26ZM7.69,7.32h-1V3.76H5.8L4.6,4.88l.63.68a1.85,1.85,0,0,0,.43-.48h0l0,2.24H4.74V8.2h3V7.32Zm12.43,3.42a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2v1.71a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V10.74Zm0-4.52A.27.27,0,0,0,20,6,.28.28,0,0,0,19.83,6H9.1A.32.32,0,0,0,8.89,6a.24.24,0,0,0-.08.19V7.93a.27.27,0,0,0,.08.19.32.32,0,0,0,.21.08H19.83A.32.32,0,0,0,20,8.12a.26.26,0,0,0,.08-.2V6.22Z" transform="translate(-4.43 -3.76)"/></g></svg>',table:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M4.41,8.05V3.76H8.7V8.05H4.41Zm5.71,0V3.76h4.3V8.05h-4.3Zm5.74-4.29h4.29V8.05H15.86V3.76Zm-11.45,10V9.48H8.7v4.3H4.41Zm5.71,0V9.48h4.3v4.3h-4.3Zm5.74,0V9.48h4.29v4.3H15.86ZM4.41,19.5V15.21H8.7V19.5H4.41Zm5.71,0V15.21h4.3V19.5h-4.3Zm5.74,0V15.21h4.29V19.5H15.86Z" transform="translate(-4.41 -3.76)"/></g></svg>',horizontal_rule:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 2.24"><g><path d="M20.15,12.75V10.51H4.41v2.24H20.15Z" transform="translate(-4.41 -10.51)"/></g></svg>',show_blocks:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.66 15.67"><g><path d="M19.72,5.58a1.64,1.64,0,0,0-1.64-1.64H6.23a1.62,1.62,0,0,0-1.16.48,1.63,1.63,0,0,0-.48,1.16V9.63a1.6,1.6,0,0,0,.48,1.16,1.62,1.62,0,0,0,1.16.47H18.09a1.67,1.67,0,0,0,1.16-.47,1.62,1.62,0,0,0,.48-1.16V5.58Zm-.94,4.05a.68.68,0,0,1-.7.7H6.23a.66.66,0,0,1-.48-.2.74.74,0,0,1-.21-.5V5.58a.66.66,0,0,1,.2-.48.71.71,0,0,1,.48-.21H18.08a.74.74,0,0,1,.5.21.66.66,0,0,1,.2.48ZM6.48,7.72a.21.21,0,0,0,.17-.07.22.22,0,0,0,.07-.17V7.06a1.27,1.27,0,0,1,.11-.52.37.37,0,0,1,.36-.23H8.77A.25.25,0,0,0,9,6.17a.19.19,0,0,0,0-.23.27.27,0,0,0-.2-.12H7.19a.88.88,0,0,0-.72.39,1.51,1.51,0,0,0-.23.85v.42a.24.24,0,0,0,.24.24Zm-.19.81a.21.21,0,0,0,.17-.07.26.26,0,0,0,.07-.17.24.24,0,0,0-.24-.24.2.2,0,0,0-.16.09.2.2,0,0,0-.07.16.22.22,0,0,0,.07.17.23.23,0,0,0,.16.06Zm8.46,5.1a1.63,1.63,0,0,0-.47-1.16A1.61,1.61,0,0,0,13.12,12H6.23a1.6,1.6,0,0,0-1.16.46,1.62,1.62,0,0,0-.48,1.16v4.05a1.64,1.64,0,0,0,1.64,1.64h6.89a1.6,1.6,0,0,0,1.16-.48,1.62,1.62,0,0,0,.47-1.16Zm-.94,4a.7.7,0,0,1-.2.49.65.65,0,0,1-.5.2H6.23a.66.66,0,0,1-.48-.2.75.75,0,0,1-.21-.49v-4a.74.74,0,0,1,.21-.5.66.66,0,0,1,.48-.2h6.89a.68.68,0,0,1,.7.7v4Zm6.15,0v-4a1.6,1.6,0,0,0-.48-1.16A1.67,1.67,0,0,0,18.32,12H17.1a1.63,1.63,0,0,0-1.16.47,1.61,1.61,0,0,0-.47,1.16v4a1.67,1.67,0,0,0,.47,1.16,1.62,1.62,0,0,0,1.16.48h1.22A1.64,1.64,0,0,0,20,17.68Zm-.94-4v4a.75.75,0,0,1-.21.49.62.62,0,0,1-.48.2H17.11a.69.69,0,0,1-.5-.2.7.7,0,0,1-.2-.49v-4a.68.68,0,0,1,.7-.7h1.22a.66.66,0,0,1,.48.2.72.72,0,0,1,.21.5Z" transform="translate(-4.44 -3.79)"/></g></svg>',cancel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M14.15,11.63l5.61,5.61a1.29,1.29,0,0,1,.38.93,1.27,1.27,0,0,1-.4.93,1.25,1.25,0,0,1-.92.4,1.31,1.31,0,0,1-.94-.4l-5.61-5.61L6.67,19.1a1.31,1.31,0,0,1-.94.4,1.24,1.24,0,0,1-.92-.4,1.27,1.27,0,0,1-.4-.93,1.33,1.33,0,0,1,.38-.93l5.61-5.63L4.79,6a1.26,1.26,0,0,1-.38-.93,1.22,1.22,0,0,1,.4-.92,1.28,1.28,0,0,1,.92-.39,1.38,1.38,0,0,1,.94.38l5.61,5.61,5.61-5.61a1.33,1.33,0,0,1,.94-.38,1.26,1.26,0,0,1,.92.39,1.24,1.24,0,0,1,.4.92,1.29,1.29,0,0,1-.39.93L17,8.81l-2.8,2.82Z" transform="translate(-4.41 -3.76)"/></g></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.77"><g><path d="M8.77,8.72a.88.88,0,0,1-.61-.27.82.82,0,0,1-.25-.61.89.89,0,0,1,.25-.62A.82.82,0,0,1,8.77,7a.81.81,0,0,1,.61.25.83.83,0,0,1,.27.62.81.81,0,0,1-.25.61.91.91,0,0,1-.63.27Zm9.62-5a1.74,1.74,0,0,1,1.76,1.76V17.76a1.74,1.74,0,0,1-1.76,1.76H6.16A1.74,1.74,0,0,1,4.4,17.76V5.51A1.74,1.74,0,0,1,6.16,3.75H18.39Zm0,1.75H6.16v8L8.53,11.8a.94.94,0,0,1,.54-.17.86.86,0,0,1,.54.2L11.09,13l3.64-4.55a.78.78,0,0,1,.34-.25.85.85,0,0,1,.42-.07.89.89,0,0,1,.39.12.78.78,0,0,1,.28.29l2.24,3.67V5.51Zm0,12.24V15.6L15.3,10.53,11.89,14.8a.89.89,0,0,1-.59.32.82.82,0,0,1-.64-.18L9,13.62,6.16,15.74v2Z" transform="translate(-4.4 -3.75)"/></g></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.55"><g><path d="M20.15,10.26V18.9l-3.94-1.57v1.2H4.41V10.66H16.22v1.23l2-.81,2-.82ZM14.64,17h0V12.54h0v-.31H6V17h8.67Zm3.94-.37v-4l-2.37,1v2l1.18.48,1.19.48ZM7.94,9.86A2.77,2.77,0,0,1,5.19,7.11a2.76,2.76,0,0,1,5.51,0A2.78,2.78,0,0,1,7.94,9.86Zm0-3.93a1.21,1.21,0,0,0-.83.35,1.15,1.15,0,0,0-.34.84A1.09,1.09,0,0,0,7.11,8,1.15,1.15,0,0,0,8,8.28,1.13,1.13,0,0,0,9.11,7.12,1.16,1.16,0,0,0,7.94,5.93Zm5.9,3.93a2.34,2.34,0,0,1-1.67-.68,2.3,2.3,0,0,1-.68-1.67,2.35,2.35,0,0,1,4-1.67,2.37,2.37,0,0,1,0,3.34,2.33,2.33,0,0,1-1.68.68Zm0-3.14a.75.75,0,1,0,.55.22.73.73,0,0,0-.55-.22Z" transform="translate(-4.41 -4.35)"/></g></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.72"><g><path d="M13.05,13.63a.24.24,0,0,1,.15.22L13.42,16a.19.19,0,0,1-.08.18l-2.12,2.14a4.08,4.08,0,0,1-1.29.85A4,4,0,0,1,4.71,17a3.92,3.92,0,0,1-.3-1.52A4,4,0,0,1,4.71,14a3.91,3.91,0,0,1,.87-1.3L7.7,10.56a.25.25,0,0,1,.2-.06l2.17.22a.21.21,0,0,1,.19.15.24.24,0,0,1,0,.25L7.12,14.23a1.81,1.81,0,0,0,0,2.58,1.78,1.78,0,0,0,1.29.52,1.74,1.74,0,0,0,1.28-.52L12.8,13.7a.24.24,0,0,1,.25-.07ZM19,4.92a4,4,0,0,1,0,5.66L16.86,12.7a.25.25,0,0,1-.17.08l-2.2-.23a.21.21,0,0,1-.19-.15.22.22,0,0,1,0-.25L17.44,9a1.81,1.81,0,0,0,0-2.58,1.78,1.78,0,0,0-1.29-.52,1.74,1.74,0,0,0-1.28.52L11.76,9.57a.21.21,0,0,1-.25,0,.24.24,0,0,1-.16-.21l-.22-2.17a.19.19,0,0,1,.08-.18l2.12-2.14a4.08,4.08,0,0,1,1.29-.85,4.05,4.05,0,0,1,3.06,0,3.85,3.85,0,0,1,1.3.85ZM5.84,9.82a.25.25,0,0,1-.18-.08.19.19,0,0,1-.07-.19l.11-.77a.2.2,0,0,1,.11-.17.24.24,0,0,1,.2,0l2.5.72a.25.25,0,0,1,.15.27.22.22,0,0,1-.23.21l-2.59,0Zm4.12-2-.73-2.5a.27.27,0,0,1,0-.2A.21.21,0,0,1,9.41,5L10.19,5a.25.25,0,0,1,.19,0,.23.23,0,0,1,.08.18l-.05,2.61a.2.2,0,0,1-.19.23h0A.22.22,0,0,1,10,7.85Zm8.76,5.58a.25.25,0,0,1,.18.08.23.23,0,0,1,.06.2l-.11.77a.25.25,0,0,1-.11.17.21.21,0,0,1-.12,0l-.08,0L16,14a.25.25,0,0,1-.15-.27.22.22,0,0,1,.22-.21l1.29,0,1.33,0Zm-4.12,2,.74,2.51a.28.28,0,0,1,0,.2.23.23,0,0,1-.18.11l-.8.11a.23.23,0,0,1-.17-.07.25.25,0,0,1-.08-.18l0-2.61a.22.22,0,0,1,.22-.22.21.21,0,0,1,.26.15Z" transform="translate(-4.41 -3.77)"/></g></svg>',math:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.73"><g><path d="M17.19,5.73a1,1,0,0,0,.71-.29,1,1,0,0,0,.28-.7,1,1,0,0,0-1-1H7.35a1,1,0,0,0-1,1,.77.77,0,0,0,.13.47h0l4.58,6.43L6.68,17.81a1.25,1.25,0,0,0-.29.71.94.94,0,0,0,.28.7.92.92,0,0,0,.69.28H17.2a1,1,0,0,0,.71-.28,1,1,0,0,0,0-1.39.92.92,0,0,0-.71-.29H9.26l3.87-5.43a.86.86,0,0,0,0-.95L9.26,5.73h7.93Z" transform="translate(-6.38 -3.77)"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.72"><g><path d="M19,18.32a4,4,0,0,0,0-5.68L15.85,9.5l-1.17,1.55L17.57,14a2,2,0,0,1,.61,1.47,2.08,2.08,0,0,1-2.09,2.09,2,2,0,0,1-1.47-.61l-.38-.37-1.74,1,.8.78a4,4,0,0,0,5.68,0ZM8,9.77a2,2,0,0,1-1.27-1,1.89,1.89,0,0,1-.21-1.57A2.1,2.1,0,0,1,7.45,6,2,2,0,0,1,9,5.76L12.27,7.2l.49-2L9.48,3.9a4,4,0,0,0-3.06.41A3.82,3.82,0,0,0,4.56,6.73a3.8,3.8,0,0,0,.4,3A3.78,3.78,0,0,0,7.39,11.6l5.38,2,.49-2-2.64-.94L8,9.77Z" transform="translate(-4.41 -3.76)"/></g></svg>',table_header:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M17,19.5v-.78H15.5v.78H17Zm-3,0v-.78H12.5v.78H14Zm-3,0v-.78H9.53v.78H11Zm-3,0v-.78H6.53v.78H8Zm10.55,0a1.73,1.73,0,0,0,.85-.35,1.67,1.67,0,0,0,.56-.76l-.71-.31a1.21,1.21,0,0,1-.35.4,1.34,1.34,0,0,1-.53.23l.08.38c.06.24.09.38.1.41Zm-13.7-.63.55-.55A.77.77,0,0,1,5.25,18a1.31,1.31,0,0,1-.06-.38v-.38H4.41v.38a2,2,0,0,0,.12.68,1.6,1.6,0,0,0,.35.57Zm15.27-2.12V15.26h-.78v1.49h.78Zm-15-1V14.23H4.41v1.49h.78Zm15-2V12.26h-.78v1.49h.78Zm-15-1V11.22H4.41v1.51h.78Zm15-2V9.26h-.78v1.51h.78Zm-15-1V8.17H4.41V9.74h.78Zm15-2V6.28h-.78V7.77h.78Zm-15-1.11V5.33L4.48,5.1a.77.77,0,0,0-.07.27,2.72,2.72,0,0,0,0,.28v1h.79ZM19.21,5l.63-.4A1.62,1.62,0,0,0,19.16,4a1.94,1.94,0,0,0-.91-.22v.78a1.31,1.31,0,0,1,.56.12.88.88,0,0,1,.4.36ZM6,4.54H7.78V3.76H6a.82.82,0,0,0-.28.06l.12.35c.07.21.1.33.11.36Zm10.8,0V3.76H15.28v.78h1.49Zm-3,0V3.76H12.28v.78h1.49Zm-3,0V3.76H9.28v.78h1.51ZM6,10.84h12.6V6.91H6Z" transform="translate(-4.4 -3.76)"/></g></svg>',merge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 15.74"><g><path d="M18.92,13.5h1.23v4.15A1.84,1.84,0,0,1,18.3,19.5H14V18.27H18.3a.6.6,0,0,0,.44-.18.59.59,0,0,0,.18-.44V13.5ZM18.3,3.76a1.84,1.84,0,0,1,1.85,1.85V9.82H18.92V5.6a.6.6,0,0,0-.18-.44A.59.59,0,0,0,18.3,5H14V3.76H18.3Zm1.85,8.51H15.6L17.26,14l-.86.86-3.14-3.17L16.4,8.51l.86.86L15.62,11h4.54v1.24Zm-13.9,6h4.27V19.5H6.25A1.84,1.84,0,0,1,4.4,17.65V13.5H5.63v4.15a.61.61,0,0,0,.62.62Zm0-14.51h4.27V5H6.25a.6.6,0,0,0-.44.18.57.57,0,0,0-.17.43V9.81H4.41V5.6A1.83,1.83,0,0,1,6.25,3.76Zm5,7.9L8.15,14.83,7.3,14,9,12.27H4.41V11H8.94L7.3,9.38,7.73,9l.43-.43Z" transform="translate(-4.4 -3.76)"/></g></svg>',split_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M10.37,12.25H6.74L8.4,13.94l-.87.86L4.41,11.63,7.53,8.5l.87.86L6.74,11h3.62v1.23Zm9.78-.61L17,14.81,16.13,14l1.66-1.69H14.16V11h3.63L16.13,9.37l.43-.43A5.24,5.24,0,0,1,17,8.51ZM18.9,8.22V5.61a.57.57,0,0,0-.18-.43A.65.65,0,0,0,18.29,5H12.88V18.28h5.41a.7.7,0,0,0,.44-.18.57.57,0,0,0,.18-.43V15h1.23v2.64a1.84,1.84,0,0,1-1.85,1.83h-12A1.84,1.84,0,0,1,4.94,19a1.81,1.81,0,0,1-.54-1.29V15H5.63v2.64a.57.57,0,0,0,.18.43.67.67,0,0,0,.44.18h5.41V5H6.25a.7.7,0,0,0-.44.18.56.56,0,0,0-.17.43V8.22H4.41V5.61A1.8,1.8,0,0,1,5,4.31a1.91,1.91,0,0,1,1.31-.55h12a1.89,1.89,0,0,1,1.31.55,1.8,1.8,0,0,1,.54,1.3V8.23H18.9Z" transform="translate(-4.4 -3.76)"/></g></svg>',caption:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.79"><g><path d="M4.41,18.52H20.15v-2H4.41ZM20,4.73H18.07V6h.65v.65H20V4.73ZM17,6V4.73H14.55V6H17ZM13.49,6V4.73H11V6h2.47ZM10,6V4.73H7.5V6H10ZM5.79,6h.65V4.73H4.5V6.67H5.8V6ZM4.5,11.34H5.79V8.48H4.5ZM6.44,13.8H5.79v-.65H4.5v1.94H6.44ZM17,15.09V13.8H14.55v1.29H17Zm-3.52,0V13.8H11v1.29h2.47Zm-3.53,0V13.8H7.5v1.29H10ZM20,13.16H18.72v.65h-.65V15.1H20Zm-1.29-1.82H20V8.48h-1.3v2.86Z" transform="translate(-4.41 -4.73)"/></g></svg>',edit:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.73"><g><path d="M7.51,5.68h6l1.52-1.57H6.94a2.4,2.4,0,0,0-1.79.82A2.8,2.8,0,0,0,4.41,6.8V17a2.55,2.55,0,0,0,.75,1.8A2.48,2.48,0,0,0,7,19.5H17.22a2.57,2.57,0,0,0,1.83-.74,2.52,2.52,0,0,0,.77-1.8V8.83l-1.58,1.54v6a1.54,1.54,0,0,1-1.53,1.53H7.51A1.54,1.54,0,0,1,6,16.41V7.21A1.52,1.52,0,0,1,7.51,5.68Zm5.63,7.47h0L10.7,10.74l-1,3.38,1.71-.48,1.7-.49Zm.34-.34h0l5.36-5.32L16.4,5.08,11,10.4l1.23,1.21,1.21,1.2ZM19.93,6.4a.82.82,0,0,0,.22-.48A.54.54,0,0,0,20,5.47L18.45,4A.67.67,0,0,0,18,3.77a.7.7,0,0,0-.48.21l-.74.72,2.44,2.43.37-.37.35-.36Z" transform="translate(-4.41 -3.77)"/></g></svg>',delete:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.74"><g><path d="M19.16,6.71a.94.94,0,0,0,.69-.28.91.91,0,0,0,.29-.68A1,1,0,0,0,19.85,5a.93.93,0,0,0-.69-.3H14.24A.94.94,0,0,0,14,4.06a.92.92,0,0,0-.7-.3h-2a1,1,0,0,0-.7.3.93.93,0,0,0-.28.68H5.39A.92.92,0,0,0,4.7,5a1,1,0,0,0-.29.71.91.91,0,0,0,.29.68,1,1,0,0,0,.69.28H19.16Zm-12.79,1a1,1,0,0,0-.7.3.94.94,0,0,0-.28.69v8.85A1.88,1.88,0,0,0,6,18.93a1.9,1.9,0,0,0,1.39.57H17.2a1.87,1.87,0,0,0,1.39-.58,1.91,1.91,0,0,0,.58-1.39V8.68A1,1,0,0,0,18.88,8a.89.89,0,0,0-.7-.29,1,1,0,0,0-.69.29.92.92,0,0,0-.29.68v7.87a1,1,0,0,1-1,1H8.34a.94.94,0,0,1-.69-.28,1,1,0,0,1-.29-.71V8.68a1,1,0,0,0-1-1Z" transform="translate(-4.41 -3.76)"/></g></svg>',modify:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.7 15.74"><g><path d="M19.79,15.23a.66.66,0,0,1,.3.38.59.59,0,0,1-.07.48l-.8,1.38a.66.66,0,0,1-.38.3.59.59,0,0,1-.48-.07l-.68-.38a4.55,4.55,0,0,1-1.34.77v.78a.64.64,0,0,1-.18.45.61.61,0,0,1-.45.18h-1.6a.6.6,0,0,1-.44-.18.66.66,0,0,1-.19-.45v-.78a4.36,4.36,0,0,1-1.32-.77l-.69.38a.58.58,0,0,1-.48.07.66.66,0,0,1-.38-.3l-.38-.66h.83a1.77,1.77,0,0,0,1.23-.52,1.72,1.72,0,0,0,.51-1.23v-.18a3,3,0,0,0,.49-.28l.15.09a1.83,1.83,0,0,0,.88.23A1.75,1.75,0,0,0,15.84,14l.88-1.52a1.7,1.7,0,0,0,.17-1.32,1.66,1.66,0,0,0-.3-.61,1.84,1.84,0,0,0-.51-.45l-.15-.09,0-.29,0-.28.15-.09a1,1,0,0,0,.26-.18l0,.06v.78a4.34,4.34,0,0,1,1.34.77l.68-.38a.68.68,0,0,1,.48-.06.64.64,0,0,1,.38.29l.8,1.38a.58.58,0,0,1,.07.48.63.63,0,0,1-.3.38l-.68.4a3.84,3.84,0,0,1,.08.76,4.13,4.13,0,0,1-.08.78l.34.18.32.2ZM10.17,7.86a1.9,1.9,0,0,1,1.35,3.23,1.85,1.85,0,0,1-1.35.55A1.9,1.9,0,0,1,8.83,8.41a1.92,1.92,0,0,1,1.34-.55Zm1.58,7.2a.73.73,0,0,1-.21.49.66.66,0,0,1-.48.2H9.29a.68.68,0,0,1-.69-.69V14.2a4.75,4.75,0,0,1-1.48-.86l-.75.45a.73.73,0,0,1-.7,0,.63.63,0,0,1-.25-.26L4.54,12a.67.67,0,0,1-.08-.53.71.71,0,0,1,.32-.42l.75-.43a4.8,4.8,0,0,1-.08-.85,4.71,4.71,0,0,1,.08-.85l-.74-.44a.71.71,0,0,1-.32-.42.65.65,0,0,1,.07-.54L5.42,6a.66.66,0,0,1,.42-.32l.18,0a.73.73,0,0,1,.35.09l.75.43A4.68,4.68,0,0,1,8.6,5.33V4.45a.68.68,0,0,1,.69-.69h1.77a.64.64,0,0,1,.48.2.73.73,0,0,1,.21.49v.88a4.75,4.75,0,0,1,1.48.85L14,5.75a.67.67,0,0,1,.34-.09l.18,0a.71.71,0,0,1,.42.32l.89,1.54a.67.67,0,0,1,.06.52.73.73,0,0,1-.32.43l-.75.42a4.8,4.8,0,0,1,.08.85,4.71,4.71,0,0,1-.08.85l.75.43a.66.66,0,0,1,.32.42.73.73,0,0,1-.06.54l-.89,1.52a.69.69,0,0,1-.25.26.7.7,0,0,1-.35.09.64.64,0,0,1-.34-.09l-.75-.45a4.87,4.87,0,0,1-1.48.86v.87ZM7.23,9.75a3,3,0,0,0,.86,2.08,2.94,2.94,0,1,0,4.16-4.16,3,3,0,0,0-2.08-.85A2.94,2.94,0,0,0,7.23,9.75Z" transform="translate(-4.44 -3.76)"/></g></svg>',revert:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 14.69"><g><path d="M18.26,15V12.3l1.89-2V15a2.58,2.58,0,0,1-.24,1c-.2.58-.75.92-1.65,1H7.56v2L4.41,15.63,7.56,13v2h10.7ZM6.3,8.28V11L4.41,13V8.28a2.58,2.58,0,0,1,.24-1c.2-.58.75-.92,1.65-1H17v-2l3.15,3.34L17,10.3v-2H6.3Z" transform="translate(-4.4 -4.28)"/></g></svg>',auto_size:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M6.71,17.19,6.89,16l1.21-.15A6,6,0,0,1,6.81,13.9a5.78,5.78,0,0,1-.45-2.27A6,6,0,0,1,8.1,7.45a5.83,5.83,0,0,1,4.17-1.73l1-1-1-1A7.89,7.89,0,0,0,5,14.64a7.73,7.73,0,0,0,1.71,2.55Zm5.57,2.31h0A7.86,7.86,0,0,0,17.85,6.07L17.67,7.3l-1.21.15a5.9,5.9,0,0,1,1.29,1.92,5.81,5.81,0,0,1,.45,2.26,5.91,5.91,0,0,1-5.9,5.9l-1,1,.49.49.47.5Z" transform="translate(-4.41 -3.76)"/></g></svg>',insert_row_below:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M15.7,1.3c-0.1-0.1-0.1-0.2-0.2-0.2L15.3,1H0.4L0.3,1.1c0,0-0.1,0.1-0.1,0.1c0,0-0.1,0.1-0.1,0.1L0,1.4v7.7l0.1,0.1c0,0.1,0.1,0.1,0.2,0.2l0.1,0.1h2.3V9.3l0.1-0.5L3,8.5l0.1-0.2c-0.1,0-0.2,0-0.3,0H1.2v-6h13.3v6h-1.6c-0.1,0-0.2,0-0.3,0l0.1,0.2l0.2,0.4C12.9,9,13,9.2,13,9.3v0.1h2.3l0.2-0.1c0.1,0,0.1-0.1,0.2-0.2l0.1-0.1V1.4L15.7,1.3z"/><path d="M10.5,7.5C9.9,7.1,9.3,6.8,8.6,6.7c-0.2,0-0.5-0.1-0.7,0c-0.2,0-0.5,0-0.7,0C6.6,6.7,6.1,6.9,5.6,7.3C5.2,7.6,4.7,8,4.4,8.4C4.3,8.6,4.2,8.8,4.2,8.9C4.1,9.1,4,9.3,3.9,9.4C3.9,9.6,3.8,9.7,3.8,9.9c0,0.2-0.1,0.3-0.1,0.5v-0.1c-0.1,0.8,0.1,1.6,0.5,2.4c0.4,0.7,1,1.3,1.7,1.7c0.3,0.2,0.6,0.3,0.9,0.3c0.3,0.1,0.7,0.1,1,0.1c0.3,0,0.7,0,1-0.1c0.3-0.1,0.6-0.2,0.9-0.3c0.5-0.3,0.9-0.6,1.3-1c0.3-0.4,0.6-0.8,0.8-1.3c0.1-0.4,0.2-0.9,0.2-1.4c0-0.5-0.1-1-0.3-1.4C11.5,8.6,11.1,8,10.5,7.5z M10.1,11.3H8.5v1.6H8H7.9H7.3v0v-0.1v-1.4H5.7v-0.4v-0.2v-0.6h0h1.5V8.5h1.2v1.6h1.6V11.3z"/></g></svg>',insert_row_above:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M0.1,14.5c0.1,0.1,0.1,0.2,0.2,0.2l0.1,0.1h14.9l0.1-0.1c0,0,0.1-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1l0.1-0.1V6.7l-0.1-0.1c0-0.1-0.1-0.1-0.2-0.2l-0.1-0.1h-2.3v0.1l-0.1,0.5l-0.2,0.4l-0.1,0.2c0.1,0,0.2,0,0.3,0h1.6v6H1.3v-6h1.6c0.1,0,0.2,0,0.3,0L3.1,7.3L2.9,6.9C2.8,6.8,2.8,6.6,2.7,6.5V6.3H0.4L0.3,6.4c-0.1,0-0.1,0.1-0.2,0.2L0,6.7v7.7L0.1,14.5z"/><path d="M5.3,8.3c0.6,0.5,1.2,0.8,1.9,0.9c0.2,0,0.5,0.1,0.7,0c0.2,0,0.5,0,0.7,0c0.6-0.1,1.1-0.3,1.6-0.6c0.5-0.3,0.9-0.7,1.2-1.2c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.4,0.2-0.5c0.1-0.1,0.1-0.3,0.1-0.4C12,5.8,12,5.6,12,5.4v0.1c0.1-0.8-0.1-1.6-0.5-2.4c-0.4-0.7-1-1.3-1.7-1.7C9.5,1.3,9.2,1.2,8.9,1.1C8.5,1,8.2,1,7.9,1c-0.3,0-0.7,0-1,0.1C6.6,1.2,6.3,1.3,6,1.4C5.5,1.7,5.1,2,4.7,2.4C4.4,2.8,4.1,3.3,3.9,3.8C3.8,4.2,3.7,4.7,3.7,5.2c0,0.5,0.1,1,0.3,1.4C4.3,7.2,4.7,7.8,5.3,8.3z M5.7,4.5h1.6V2.9h0.5h0.1h0.6v0v0.1v1.4H10v0.4v0.2v0.6h0H8.5v1.6H7.3V5.7H5.7V4.5z"/></g></svg>',insert_column_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M14.5,15.7c0.1-0.1,0.2-0.1,0.2-0.2l0.1-0.1V0.4l-0.1-0.1c0,0-0.1-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1L14.4,0H6.7L6.6,0.1c-0.1,0-0.1,0.1-0.2,0.2L6.3,0.4v2.3h0.1l0.5,0.1L7.3,3l0.2,0.1c0-0.1,0-0.2,0-0.3V1.2h6v13.3h-6v-1.6c0-0.1,0-0.2,0-0.3l-0.2,0.1l-0.4,0.2C6.7,12.9,6.6,13,6.4,13H6.3v2.3l0.1,0.2c0,0.1,0.1,0.1,0.2,0.2l0.1,0.1h7.7L14.5,15.7z"/><path d="M8.3,10.5C8.7,10,9,9.3,9.1,8.6c0-0.2,0.1-0.5,0-0.7c0-0.2,0-0.5,0-0.7C9,6.7,8.8,6.1,8.5,5.7C8.2,5.2,7.8,4.8,7.3,4.5C7.2,4.4,7,4.3,6.9,4.2C6.7,4.1,6.5,4,6.4,4C6.2,3.9,6.1,3.9,5.9,3.8c-0.2,0-0.3-0.1-0.5-0.1h0.1C4.7,3.7,3.8,3.9,3.1,4.3C2.4,4.7,1.8,5.3,1.4,6C1.3,6.3,1.2,6.6,1.1,6.9C1,7.2,1,7.6,1,7.9c0,0.3,0,0.7,0.1,1c0.1,0.3,0.2,0.6,0.3,0.9c0.3,0.5,0.6,0.9,1,1.3c0.4,0.3,0.8,0.6,1.3,0.8C4.2,12,4.7,12.1,5.1,12c0.5,0,1-0.1,1.4-0.3C7.2,11.5,7.8,11.1,8.3,10.5zM4.5,10.1V8.5H2.9V8V7.9V7.3h0H3h1.4V5.7h0.4h0.2h0.6v0v1.5h1.6v1.2H5.7v1.6H4.5z"/></g></svg>',insert_column_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M1.3,0.1C1.2,0.2,1.1,0.2,1.1,0.3L1,0.4v14.9l0.1,0.1c0,0,0.1,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1l0.1,0.1h7.7l0.1-0.1c0.1,0,0.1-0.1,0.2-0.2l0.1-0.1v-2.3H9.3l-0.5-0.1l-0.4-0.2l-0.2-0.1c0,0.1,0,0.2,0,0.3v1.6h-6V1.3h6v1.6c0,0.1,0,0.2,0,0.3l0.2-0.1l0.4-0.2C9,2.9,9.2,2.8,9.3,2.8h0.1V0.5L9.4,0.3c0-0.1-0.1-0.1-0.2-0.2L9.1,0H1.4L1.3,0.1z"/><path d="M7.5,5.3C7,5.8,6.7,6.5,6.6,7.2c0,0.2-0.1,0.5,0,0.7c0,0.2,0,0.5,0,0.7c0.1,0.6,0.3,1.1,0.6,1.6c0.3,0.5,0.7,0.9,1.2,1.2c0.2,0.1,0.3,0.2,0.5,0.3c0.2,0.1,0.4,0.2,0.5,0.2c0.1,0.1,0.3,0.1,0.4,0.1c0.2,0,0.3,0.1,0.5,0.1h-0.1c0.8,0.1,1.6-0.1,2.4-0.5c0.7-0.4,1.3-1,1.7-1.7c0.2-0.3,0.3-0.6,0.3-0.9c0.1-0.3,0.1-0.7,0.1-1c0-0.3,0-0.7-0.1-1c-0.1-0.3-0.2-0.6-0.3-0.9c-0.3-0.5-0.6-0.9-1-1.3C13,4.4,12.5,4.2,12,4c-0.4-0.1-0.9-0.2-1.4-0.2c-0.5,0-1,0.1-1.4,0.2C8.5,4.3,7.9,4.7,7.5,5.3z M11.3,5.7v1.6h1.6v0.5v0.1v0.6h0h-0.1h-1.4v1.6h-0.4h-0.2h-0.6v0V8.5H8.5V7.3h1.6V5.7H11.3z"/></g></svg>',delete_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 13.83"><g><path d="M4.7,18.46l.12.08H19.73l.12-.08a.58.58,0,0,0,.22-.22l.08-.12,0-7.69-.08-.11a.77.77,0,0,0-.18-.18l-.11-.08-2.31,0-.08.28-.1.29a1.58,1.58,0,0,1-.12.29l-.14.34s0,0,.18,0H18.9v6H5.64v-6H7.35c.14,0,.2,0,.18,0l-.14-.34a2.85,2.85,0,0,1-.12-.29l-.1-.29-.07-.27-2.31,0-.11.08a.77.77,0,0,0-.18.18l-.08.11,0,7.69.08.12a.47.47,0,0,0,.09.12l.13.09ZM12.11,13a4,4,0,0,0,1.46-.21,4.51,4.51,0,0,0,1.31-.71A4,4,0,0,0,16.26,10a4.32,4.32,0,0,0-.08-2.54,4.34,4.34,0,0,0-1-1.52,4.15,4.15,0,0,0-1.54-1,4.34,4.34,0,0,0-1.35-.22A4.07,4.07,0,0,0,11,4.93,3.94,3.94,0,0,0,9.24,6.07,3.92,3.92,0,0,0,8.15,8.88a3.91,3.91,0,0,0,.12.95A4.16,4.16,0,0,0,12.11,13Zm2.35-4.14v.58H10.09V8.27h4.37v.58Z" transform="translate(-4.4 -4.71)"/></g></svg>',delete_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13.81 15.74"><g><path d="M5.66,19.42l.12.08,7.69,0,.11-.08a.77.77,0,0,0,.18-.18l.08-.11,0-2.32-.15,0-.45-.15-.42-.18-.17-.07a1,1,0,0,0,0,.27v1.63h-6V5h6V6.62a.9.9,0,0,0,0,.26l.17-.07.42-.17a3.91,3.91,0,0,1,.45-.15l.15,0,0-2.32L13.75,4a.77.77,0,0,0-.18-.18l-.11-.08H5.79l-.13.07a.63.63,0,0,0-.21.22l-.08.12V19.08l.08.12a.47.47,0,0,0,.09.12.35.35,0,0,0,.12.1Zm9-3.67a4.16,4.16,0,0,0,2.36-.51,4.08,4.08,0,0,0,1.67-1.72,4,4,0,0,0,.35-.91,3.79,3.79,0,0,0,.1-1,4.71,4.71,0,0,0-.11-1,5,5,0,0,0-.3-.87,4.25,4.25,0,0,0-1-1.25,4.49,4.49,0,0,0-1.34-.81A4.26,4.26,0,0,0,15,7.48a3.88,3.88,0,0,0-1.41.25A4.32,4.32,0,0,0,11.86,9,4,4,0,0,0,11,10.94a4.4,4.4,0,0,0-.05.68,4.5,4.5,0,0,0,.05.68,3.93,3.93,0,0,0,.61,1.57,4.22,4.22,0,0,0,1.18,1.2,4.59,4.59,0,0,0,.48.27c.2.1.37.17.5.22a2.44,2.44,0,0,0,.45.12,4.61,4.61,0,0,0,.5.07Zm2.54-4.12v.58H12.87V11h4.37v.59Z" transform="translate(-5.37 -3.76)"/></g></svg>',fixed_column_width:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6,5H18A1,1 0 0,1 19,6A1,1 0 0,1 18,7H6A1,1 0 0,1 5,6A1,1 0 0,1 6,5M21,2V4H3V2H21M15,8H17V22H15V8M7,8H9V22H7V8M11,8H13V22H11V8Z" /></svg>',rotate_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M0.5,10.2c0,0.1,0,0.2,0,0.3v0.2l0,0c0.1,0.3,0.3,0.6,0.4,0.9l0,0C1,11.8,1.3,12,1.5,11.9h0.1h0.2h0.1c0.1-0.1,0.3-0.3,0.4-0.5v-0.2c0-0.1,0-0.2-0.1-0.3l0,0c-0.2-0.2-0.3-0.4-0.3-0.7l0,0C1.8,10,1.7,9.9,1.5,9.8c-0.1,0-0.2,0-0.3,0H0.9C0.7,9.9,0.6,10,0.5,10.2L0.5,10.2z"/><path d="M2.2,11.5L2.2,11.5L2.2,11.5z"/><path d="M5.9,3.6L5.9,3.6L5.9,3.6z"/><path d="M0.1,7.9c0,0.3,0,0.6,0,0.9l0,0l0,0l0,0l0,0c0,0.2,0.1,0.3,0.2,0.4l0,0c0.2,0.1,0.3,0.2,0.5,0.2l0,0l0,0c0.2,0,0.4-0.1,0.5-0.3l0,0c0-0.1,0.1-0.3,0.1-0.4V8.6l0,0c0-0.2,0-0.5,0-0.7l0,0c0-0.2-0.1-0.4-0.2-0.5C1.1,7.3,0.9,7.2,0.7,7.2S0.3,7.3,0.2,7.4C0.1,7.5,0,7.7,0.1,7.9z"/><path d="M1.9,12.7L1.9,12.7c0,0.2,0,0.4,0.2,0.5l0,0l0.2,0.3l0,0c0.2,0.1,0.3,0.2,0.5,0.4l0,0l0,0l0,0l0,0C2.9,14,3,14.1,3.2,14.1s0.4-0.1,0.5-0.2c0.1-0.2,0.2-0.3,0.2-0.5v-0.1c0-0.2-0.1-0.4-0.2-0.5l0,0l-0.4-0.4l-0.2-0.2l0,0C3,12.1,2.8,12,2.6,12l0,0c-0.2,0-0.4,0.1-0.5,0.2l0,0C2,12.3,1.9,12.5,1.9,12.7z"/><path d="M6.6,15c0,0.2,0.1,0.4,0.2,0.5c0.1,0.1,0.2,0.2,0.4,0.3l0,0c0.3,0,0.5,0,0.7,0h0.3l0,0c0.2,0,0.4-0.1,0.5-0.2c0.1-0.2,0.2-0.3,0.2-0.5l0,0l0,0c0-0.2-0.1-0.4-0.2-0.5l0,0c-0.1-0.1-0.3-0.2-0.5-0.2l0,0H7.9c-0.1,0-0.3,0-0.5,0l0,0H7.3c-0.2-0.1-0.3,0-0.5,0.1l0,0C6.7,14.6,6.6,14.8,6.6,15L6.6,15L6.6,15L6.6,15z"/><path d="M4.2,7.4C4,7.5,4,7.7,4,7.9c0,0.2,0,0.4,0.2,0.5l0,0l3.2,3.2l0,0c0.1,0.1,0.3,0.2,0.5,0.2s0.3-0.1,0.5-0.2l0,0l3.2-3.2l0,0c0.1-0.1,0.2-0.3,0.2-0.5c0-0.2-0.1-0.4-0.2-0.5l0,0C11.5,7.3,11,6.7,10,5.8l0,0L8.4,4.2l0,0C8.3,4.1,8.1,4,7.9,4S7.5,4.1,7.4,4.2L4.2,7.4L4.2,7.4z M6.8,9L5.7,7.9l2.2-2.2l2.3,2.2l-2.3,2.2C7.7,9.9,7.3,9.5,6.8,9L6.8,9z"/><path d="M4.1,14.1C4,14.2,4,14.3,4,14.4v0.2l0,0c0.1,0.1,0.2,0.3,0.4,0.4l0,0c0.3,0.1,0.6,0.2,0.9,0.4h0.1h0.1l0,0c0.2,0,0.3-0.1,0.5-0.1l0,0c0.2-0.1,0.3-0.3,0.3-0.4l0,0l0,0l0,0l0,0v-0.2c0-0.1-0.1-0.2-0.1-0.3l0,0C6.1,14.2,6,14.1,5.8,14l0,0c-0.3-0.1-0.5-0.2-0.8-0.2l0,0c-0.1-0.1-0.2-0.1-0.3-0.1H4.5C4.3,13.7,4.2,13.9,4.1,14.1z"/><path d="M9.3,14.4c0,0.1-0.1,0.3,0,0.4V15l0,0c0,0.1,0.1,0.3,0.5,0.4c0.1,0.1,0.3,0.1,0.4,0.1l0,0h0.1l0,0c0.3-0.1,0.6-0.2,0.9-0.3l0,0c0.1-0.1,0.2-0.2,0.3-0.4l0.1-0.3c0-0.1-0.1-0.2-0.1-0.3l0,0c-0.1-0.2-0.2-0.3-0.4-0.4l0,0h-0.3c-0.1,0-0.2,0-0.3,0l0,0c-0.2,0.1-0.5,0.2-0.8,0.3l0,0C9.5,14.1,9.4,14.2,9.3,14.4L9.3,14.4z"/><path d="M11.4,14.7L11.4,14.7L11.4,14.7z"/><path d="M9.5,15.3L9.5,15.3L9.5,15.3z"/><path d="M15.9,7.9c0-1-0.2-2-0.6-3l0,0c-0.4-1-1-1.9-1.7-2.6C12.8,1.6,12,1,11,0.6l0,0C10.1,0.2,9,0,8,0C7.3,0,6.5,0.1,5.8,0.3l0,0C5.2,0.5,4.6,0.8,4,1.1L3.1,0.2l0,0C2.9,0.1,2.8,0,2.6,0H2.4l0,0C2.2,0,2,0.2,1.9,0.4l0,0L0.1,4.9l0,0C0,5,0,5.1,0,5.2c0,0.2,0.1,0.4,0.2,0.5l0,0c0.2,0.1,0.3,0.2,0.5,0.2h0.1H1l0,0l4.7-1.8l0,0C5.9,4,6.1,3.8,6.1,3.6V3.4C6.1,3.2,6,3,5.9,2.9l0,0L5.1,2.1c0.4-0.2,0.8-0.4,1.3-0.5c0.5-0.1,1.1-0.2,1.7-0.2c0.9,0,1.7,0.2,2.5,0.5l0,0c0.8,0.3,1.5,0.8,2.1,1.4c0.6,0.6,1.1,1.3,1.4,2.1l0,0c0.3,0.8,0.5,1.6,0.5,2.5s-0.2,1.7-0.5,2.5l0,0c-0.3,0.8-0.8,1.5-1.4,2.1c-0.2,0.2-0.4,0.3-0.6,0.5l0,0c-0.2,0.1-0.3,0.3-0.3,0.5v0.1c0,0.1,0,0.3,0.1,0.4l0,0c0.1,0.2,0.3,0.3,0.5,0.3l0,0c0.1,0,0.3-0.1,0.4-0.2l0,0l0,0l0,0l0,0c0.2-0.2,0.5-0.4,0.7-0.6l0,0l0,0l0,0l0,0c0.7-0.8,1.3-1.6,1.7-2.6C15.6,10,15.8,9,15.9,7.9z M1.9,4C2,3.8,2.1,3.5,2.3,3.1l0,0L2.7,2l1.2,1.2L1.9,4z"/><path d="M6.8,15.5L6.8,15.5L6.8,15.5z"/></g></svg>',rotate_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M9.9,15.3L9.9,15.3L9.9,15.3z"/><path d="M6.9,15.1L6.9,15.1c0,0.1,0.1,0.3,0.2,0.4l0,0c0.1,0.2,0.3,0.3,0.5,0.3l0,0h0.3c0.2,0,0.4,0,0.7,0l0,0c0.2-0.1,0.3-0.2,0.4-0.3c0.1-0.1,0.2-0.2,0.2-0.4V15c0-0.2-0.1-0.4-0.2-0.4c-0.2-0.1-0.3-0.2-0.5-0.2H8.4l0,0c-0.1,0-0.3,0-0.5,0H7.6l0,0c-0.2,0-0.4,0.1-0.5,0.2C7,14.7,6.9,14.9,6.9,15.1z"/><path d="M6.5,14.4L6.5,14.4L6.5,14.4z"/><path d="M5.8,5.8L5.8,5.8c-1,0.9-1.5,1.5-1.7,1.6l0,0C4,7.5,4,7.7,4,7.9c0,0.2,0,0.4,0.2,0.5l0,0l3.2,3.2l0,0c0.2,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2l0,0l3.2-3.2l0,0c0.1-0.1,0.2-0.3,0.2-0.5c0-0.2-0.1-0.4-0.2-0.5l0,0L8.4,4.2C8.3,4.1,8.1,4,7.9,4C7.7,4,7.5,4.1,7.4,4.2l0,0L5.8,5.8z M5.6,7.9l2.3-2.2l2.2,2.2L9,9l0,0l0,0l0,0l0,0c-0.5,0.6-0.9,0.9-1.1,1.1L5.6,7.9z"/><path d="M9,15.5L9,15.5L9,15.5z"/><path d="M9.6,14.7v0.2l0,0l0,0l0,0l0,0c0.1,0.2,0.1,0.3,0.3,0.3c0.1,0.1,0.3,0.1,0.4,0.1l0,0h0.1h0.1c0.3-0.1,0.6-0.3,0.9-0.4l0,0c0.1-0.1,0.2-0.2,0.3-0.4l0,0v-0.2c0-0.1,0-0.2-0.1-0.3c-0.1-0.2-0.2-0.3-0.4-0.4H11c-0.1,0-0.2,0.1-0.3,0.1l0,0c-0.2,0.1-0.4,0.2-0.7,0.3l0,0l0,0c-0.1,0.1-0.3,0.2-0.4,0.4C9.6,14.5,9.6,14.6,9.6,14.7z"/><path d="M9,14.5L9,14.5L9,14.5z"/><path d="M9.6,14.4L9.6,14.4L9.6,14.4z"/><path d="M11.7,14L11.7,14L11.7,14z"/><path d="M15.6,7.4L15.6,7.4L15.6,7.4z"/><path d="M15,9.4c0.2,0,0.4,0,0.6-0.2l0,0c0.1-0.1,0.2-0.2,0.2-0.4l0,0l0,0l0,0l0,0c0-0.3,0-0.6,0-0.9c0-0.2-0.1-0.4-0.2-0.5c-0.1-0.1-0.3-0.2-0.5-0.2s-0.4,0.1-0.5,0.2c-0.1,0.1-0.2,0.3-0.2,0.5l0,0c0,0.2,0,0.4,0,0.7l0,0v0.1c0,0.1,0,0.3,0.1,0.4l0,0C14.6,9.3,14.8,9.4,15,9.4L15,9.4L15,9.4z"/><path d="M14,12h0.1h0.2h0.1c0.2,0,0.5-0.2,0.6-0.4l0,0c0.2-0.3,0.3-0.6,0.4-0.9l0,0v-0.2c0-0.1-0.1-0.2-0.1-0.3c-0.1-0.2-0.2-0.3-0.4-0.4h-0.3c-0.1,0-0.2,0-0.3,0C14.2,9.9,14,10,14,10.3l0,0c-0.1,0.2-0.2,0.5-0.3,0.7l0,0c-0.1,0.1-0.1,0.2-0.1,0.3v0.2l0,0l0,0C13.6,11.6,13.8,11.8,14,12z"/><path d="M14.6,7.4L14.6,7.4L14.6,7.4z"/><path d="M4.4,14.2c-0.1,0.1-0.1,0.2-0.1,0.3l0.1,0.2c0,0.2,0.2,0.3,0.3,0.4l0,0c0.3,0.1,0.6,0.3,1.1,0.4l0,0h0.1l0,0c0.1,0,0.2-0.1,0.4-0.2c0.1,0,0.2-0.2,0.3-0.3l0,0v-0.2c0-0.1-0.1-0.3-0.2-0.4c-0.1-0.1-0.2-0.2-0.4-0.3l0,0c-0.2-0.1-0.5-0.2-0.7-0.3l0,0c-0.1,0-0.2,0-0.3,0H4.7l0,0C4.6,13.9,4.4,14,4.4,14.2L4.4,14.2z"/><path d="M11.9,13.3c0,0.2,0.1,0.4,0.2,0.6c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2l0,0l0,0l0,0l0,0c0.1-0.1,0.3-0.3,0.4-0.4l0,0l0.2-0.3l0,0c0.1-0.2,0.2-0.3,0.2-0.5l0,0c0-0.2-0.1-0.4-0.2-0.5l0,0c-0.1-0.1-0.3-0.2-0.5-0.2l0,0c-0.2,0-0.4,0.1-0.5,0.2l0,0l-0.2,0.2l-0.4,0.4l0,0C12,13,11.9,13.1,11.9,13.3L11.9,13.3z"/><path d="M12.1,13.8L12.1,13.8L12.1,13.8z"/><path d="M11.9,13.3L11.9,13.3L11.9,13.3z"/><path d="M15.9,5.2c0-0.1-0.1-0.2-0.1-0.3l0,0L14,0.4l0,0C13.9,0.2,13.7,0,13.5,0l0,0l0,0h-0.2c-0.2,0-0.4,0.1-0.5,0.2l0,0l-0.9,0.9c-0.5-0.3-1.1-0.6-1.8-0.8l0,0C9.4,0.1,8.7,0,7.9,0c-1,0-2,0.2-3,0.6S3,1.6,2.3,2.3C1.6,3.1,1,3.9,0.6,4.9l0,0C0.2,5.8,0,6.8,0,7.9c0,1,0.2,2,0.6,3s0.9,1.8,1.7,2.6l0,0l0,0l0,0l0,0c0.2,0.2,0.5,0.4,0.7,0.6l0,0l0,0l0,0l0,0c0.2,0.1,0.3,0.2,0.5,0.2l0,0c0.2,0,0.4-0.1,0.6-0.3l0,0c0.1-0.1,0.1-0.3,0.1-0.4v-0.1l0,0C4.1,13.3,4,13.1,3.9,13l0,0c-0.2-0.1-0.4-0.3-0.6-0.5c-0.6-0.6-1.1-1.3-1.4-2.1l0,0C1.6,9.6,1.4,8.8,1.4,7.9s0.2-1.7,0.5-2.5l0,0c0.3-0.8,0.8-1.5,1.4-2.1c0.6-0.6,1.3-1.1,2.1-1.4l0,0C6.2,1.6,7,1.4,7.9,1.4c0.6,0,1.1,0.1,1.7,0.2c0.5,0.1,0.9,0.3,1.3,0.5l-0.8,0.8l0,0C10,3.1,9.9,3.2,9.9,3.4v0.2l0,0l0,0c0,0.2,0.2,0.4,0.4,0.5l0,0l4.5,1.8l0,0H15h0.1c0.2,0,0.4-0.1,0.5-0.2l0,0C15.7,5.6,15.8,5.4,15.9,5.2z M11.8,3.2L13,2l0.4,1.1l0,0c0.2,0.4,0.3,0.7,0.4,0.9L11.8,3.2z"/></g></svg>',mirror_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.75 15.74"><g><path d="M13.75,3.76l5.9,15.74h-5.9V3.76ZM4.9,19.5,10.8,3.76V19.5H4.9Z" transform="translate(-4.9 -3.76)"/></g></svg>',mirror_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.75"><g><path d="M20.15,13.1,4.41,19V13.1H20.15ZM4.41,4.25l15.74,5.9H4.41V4.25Z" transform="translate(-4.41 -4.25)"/></g></svg>',checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 12.1"><g><path d="M4.59,12.23l.12.18L9.43,17.5a.58.58,0,0,0,.84,0L20,7.45h0a.58.58,0,0,0,0-.84l-.85-.85a.58.58,0,0,0-.84,0H18.2l-8.12,8.41a.29.29,0,0,1-.42,0l-3.4-3.63a.58.58,0,0,0-.84,0l-.85.85a.6.6,0,0,0-.14.21.51.51,0,0,0,0,.44c.05.06.1.13.16.19Z" transform="translate(-4.38 -5.58)"/></g></svg>',line_break:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6a1,1,0,0,0-1,1v4a1,1,0,0,1-1,1H7.41l1.3-1.29A1,1,0,0,0,7.29,9.29l-3,3a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76,1,1,0,0,0,.21.33l3,3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42L7.41,14H17a3,3,0,0,0,3-3V7A1,1,0,0,0,19,6Z"/></svg>',audio:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z" /></svg>',image_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="30 30 150 150"><g><path d="M152.775,120.548V51.651c0-12.271-9.984-22.254-22.254-22.254H43.727c-12.271,0-22.254,9.983-22.254,22.254v68.896c0,12.27,9.983,22.254,22.254,22.254h86.795C142.791,142.802,152.775,132.817,152.775,120.548z M36.394,51.651c0-4.042,3.291-7.333,7.333-7.333h86.795c4.042,0,7.332,3.291,7.332,7.333v23.917l-14.938-17.767c-1.41-1.678-3.487-2.649-5.68-2.658h-0.029c-2.184,0-4.255,0.954-5.674,2.613L76.709,98.519l-9.096-9.398c-1.427-1.474-3.392-2.291-5.448-2.273c-2.052,0.025-4.004,0.893-5.396,2.4L36.394,111.32V51.651z M41.684,127.585l20.697-22.416l9.312,9.622c1.461,1.511,3.489,2.334,5.592,2.27c2.101-0.066,4.075-1.013,5.44-2.612l34.436-40.308l20.693,24.613v21.794c0,4.042-3.29,7.332-7.332,7.332H43.727C43.018,127.88,42.334,127.775,41.684,127.585z M182.616,152.5V75.657c0-4.12-3.34-7.46-7.461-7.46c-4.119,0-7.46,3.34-7.46,7.46V152.5c0,4.112-3.347,7.46-7.461,7.46h-94c-4.119,0-7.46,3.339-7.46,7.459c0,4.123,3.341,7.462,7.46,7.462h94C172.576,174.881,182.616,164.841,182.616,152.5z"/></g></svg>',bookmark:'<svg viewBox="0 0 24 24"><path d="M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',download:'<svg viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z" /></svg>',dir_ltr:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2H9C6.79 2 5 3.79 5 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zm0 12v3H5v2h12v3l4-4-4-4z"/></svg>',dir_rtl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zM8 14l-4 4 4 4v-3h12v-2H8v-3z"/></svg>',alert_outline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" /></svg>',more_text:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M49.711,142.188h49.027c2.328,0.002,4.394,1.492,5.129,3.699l9.742,29.252c0.363,1.092,1.385,1.828,2.537,1.83l15.883,0.01c0.859,0,1.667-0.412,2.17-1.109s0.641-1.594,0.37-2.41l-16.625-50.045L86.503,28.953c-0.36-1.097-1.383-1.839-2.537-1.842H64.532c-1.153-0.001-2.178,0.736-2.542,1.831L13.847,173.457c-0.271,0.816-0.135,1.713,0.369,2.412c0.503,0.697,1.311,1.109,2.171,1.109h15.872c1.151,0,2.173-0.736,2.537-1.828l9.793-29.287C45.325,143.66,47.39,142.18,49.711,142.188L49.711,142.188z M53.493,119.098l15.607-46.9c0.744-2.196,2.806-3.674,5.125-3.674s4.381,1.478,5.125,3.674l15.607,46.904c0.537,1.621,0.263,3.402-0.736,4.789c-1.018,1.408-2.649,2.24-4.386,2.24H58.615c-1.736,0-3.368-0.832-4.386-2.24C53.23,122.504,52.956,120.721,53.493,119.098L53.493,119.098z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_paragraph:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M128.39,28.499H63.493c-25.558,0-46.354,20.796-46.354,46.354c0,25.559,20.796,46.353,46.354,46.353h9.271v55.625h18.542V47.04h9.271V176.83h18.543V47.04h9.271V28.499z M72.764,102.664h-9.271c-15.337,0-27.813-12.475-27.813-27.812c0-15.336,12.476-27.813,27.813-27.813h9.271V102.664z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="35 30 140 140"><g><path d="M137.215,102.045c0,3.498-2.835,6.332-6.333,6.332H24.549c-3.498,0-6.334-2.834-6.334-6.332l0,0c0-3.498,2.836-6.333,6.334-6.333h106.333C134.38,95.711,137.215,98.547,137.215,102.045L137.215,102.045z M77.715,161.545c-3.498,0-6.333-2.836-6.333-6.334V48.878c0-3.498,2.836-6.333,6.333-6.333l0,0c3.498,0,6.334,2.835,6.334,6.333v106.333C84.049,158.709,81.213,161.545,77.715,161.545L77.715,161.545z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.632,190.465,66.177,190.465,63.32L190.465,63.32z M190.465,101.993c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.888,1.026,5.353,3.056,7.396c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.993L190.465,101.993z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 3.58"><g><path d="M4.64,10.73a1.84,1.84,0,0,1,.65-.65,1.76,1.76,0,0,1,1.79,0A1.79,1.79,0,0,1,8,11.63a1.84,1.84,0,0,1-.25.9,1.69,1.69,0,0,1-.65.65,1.8,1.8,0,0,1-2.69-1.55A2.08,2.08,0,0,1,4.64,10.73Zm6.09,0a1.84,1.84,0,0,1,.65-.65,1.78,1.78,0,0,1,2.67,1.55,1.73,1.73,0,0,1-.24.9,1.84,1.84,0,0,1-.65.65,1.76,1.76,0,0,1-1.79,0,1.79,1.79,0,0,1-.64-2.44Zm6.08,0a1.69,1.69,0,0,1,.65-.65,1.76,1.76,0,0,1,1.79,0,1.79,1.79,0,0,1,.9,1.54,1.73,1.73,0,0,1-.24.9,1.84,1.84,0,0,1-.65.65,1.8,1.8,0,0,1-2.69-1.55A2,2,0,0,1,16.81,10.73Z" transform="translate(-4.39 -9.84)"/></g></svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3.94 15.75"><g><path d="M12.28,7.69a1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39,1.92,1.92,0,0,1,.58-1.39,2,2,0,0,1,1.39-.58,1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39,1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58Zm0,2a1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39A1.92,1.92,0,0,1,13.67,13a2,2,0,0,1-1.39.58A1.92,1.92,0,0,1,10.89,13a2,2,0,0,1-.58-1.39,2,2,0,0,1,2-2Zm0,5.9a1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39,1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58,1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39,1.92,1.92,0,0,1,.58-1.39,1.94,1.94,0,0,1,1.39-.58Z" transform="translate(-10.31 -3.75)"/></g></svg>',attachment:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8.38 15.68"><g><path d="M15.23,6h1v9.78a3.88,3.88,0,0,1-1.31,2.45,4,4,0,0,1-6.57-2.45V7A3,3,0,0,1,9.2,4.89a3,3,0,0,1,5,2.09v8.31a1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58,1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39V8h1v7.32a1,1,0,0,0,.29.69,1,1,0,0,0,.69.28A.9.9,0,0,0,13,16a1,1,0,0,0,.29-.69V7a1.92,1.92,0,0,0-.58-1.39A2,2,0,0,0,11.27,5a1.92,1.92,0,0,0-1.39.58A2,2,0,0,0,9.33,7v8.31a3,3,0,1,0,5.9,0V6Z" transform="translate(-8.08 -3.78)"/></g></svg>',map:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.7 15.62"><g><path d="M12.05,12.42a2.93,2.93,0,1,1,2.07-5A2.88,2.88,0,0,1,15,9.49a3,3,0,0,1-.86,2.07,2.89,2.89,0,0,1-2.07.86Zm0-5.36a2.43,2.43,0,0,0-1.72,4.16,2.48,2.48,0,0,0,1.72.72,2.44,2.44,0,0,0,0-4.88Zm0-3.3A5.84,5.84,0,0,1,17.9,9.62a9.94,9.94,0,0,1-1.73,5A33.59,33.59,0,0,1,12.84,19a1.52,1.52,0,0,1-.23.2,1,1,0,0,1-.55.2h0a1,1,0,0,1-.55-.2,1.52,1.52,0,0,1-.23-.2,33.59,33.59,0,0,1-3.33-4.32,9.93,9.93,0,0,1-1.72-5,5.84,5.84,0,0,1,5.85-5.86ZM12,18.34l.08.05.06-.06a35.58,35.58,0,0,0,3.06-3.93,9.35,9.35,0,0,0,1.74-4.77,4.88,4.88,0,0,0-4.88-4.88A4.79,4.79,0,0,0,8.6,6.17,4.84,4.84,0,0,0,7.17,9.62,9.29,9.29,0,0,0,8.91,14.4,36,36,0,0,0,12,18.34Z" transform="translate(-6.2 -3.76)"/></g></svg>',magic_stick:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.75"><g><path d="M19.86,19.21a1,1,0,0,0,.28-.68,1,1,0,0,0-.28-.7L13,10.93a1,1,0,0,0-.7-.28,1,1,0,0,0-.68,1.65l6.9,6.9a1,1,0,0,0,.69.29.93.93,0,0,0,.69-.28ZM9.19,8.55a3,3,0,0,0,1.68,0,14.12,14.12,0,0,0,1.41-.32A11.26,11.26,0,0,0,10.8,7.06c-.56-.36-.86-.56-.91-.58S10,5.91,10,5.11s0-1.26-.15-1.37a4.35,4.35,0,0,0-1.19.71c-.53.4-.81.62-.87.68a9,9,0,0,0-2-.6,6.84,6.84,0,0,0-.76-.09s0,.27.08.77a8.6,8.6,0,0,0,.61,2q-.09.09-.69.87a3.59,3.59,0,0,0-.68,1.17c.12.17.57.23,1.36.15S7,9.26,7.15,9.23s.21.36.57.91a10.49,10.49,0,0,0,1.14,1.48c0-.1.14-.57.31-1.4a3,3,0,0,0,0-1.67Z" transform="translate(-4.41 -3.74)"/></g></svg>',empty_file:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12.78 15.75"><g><path d="M14.73,3.76,18.67,7.7v9.84a2,2,0,0,1-2,2H7.84a1.89,1.89,0,0,1-1.38-.58,2,2,0,0,1-.57-1.39V5.73a1.93,1.93,0,0,1,.57-1.38,2,2,0,0,1,1.38-.58h6.62l.26,0v0Zm2.95,4.92h-2a1.93,1.93,0,0,1-1.38-.57,2,2,0,0,1-.58-1.4V6.17c0-.36,0-.84,0-1.43H7.85a1,1,0,0,0-.7.29,1,1,0,0,0-.29.7V17.54a1,1,0,0,0,.29.69,1,1,0,0,0,.69.29h8.85a1,1,0,0,0,.71-.29.92.92,0,0,0,.28-.69Zm0-1L14.73,4.74v2A1,1,0,0,0,15,7.4a1,1,0,0,0,.69.29Z" transform="translate(-5.89 -3.76)"/></g></svg>'};var lv={exports:{}};(function(t){(function(n,r){t.exports=n.document?r(n,!0):function(i){if(!i.document)throw new Error("SUNEDITOR_LANG a window with a document");return r(i)}})(typeof window<"u"?window:At,function(n,r){const i={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery",dir_ltr:"Left to right",dir_rtl:"Right to left",mention:"Mention"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window",downloadLinkCheck:"Download link",bookmark:"Bookmark"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return typeof r>"u"&&(n.SUNEDITOR_LANG||Object.defineProperty(n,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(n.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:i})),i})})(lv);var oT=lv.exports;const aT=Di(oT),et={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,isChromium:null,isMobile:null,isResizeObserverSupported:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform),this.isChromium=!!window.chrome,this.isResizeObserverSupported=typeof ResizeObserver=="function",this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0)&&"ontouchstart"in window)},_allowedEmptyNodeList:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas",_HTMLConvertor:function(t){const n={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return t.replace(/&|\u00A0|'|"|<|>/g,function(r){return typeof n[r]=="string"?n[r]:r})},zeroWidthSpace:"",zeroWidthRegExp:new RegExp("","g"),onlyZeroWidthRegExp:new RegExp("^+$"),fontValueMap:{"xx-small":1,"x-small":2,small:3,medium:4,large:5,"x-large":6,"xx-large":7},onlyZeroWidthSpace:function(t){return t==null?!1:(typeof t!="string"&&(t=t.textContent),t===""||this.onlyZeroWidthRegExp.test(t))},getXMLHttpRequest:function(){if(this._w.ActiveXObject)try{return new ActiveXObject("Msxml2.XMLHTTP")}catch{try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{return null}}else return this._w.XMLHttpRequest?new XMLHttpRequest:null},getValues:function(t){return t?this._w.Object.keys(t).map(function(n){return t[n]}):[]},camelToKebabCase:function(t){return typeof t=="string"?t.replace(/[A-Z]/g,function(n){return"-"+n.toLowerCase()}):t.map(function(n){return et.camelToKebabCase(n)})},kebabToCamelCase:function(t){return typeof t=="string"?t.replace(/-[a-zA-Z]/g,function(n){return n.replace("-","").toUpperCase()}):t.map(function(n){return et.camelToKebabCase(n)})},createElement:function(t){return this._d.createElement(t)},createTextNode:function(t){return this._d.createTextNode(t||"")},HTMLEncoder:function(t){const n={"<":"$lt;",">":"$gt;"};return t.replace(/<|>/g,function(r){return typeof n[r]=="string"?n[r]:r})},HTMLDecoder:function(t){const n={"$lt;":"<","$gt;":">"};return t.replace(/\$lt;|\$gt;/g,function(r){return typeof n[r]=="string"?n[r]:r})},hasOwn:function(t,n){return this._hasOwn.call(t,n)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(t,n){let r="";const i=[],s=n==="js"?"script":"link",o=n==="js"?"src":"href";let l="(?:";for(let f=0,u=t.length;f<u;f++)l+=t[f]+(f<u-1?"|":")");const c=new this._w.RegExp("(^|.*[\\/])"+l+"(\\.[^\\/]+)?."+n+"(?:\\?.*|;.*)?$","i"),a=new this._w.RegExp(".+\\."+n+"(?:\\?.*|;.*)?$","i");for(let f=this._d.getElementsByTagName(s),u=0;u<f.length;u++)a.test(f[u][o])&&i.push(f[u]);for(let f=0;f<i.length;f++){let u=i[f][o].match(c);if(u){r=u[0];break}}if(r===""&&(r=i.length>0?i[0][o]:""),r.indexOf(":/")===-1&&r.slice(0,2)!=="//"&&(r=r.indexOf("/")===0?location.href.match(/^.*?:\/\/[^\/]*/)[0]+r:location.href.match(/^[^\?]*\/(?:)/)[0]+r),!r)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+n+")";return r},getPageStyle:function(t){let n="";const r=(t||this._d).styleSheets;for(let i=0,s=r.length,o;i<s;i++){try{o=r[i].cssRules}catch{continue}if(o)for(let l=0,c=o.length;l<c;l++)n+=o[l].cssText}return n},getIframeDocument:function(t){let n=t.contentWindow||t.contentDocument;return n.document&&(n=n.document),n},getAttributesToString:function(t,n){if(!t.attributes)return"";const r=t.attributes;let i="";for(let s=0,o=r.length;s<o;s++)n&&n.indexOf(r[s].name)>-1||(i+=r[s].name+'="'+r[s].value+'" ');return i},getByteLength:function(t){if(!t||!t.toString)return 0;t=t.toString();const n=this._w.encodeURIComponent;let r,i;return this.isIE_Edge?(i=this._w.unescape(n(t)).length,r=0,n(t).match(/(%0A|%0D)/gi)!==null&&(r=n(t).match(/(%0A|%0D)/gi).length),i+r):(i=new this._w.TextEncoder("utf-8").encode(t).length,r=0,n(t).match(/(%0A|%0D)/gi)!==null&&(r=n(t).match(/(%0A|%0D)/gi).length),i+r)},isWysiwygDiv:function(t){return t&&t.nodeType===1&&(this.hasClass(t,"se-wrapper-wysiwyg")||/^BODY$/i.test(t.nodeName))},isNonEditable:function(t){return t&&t.nodeType===1&&t.getAttribute("contenteditable")==="false"},isTextStyleElement:function(t){return t&&t.nodeType!==3&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)$/i.test(t.nodeName)},isInputElement:function(t){return t&&t.nodeType===1&&/^(INPUT|TEXTAREA)$/i.test(t.nodeName)},isFormatElement:function(t){return t&&t.nodeType===1&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD|DETAILS)$/i.test(t.nodeName)||this.hasClass(t,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(t)&&!this.isWysiwygDiv(t)},isRangeFormatElement:function(t){return t&&t.nodeType===1&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD|DETAILS)$/i.test(t.nodeName)||this.hasClass(t,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(t){return t&&t.nodeType===1&&(/^(TH|TD)$/i.test(t.nodeName)||this.hasClass(t,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(t){return t&&t.nodeType===1&&(/^PRE$/i.test(t.nodeName)||this.hasClass(t,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(t)&&!this.isWysiwygDiv(t)},isClosureFreeFormatElement:function(t){return t&&t.nodeType===1&&this.hasClass(t,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(t){return t&&(/se-component/.test(t.className)||/^(TABLE|HR)$/.test(t.nodeName))},isUneditableComponent:function(t){return t&&this.hasClass(t,"__se__uneditable")},isMediaComponent:function(t){return t&&/se-component/.test(t.className)},isNotCheckingNode:function(t){return t&&/katex|__se__tag/.test(t.className)},getFormatElement:function(t,n){if(!t)return null;for(n||(n=function(){return!0});t;){if(this.isWysiwygDiv(t))return null;if(this.isRangeFormatElement(t)&&t.firstElementChild,this.isFormatElement(t)&&n(t))return t;t=t.parentNode}return null},getRangeFormatElement:function(t,n){if(!t)return null;for(n||(n=function(){return!0});t;){if(this.isWysiwygDiv(t))return null;if(this.isRangeFormatElement(t)&&!/^(THEAD|TBODY|TR)$/i.test(t.nodeName)&&n(t))return t;t=t.parentNode}return null},getFreeFormatElement:function(t,n){if(!t)return null;for(n||(n=function(){return!0});t;){if(this.isWysiwygDiv(t))return null;if(this.isFreeFormatElement(t)&&n(t))return t;t=t.parentNode}return null},getClosureFreeFormatElement:function(t,n){if(!t)return null;for(n||(n=function(){return!0});t;){if(this.isWysiwygDiv(t))return null;if(this.isClosureFreeFormatElement(t)&&n(t))return t;t=t.parentNode}return null},copyTagAttributes:function(t,n,r){if(n.style.cssText){const s=n.style;for(let o=0,l=s.length;o<l;o++)t.style[s[o]]=s[s[o]]}const i=n.attributes;for(let s=0,o=i.length,l;s<o;s++)l=i[s].name.toLowerCase(),r&&r.indexOf(l)>-1||!i[s].value?t.removeAttribute(l):l!=="style"&&t.setAttribute(i[s].name,i[s].value)},copyFormatAttributes:function(t,n){n=n.cloneNode(!1),n.className=n.className.replace(/(\s|^)__se__format__[^\s]+/g,""),this.copyTagAttributes(t,n)},getArrayItem:function(t,n,r){if(!t||t.length===0)return null;n=n||function(){return!0};const i=[];for(let s=0,o=t.length,l;s<o;s++)if(l=t[s],n(l))if(r)i.push(l);else return l;return r?i:null},arrayIncludes:function(t,n){for(let r=0;r<t.length;r++)if(t[r]===n)return!0;return!1},getArrayIndex:function(t,n){let r=-1;for(let i=0,s=t.length;i<s;i++)if(t[i]===n){r=i;break}return r},nextIdx:function(t,n){let r=this.getArrayIndex(t,n);return r===-1?-1:r+1},prevIdx:function(t,n){let r=this.getArrayIndex(t,n);return r===-1?-1:r-1},getPositionIndex:function(t){let n=0;for(;t=t.previousSibling;)n+=1;return n},getNodePath:function(t,n,r){const i=[];let s=!0;return this.getParentElement(t,(function(o){if(o===n&&(s=!1),s&&!this.isWysiwygDiv(o)){if(r&&o.nodeType===3){let l=null,c=null;r.s=r.e=0;let a=o.previousSibling;for(;a&&a.nodeType===3;)c=a.textContent.replace(this.zeroWidthRegExp,""),r.s+=c.length,o.textContent=c+o.textContent,l=a,a=a.previousSibling,this.removeItem(l);let f=o.nextSibling;for(;f&&f.nodeType===3;)c=f.textContent.replace(this.zeroWidthRegExp,""),r.e+=c.length,o.textContent+=c,l=f,f=f.nextSibling,this.removeItem(l)}i.push(o)}return!1}).bind(this)),i.map(this.getPositionIndex).reverse()},getNodeFromPath:function(t,n){let r=n,i;for(let s=0,o=t.length;s<o&&(i=r.childNodes,i.length!==0);s++)i.length<=t[s]?r=i[i.length-1]:r=i[t[s]];return r},isSameAttributes:function(t,n){if(t.nodeType===3&&n.nodeType===3)return!0;if(t.nodeType===3||n.nodeType===3)return!1;const r=t.style,i=n.style;let s=0;for(let f=0,u=r.length;f<u;f++)r[r[f]]===i[r[f]]&&s++;const o=t.classList,l=n.classList,c=this._w.RegExp;let a=0;for(let f=0,u=o.length;f<u;f++)c("(s|^)"+o[f]+"(s|$)").test(l.value)&&a++;return s===i.length&&s===r.length&&a===l.length&&a===o.length},isEmptyLine:function(t){return!t||!t.parentNode||!t.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&t.children.length===0&&this.onlyZeroWidthSpace(t.textContent)},isSpanWithoutAttr:function(t){return!!t&&t.nodeType===1&&/^SPAN$/i.test(t.nodeName)&&!t.className&&!t.style.cssText},isList:function(t){return t&&/^(OL|UL)$/i.test(typeof t=="string"?t:t.nodeName)},isListCell:function(t){return t&&/^LI$/i.test(typeof t=="string"?t:t.nodeName)},isTable:function(t){return t&&/^(TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(typeof t=="string"?t:t.nodeName)},isCell:function(t){return t&&/^(TD|TH)$/i.test(typeof t=="string"?t:t.nodeName)},isBreak:function(t){return t&&/^BR$/i.test(typeof t=="string"?t:t.nodeName)},isAnchor:function(t){return t&&/^A$/i.test(typeof t=="string"?t:t.nodeName)},isMedia:function(t){return t&&/^(IMG|IFRAME|AUDIO|VIDEO|CANVAS)$/i.test(typeof t=="string"?t:t.nodeName)},isFigures:function(t){return t&&(this.isMedia(t)||/^(FIGURE)$/i.test(typeof t=="string"?t:t.nodeName))},isNumber:function(t){return!!t&&/^-?\d+(\.\d+)?$/.test(t+"")},getNumber:function(t,n){if(!t)return 0;let r=(t+"").match(/-?\d+(\.\d+)?/);return!r||!r[0]?0:(r=r[0],n<0?r*1:n===0?this._w.Math.round(r*1):(r*1).toFixed(n)*1)},getListChildren:function(t,n){const r=[];return!t||!t.children||t.children.length===0||(n=n||function(){return!0},function i(s){if(t!==s&&n(s)&&r.push(s),s.children)for(let o=0,l=s.children.length;o<l;o++)i(s.children[o])}(t)),r},getListChildNodes:function(t,n){const r=[];return!t||t.childNodes.length===0||(n=n||function(){return!0},function i(s){t!==s&&n(s)&&r.push(s);for(let o=0,l=s.childNodes.length;o<l;o++)i(s.childNodes[o])}(t)),r},getElementDepth:function(t){if(!t||this.isWysiwygDiv(t))return-1;let n=0;for(t=t.parentNode;t&&!this.isWysiwygDiv(t);)n+=1,t=t.parentNode;return n},compareElements:function(t,n){let r=t,i=n;for(;r&&i&&r.parentNode!==i.parentNode;)r=r.parentNode,i=i.parentNode;if(!r||!i)return{ancestor:null,a:t,b:n,result:0};const s=r.parentNode.childNodes,o=this.getArrayIndex(s,r),l=this.getArrayIndex(s,i);return{ancestor:r.parentNode,a:r,b:i,result:o>l?1:o<l?-1:0}},getParentElement:function(t,n){let r;if(typeof n=="function")r=n;else{let i;/^\./.test(n)?(i="className",n=n.split(".")[1]):/^#/.test(n)?(i="id",n="^"+n.split("#")[1]+"$"):/^:/.test(n)?(i="name",n="^"+n.split(":")[1]+"$"):(i="nodeName",n="^"+n+"$");const s=new this._w.RegExp(n,"i");r=function(o){return s.test(o[i])}}for(;t&&!r(t);){if(this.isWysiwygDiv(t))return null;t=t.parentNode}return t},getPreviousDeepestNode:function(t,n){let r=t.previousSibling;if(!r){for(let i=t.parentNode;i;i=i.parentNode){if(i===n)return null;if(i.previousSibling){r=i.previousSibling;break}}if(!r)return null}for(;r.lastChild;)r=r.lastChild;return r},getNextDeepestNode:function(t,n){let r=t.nextSibling;if(!r){for(let i=t.parentNode;i;i=i.parentNode){if(i===n)return null;if(i.nextSibling){r=i.nextSibling;break}}if(!r)return null}for(;r.firstChild;)r=r.firstChild;return r},getChildElement:function(t,n,r){let i;if(typeof n=="function")i=n;else{let o;/^\./.test(n)?(o="className",n=n.split(".")[1]):/^#/.test(n)?(o="id",n="^"+n.split("#")[1]+"$"):/^:/.test(n)?(o="name",n="^"+n.split(":")[1]+"$"):(o="nodeName",n="^"+(n==="text"?"#"+n:n)+"$");const l=new this._w.RegExp(n,"i");i=function(c){return l.test(c[o])}}const s=this.getListChildNodes(t,function(o){return i(o)});return s[r?s.length-1:0]},getEdgeChildNodes:function(t,n){if(t){for(n||(n=t);t&&t.nodeType===1&&t.childNodes.length>0&&!this.isBreak(t);)t=t.firstChild;for(;n&&n.nodeType===1&&n.childNodes.length>0&&!this.isBreak(n);)n=n.lastChild;return{sc:t,ec:n||t}}},getOffset:function(t,n){let r=0,i=0,s=t.nodeType===3?t.parentElement:t;const o=this.getParentElement(t,this.isWysiwygDiv.bind(this));for(;s&&!this.hasClass(s,"se-container")&&s!==o;)r+=s.offsetLeft,i+=s.offsetTop,s=s.offsetParent;const l=n&&/iframe/i.test(n.nodeName);return{left:r+(l?n.parentElement.offsetLeft:0),top:i-(o?o.scrollTop:0)+(l?n.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(t,n,r,i){if(t<=i?n<r:n>r)return 0;const s=(t>r?t:r)-(n<i?n:i);return(s<0?s*-1:s)+1},changeTxt:function(t,n){!t||!n||(t.textContent=n)},changeElement:function(t,n){if(typeof n=="string")if(t.outerHTML)t.outerHTML=n;else{const r=this.createElement("DIV");r.innerHTML=n,n=r.firstChild,t.parentNode.replaceChild(n,t)}else n.nodeType===1&&t.parentNode.replaceChild(n,t)},setStyle:function(t,n,r){t.style[n]=r,!r&&!t.style.cssText&&t.removeAttribute("style")},hasClass:function(t,n){if(t)return new this._w.RegExp(n).test(t.className)},addClass:function(t,n){!t||new this._w.RegExp("(\\s|^)"+n+"(\\s|$)").test(t.className)||(t.className+=(t.className.length>0?" ":"")+n)},removeClass:function(t,n){if(!t)return;const r=new this._w.RegExp("(\\s|^)"+n+"(\\s|$)");t.className=t.className.replace(r," ").trim(),t.className.trim()||t.removeAttribute("class")},toggleClass:function(t,n){if(!t)return;let r=!1;const i=new this._w.RegExp("(\\s|^)"+n+"(\\s|$)");return i.test(t.className)?t.className=t.className.replace(i," ").trim():(t.className+=" "+n,r=!0),t.className.trim()||t.removeAttribute("class"),r},isImportantDisabled:function(t){return t.hasAttribute("data-important-disabled")},setDisabledButtons:function(t,n,r){for(let i=0,s=n.length;i<s;i++){let o=n[i];(r||!this.isImportantDisabled(o))&&(o.disabled=t),r&&(t?o.setAttribute("data-important-disabled",""):o.removeAttribute("data-important-disabled"))}},removeItem:function(t){t&&(typeof t.remove=="function"?t.remove():t.parentNode&&t.parentNode.removeChild(t))},removeItemAllParents:function(t,n,r){if(!t)return null;let i=null;return n||(n=(function(s){if(s===r||this.isComponent(s))return!1;const o=s.textContent.trim();return o.length===0||/^(\n|\u200B)+$/.test(o)}).bind(this)),function s(o){if(!et.isWysiwygDiv(o)){const l=o.parentNode;l&&n(o)&&(i={sc:o.previousElementSibling,ec:o.nextElementSibling},et.removeItem(o),s(l))}}(t),i},detachNestedList:function(t,n){const r=this._deleteNestedList(t);let i,s;if(r){i=r.cloneNode(!1),s=r.childNodes;const l=this.getPositionIndex(t);for(;s[l];)i.appendChild(s[l])}else i=t;let o;if(n)o=this.getListChildren(i,(function(l){return this.isListCell(l)&&!l.previousElementSibling}).bind(this));else{const l=this.getElementDepth(t)+2;o=this.getListChildren(t,(function(c){return this.isListCell(c)&&!c.previousElementSibling&&this.getElementDepth(c)===l}).bind(this))}for(let l=0,c=o.length;l<c;l++)this._deleteNestedList(o[l]);return r&&(r.parentNode.insertBefore(i,r.nextSibling),s&&s.length===0&&this.removeItem(r)),i===t?i.parentNode:i},_deleteNestedList:function(t){const n=t.parentNode;let r=n,i=r.parentNode,s,o,l,c,a;for(;this.isListCell(i);){for(c=this.getPositionIndex(t),s=i.nextElementSibling,o=i.parentNode,l=r;l;){if(r=r.nextSibling,this.isList(l)){for(a=l.childNodes;a[c];)o.insertBefore(a[c],s);a.length===0&&this.removeItem(l)}else o.appendChild(l);l=r}r=o,i=o.parentNode}return n.children.length===0&&this.removeItem(n),o},splitElement:function(t,n,r){if(this.isWysiwygDiv(t))return t;if(n&&!this.isNumber(n)){const y=t.childNodes;let _=this.getPositionIndex(n);const S=t.cloneNode(!1),E=t.cloneNode(!1);for(let d=0,h=y.length;d<h;d++){if(d<_)S.appendChild(y[d]);else if(d>_)E.appendChild(y[d]);else continue;d--,h--,_--}return S.childNodes.length>0&&t.parentNode.insertBefore(S,t),E.childNodes.length>0&&t.parentNode.insertBefore(E,t.nextElementSibling),t}const i=t.parentNode;let s=0,o=1,l=!0,c,a,f;if((!r||r<0)&&(r=0),t.nodeType===3){if(s=this.getPositionIndex(t),n>=0&&t.length!==n){t.splitText(n);const y=this.getNodeFromPath([s+1],i);this.onlyZeroWidthSpace(y)&&(y.data=this.zeroWidthSpace)}}else if(t.nodeType===1){if(n===0){for(;t.firstChild;)t=t.firstChild;if(t.nodeType===3){const y=this.createTextNode(this.zeroWidthSpace);t.parentNode.insertBefore(y,t),t=y}}t.previousSibling?t=t.previousSibling:this.getElementDepth(t)===r&&(l=!1)}t.nodeType===1&&(o=0);let u=t;for(;this.getElementDepth(u)>r;)for(s=this.getPositionIndex(u)+o,u=u.parentNode,f=c,c=u.cloneNode(!1),a=u.childNodes,f&&(this.isListCell(c)&&this.isList(f)&&f.firstElementChild?(c.innerHTML=f.firstElementChild.innerHTML,et.removeItem(f.firstElementChild),f.children.length>0&&c.appendChild(f)):c.appendChild(f));a[s];)c.appendChild(a[s]);u.childNodes.length<=1&&(!u.firstChild||u.firstChild.textContent.length===0)&&(u.innerHTML="<br>");const m=u.parentNode;return l&&(u=u.nextSibling),c?(this.mergeSameTags(c,null,!1),this.mergeNestedTags(c,(function(y){return this.isList(y)}).bind(this)),c.childNodes.length>0?m.insertBefore(c,u):c=u,this.isListCell(c)&&c.children&&this.isList(c.children[0])&&c.insertBefore(this.createElement("BR"),c.children[0]),i.childNodes.length===0&&this.removeItem(i),c):u},mergeSameTags:function(t,n,r){const i=this,s=n?n.length:0;let o=null;return s&&(o=this._w.Array.apply(null,new this._w.Array(s)).map(this._w.Number.prototype.valueOf,0)),function l(c,a,f){const u=c.childNodes;for(let m=0,y=u.length,_,S;m<y&&(_=u[m],S=u[m+1],!!_);m++)if(!(i.isBreak(_)||i.isMedia(_)||i.isInputElement(_))){if(r&&i._isIgnoreNodeChange(_)||!r&&(i.isTable(_)||i.isListCell(_)||i.isFormatElement(_)&&!i.isFreeFormatElement(_))){(i.isTable(_)||i.isListCell(_))&&l(_,a+1,m);continue}if(y===1&&c.nodeName===_.nodeName&&c.parentNode){if(s){let E,d,h,v,x;for(let g=0;g<s;g++)if(E=n[g],E&&E[a]===m){for(d=_,h=c,v=a,x=!0;v>=0;){if(i.getArrayIndex(h.childNodes,d)!==E[v]){x=!1;break}d=_.parentNode,h=d.parentNode,v--}x&&(E.splice(a,1),E[a]=m)}}i.copyTagAttributes(_,c),c.parentNode.insertBefore(_,c),i.removeItem(c)}if(!S){_.nodeType===1&&l(_,a+1,m);break}if(_.nodeName===S.nodeName&&i.isSameAttributes(_,S)&&_.href===S.href){const E=_.childNodes;let d=0;for(let g=0,b=E.length;g<b;g++)E[g].textContent.length>0&&d++;const h=_.lastChild,v=S.firstChild;let x=0;if(h&&v){const g=h.nodeType===3&&v.nodeType===3;x=h.textContent.length;let b=h.previousSibling;for(;b&&b.nodeType===3;)x+=b.textContent.length,b=b.previousSibling;if(d>0&&h.nodeType===3&&v.nodeType===3&&(h.textContent.length>0||v.textContent.length>0)&&d--,s){let w=null;for(let k=0;k<s;k++)if(w=n[k],w&&w[a]>m){if(a>0&&w[a-1]!==f)continue;w[a]-=1,w[a+1]>=0&&w[a]===m&&(w[a+1]+=d,g&&h&&h.nodeType===3&&v&&v.nodeType===3&&(o[k]+=x))}}}if(_.nodeType===3){if(x=_.textContent.length,_.textContent+=S.textContent,s){let g=null;for(let b=0;b<s;b++)if(g=n[b],g&&g[a]>m){if(a>0&&g[a-1]!==f)continue;g[a]-=1,g[a+1]>=0&&g[a]===m&&(g[a+1]+=d,o[b]+=x)}}}else _.innerHTML+=S.innerHTML;i.removeItem(S),m--}else _.nodeType===1&&l(_,a+1,m)}}(t,0,0),o},mergeNestedTags:function(t,n){typeof n=="string"?n=(function(r){return this.test(r.tagName)}).bind(new this._w.RegExp("^("+(n||".+")+")$","i")):typeof n!="function"&&(n=function(){return!0}),function r(i){let s=i.children;if(s.length===1&&s[0].nodeName===i.nodeName&&n(i)){const o=s[0];for(s=o.children;s[0];)i.appendChild(s[0]);i.removeChild(o)}for(let o=0,l=i.children.length;o<l;o++)r(i.children[o])}(t)},removeEmptyNode:function(t,n,r){const i=this;n&&(n=i.getParentElement(n,function(s){return t===s.parentElement})),function s(o){if(i._notTextNode(o)||o===n||i.isNonEditable(o))return 0;if(o!==t&&i.onlyZeroWidthSpace(o.textContent)&&(!o.firstChild||!i.isBreak(o.firstChild))&&!o.querySelector(i._allowedEmptyNodeList)){if(o.parentNode)return o.parentNode.removeChild(o),-1}else{const l=o.children;for(let c=0,a=l.length,f=0;c<a;c++)!l[c+f]||i.isComponent(l[c+f])||(f+=s(l[c+f]))}return 0}(t),t.childNodes.length===0&&(r?this.removeItem(t):t.innerHTML="<br>")},htmlRemoveWhiteSpace:function(t){return t?t.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)[^>^<]+>\s+(?=<)/ig,function(n){return n.replace(/\n/g,"").replace(/\s+/," ")}):""},htmlCompress:function(t){return t.replace(/\n/g,"").replace(/>\s+</g,"> <")},sortByDepth:function(t,n){const r=n?1:-1,i=r*-1;t.sort((function(s,o){return!this.isListCell(s)||!this.isListCell(o)?0:(s=this.getElementDepth(s),o=this.getElementDepth(o),s>o?r:s<o?i:0)}).bind(this))},escapeStringRegexp:function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},_isExcludeSelectionElement:function(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.isComponent(t)||/FIGURE/i.test(t.nodeName))},_isIgnoreNodeChange:function(t){return t&&t.nodeType!==3&&(this.isNonEditable(t)||!this.isTextStyleElement(t))},_isMaintainedNode:function(t){return t&&t.nodeType!==3&&/^(a|label|code|summary)$/i.test(typeof t=="string"?t:t.nodeName)},_isSizeNode:function(t){return t&&t.nodeType!==3&&this.isTextStyleElement(t)&&!!t.style.fontSize},_notTextNode:function(t){return t&&t.nodeType!==3&&(this.isComponent(t)||/^(br|input|select|canvas|img|iframe|audio|video)$/i.test(typeof t=="string"?t:t.nodeName))},_disallowedTags:function(t){return/^(meta|script|link|style|[a-z]+\:[a-z]+)$/i.test(t.nodeName)},createTagsWhitelist:function(t){return new RegExp("<\\/?\\b(?!\\b"+(t||"").replace(/\|/g,"\\b|\\b")+"\\b)[^>]*>","gi")},createTagsBlacklist:function(t){return new RegExp("<\\/?\\b(?:\\b"+(t||"^").replace(/\|/g,"\\b|\\b")+"\\b)[^>]*>","gi")},_consistencyCheckOfHTML:function(t,n,r,i,s){const o=[],l=[],c=[],a=[],f=this.getListChildNodes(t,(function(m){if(m.nodeType!==1)return this.isList(m.parentElement)&&o.push(m),!1;if(r.test(m.nodeName)||!n.test(m.nodeName)&&m.childNodes.length===0&&this.isNotCheckingNode(m))return o.push(m),!1;const y=!this.getParentElement(m,this.isNotCheckingNode);if(!this.isTable(m)&&!this.isListCell(m)&&!this.isAnchor(m)&&(this.isFormatElement(m)||this.isRangeFormatElement(m)||this.isTextStyleElement(m))&&m.childNodes.length===0&&y)return l.push(m),!1;if(this.isList(m.parentNode)&&!this.isList(m)&&!this.isListCell(m))return c.push(m),!1;if(this.isCell(m)){const S=m.firstElementChild;if(!this.isFormatElement(S)&&!this.isRangeFormatElement(S)&&!this.isComponent(S))return a.push(m),!1}if(y&&m.className){const S=new this._w.Array(m.classList).map(i).join(" ").trim();S?m.className=S:m.removeAttribute("class")}return s&&m.parentNode!==t&&y&&(this.isListCell(m)&&!this.isList(m.parentNode)||(this.isFormatElement(m)||this.isComponent(m))&&!this.isRangeFormatElement(m.parentNode)&&!this.getParentElement(m,this.isComponent))}).bind(this));for(let m=0,y=o.length;m<y;m++)this.removeItem(o[m]);const u=[];for(let m=0,y=f.length,_,S;m<y;m++)if(_=f[m],S=_.parentNode,!(!S||!S.parentNode))if(this.getParentElement(_,this.isListCell)){const E=_.childNodes;for(let d=E.length-1;y>=0;d--)S.insertBefore(_,E[d]);u.push(_)}else S.parentNode.insertBefore(_,S),u.push(S);for(let m=0,y=u.length,_;m<y;m++)_=u[m],this.onlyZeroWidthSpace(_.textContent.trim())&&this.removeItem(_);for(let m=0,y=l.length;m<y;m++)this.removeItem(l[m]);for(let m=0,y=c.length,_,S,E,d;m<y;m++)if(_=c[m],d=_.parentNode,!!d)if(S=this.createElement("LI"),this.isFormatElement(_)){for(E=_.childNodes;E[0];)S.appendChild(E[0]);d.insertBefore(S,_),this.removeItem(_)}else _=_.nextSibling,S.appendChild(c[m]),d.insertBefore(S,_);for(let m=0,y=a.length,_,S;m<y;m++)_=a[m],S=this.createElement("DIV"),S.innerHTML=_.textContent.trim().length===0&&_.children.length===0?"<br>":_.innerHTML,_.innerHTML=S.outerHTML},_setDefaultOptionStyle:function(t,n){let r="";t.height&&(r+="height:"+t.height+";"),t.minHeight&&(r+="min-height:"+t.minHeight+";"),t.maxHeight&&(r+="max-height:"+t.maxHeight+";"),t.position&&(r+="position:"+t.position+";"),t.width&&(r+="width:"+t.width+";"),t.minWidth&&(r+="min-width:"+t.minWidth+";"),t.maxWidth&&(r+="max-width:"+t.maxWidth+";");let i="",s="",o="";n=r+n;const l=n.split(";");for(let c=0,a=l.length,f;c<a;c++)if(f=l[c].trim(),!!f){if(/^(min-|max-)?width\s*:/.test(f)||/^(z-index|position)\s*:/.test(f)){i+=f+";";continue}if(/^(min-|max-)?height\s*:/.test(f)){/^height/.test(f)&&f.split(":")[1].trim()==="auto"&&(t.height="auto"),s+=f+";";continue}o+=f+";"}return{top:i,frame:s,editor:o}},_setIframeDocument:function(t,n){t.setAttribute("scrolling","auto"),t.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+this._setIframeCssTags(n),t.contentDocument.body.className=n._editableClass,t.contentDocument.body.setAttribute("contenteditable",!0),t.contentDocument.body.setAttribute("autocorrect","off")},_setIframeCssTags:function(t){const n=t.iframeCSSFileName,r=this._w.RegExp;let i="";for(let s=0,o=n.length,l;s<o;s++){if(l=[],/(^https?:\/\/)|(^data:text\/css,)/.test(n[s]))l.push(n[s]);else{const c=new r("(^|.*[\\/])"+n[s]+"(\\..+)?\\.css(?:\\?.*|;.*)?$","i");for(let a=document.getElementsByTagName("link"),f=0,u=a.length,m;f<u;f++)m=a[f].href.match(c),m&&l.push(m[0])}if(!l||l.length===0)throw'[SUNEDITOR.constructor.iframe.fail] The suneditor CSS files installation path could not be automatically detected. Please set the option property "iframeCSSFileName" before creating editor instances.';for(let c=0,a=l.length;c<a;c++)i+='<link href="'+l[c]+'" rel="stylesheet">'}return i+(t.height==="auto"?`<style>
|
|
327
327
|
/** Iframe height auto */
|
|
328
328
|
body{height: min-content; overflow: hidden;}
|
|
329
329
|
</style>`:"")}},e0={init:function(t,n){typeof n!="object"&&(n={});const r=document;this._initOptions(t,n);const i=r.createElement("DIV");i.className="sun-editor"+(n.rtl?" se-rtl":""),t.id&&(i.id="suneditor_"+t.id);const s=r.createElement("DIV");s.className="se-container";const o=this._createToolBar(r,n.buttonList,n.plugins,n),l=o.element.cloneNode(!1);l.className+=" se-toolbar-shadow",o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(n.katex);const c=r.createElement("DIV");c.className="se-arrow";const a=r.createElement("DIV");a.className="se-toolbar-sticky-dummy";const f=r.createElement("DIV");f.className="se-wrapper";const u=this._initElements(n,i,o.element,c),m=u.bottomBar,y=u.wysiwygFrame,_=u.placeholder;let S=u.codeView;const E=m.resizingBar,d=m.navigation,h=m.charWrapper,v=m.charCounter,x=r.createElement("DIV");x.className="se-loading-box sun-editor-common",x.innerHTML='<div class="se-loading-effect"></div>';const g=r.createElement("DIV");g.className="se-line-breaker",g.innerHTML='<button class="se-btn">'+n.icons.line_break+"</button>";const b=r.createElement("DIV");b.className+="se-line-breaker-component";const w=b.cloneNode(!0);b.innerHTML=w.innerHTML=n.icons.line_break;const k=r.createElement("DIV");k.className="se-resizing-back";const N=r.createElement("INPUT");N.tabIndex=-1,N.style.cssText="position: fixed !important; top: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;";const T=n.toolbarContainer;T&&(T.appendChild(o.element),T.appendChild(l));const D=n.resizingBarContainer;return E&&D&&D.appendChild(E),f.appendChild(S),_&&f.appendChild(_),T||(s.appendChild(o.element),s.appendChild(l)),s.appendChild(a),s.appendChild(f),s.appendChild(k),s.appendChild(x),s.appendChild(g),s.appendChild(b),s.appendChild(w),s.appendChild(N),E&&!D&&s.appendChild(E),i.appendChild(s),S=this._checkCodeMirror(n,S),{constructed:{_top:i,_relative:s,_toolBar:o.element,_toolbarShadow:l,_menuTray:o._menuTray,_editorArea:f,_wysiwygArea:y,_codeArea:S,_placeholder:_,_resizingBar:E,_navigation:d,_charWrapper:h,_charCounter:v,_loading:x,_lineBreaker:g,_lineBreaker_t:b,_lineBreaker_b:w,_resizeBack:k,_stickyDummy:a,_arrow:c,_focusTemp:N},options:n,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(t,n){if(t.codeMirror){const r=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},t.codeMirror.options||{}].reduce(function(s,o){for(let l in o)et.hasOwn(o,l)&&(s[l]=o[l]);return s},{});t.height==="auto"&&(r.viewportMargin=1/0,r.height="auto");const i=t.codeMirror.src.fromTextArea(n,r);i.display.wrapper.style.cssText=n.style.cssText,t.codeMirrorEditor=i,n=i.display.wrapper,n.className+=" se-wrapper-code-mirror"}return n},_checkKatexMath:function(t){if(!t)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const n=[{throwOnError:!1},t.options||{}].reduce(function(r,i){for(let s in i)et.hasOwn(i,s)&&(r[s]=i[s]);return r},{});t.options=n},_setOptions:function(t,n,r){this._initOptions(n.element.originElement,t);const i=n.element,s=i.relative,o=i.editorArea,l=t.toolbarContainer&&t.toolbarContainer!==r.toolbarContainer,c=t.lang!==r.lang||t.buttonList!==r.buttonList||t.mode!==r.mode||l,a=this._createToolBar(document,c?t.buttonList:r.buttonList,t.plugins,t);a.pluginCallButtons.math&&this._checkKatexMath(t.katex);const f=document.createElement("DIV");f.className="se-arrow",c&&(a.element.style.visibility="hidden",l?(t.toolbarContainer.appendChild(a.element),i.toolbar.parentElement.removeChild(i.toolbar)):i.toolbar.parentElement.replaceChild(a.element,i.toolbar),i.toolbar=a.element,i._menuTray=a._menuTray,i._arrow=f);const u=this._initElements(t,i.topArea,c?a.element:i.toolbar,f),m=u.bottomBar,y=u.wysiwygFrame,_=u.placeholder;let S=u.codeView;return i.resizingBar&&et.removeItem(i.resizingBar),m.resizingBar&&(t.resizingBarContainer&&t.resizingBarContainer!==r.resizingBarContainer?t.resizingBarContainer.appendChild(m.resizingBar):s.appendChild(m.resizingBar)),o.innerHTML="",o.appendChild(S),_&&o.appendChild(_),S=this._checkCodeMirror(t,S),i.resizingBar=m.resizingBar,i.navigation=m.navigation,i.charWrapper=m.charWrapper,i.charCounter=m.charCounter,i.wysiwygFrame=y,i.code=S,i.placeholder=_,t.rtl?et.addClass(i.topArea,"se-rtl"):et.removeClass(i.topArea,"se-rtl"),{callButtons:a.pluginCallButtons,plugins:a.plugins,toolbar:a}},_initElements:function(t,n,r,i){n.style.cssText=t._editorStyles.top,/inline/i.test(t.mode)?(r.className+=" se-toolbar-inline",r.style.width=t.toolbarWidth):/balloon/i.test(t.mode)&&(r.className+=" se-toolbar-balloon",r.style.width=t.toolbarWidth,r.appendChild(i));const s=document.createElement(t.iframe?"IFRAME":"DIV");if(s.className="se-wrapper-inner se-wrapper-wysiwyg",t.iframe)s.allowFullscreen=!0,s.frameBorder=0,s.style.cssText=t._editorStyles.frame,s.className+=t.className;else{s.setAttribute("contenteditable",!0),s.setAttribute("autocorrect","off"),s.setAttribute("scrolling","auto");for(let m in t.iframeAttributes)s.setAttribute(m,t.iframeAttributes[m]);s.className+=" "+t._editableClass,s.style.cssText=t._editorStyles.frame+t._editorStyles.editor,s.className+=t.className}const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code"+t.className,o.style.cssText=t._editorStyles.frame,o.style.display="none",t.height==="auto"&&(o.style.overflow="hidden");let l=null,c=null,a=null,f=null;if(t.resizingBar&&(l=document.createElement("DIV"),l.className="se-resizing-bar sun-editor-common",c=document.createElement("DIV"),c.className="se-navigation sun-editor-common",l.appendChild(c),t.charCounter)){if(a=document.createElement("DIV"),a.className="se-char-counter-wrapper",t.charCounterLabel){const m=document.createElement("SPAN");m.className="se-char-label",m.textContent=t.charCounterLabel,a.appendChild(m)}if(f=document.createElement("SPAN"),f.className="se-char-counter",f.textContent="0",a.appendChild(f),t.maxCharCount>0){const m=document.createElement("SPAN");m.textContent=" / "+t.maxCharCount,a.appendChild(m)}l.appendChild(a)}let u=null;return t.placeholder&&(u=document.createElement("SPAN"),u.className="se-placeholder",u.innerText=t.placeholder),{bottomBar:{resizingBar:l,navigation:c,charWrapper:a,charCounter:f},wysiwygFrame:s,codeView:o,placeholder:u}},_initOptions:function(t,n){const r={};if(n.plugins){const o=n.plugins,l=o.length?o:Object.keys(o).map(function(c){return o[c]});for(let c=0,a=l.length,f;c<a;c++)f=l[c].default||l[c],r[f.name]=f}n.plugins=r,n.strictMode=n.strictMode!==!1,n.strictHTMLValidation=n.strictHTMLValidation!==!1,n.lang=n.lang||aT,n.value=typeof n.value=="string"?n.value:null,n.allowedClassNames=new et._w.RegExp((n.allowedClassNames&&typeof n.allowedClassNames=="string"?n.allowedClassNames+"|":"")+"^__se__|se-|katex"),n.historyStackDelayTime=typeof n.historyStackDelayTime=="number"?n.historyStackDelayTime:400,n.frameAttrbutes=n.frameAttrbutes||{},n.defaultTag=typeof n.defaultTag=="string"&&n.defaultTag.length>0?n.defaultTag:"p";const i=n.textTags=[{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",sub:"SUB",sup:"SUP"},n.textTags||{}].reduce(function(o,l){for(let c in l)o[c]=l[c];return o},{});n._textTagsMap={strong:i.bold.toLowerCase(),b:i.bold.toLowerCase(),u:i.underline.toLowerCase(),ins:i.underline.toLowerCase(),em:i.italic.toLowerCase(),i:i.italic.toLowerCase(),del:i.strike.toLowerCase(),strike:i.strike.toLowerCase(),s:i.strike.toLowerCase(),sub:i.sub.toLowerCase(),sup:i.sup.toLowerCase()},n._defaultCommand={bold:n.textTags.bold,underline:n.textTags.underline,italic:n.textTags.italic,strike:n.textTags.strike,subscript:n.textTags.sub,superscript:n.textTags.sup},n.__allowedScriptTag=n.__allowedScriptTag===!0;const s="br|p|div|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary";n.tagsBlacklist=n.tagsBlacklist||"",n._defaultTagsWhitelist=(typeof n._defaultTagsWhitelist=="string"?n._defaultTagsWhitelist:s)+(n.__allowedScriptTag?"|script":""),n._editorTagsWhitelist=n.addTagsWhitelist==="*"?"*":this._setWhitelist(n._defaultTagsWhitelist+(typeof n.addTagsWhitelist=="string"&&n.addTagsWhitelist.length>0?"|"+n.addTagsWhitelist:""),n.tagsBlacklist),n.pasteTagsBlacklist=n.tagsBlacklist+(n.tagsBlacklist&&n.pasteTagsBlacklist?"|"+n.pasteTagsBlacklist:n.pasteTagsBlacklist||""),n.pasteTagsWhitelist=n.pasteTagsWhitelist==="*"?"*":this._setWhitelist(typeof n.pasteTagsWhitelist=="string"?n.pasteTagsWhitelist:n._editorTagsWhitelist,n.pasteTagsBlacklist),n.attributesWhitelist=!n.attributesWhitelist||typeof n.attributesWhitelist!="object"?null:n.attributesWhitelist,n.attributesBlacklist=!n.attributesBlacklist||typeof n.attributesBlacklist!="object"?null:n.attributesBlacklist,n.mode=n.mode||"classic",n.rtl=!!n.rtl,n.lineAttrReset=["id"].concat(n.lineAttrReset&&typeof n.lineAttrReset=="string"?n.lineAttrReset.toLowerCase().split("|"):[]),n._editableClass="sun-editor-editable"+(n.rtl?" se-rtl":""),n._printClass=typeof n._printClass=="string"?n._printClass:null,n.toolbarWidth=n.toolbarWidth?et.isNumber(n.toolbarWidth)?n.toolbarWidth+"px":n.toolbarWidth:"auto",n.toolbarContainer=typeof n.toolbarContainer=="string"?document.querySelector(n.toolbarContainer):n.toolbarContainer,n.stickyToolbar=/balloon/i.test(n.mode)||n.toolbarContainer?-1:n.stickyToolbar===void 0?0:/^\d+/.test(n.stickyToolbar)?et.getNumber(n.stickyToolbar,0):-1,n.hideToolbar=!!n.hideToolbar,n.fullScreenOffset=n.fullScreenOffset===void 0?0:/^\d+/.test(n.fullScreenOffset)?et.getNumber(n.fullScreenOffset,0):0,n.fullPage=!!n.fullPage,n.iframe=n.fullPage||!!n.iframe,n.iframeAttributes=n.iframeAttributes||{},n.iframeCSSFileName=n.iframe?typeof n.iframeCSSFileName=="string"?[n.iframeCSSFileName]:n.iframeCSSFileName||["suneditor"]:null,n.previewTemplate=typeof n.previewTemplate=="string"?n.previewTemplate:null,n.printTemplate=typeof n.printTemplate=="string"?n.printTemplate:null,n.codeMirror=n.codeMirror?n.codeMirror.src?n.codeMirror:{src:n.codeMirror}:null,n.katex=n.katex?n.katex.src?n.katex:{src:n.katex}:null,n.mathFontSize=n.mathFontSize?n.mathFontSize:[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],n.position=typeof n.position=="string"?n.position:null,n.display=n.display||(t.style.display==="none"||!t.style.display?"block":t.style.display),n.popupDisplay=n.popupDisplay||"full",n.resizingBar=n.resizingBar===void 0?!/inline|balloon/i.test(n.mode):n.resizingBar,n.showPathLabel=n.resizingBar?typeof n.showPathLabel=="boolean"?n.showPathLabel:!0:!1,n.resizeEnable=n.resizeEnable===void 0?!0:!!n.resizeEnable,n.resizingBarContainer=typeof n.resizingBarContainer=="string"?document.querySelector(n.resizingBarContainer):n.resizingBarContainer,n.charCounter=n.maxCharCount>0?!0:typeof n.charCounter=="boolean"?n.charCounter:!1,n.charCounterType=typeof n.charCounterType=="string"?n.charCounterType:"char",n.charCounterLabel=typeof n.charCounterLabel=="string"?n.charCounterLabel.trim():null,n.maxCharCount=et.isNumber(n.maxCharCount)&&n.maxCharCount>-1?n.maxCharCount*1:null,n.width=n.width?et.isNumber(n.width)?n.width+"px":n.width:t.clientWidth?t.clientWidth+"px":"100%",n.minWidth=(et.isNumber(n.minWidth)?n.minWidth+"px":n.minWidth)||"",n.maxWidth=(et.isNumber(n.maxWidth)?n.maxWidth+"px":n.maxWidth)||"",n.height=n.height?et.isNumber(n.height)?n.height+"px":n.height:t.clientHeight?t.clientHeight+"px":"auto",n.minHeight=(et.isNumber(n.minHeight)?n.minHeight+"px":n.minHeight)||"",n.maxHeight=(et.isNumber(n.maxHeight)?n.maxHeight+"px":n.maxHeight)||"",n.className=typeof n.className=="string"&&n.className.length>0?" "+n.className:"",n.defaultStyle=typeof n.defaultStyle=="string"?n.defaultStyle:"",n.font=n.font?n.font:["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],n.fontSize=n.fontSize?n.fontSize:null,n.formats=n.formats?n.formats:null,n.colorList=n.colorList?n.colorList:null,n.lineHeights=n.lineHeights?n.lineHeights:null,n.paragraphStyles=n.paragraphStyles?n.paragraphStyles:null,n.textStyles=n.textStyles?n.textStyles:null,n.fontSizeUnit=typeof n.fontSizeUnit=="string"&&n.fontSizeUnit.trim().toLowerCase()||"px",n.alignItems=typeof n.alignItems=="object"?n.alignItems:n.rtl?["right","center","left","justify"]:["left","center","right","justify"],n.imageResizing=n.imageResizing===void 0?!0:n.imageResizing,n.imageHeightShow=n.imageHeightShow===void 0?!0:!!n.imageHeightShow,n.imageAlignShow=n.imageAlignShow===void 0?!0:!!n.imageAlignShow,n.imageWidth=n.imageWidth?et.isNumber(n.imageWidth)?n.imageWidth+"px":n.imageWidth:"auto",n.imageHeight=n.imageHeight?et.isNumber(n.imageHeight)?n.imageHeight+"px":n.imageHeight:"auto",n.imageSizeOnlyPercentage=!!n.imageSizeOnlyPercentage,n._imageSizeUnit=n.imageSizeOnlyPercentage?"%":"px",n.imageRotation=n.imageRotation!==void 0?n.imageRotation:!(n.imageSizeOnlyPercentage||!n.imageHeightShow),n.imageFileInput=n.imageFileInput===void 0?!0:n.imageFileInput,n.imageUrlInput=n.imageUrlInput===void 0||!n.imageFileInput?!0:n.imageUrlInput,n.imageUploadHeader=n.imageUploadHeader||null,n.imageUploadUrl=typeof n.imageUploadUrl=="string"?n.imageUploadUrl:null,n.imageUploadSizeLimit=/\d+/.test(n.imageUploadSizeLimit)?et.getNumber(n.imageUploadSizeLimit,0):null,n.imageMultipleFile=!!n.imageMultipleFile,n.imageAccept=typeof n.imageAccept!="string"||n.imageAccept.trim()==="*"?"image/*":n.imageAccept.trim()||"image/*",n.imageGalleryData=n.imageGalleryData||null,n.imageGalleryUrl=typeof n.imageGalleryUrl=="string"?n.imageGalleryUrl:null,n.imageGalleryHeader=n.imageGalleryHeader||null,n.videoResizing=n.videoResizing===void 0?!0:n.videoResizing,n.videoHeightShow=n.videoHeightShow===void 0?!0:!!n.videoHeightShow,n.videoAlignShow=n.videoAlignShow===void 0?!0:!!n.videoAlignShow,n.videoRatioShow=n.videoRatioShow===void 0?!0:!!n.videoRatioShow,n.videoWidth=!n.videoWidth||!et.getNumber(n.videoWidth,0)?"":et.isNumber(n.videoWidth)?n.videoWidth+"px":n.videoWidth,n.videoHeight=!n.videoHeight||!et.getNumber(n.videoHeight,0)?"":et.isNumber(n.videoHeight)?n.videoHeight+"px":n.videoHeight,n.videoSizeOnlyPercentage=!!n.videoSizeOnlyPercentage,n._videoSizeUnit=n.videoSizeOnlyPercentage?"%":"px",n.videoRotation=n.videoRotation!==void 0?n.videoRotation:!(n.videoSizeOnlyPercentage||!n.videoHeightShow),n.videoRatio=et.getNumber(n.videoRatio,4)||.5625,n.videoRatioList=n.videoRatioList?n.videoRatioList:null,n.youtubeQuery=(n.youtubeQuery||"").replace("?",""),n.vimeoQuery=(n.vimeoQuery||"").replace("?",""),n.videoFileInput=!!n.videoFileInput,n.videoUrlInput=n.videoUrlInput===void 0||!n.videoFileInput?!0:n.videoUrlInput,n.videoUploadHeader=n.videoUploadHeader||null,n.videoUploadUrl=typeof n.videoUploadUrl=="string"?n.videoUploadUrl:null,n.videoUploadSizeLimit=/\d+/.test(n.videoUploadSizeLimit)?et.getNumber(n.videoUploadSizeLimit,0):null,n.videoMultipleFile=!!n.videoMultipleFile,n.videoTagAttrs=n.videoTagAttrs||null,n.videoIframeAttrs=n.videoIframeAttrs||null,n.videoAccept=typeof n.videoAccept!="string"||n.videoAccept.trim()==="*"?"video/*":n.videoAccept.trim()||"video/*",n.audioWidth=n.audioWidth?et.isNumber(n.audioWidth)?n.audioWidth+"px":n.audioWidth:"",n.audioHeight=n.audioHeight?et.isNumber(n.audioHeight)?n.audioHeight+"px":n.audioHeight:"",n.audioFileInput=!!n.audioFileInput,n.audioUrlInput=n.audioUrlInput===void 0||!n.audioFileInput?!0:n.audioUrlInput,n.audioUploadHeader=n.audioUploadHeader||null,n.audioUploadUrl=typeof n.audioUploadUrl=="string"?n.audioUploadUrl:null,n.audioUploadSizeLimit=/\d+/.test(n.audioUploadSizeLimit)?et.getNumber(n.audioUploadSizeLimit,0):null,n.audioMultipleFile=!!n.audioMultipleFile,n.audioTagAttrs=n.audioTagAttrs||null,n.audioAccept=typeof n.audioAccept!="string"||n.audioAccept.trim()==="*"?"audio/*":n.audioAccept.trim()||"audio/*",n.tableCellControllerPosition=typeof n.tableCellControllerPosition=="string"?n.tableCellControllerPosition.toLowerCase():"cell",n.linkTargetNewWindow=!!n.linkTargetNewWindow,n.linkProtocol=typeof n.linkProtocol=="string"?n.linkProtocol:null,n.linkRel=Array.isArray(n.linkRel)?n.linkRel:[],n.linkRelDefault=n.linkRelDefault||{},n.tabDisable=!!n.tabDisable,n.shortcutsDisable=Array.isArray(n.shortcutsDisable)?n.shortcutsDisable:[],n.shortcutsHint=n.shortcutsHint===void 0?!0:!!n.shortcutsHint,n.callBackSave=n.callBackSave?n.callBackSave:null,n.templates=n.templates?n.templates:null,n.placeholder=typeof n.placeholder=="string"?n.placeholder:null,n.mediaAutoSelect=n.mediaAutoSelect===void 0?!0:!!n.mediaAutoSelect,n.buttonList=n.buttonList?n.buttonList:[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],n.rtl&&(n.buttonList=n.buttonList.reverse()),n.icons=!n.icons||typeof n.icons!="object"?Yf:[Yf,n.icons].reduce(function(o,l){for(let c in l)et.hasOwn(l,c)&&(o[c]=l[c]);return o},{}),n.icons=n.rtl?[n.icons,n.icons.rtl].reduce(function(o,l){for(let c in l)et.hasOwn(l,c)&&(o[c]=l[c]);return o},{}):n.icons,n.__listCommonStyle=n.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"],n._editorStyles=et._setDefaultOptionStyle(n,n.defaultStyle)},_setWhitelist:function(t,n){if(typeof n!="string")return t;n=n.split("|"),t=t.split("|");for(let r=0,i=n.length,s;r<i;r++)s=t.indexOf(n[r]),s>-1&&t.splice(s,1);return t.join("|")},_defaultButtons:function(t){const n=t.icons,r=t.lang,i=et.isOSX_IOS?"⌘":"CTRL",s=et.isOSX_IOS?"⇧":"+SHIFT",o=t.shortcutsHint?t.shortcutsDisable:["bold","strike","underline","italic","undo","indent","save"],l=t.rtl?["[","]"]:["]","["],c=t.rtl?[n.outdent,n.indent]:[n.indent,n.outdent];return{bold:["",r.toolbar.bold+'<span class="se-shortcut">'+(o.indexOf("bold")>-1?"":i+'+<span class="se-shortcut-key">B</span>')+"</span>","bold","",n.bold],underline:["",r.toolbar.underline+'<span class="se-shortcut">'+(o.indexOf("underline")>-1?"":i+'+<span class="se-shortcut-key">U</span>')+"</span>","underline","",n.underline],italic:["",r.toolbar.italic+'<span class="se-shortcut">'+(o.indexOf("italic")>-1?"":i+'+<span class="se-shortcut-key">I</span>')+"</span>","italic","",n.italic],strike:["",r.toolbar.strike+'<span class="se-shortcut">'+(o.indexOf("strike")>-1?"":i+s+'+<span class="se-shortcut-key">S</span>')+"</span>","strike","",n.strike],subscript:["",r.toolbar.subscript,"SUB","",n.subscript],superscript:["",r.toolbar.superscript,"SUP","",n.superscript],removeFormat:["",r.toolbar.removeFormat,"removeFormat","",n.erase],indent:["",r.toolbar.indent+'<span class="se-shortcut">'+(o.indexOf("indent")>-1?"":i+'+<span class="se-shortcut-key">'+l[0]+"</span>")+"</span>","indent","",c[0]],outdent:["",r.toolbar.outdent+'<span class="se-shortcut">'+(o.indexOf("indent")>-1?"":i+'+<span class="se-shortcut-key">'+l[1]+"</span>")+"</span>","outdent","",c[1]],fullScreen:["se-code-view-enabled se-resizing-enabled",r.toolbar.fullScreen,"fullScreen","",n.expansion],showBlocks:["",r.toolbar.showBlocks,"showBlocks","",n.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled",r.toolbar.codeView,"codeView","",n.code_view],undo:["",r.toolbar.undo+'<span class="se-shortcut">'+(o.indexOf("undo")>-1?"":i+'+<span class="se-shortcut-key">Z</span>')+"</span>","undo","",n.undo],redo:["",r.toolbar.redo+'<span class="se-shortcut">'+(o.indexOf("undo")>-1?"":i+'+<span class="se-shortcut-key">Y</span> / '+i+s+'+<span class="se-shortcut-key">Z</span>')+"</span>","redo","",n.redo],preview:["se-resizing-enabled",r.toolbar.preview,"preview","",n.preview],print:["se-resizing-enabled",r.toolbar.print,"print","",n.print],dir:["",r.toolbar[t.rtl?"dir_ltr":"dir_rtl"],"dir","",n[t.rtl?"dir_ltr":"dir_rtl"]],dir_ltr:["",r.toolbar.dir_ltr,"dir_ltr","",n.dir_ltr],dir_rtl:["",r.toolbar.dir_rtl,"dir_rtl","",n.dir_rtl],save:["se-resizing-enabled",r.toolbar.save+'<span class="se-shortcut">'+(o.indexOf("save")>-1?"":i+'+<span class="se-shortcut-key">S</span>')+"</span>","save","",n.save],blockquote:["",r.toolbar.tag_blockquote,"blockquote","command",n.blockquote],font:["se-btn-select se-btn-tool-font",r.toolbar.font,"font","submenu",'<span class="txt">'+r.toolbar.font+"</span>"+n.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",r.toolbar.formats,"formatBlock","submenu",'<span class="txt">'+r.toolbar.formats+"</span>"+n.arrow_down],fontSize:["se-btn-select se-btn-tool-size",r.toolbar.fontSize,"fontSize","submenu",'<span class="txt">'+r.toolbar.fontSize+"</span>"+n.arrow_down],fontColor:["",r.toolbar.fontColor,"fontColor","submenu",n.font_color],hiliteColor:["",r.toolbar.hiliteColor,"hiliteColor","submenu",n.highlight_color],align:["se-btn-align",r.toolbar.align,"align","submenu",t.rtl?n.align_right:n.align_left],list:["",r.toolbar.list,"list","submenu",n.list_number],horizontalRule:["btn_line",r.toolbar.horizontalRule,"horizontalRule","submenu",n.horizontal_rule],table:["",r.toolbar.table,"table","submenu",n.table],lineHeight:["",r.toolbar.lineHeight,"lineHeight","submenu",n.line_height],template:["",r.toolbar.template,"template","submenu",n.template],paragraphStyle:["",r.toolbar.paragraphStyle,"paragraphStyle","submenu",n.paragraph_style],textStyle:["",r.toolbar.textStyle,"textStyle","submenu",n.text_style],link:["",r.toolbar.link,"link","dialog",n.link],image:["",r.toolbar.image,"image","dialog",n.image],video:["",r.toolbar.video,"video","dialog",n.video],audio:["",r.toolbar.audio,"audio","dialog",n.audio],math:["",r.toolbar.math,"math","dialog",n.math],imageGallery:["",r.toolbar.imageGallery,"imageGallery","fileBrowser",n.image_gallery]}},_createModuleGroup:function(){const t=et.createElement("DIV");t.className="se-btn-module se-btn-module-border";const n=et.createElement("UL");return n.className="se-menu-list",t.appendChild(n),{div:t,ul:n}},_createButton:function(t,n,r,i,s,o,l){const c=et.createElement("LI"),a=et.createElement("BUTTON"),f=n||r;return a.setAttribute("type","button"),a.setAttribute("class","se-btn"+(t?" "+t:"")+" se-tooltip"),a.setAttribute("data-command",r),a.setAttribute("data-display",i),a.setAttribute("aria-label",f.replace(/<span .+<\/span>/,"")),a.setAttribute("tabindex","-1"),s||(s='<span class="se-icon-text">!</span>'),/^default\./i.test(s)&&(s=l[s.replace(/^default\./i,"")]),/^text\./i.test(s)&&(s=s.replace(/^text\./i,""),a.className+=" se-btn-more-text"),s+='<span class="se-tooltip-inner"><span class="se-tooltip-text">'+f+"</span></span>",o&&a.setAttribute("disabled",!0),a.innerHTML=s,c.appendChild(a),{li:c,button:a}},_createToolBar:function(t,n,r,i){const s=t.createElement("DIV");s.className="se-toolbar-separator-vertical";const o=t.createElement("DIV");o.className="se-toolbar sun-editor-common";const l=t.createElement("DIV");l.className="se-btn-tray",o.appendChild(l),n=JSON.parse(JSON.stringify(n));const c=i.icons,a=this._defaultButtons(i),f={},u=[];let m=null,y=null,_=null,S=null,E="",d=!1;const h=et.createElement("DIV");h.className="se-toolbar-more-layer";e:for(let g=0,b,w,k,N,T;g<n.length;g++)if(b=!1,T="",N=n[g],_=this._createModuleGroup(),typeof N=="object"){for(let D=0,I;D<N.length;D++){if(y=N[D],I=!1,/^\%\d+/.test(y)&&D===0){N[0]=y.replace(/[^\d]/g,""),u.push(N),n.splice(g--,1);continue e}if(typeof y=="object")typeof y.add=="function"?(E=y.name,m=a[E],r[E]=y):(E=y.name,m=[y.buttonClass,y.title,y.name,y.dataDisplay,y.innerHTML,y._disabled]);else{if(/^\-/.test(y)){T=y.substr(1),_.div.className+=" module-float-"+T;continue}if(/^\#/.test(y)){y.substr(1)==="fix"&&(_.ul.className+=" se-menu-dir-fix");continue}if(/^\:/.test(y)){I=!0;const L=y.match(/^\:([^\-]+)\-([^\-]+)\-([^\-]+)/);k="__se__"+L[1].trim();const R=L[2].trim(),P=L[3].trim();m=["se-btn-more",R,k,"MORE",P]}else m=a[y];if(E=y,!m){const L=r[E];if(!L)throw Error("[SUNEDITOR.create.toolbar.fail] The button name of a plugin that does not exist. ["+E+"]");m=[L.buttonClass,L.title,L.name,L.display,L.innerHTML,L._disabled]}}S=this._createButton(m[0],m[1],m[2],m[3],m[4],m[5],c),(b?w:_.ul).appendChild(S.li),r[E]&&(f[E]=S.button),I&&(b=!0,w=et.createElement("DIV"),w.className="se-more-layer "+k,w.innerHTML='<div class="se-more-form"><ul class="se-menu-list"'+(T?' style="float: '+T+';"':"")+"></ul></div>",h.appendChild(w),w=w.firstElementChild.firstElementChild)}if(d){const D=s.cloneNode(!1);l.appendChild(D)}l.appendChild(_.div),d=!0}else if(/^\/$/.test(N)){const D=t.createElement("DIV");D.className="se-btn-module-enter",l.appendChild(D),d=!1}switch(l.children.length){case 0:l.style.display="none";break;case 1:et.removeClass(l.firstElementChild,"se-btn-module-border");break;default:if(i.rtl){const g=s.cloneNode(!1);g.style.float=l.lastElementChild.style.float,l.appendChild(g)}}u.length>0&&u.unshift(n),h.children.length>0&&l.appendChild(h);const v=t.createElement("DIV");v.className="se-menu-tray",o.appendChild(v);const x=t.createElement("DIV");return x.className="se-toolbar-cover",o.appendChild(x),i.hideToolbar&&(o.style.display="none"),{element:o,plugins:r,pluginCallButtons:f,responsiveButtons:u,_menuTray:v,_buttonTray:l}}},t0=function(t,n,r){return{element:{originElement:t,topArea:n._top,relative:n._relative,toolbar:n._toolBar,_toolbarShadow:n._toolbarShadow,_buttonTray:n._toolBar.querySelector(".se-btn-tray"),_menuTray:n._menuTray,resizingBar:n._resizingBar,navigation:n._navigation,charWrapper:n._charWrapper,charCounter:n._charCounter,editorArea:n._editorArea,wysiwygFrame:n._wysiwygArea,wysiwyg:n._wysiwygArea,code:n._codeArea,placeholder:n._placeholder,loading:n._loading,lineBreaker:n._lineBreaker,lineBreaker_t:n._lineBreaker_t,lineBreaker_b:n._lineBreaker_b,resizeBackground:n._resizeBack,_stickyDummy:n._stickyDummy,_arrow:n._arrow,_focusTemp:n._focusTemp},tool:{cover:n._toolBar.querySelector(".se-toolbar-cover"),bold:n._toolBar.querySelector('[data-command="bold"]'),underline:n._toolBar.querySelector('[data-command="underline"]'),italic:n._toolBar.querySelector('[data-command="italic"]'),strike:n._toolBar.querySelector('[data-command="strike"]'),sub:n._toolBar.querySelector('[data-command="SUB"]'),sup:n._toolBar.querySelector('[data-command="SUP"]'),undo:n._toolBar.querySelector('[data-command="undo"]'),redo:n._toolBar.querySelector('[data-command="redo"]'),save:n._toolBar.querySelector('[data-command="save"]'),outdent:n._toolBar.querySelector('[data-command="outdent"]'),indent:n._toolBar.querySelector('[data-command="indent"]'),fullScreen:n._toolBar.querySelector('[data-command="fullScreen"]'),showBlocks:n._toolBar.querySelector('[data-command="showBlocks"]'),codeView:n._toolBar.querySelector('[data-command="codeView"]'),dir:n._toolBar.querySelector('[data-command="dir"]'),dir_ltr:n._toolBar.querySelector('[data-command="dir_ltr"]'),dir_rtl:n._toolBar.querySelector('[data-command="dir_rtl"]')},options:r,option:r}};function lT(t,n){const r=t._w,i=t.util,s=t.options.historyStackDelayTime;let o=t.context.element,l=t.context.tool.undo,c=t.context.tool.redo,a=null,f=0,u=[];function m(){const _=u[f];o.wysiwyg.innerHTML=_.contents,t.setRange(i.getNodeFromPath(_.s.path,o.wysiwyg),_.s.offset,i.getNodeFromPath(_.e.path,o.wysiwyg),_.e.offset),t.focus(),u.length<=1?(l&&l.setAttribute("disabled",!0),c&&c.setAttribute("disabled",!0)):f===0?(l&&l.setAttribute("disabled",!0),c&&c.removeAttribute("disabled")):f===u.length-1?(l&&l.removeAttribute("disabled"),c&&c.setAttribute("disabled",!0)):(l&&l.removeAttribute("disabled"),c&&c.removeAttribute("disabled")),t.controllersOff(),t._checkComponents(),t._setCharCount(),t._resourcesStateChange(),n()}function y(){t._checkComponents();const _=o.wysiwyg.innerHTML;if(!_||u[f]&&_===u[f].contents)return;f++;const S=t._variable._range;u.length>f&&(u=u.slice(0,f),c&&c.setAttribute("disabled",!0)),S?u[f]={contents:_,s:{path:i.getNodePath(S.startContainer,null,null),offset:S.startOffset},e:{path:i.getNodePath(S.endContainer,null,null),offset:S.endOffset}}:u[f]={contents:_,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},f===1&&l&&l.removeAttribute("disabled"),t._setCharCount(),n()}return{stack:u,push:function(_){r.setTimeout(t._resourcesStateChange.bind(t));const S=typeof _=="number"?_>0?_:0:_?s:0;if((!S||a)&&(r.clearTimeout(a),!S)){y();return}a=r.setTimeout(function(){r.clearTimeout(a),a=null,y()},S)},undo:function(){f>0&&(f--,m())},redo:function(){u.length-1>f&&(f++,m())},go:function(_){f=_<0?u.length-1:_,m()},getCurrentIndex:function(){return f},reset:function(_){l&&l.setAttribute("disabled",!0),c&&c.setAttribute("disabled",!0),t._variable.isChanged=!1,t.context.tool.save&&t.context.tool.save.setAttribute("disabled",!0),u.splice(0),f=0,u[f]={contents:t.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},_||n()},_resetCachingButton:function(){o=t.context.element,l=t.context.tool.undo,c=t.context.tool.redo,f===0?(l&&l.setAttribute("disabled",!0),c&&f===u.length-1&&c.setAttribute("disabled",!0),t._variable.isChanged=!1,t.context.tool.save&&t.context.tool.save.setAttribute("disabled",!0)):f===u.length-1&&c&&c.setAttribute("disabled",!0)},_destroy:function(){a&&r.clearTimeout(a),u=null}}}const Gf={name:"notice",add:function(t){const n=t.context;n.notice={};let r=t.util.createElement("DIV"),i=t.util.createElement("SPAN"),s=t.util.createElement("BUTTON");r.className="se-notice",s.className="close",s.setAttribute("aria-label","Close"),s.setAttribute("title",t.lang.dialogBox.close),s.innerHTML=t.icons.cancel,r.appendChild(i),r.appendChild(s),n.notice.modal=r,n.notice.message=i,s.addEventListener("click",this.onClick_cancel.bind(t)),n.element.editorArea.appendChild(r),r=null},onClick_cancel:function(t){t.preventDefault(),t.stopPropagation(),this.plugins.notice.close.call(this)},open:function(t){this.context.notice.message.textContent=t,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}};function cT(t,n,r,i,s,o){const l=t.element.originElement.ownerDocument||document,c=l.defaultView||window,a=et,f=s.icons,u={_d:l,_w:c,_parser:new c.DOMParser,_prevRtl:s.rtl,_editorHeight:0,_editorHeightPadding:0,_listCamel:s.__listCommonStyle,_listKebab:a.camelToKebabCase(s.__listCommonStyle),__focusTemp:t.element._focusTemp,_wd:null,_ww:null,_shadowRoot:null,_shadowRootControllerEventTarget:null,util:a,functions:null,options:null,wwComputedStyle:null,notice:Gf,icons:f,history:null,context:t,pluginCallButtons:n,plugins:r||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:[],resizingDisabledButtons:[],_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_htmlCheckBlacklistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,editorTagsBlacklistRegExp:null,pasteTagsWhitelistRegExp:null,pasteTagsBlacklistRegExp:null,hasFocus:!1,isDisabled:!1,isReadOnly:!1,_attributesWhitelistRegExp:null,_attributesWhitelistRegExp_all_data:null,_attributesBlacklistRegExp:null,_attributesTagsWhitelist:null,_attributesTagsBlacklist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:{},_commandMapStyles:{STRONG:["font-weight"],U:["text-decoration"],EM:["font-style"],DEL:["text-decoration"]},_styleCommandMap:null,_cleanStyleRegExp:{div:new c.RegExp("\\s*[^-a-zA-Z](.+)\\s*:[^;]+(?!;)*","ig"),span:new c.RegExp("\\s*[^-a-zA-Z](font-family|font-size|color|background-color)\\s*:[^;]+(?!;)*","ig"),format:new c.RegExp("\\s*[^-a-zA-Z](text-align|margin-left|margin-right|width|height|line-height)\\s*:[^;]+(?!;)*","ig"),fontSizeUnit:new c.RegExp("\\d+"+s.fontSizeUnit+"$","i")},_variable:{isChanged:!1,isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:2,minResizingSize:a.getNumber(t.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:t.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},_formatAttrsTemp:null,_saveButtonStates:function(){this.allCommandButtons||(this.allCommandButtons={});const d=this.context.element._buttonTray.querySelectorAll(".se-menu-list button[data-display]");for(let h=0,v,x;h<d.length;h++)v=d[h],x=v.getAttribute("data-command"),this.allCommandButtons[x]=v},_recoverButtonStates:function(){if(this.allCommandButtons){const d=this.context.element._buttonTray.querySelectorAll(".se-menu-list button[data-display]");for(let h=0,v,x,g;h<d.length;h++)v=d[h],x=v.getAttribute("data-command"),g=this.allCommandButtons[x],g&&(v.parentElement.replaceChild(g,v),this.context.tool[x]&&(this.context.tool[x]=g))}},callPlugin:function(d,h,v){if(v=v||n[d],this.plugins[d])this.initPlugins[d]?typeof this._targetPlugins[d]=="object"&&v&&this.initMenuTarget(d,v,this._targetPlugins[d]):(this.plugins[d].add(this,v),this.initPlugins[d]=!0);else throw Error('[SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"'+d+'")');this.plugins[d].active&&!this.commandMap[d]&&v&&(this.commandMap[d]=v,this.activePlugins.push(d)),typeof h=="function"&&h()},addModule:function(d){for(let h=0,v=d.length,x;h<v;h++)x=d[h].name,this.plugins[x]||(this.plugins[x]=d[h]),this.initPlugins[x]||(this.initPlugins[x]=!0,typeof this.plugins[x].add=="function"&&this.plugins[x].add(this))},getGlobalScrollOffset:function(){let d=0,h=0,v=t.element.topArea;for(;v;)d+=v.scrollTop,h+=v.scrollLeft,v=v.parentElement;for(v=this._shadowRoot?this._shadowRoot.host:null;v;)d+=v.scrollTop,h+=v.scrollLeft,v=v.parentElement;return{top:d,left:h}},initMenuTarget:function(d,h,v){h?(t.element._menuTray.appendChild(v),this._targetPlugins[d]=!0,this._menuTray[h.getAttribute("data-command")]=v):this._targetPlugins[d]=v},submenuOn:function(d){this._bindedSubmenuOff&&this._bindedSubmenuOff(),this._bindControllersOff&&this.controllersOff();const h=this._submenuName=d.getAttribute("data-command"),v=this.submenu=this._menuTray[h];this.submenuActiveButton=d,this._setMenuPosition(d,v),this._bindedSubmenuOff=this.submenuOff.bind(this),this.addDocEvent("mousedown",this._bindedSubmenuOff,!1),this.plugins[h].on&&this.plugins[h].on.call(this),this._antiBlur=!0},submenuOff:function(){this.removeDocEvent("mousedown",this._bindedSubmenuOff),this._bindedSubmenuOff=null,this.submenu&&(this._submenuName="",this.submenu.style.display="none",this.submenu=null,a.removeClass(this.submenuActiveButton,"on"),this.submenuActiveButton=null,this._notHideToolbar=!1),this._antiBlur=!1},moreLayerOff:function(){if(this._moreLayerActiveButton){const d=t.element.toolbar.querySelector("."+this._moreLayerActiveButton.getAttribute("data-command"));d.style.display="none",a.removeClass(this._moreLayerActiveButton,"on"),this._moreLayerActiveButton=null}},containerOn:function(d){this._bindedContainerOff&&this._bindedContainerOff();const h=this._containerName=d.getAttribute("data-command"),v=this.container=this._menuTray[h];this.containerActiveButton=d,this._setMenuPosition(d,v),this._bindedContainerOff=this.containerOff.bind(this),this.addDocEvent("mousedown",this._bindedContainerOff,!1),this.plugins[h].on&&this.plugins[h].on.call(this),this._antiBlur=!0},containerOff:function(){this.removeDocEvent("mousedown",this._bindedContainerOff),this._bindedContainerOff=null,this.container&&(this._containerName="",this.container.style.display="none",this.container=null,a.removeClass(this.containerActiveButton,"on"),this.containerActiveButton=null,this._notHideToolbar=!1),this._antiBlur=!1},_setMenuPosition:function(d,h){h.style.visibility="hidden",h.style.display="block",h.style.height="",a.addClass(d,"on");const v=this.context.element.toolbar,x=v.offsetWidth,g=m._getEditorOffsets(t.element.toolbar),b=h.offsetWidth,w=d.parentElement.offsetLeft+3;if(s.rtl){const P=d.offsetWidth,O=b>P?b-P:0,U=O>0?0:P-b;h.style.left=w-O+U+"px",g.left>m._getEditorOffsets(h).left&&(h.style.left="0px")}else{const P=x<=b?0:x-(w+b);P<0?h.style.left=w+P+"px":h.style.left=w+"px"}let k=0,N=d;for(;N&&N!==v;)k+=N.offsetTop,N=N.offsetParent;const T=k;this._isBalloon?k+=v.offsetTop+d.offsetHeight:k-=d.offsetHeight;const D=g.top,I=h.offsetHeight,L=this.getGlobalScrollOffset().top,R=c.innerHeight-(D-L+T+d.parentElement.offsetHeight);if(R<I){let P=-1*(I-T+3);const O=D-L+P,U=I+(O<0?O:0);U>R?(h.style.height=U+"px",P=-1*(U-T+3)):(h.style.height=R+"px",P=T+d.parentElement.offsetHeight),h.style.top=P+"px"}else h.style.top=T+d.parentElement.offsetHeight+"px";h.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let d=0,h;d<arguments.length;d++)if(h=arguments[d],!!h){if(typeof h=="string"){this.currentControllerName=h;continue}if(typeof h=="function"){this.controllerArray.push(h);continue}if(!a.hasClass(h,"se-controller")){this.currentControllerTarget=h,this.currentFileComponentInfo=this.getFileComponent(h);continue}h.style&&(h.style.display="block",this._shadowRoot&&this._shadowRootControllerEventTarget.indexOf(h)===-1&&(h.addEventListener("mousedown",function(v){v.preventDefault(),v.stopPropagation()}),this._shadowRootControllerEventTarget.push(h))),this.controllerArray.push(h)}this._bindControllersOff=this.controllersOff.bind(this),this.addDocEvent("mousedown",this._bindControllersOff,!1),this.addDocEvent("keydown",this._bindControllersOff,!1),this._antiBlur=!0,typeof y.showController=="function"&&y.showController(this.currentControllerName,this.controllerArray,this)},controllersOff:function(d){this._lineBreaker.style.display="none";const h=this.controllerArray.length;if(d&&d.target&&h>0){for(let v=0;v<h;v++)if(typeof this.controllerArray[v].contains=="function"&&this.controllerArray[v].contains(d.target))return}if(!(this._fileManager.pluginRegExp.test(this.currentControllerName)&&d&&d.type==="keydown"&&d.keyCode!==27)&&(t.element.lineBreaker_t.style.display=t.element.lineBreaker_b.style.display="none",this._variable._lineBreakComp=null,this.currentControllerName="",this.currentControllerTarget=null,this.currentFileComponentInfo=null,this.effectNode=null,!!this._bindControllersOff)){if(this.removeDocEvent("mousedown",this._bindControllersOff),this.removeDocEvent("keydown",this._bindControllersOff),this._bindControllersOff=null,h>0){for(let v=0;v<h;v++)typeof this.controllerArray[v]=="function"?this.controllerArray[v]():this.controllerArray[v].style.display="none";this.controllerArray=[]}this._antiBlur=!1}},setControllerPosition:function(d,h,v,x){s.rtl&&(x.left*=-1);const g=a.getOffset(h,t.element.wysiwygFrame);d.style.visibility="hidden",d.style.display="block";const b=v==="top"?-(d.offsetHeight+2):h.offsetHeight+12;d.style.top=g.top+b+x.top+"px";const w=g.left-t.element.wysiwygFrame.scrollLeft+x.left,k=d.offsetWidth,N=h.offsetWidth,T=a.hasClass(d.firstElementChild,"se-arrow")?d.firstElementChild:null;if(s.rtl){const D=k>N?k-N:0,I=D>0?0:N-k;d.style.left=w-D+I+"px",D>0&&T&&(T.style.left=(k-14<10+D?k-14:10+D)+"px");const L=t.element.wysiwygFrame.offsetLeft-d.offsetLeft;L>0&&(d.style.left="0px",T&&(T.style.left=L+"px"))}else{d.style.left=w+"px";const D=t.element.wysiwygFrame.offsetWidth-(d.offsetLeft+k);D<0?(d.style.left=d.offsetLeft+D+"px",T&&(T.style.left=20-D+"px")):T&&(T.style.left="20px")}d.style.visibility=""},execCommand:function(d,h,v){this._wd.execCommand(d,h,d==="formatBlock"?"<"+v+">":v),this.history.push(!0)},nativeFocus:function(){this.__focus(),this._editorRange()},__focus:function(){const d=a.getParentElement(this.getSelectionNode(),"figcaption");d?d.focus():t.element.wysiwyg.focus()},focus:function(){if(t.element.wysiwygFrame.style.display!=="none"){if(s.iframe)this.nativeFocus();else try{const d=this.getRange();if(d.startContainer===d.endContainer&&a.isWysiwygDiv(d.startContainer)){const h=d.commonAncestorContainer.children[d.startOffset];if(!a.isFormatElement(h)&&!a.isComponent(h)){const v=a.createElement(s.defaultTag),x=a.createElement("BR");v.appendChild(x),t.element.wysiwyg.insertBefore(v,h),this.setRange(x,0,x,0);return}}this.setRange(d.startContainer,d.startOffset,d.endContainer,d.endOffset)}catch{this.nativeFocus()}m._applyTagEffects(),this._isBalloon&&m._toggleToolbarBalloon()}},focusEdge:function(d){d||(d=t.element.wysiwyg.lastElementChild);const h=this.getFileComponent(d);h?this.selectComponent(h.target,h.pluginName):d?(d=a.getChildElement(d,function(v){return v.childNodes.length===0||v.nodeType===3},!0),d?this.setRange(d,d.textContent.length,d,d.textContent.length):this.nativeFocus()):this.focus()},blur:function(){s.iframe?t.element.wysiwygFrame.blur():t.element.wysiwyg.blur()},setRange:function(d,h,v,x){if(!d||!v)return;(a.isBreak(d)||d.nodeType===3)&&h>d.textContent.length&&(h=d.textContent.length),(a.isBreak(v)||v.nodeType===3)&&x>v.textContent.length&&(x=v.textContent.length),a.isFormatElement(d)&&(d=d.childNodes[h>0?d.childNodes.length-1:0]||d,h=h>0?d.nodeType===1&&!a.isBreak(d)?1:d.textContent?d.textContent.length:0:0),a.isFormatElement(v)&&(v=v.childNodes[x>0?v.childNodes.length-1:0]||v,x=x>0?v.nodeType===1&&!a.isBreak(v)?1:v.textContent?v.textContent.length:0:0);const g=this._wd.createRange();try{h>d.textContent.length&&(h=d.textContent.length),x>v.textContent.length&&(x=v.textContent.length),g.setStart(d,h),g.setEnd(v,x)}catch(w){console.warn("[SUNEDITOR.core.focus.error] "+w),this.nativeFocus();return}const b=this.getSelection();return b.removeAllRanges&&b.removeAllRanges(),b.addRange(g),this._rangeInfo(g,this.getSelection()),s.iframe&&this.__focus(),g},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.hasFocus&&this.getSelection().removeAllRanges(),this._setKeyEffect([])},getRange:function(){const d=this._variable._range||this._createDefaultRange(),h=this.getSelection();if(d.collapsed===h.isCollapsed||!t.element.wysiwyg.contains(h.focusNode))return d;if(h.rangeCount>0)return this._variable._range=h.getRangeAt(0),this._variable._range;{const v=h.anchorNode,x=h.focusNode,g=h.anchorOffset,b=h.focusOffset,w=a.compareElements(v,x),k=w.ancestor&&(w.result===0?g<=b:w.result>1);return this.setRange(k?v:x,k?g:b,k?x:v,k?b:g)}},getRange_addLine:function(d,h){if(this._selectionVoid(d)){const v=t.element.wysiwyg,x=a.createElement(s.defaultTag);x.innerHTML="<br>",v.insertBefore(x,h&&h!==v?h.nextElementSibling:v.firstElementChild),this.setRange(x.firstElementChild,0,x.firstElementChild,1),d=this._variable._range}return d},getSelection:function(){const d=this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection();return!this._variable._range&&!t.element.wysiwyg.contains(d.focusNode)&&(d.removeAllRanges(),d.addRange(this._createDefaultRange())),d},getSelectionNode:function(){if(t.element.wysiwyg.contains(this._variable._selectionNode)||this._editorRange(),!this._variable._selectionNode){const d=a.getChildElement(t.element.wysiwyg.firstChild,function(h){return h.childNodes.length===0||h.nodeType===3},!1);if(!d)this._editorRange();else return this._variable._selectionNode=d,d}return this._variable._selectionNode},_editorRange:function(){const d=this._wd.activeElement;if(a.isInputElement(d))return this._variable._selectionNode=d,d;const h=this.getSelection();if(!h)return null;let v=null;h.rangeCount>0?v=h.getRangeAt(0):v=this._createDefaultRange(),this._rangeInfo(v,h)},_rangeInfo:function(d,h){let v=null;this._variable._range=d,d.collapsed?a.isWysiwygDiv(d.commonAncestorContainer)?v=d.commonAncestorContainer.children[d.startOffset]||d.commonAncestorContainer:v=d.commonAncestorContainer:v=h.extentNode||h.anchorNode,this._variable._selectionNode=v},_createDefaultRange:function(){const d=t.element.wysiwyg,h=this._wd.createRange();let v=d.firstElementChild,x=null;return v?(x=v.firstChild,x||(x=a.createElement("BR"),v.appendChild(x))):(v=a.createElement(s.defaultTag),x=a.createElement("BR"),v.appendChild(x),d.appendChild(v)),h.setStart(x,0),h.setEnd(x,0),h},_selectionVoid:function(d){const h=d.commonAncestorContainer;return a.isWysiwygDiv(d.startContainer)&&a.isWysiwygDiv(d.endContainer)||/FIGURE/i.test(h.nodeName)||this._fileManager.regExp.test(h.nodeName)||a.isMediaComponent(h)},_resetRangeToTextNode:function(){const d=this.getRange();if(this._selectionVoid(d))return!1;const h=d.collapsed;let v=d.startContainer,x=d.startOffset,g=d.endContainer,b=d.endOffset,w,k,N;if(a.isFormatElement(v))for(v.childNodes[x]?(v=v.childNodes[x]||v,x=0):(v=v.lastChild||v,x=v.textContent.length);v&&v.nodeType===1&&v.firstChild;)v=v.firstChild||v,x=0;if(a.isFormatElement(g)){for(g=g.childNodes[b]||g.lastChild||g;g&&g.nodeType===1&&g.lastChild;)g=g.lastChild;b=h?0:g.textContent.length}if(w=a.isWysiwygDiv(v)?t.element.wysiwyg.firstChild:v,k=x,a.isBreak(w)||w.nodeType===1&&w.childNodes.length>0){const T=a.isBreak(w);if(!T){for(;w&&!a.isBreak(w)&&w.nodeType===1;)w=w.childNodes[k]||w.nextElementSibling||w.nextSibling,k=0;let D=a.getFormatElement(w,null);D===a.getRangeFormatElement(D,null)&&(D=a.createElement(a.getParentElement(w,a.isCell)?"DIV":s.defaultTag),w.parentNode.insertBefore(D,w),D.appendChild(w))}if(a.isBreak(w)){const D=a.createTextNode(a.zeroWidthSpace);w.parentNode.insertBefore(D,w),w=D,T&&v===g&&(g=w,b=1)}}if(v=w,x=k,w=a.isWysiwygDiv(g)?t.element.wysiwyg.lastChild:g,k=b,a.isBreak(w)||w.nodeType===1&&w.childNodes.length>0){const T=a.isBreak(w);if(!T){for(;w&&!a.isBreak(w)&&w.nodeType===1&&(N=w.childNodes,N.length!==0);)w=N[k>0?k-1:k]||!/FIGURE/i.test(N[0].nodeName)?N[0]:w.previousElementSibling||w.previousSibling||v,k=k>0?w.textContent.length:k;let D=a.getFormatElement(w,null);D===a.getRangeFormatElement(D,null)&&(D=a.createElement(a.isCell(D)?"DIV":s.defaultTag),w.parentNode.insertBefore(D,w),D.appendChild(w))}if(a.isBreak(w)){const D=a.createTextNode(a.zeroWidthSpace);w.parentNode.insertBefore(D,w),w=D,k=1,T&&!w.previousSibling&&a.removeItem(g)}}return g=w,b=k,this.setRange(v,x,g,b),!0},getSelectedElements:function(d){if(!this._resetRangeToTextNode())return[];let h=this.getRange();if(a.isWysiwygDiv(h.startContainer)){const P=t.element.wysiwyg.children;if(P.length===0)return[];this.setRange(P[0],0,P[P.length-1],P[P.length-1].textContent.trim().length),h=this.getRange()}const v=h.startContainer,x=h.endContainer,g=h.commonAncestorContainer,b=a.getListChildren(g,function(P){return d?d(P):a.isFormatElement(P)});if(!a.isWysiwygDiv(g)&&!a.isRangeFormatElement(g)&&b.unshift(a.getFormatElement(g,null)),v===x||b.length===1)return b;let w=a.getFormatElement(v,null),k=a.getFormatElement(x,null),N=null,T=null;const D=function(P){return a.isTable(P)?/^TABLE$/i.test(P.nodeName):!0};let I=a.getRangeFormatElement(w,D),L=a.getRangeFormatElement(k,D);a.isTable(I)&&a.isListCell(I.parentNode)&&(I=I.parentNode),a.isTable(L)&&a.isListCell(L.parentNode)&&(L=L.parentNode);const R=I===L;for(let P=0,O=b.length,U;P<O;P++){if(U=b[P],w===U||!R&&U===I){N=P;continue}if(k===U||!R&&U===L){T=P;break}}return N===null&&(N=0),T===null&&(T=b.length-1),b.slice(N,T+1)},getSelectedElementsAndComponents:function(d){const h=this.getRange().commonAncestorContainer,v=a.getParentElement(h,a.isComponent),x=a.isTable(h)?this.getSelectedElements(null):this.getSelectedElements((function(g){const b=this.getParentElement(g,this.isComponent);return this.isFormatElement(g)&&(!b||b===v)||this.isComponent(g)&&!this.getFormatElement(g)}).bind(a));if(d){for(let g=0,b=x.length;g<b;g++)for(let w=g-1;w>=0;w--)if(x[w].contains(x[g])){x.splice(g,1),g--,b--;break}}return x},isEdgePoint:function(d,h,v){return d.nodeType===1&&!d.textContent.length?!0:v!=="end"&&h===0||(!v||v!=="start")&&!d.nodeValue&&h===1||(!v||v==="end")&&!!d.nodeValue&&h===d.nodeValue.length},_isEdgeFormat:function(d,h,v){if(!this.isEdgePoint(d,h,v))return!1;const x=[];for(v=v==="start"?"previousSibling":"nextSibling";d&&!a.isFormatElement(d)&&!a.isWysiwygDiv(d);)if(!d[v]||a.isBreak(d[v])&&!d[v][v])d.nodeType===1&&x.push(d.cloneNode(!1)),d=d.parentNode;else return null;return x},showLoading:function(){t.element.loading.style.display="block"},closeLoading:function(){t.element.loading.style.display="none"},appendFormatTag:function(d,h){if(!d||!d.parentNode)return null;const v=a.getFormatElement(this.getSelectionNode(),null);let x=null;if(!a.isFormatElement(d)&&a.isFreeFormatElement(v||d.parentNode))x=a.createElement("BR");else{const g=h?typeof h=="string"?h:h.nodeName:a.isFormatElement(v)&&!a.isRangeFormatElement(v)&&!a.isFreeFormatElement(v)?v.nodeName:s.defaultTag;x=a.createElement(g),x.innerHTML="<br>",(h&&typeof h!="string"||!h&&a.isFormatElement(v))&&a.copyTagAttributes(x,h||v,["id"])}return a.isCell(d)?d.insertBefore(x,d.nextElementSibling):d.parentNode.insertBefore(x,d.nextElementSibling),x},insertComponent:function(d,h,v,x){if(this.isReadOnly||v&&!this.checkCharCount(d,null))return null;const g=this.removeNode();this.getRange_addLine(this.getRange(),g.container);let b=null,w=this.getSelectionNode(),k=a.getFormatElement(w,null);if(a.isListCell(k))this.insertNode(d,w===k?null:(w||g.container).nextSibling,!1),d.nextSibling||d.parentNode.appendChild(a.createElement("BR"));else{if(this.getRange().collapsed&&(g.container.nodeType===3||a.isBreak(g.container))){const N=a.getParentElement(g.container,(function(T){return this.isRangeFormatElement(T)}).bind(a));b=a.splitElement(g.container,g.offset,N?a.getElementDepth(N)+1:0),b&&(k=b.previousSibling)}this.insertNode(d,a.isRangeFormatElement(k)?null:k,!1),k&&a.onlyZeroWidthSpace(k)&&a.removeItem(k)}if(!x){this.setRange(d,0,d,0);const N=this.getFileComponent(d);N?this.selectComponent(N.target,N.pluginName):b&&(b=a.getEdgeChildNodes(b,null).sc||b,this.setRange(b,0,b,0))}return h||this.history.push(1),b||d},getFileComponent:function(d){if(!this._fileManager.queryString||!d)return null;let h,v;return(/^FIGURE$/i.test(d.nodeName)||/se-component/.test(d.className))&&(h=d.querySelector(this._fileManager.queryString)),!h&&d.nodeName&&this._fileManager.regExp.test(d.nodeName)&&(h=d),h&&(v=this._fileManager.pluginMap[h.nodeName.toLowerCase()],v)?{target:h,component:a.getParentElement(h,a.isComponent),pluginName:v}:null},selectComponent:function(d,h){if(a.isUneditableComponent(a.getParentElement(d,a.isComponent))||a.isUneditableComponent(d))return!1;this.hasFocus||this.focus();const v=this.plugins[h];v&&c.setTimeout((function(){typeof v.select=="function"&&this.callPlugin(h,v.select.bind(this,d),null),this._setComponentLineBreaker(d)}).bind(this))},_setComponentLineBreaker:function(d){this._lineBreaker.style.display="none";const h=a.getParentElement(d,a.isComponent);if(!h)return;const v=t.element.lineBreaker_t.style,x=t.element.lineBreaker_b.style,g=this.context.resizing.resizeContainer.style.display==="block"?this.context.resizing.resizeContainer:d,b=a.isListCell(h.parentNode);let w,k,N;(b?!h.previousSibling||a.isComponent(h.previousElementSibling):!a.isFormatElement(h.previousElementSibling))?(this._variable._lineBreakComp=h,k=t.element.wysiwyg.scrollTop,w=a.getOffset(d,t.element.wysiwygFrame).top+k,N=g.offsetWidth/2/2,v.top=w-k-12+"px",v.left=a.getOffset(g).left+N+"px",v.display="block"):v.display="none",(b?!h.nextSibling||a.isComponent(h.nextElementSibling):!a.isFormatElement(h.nextElementSibling))?(w||(this._variable._lineBreakComp=h,k=t.element.wysiwyg.scrollTop,w=a.getOffset(d,t.element.wysiwygFrame).top+k,N=g.offsetWidth/2/2),x.top=w+g.offsetHeight-k-12+"px",x.left=a.getOffset(g).left+g.offsetWidth-N-24+"px",x.display="block"):x.display="none"},_checkDuplicateNode:function(d,h){(function v(x){u._dupleCheck(x,h);const g=x.childNodes;for(let b=0,w=g.length;b<w;b++)v(g[b])})(d)},_dupleCheck:function(d,h){if(!a.isTextStyleElement(d))return;const v=(d.style.cssText.match(/[^;]+;/g)||[]).map(function(b){return b.trim()}),x=d.nodeName;if(/^span$/i.test(x)&&v.length===0)return d;let g=!1;return function b(w){if(!(a.isWysiwygDiv(w)||!a.isTextStyleElement(w))){if(w.nodeName===x){g=!0;const k=w.style.cssText.match(/[^;]+;/g)||[];for(let N=0,T=k.length,D;N<T;N++)(D=v.indexOf(k[N].trim()))>-1&&v.splice(D,1);for(let N=0,T=w.classList.length;N<T;N++)d.classList.remove(w.classList[N])}b(w.parentElement)}}(h),g&&((d.style.cssText=v.join(" "))||(d.setAttribute("style",""),d.removeAttribute("style")),d.attributes.length||d.setAttribute("data-se-duple","true")),d},insertNode:function(d,h,v){if(this.isReadOnly||v&&!this.checkCharCount(d,null))return null;let x=null,g=this.getRange(),b=a.isListCell(g.commonAncestorContainer)?g.commonAncestorContainer:a.getFormatElement(this.getSelectionNode(),null),w=a.isListCell(b)&&(a.isListCell(d)||a.isList(d)),k,N,T,D=null;const I=a.isFreeFormatElement(b),L=!I&&(a.isFormatElement(d)||a.isRangeFormatElement(d))||a.isComponent(d);if(w&&(T=h||a.isList(d)?b.lastChild:b.nextElementSibling,D=a.isList(d)?b:(T||b).parentNode),!h&&(L||a.isComponent(d)||a.isMedia(d))){const j=this.isEdgePoint(g.endContainer,g.endOffset,"end"),F=this.removeNode(),Y=F.container,q=Y===F.prevContainer&&g.collapsed?null:F.prevContainer;if(w&&q)if(D=q.nodeType===3?q.parentNode:q,D.contains(Y)){let G=!0;for(T=Y;T.parentNode&&T.parentNode!==D;)T=T.parentNode,G=!1;G&&Y===q&&(T=T.nextSibling)}else T=null;else if(w&&a.isListCell(Y)&&!b.parentElement)b=a.createElement("LI"),D.appendChild(b),Y.appendChild(D),T=null;else if(Y.nodeType===3||a.isBreak(Y)||w){const G=a.getParentElement(Y,(function($){return this.isRangeFormatElement($)||this.isListCell($)}).bind(a));if(h=a.splitElement(Y,F.offset,G?a.getElementDepth(G)+1:0),!h)a.isListCell(b)||(T=h=b);else if(w){if(b.contains(Y)){const $=a.isList(b.lastElementChild);let Z=null;j||(Z=b.cloneNode(!1),Z.appendChild(h.textContent.trim()?h:a.createTextNode(a.zeroWidthSpace))),$&&(Z||(Z=b.cloneNode(!1),Z.appendChild(a.createTextNode(a.zeroWidthSpace))),Z.appendChild(b.lastElementChild)),Z&&(b.parentNode.insertBefore(Z,b.nextElementSibling),T=h=Z)}}else h=h.previousSibling}}g=!h&&!L?this.getRange_addLine(this.getRange(),null):this.getRange();const R=g.commonAncestorContainer,P=g.startOffset,O=g.endOffset,U=g.startContainer===R&&a.isFormatElement(R),H=U&&(R.childNodes[P]||R.childNodes[0])||g.startContainer,B=U&&(R.childNodes[O]||R.childNodes[R.childNodes.length-1])||g.endContainer;if(!w)if(h)k=h.parentNode,h=h.nextSibling,N=!0;else if(k=H,H.nodeType===3&&(k=H.parentNode),g.collapsed)if(R.nodeType===3)R.textContent.length>O?h=R.splitText(O):h=R.nextSibling;else if(a.isBreak(k))h=k,k=k.parentNode;else{let j=k.childNodes[P];const F=j&&j.nodeType===3&&a.onlyZeroWidthSpace(j)&&a.isBreak(j.nextSibling)?j.nextSibling:j;F?!F.nextSibling&&a.isBreak(F)?(k.removeChild(F),h=null):h=a.isBreak(F)&&!a.isBreak(d)?F:F.nextSibling:h=null}else if(H===B){this.isEdgePoint(B,O)?h=B.nextSibling:h=B.splitText(O);let F=H;this.isEdgePoint(H,P)||(F=H.splitText(P)),k.removeChild(F),k.childNodes.length===0&&L&&(k.innerHTML="<br>")}else{const F=this.removeNode(),Y=F.container,q=F.prevContainer;if(Y&&Y.childNodes.length===0&&L&&(a.isFormatElement(Y)?Y.innerHTML="<br>":a.isRangeFormatElement(Y)&&(Y.innerHTML="<"+s.defaultTag+"><br></"+s.defaultTag+">")),a.isListCell(Y)&&d.nodeType===3)k=Y,h=null;else if(!L&&q)if(k=q.nodeType===3?q.parentNode:q,k.contains(Y)){let G=!0;for(h=Y;h.parentNode&&h.parentNode!==k;)h=h.parentNode,G=!1;G&&Y===q&&(h=h.nextSibling)}else h=null;else a.isWysiwygDiv(Y)&&!a.isFormatElement(d)?(k=Y.appendChild(a.createElement(s.defaultTag)),h=null):(h=L?B:Y===q?Y.nextSibling:Y,k=!h||!h.parentNode?R:h.parentNode);for(;h&&!a.isFormatElement(h)&&h.parentNode!==R;)h=h.parentNode}try{if(!w){if((a.isWysiwygDiv(h)||k===t.element.wysiwyg.parentNode)&&(k=t.element.wysiwyg,h=null),a.isFormatElement(d)||a.isRangeFormatElement(d)||!a.isListCell(k)&&a.isComponent(d)){const j=k;if(a.isList(h))k=h,h=null;else if(a.isListCell(h))k=h.previousElementSibling||h;else if(!N&&!h){const F=this.removeNode(),Y=F.container.nodeType===3?a.isListCell(a.getFormatElement(F.container,null))?F.container:a.getFormatElement(F.container,null)||F.container.parentNode:F.container,q=a.isWysiwygDiv(Y)||a.isRangeFormatElement(Y);k=q?Y:Y.parentNode,h=q?null:Y.nextSibling}j.childNodes.length===0&&k!==j&&a.removeItem(j)}if(L&&!I&&!a.isRangeFormatElement(k)&&!a.isListCell(k)&&!a.isWysiwygDiv(k)&&(h=k.nextElementSibling,k=k.parentNode),a.isWysiwygDiv(k)&&(d.nodeType===3||a.isBreak(d))){const j=a.createElement(s.defaultTag);j.appendChild(d),x=d,d=j}}if(w?D.parentNode?(k=D,h=T):(k=t.element.wysiwyg,h=null):h=k===h?k.lastChild:h,a.isListCell(d)&&!a.isList(k)){if(a.isListCell(k))h=k.nextElementSibling,k=k.parentNode;else{const j=a.createElement("ol");k.insertBefore(j,h),k=j,h=null}w=!0}if(this._checkDuplicateNode(d,k),k.insertBefore(d,h),w)if(a.onlyZeroWidthSpace(b.textContent.trim()))a.removeItem(b),d=d.lastChild;else{const j=a.getArrayItem(b.children,a.isList);j&&(d!==j?(d.appendChild(j),d=j.previousSibling):(k.appendChild(d),d=k),a.onlyZeroWidthSpace(b.textContent.trim())&&a.removeItem(b))}}catch(j){k.appendChild(d),console.warn("[SUNEDITOR.insertNode.warn] "+j)}finally{x&&(d=x);const j=k.querySelectorAll("[data-se-duple]");if(j.length>0)for(let F=0,Y=j.length,q,G,$,Z;F<Y;F++){for(q=j[F],$=q.childNodes,Z=q.parentNode;$[0];)G=$[0],Z.insertBefore(G,q);q===d&&(d=G),a.removeItem(q)}if((a.isFormatElement(d)||a.isComponent(d))&&H===B){const F=a.getFormatElement(R,null);F&&F.nodeType===1&&a.isEmptyLine(F)&&a.removeItem(F)}if(I&&(a.isFormatElement(d)||a.isRangeFormatElement(d))&&(d=this._setIntoFreeFormat(d)),!a.isComponent(d)){let F=1;if(d.nodeType===3)F=d.textContent.length,this.setRange(d,F,d,F);else if(!a.isBreak(d)&&!a.isListCell(d)&&a.isFormatElement(k)){let Y=null;(!d.previousSibling||a.isBreak(d.previousSibling))&&(Y=a.createTextNode(a.zeroWidthSpace),d.parentNode.insertBefore(Y,d)),(!d.nextSibling||a.isBreak(d.nextSibling))&&(Y=a.createTextNode(a.zeroWidthSpace),d.parentNode.insertBefore(Y,d.nextSibling)),a._isIgnoreNodeChange(d)&&(d=d.nextSibling,F=0)}this.setRange(d,F,d,F)}return d}},_setIntoFreeFormat:function(d){const h=d.parentNode;let v,x;for(;a.isFormatElement(d)||a.isRangeFormatElement(d);){for(v=d.childNodes,x=null;v[0];){if(x=v[0],a.isFormatElement(x)||a.isRangeFormatElement(x)){if(this._setIntoFreeFormat(x),!d.parentNode)break;v=d.childNodes;continue}h.insertBefore(x,d)}d.childNodes.length===0&&a.removeItem(d),d=a.createElement("BR"),h.insertBefore(d,x.nextSibling)}return d},removeNode:function(){this._resetRangeToTextNode();const d=this.getRange();if(d.startContainer===d.endContainer){const F=a.getParentElement(d.startContainer,a.isMediaComponent);if(F){const Y=a.createElement("BR"),q=a.createElement(s.defaultTag);return q.appendChild(Y),a.changeElement(F,q),u.setRange(q,0,q,0),this.history.push(!0),{container:q,offset:0,prevContainer:null}}}const h=d.startOffset===0,v=u.isEdgePoint(d.endContainer,d.endOffset,"end");let x=null,g=null,b=null;h&&(g=a.getFormatElement(d.startContainer),g&&(x=g.previousElementSibling,g=x)),v&&(b=a.getFormatElement(d.endContainer),b=b&&b.nextElementSibling);let w,k=0,N=d.startContainer,T=d.endContainer,D=d.startOffset,I=d.endOffset;const L=d.commonAncestorContainer.nodeType===3&&d.commonAncestorContainer.parentNode===N.parentNode?N.parentNode:d.commonAncestorContainer;if(L===N&&L===T&&(N=L.children[D],T=L.children[I],D=I=0),!N||!T)return{container:L,offset:0};if(N===T&&d.collapsed&&N.textContent&&a.onlyZeroWidthSpace(N.textContent.substr(D)))return{container:N,offset:D,prevContainer:N&&N.parentNode?N:null};let R=null,P=null;const O=a.getListChildNodes(L,null);let U=a.getArrayIndex(O,N),H=a.getArrayIndex(O,T);if(O.length>0&&U>-1&&H>-1){for(let F=U+1,Y=N;F>=0;F--)O[F]===Y.parentNode&&O[F].firstChild===Y&&D===0&&(U=F,Y=Y.parentNode);for(let F=H-1,Y=T;F>U;F--)O[F]===Y.parentNode&&O[F].nodeType===1&&(O.splice(F,1),Y=Y.parentNode,--H)}else{if(O.length===0){if(a.isFormatElement(L)||a.isRangeFormatElement(L)||a.isWysiwygDiv(L)||a.isBreak(L)||a.isMedia(L))return{container:L,offset:0};if(L.nodeType===3)return{container:L,offset:I};O.push(L),N=T=L}else if(N=T=O[0],a.isBreak(N)||a.onlyZeroWidthSpace(N))return{container:a.isMedia(L)?L:N,offset:0};U=H=0}for(let F=U;F<=H;F++){const Y=O[F];if(Y.length===0||Y.nodeType===3&&Y.data===void 0){this._nodeRemoveListItem(Y);continue}if(Y===N){if(N.nodeType===1){if(a.isComponent(N))continue;R=a.createTextNode(N.textContent)}else Y===T?(R=a.createTextNode(N.substringData(0,D)+T.substringData(I,T.length-I)),k=D):R=a.createTextNode(N.substringData(0,D));if(R.length>0?N.data=R.data:this._nodeRemoveListItem(N),Y===T)break;continue}if(Y===T){if(T.nodeType===1){if(a.isComponent(T))continue;P=a.createTextNode(T.textContent)}else P=a.createTextNode(T.substringData(I,T.length-I));P.length>0?T.data=P.data:this._nodeRemoveListItem(T);continue}this._nodeRemoveListItem(Y)}const B=a.getParentElement(T,"ul"),j=a.getParentElement(N,"li");if(B&&j&&j.contains(B)?(w=B.previousSibling,k=w.textContent.length):(w=T&&T.parentNode?T:N&&N.parentNode?N:d.endContainer||d.startContainer,k=!h&&!v?k:v?w.textContent.length:0),!a.isWysiwygDiv(w)&&w.childNodes.length===0){const F=a.removeItemAllParents(w,null,null);F&&(w=F.sc||F.ec||t.element.wysiwyg)}return!a.getFormatElement(w)&&!(N&&N.parentNode)&&(b?(w=b,k=0):g&&(w=g,k=1)),this.setRange(w,k,w,k),this.history.push(!0),{container:w,offset:k,prevContainer:x}},_nodeRemoveListItem:function(d){const h=a.getFormatElement(d,null);a.removeItem(d),a.isListCell(h)&&(a.removeItemAllParents(h,null,null),h&&a.isList(h.firstChild)&&h.insertBefore(a.createTextNode(a.zeroWidthSpace),h.firstChild))},applyRangeFormatElement:function(d){this.getRange_addLine(this.getRange(),null);const h=this.getSelectedElementsAndComponents(!1);if(!h||h.length===0)return;e:for(let I=0,L=h.length,R,P,O,U,H,B;I<L;I++)if(R=h[I],!!a.isListCell(R)&&(P=R.lastElementChild,P&&a.isListCell(R.nextElementSibling)&&h.indexOf(R.nextElementSibling)>-1&&(U=P.lastElementChild,h.indexOf(U)>-1))){let j=null;for(;j=U.lastElementChild;)if(a.isList(j))if(h.indexOf(j.lastElementChild)>-1)U=j.lastElementChild;else continue e;O=P.firstElementChild,H=h.indexOf(O),B=h.indexOf(U),h.splice(H,B-H+1),L=h.length;continue}let v=h[h.length-1],x,g,b;a.isRangeFormatElement(v)||a.isFormatElement(v)?x=v:x=a.getRangeFormatElement(v,null)||a.getFormatElement(v,null),a.isCell(x)?(g=null,b=x):(g=x.nextSibling,b=x.parentNode);let w=a.getElementDepth(x),k=null;const N=[],T=function(I,L,R){let P=null;if(I!==L&&!a.isTable(L)){if(L&&a.getElementDepth(I)===a.getElementDepth(L))return R;P=a.removeItemAllParents(L,null,I)}return P?P.ec:R};for(let I=0,L=h.length,R,P,O,U,H,B,j;I<L;I++)if(R=h[I],P=R.parentNode,!(!P||d.contains(P)))if(O=a.getElementDepth(R),a.isList(P)){if(k===null&&(B?(k=B,j=!0,B=null):k=P.cloneNode(!1)),N.push(R),H=h[I+1],I===L-1||H&&H.parentNode!==P){H&&R.contains(H.parentNode)&&(B=H.parentNode.cloneNode(!1));let F=P.parentNode,Y;for(;a.isList(F);)Y=a.createElement(F.nodeName),Y.appendChild(k),k=Y,F=F.parentNode;const q=this.detachRangeFormatElement(P,N,null,!0,!0);w>=O?(w=O,b=q.cc,g=T(b,P,q.ec),g&&(b=g.parentNode)):b===q.cc&&(g=q.ec),b!==q.cc&&(U=T(b,q.cc,U),U!==void 0?g=U:g=q.cc);for(let G=0,$=q.removeArray.length;G<$;G++)k.appendChild(q.removeArray[G]);j||d.appendChild(k),B&&q.removeArray[q.removeArray.length-1].appendChild(B),k=null,j=!1}}else w>=O&&(w=O,b=P,g=R.nextSibling),d.appendChild(R),b!==P&&(U=T(b,P),U!==void 0&&(g=U));if(this.effectNode=null,a.mergeSameTags(d,null,!1),a.mergeNestedTags(d,(function(I){return this.isList(I)}).bind(a)),g&&a.getElementDepth(g)>0&&(a.isList(g.parentNode)||a.isList(g.parentNode.parentNode))){const I=a.getParentElement(g,(function(R){return this.isRangeFormatElement(R)&&!this.isList(R)}).bind(a)),L=a.splitElement(g,null,I?a.getElementDepth(I)+1:0);L.parentNode.insertBefore(d,L)}else b.insertBefore(d,g),T(d,g);const D=a.getEdgeChildNodes(d.firstElementChild,d.lastElementChild);h.length>1?this.setRange(D.sc,0,D.ec,D.ec.textContent.length):this.setRange(D.ec,D.ec.textContent.length,D.ec,D.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(d,h,v,x,g){const b=this.getRange();let w=b.startOffset,k=b.endOffset,N=a.getListChildNodes(d,function(q){return q.parentNode===d}),T=d.parentNode,D=null,I=null,L=d.cloneNode(!1);const R=[],P=a.isList(v);let O=!1,U=!1,H=!1;function B(q,G,$,Z){if(a.onlyZeroWidthSpace(G)&&(G.innerHTML=a.zeroWidthSpace,w=k=1),G.nodeType===3)return q.insertBefore(G,$),G;const ee=(H?G:Z).childNodes;let te=G.cloneNode(!1),se=null,ie=null;for(;ee[0];)ie=ee[0],a._notTextNode(ie)&&!a.isBreak(ie)&&!a.isListCell(te)?(te.childNodes.length>0&&(se||(se=te),q.insertBefore(te,$),te=G.cloneNode(!1)),q.insertBefore(ie,$),se||(se=ie)):te.appendChild(ie);if(te.childNodes.length>0){if(a.isListCell(q)&&a.isListCell(te)&&a.isList($))if(P){for(se=$;$;)te.appendChild($),$=$.nextSibling;q.parentNode.insertBefore(te,q.nextElementSibling)}else{const ae=Z.nextElementSibling,de=a.detachNestedList(Z,!1);if(d!==de||ae!==Z.nextElementSibling){const be=te.childNodes;for(;be[0];)Z.appendChild(be[0]);d=de,U=!0}}else q.insertBefore(te,$);se||(se=te)}return se}for(let q=0,G=N.length,$,Z,ee;q<G;q++)if($=N[q],!($.nodeType===3&&a.isList(L)))if(H=!1,x&&q===0&&(!h||h.length===G||h[0]===$?D=d.previousSibling:D=L),h&&(Z=h.indexOf($)),h&&Z===-1)L||(L=d.cloneNode(!1)),L.appendChild($);else{if(h&&(ee=h[Z+1]),L&&L.children.length>0&&(T.insertBefore(L,d),L=null),!P&&a.isListCell($))if(ee&&a.getElementDepth($)!==a.getElementDepth(ee)&&(a.isListCell(T)||a.getArrayItem($.children,a.isList,!1))){const te=$.nextElementSibling,se=a.detachNestedList($,!1);(d!==se||te!==$.nextElementSibling)&&(d=se,U=!0)}else{const te=$;$=a.createElement(x?te.nodeName:a.isList(d.parentNode)||a.isListCell(d.parentNode)?"LI":a.isCell(d.parentNode)?"DIV":s.defaultTag);const se=a.isListCell($),ie=te.childNodes;for(;ie[0]&&!(a.isList(ie[0])&&!se);)$.appendChild(ie[0]);a.copyFormatAttributes($,te),H=!0}else $=$.cloneNode(!1);if(!U&&(x?(R.push($),a.removeItem(N[q])):(v?(O||(T.insertBefore(v,d),O=!0),$=B(v,$,null,N[q])):$=B(T,$,d,N[q]),U||(h?(I=$,D||(D=$)):D||(D=I=$))),U)){U=H=!1,N=a.getListChildNodes(d,function(te){return te.parentNode===d}),L=d.cloneNode(!1),T=d.parentNode,q=-1,G=N.length;continue}}const j=d.parentNode;let F=d.nextSibling;L&&L.children.length>0&&j.insertBefore(L,F),v?D=v.previousSibling:D||(D=d.previousSibling),F=d.nextSibling!==L?d.nextSibling:L?L.nextSibling:null,d.children.length===0||d.textContent.length===0?a.removeItem(d):a.removeEmptyNode(d,null,!1);let Y=null;if(x)Y={cc:j,sc:D,so:w,ec:F,eo:k,removeArray:R};else{D||(D=I),I||(I=D);const q=a.getEdgeChildNodes(D,I.parentNode?D:I);Y={cc:(q.sc||q.ec).parentNode,sc:q.sc,so:w,ec:q.ec,eo:k,removeArray:null}}if(this.effectNode=null,g)return Y;!x&&Y&&(h?this.setRange(Y.sc,w,Y.ec,k):this.setRange(Y.sc,0,Y.sc,0)),this.history.push(!1)},detachList:function(d,h){let v={},x=!1,g=!1,b=null,w=null;const k=(function(N){return!this.isComponent(N)}).bind(a);for(let N=0,T=d.length,D,I,L,R;N<T;N++){if(L=N===T-1,I=a.getRangeFormatElement(d[N],k),R=a.isList(I),!D&&R)D=I,v={r:D,f:[a.getParentElement(d[N],"LI")]},N===0&&(x=!0);else if(D&&R)if(D!==I){const P=this.detachRangeFormatElement(v.f[0].parentNode,v.f,null,h,!0);I=d[N].parentNode,x&&(b=P.sc,x=!1),L&&(w=P.ec),R?(D=I,v={r:D,f:[a.getParentElement(d[N],"LI")]},L&&(g=!0)):D=null}else v.f.push(a.getParentElement(d[N],"LI")),L&&(g=!0);if(L&&a.isList(D)){const P=this.detachRangeFormatElement(v.f[0].parentNode,v.f,null,h,!0);(g||T===1)&&(w=P.ec),x&&(b=P.sc||w)}}return{sc:b,ec:w}},nodeChange:function(d,h,v,x){this._resetRangeToTextNode();let g=this.getRange_addLine(this.getRange(),null);h=h&&h.length>0?h:!1,v=v&&v.length>0?v:!1;const b=!d,w=b&&!v&&!h;let k=g.startContainer,N=g.startOffset,T=g.endContainer,D=g.endOffset;if(w&&g.collapsed&&a.isFormatElement(k.parentNode)||k===T&&k.nodeType===1&&a.isNonEditable(k)){const ie=k.parentNode;if(!a.isListCell(ie)||!a.getValues(ie.style).some((function(ae){return this._listKebab.indexOf(ae)>-1}).bind(this)))return}if(g.collapsed&&!w&&k.nodeType===1&&!a.isBreak(k)&&!a.isComponent(k)){let ie=null;const ae=k.childNodes[N];ae&&(ae.nextSibling?ie=a.isBreak(ae)?ae:ae.nextSibling:ie=null);const de=a.createTextNode(a.zeroWidthSpace);k.insertBefore(de,ie),this.setRange(de,1,de,1),g=this.getRange(),k=g.startContainer,N=g.startOffset,T=g.endContainer,D=g.endOffset}a.isFormatElement(k)&&(k=k.childNodes[N]||k.firstChild,N=0),a.isFormatElement(T)&&(T=T.childNodes[D]||T.lastChild,D=T.textContent.length),b&&(d=a.createElement("DIV"));const I=c.RegExp,L=d.nodeName;if(!w&&k===T&&!v&&d){let ie=k,ae=0;const de=[],be=d.style;for(let pe=0,Se=be.length;pe<Se;pe++)de.push(be[pe]);const ce=d.classList;for(let pe=0,Se=ce.length;pe<Se;pe++)de.push("."+ce[pe]);if(de.length>0){for(;!a.isFormatElement(ie)&&!a.isWysiwygDiv(ie);){for(let pe=0;pe<de.length;pe++)if(ie.nodeType===1){const Se=de[pe],Re=/^\./.test(Se)?new I("\\s*"+Se.replace(/^\./,"")+"(\\s+|$)","ig"):!1,Fe=b?!!ie.style[Se]:!!ie.style[Se]&&!!d.style[Se]&&ie.style[Se]===d.style[Se],Ie=Re===!1?!1:b?!!ie.className.match(Re):!!ie.className.match(Re)&&!!d.className.match(Re);(Fe||Ie)&&ae++}ie=ie.parentNode}if(ae>=de.length)return}}let R={},P={},O,U="",H="",B="";if(h){for(let ie=0,ae=h.length,de;ie<ae;ie++)de=h[ie],/^\./.test(de)?H+=(H?"|":"\\s*(?:")+de.replace(/^\./,""):U+=(U?"|":"(?:;|^|\\s)(?:")+de;U&&(U+=")\\s*:[^;]*\\s*(?:;|$)",U=new I(U,"ig")),H&&(H+=")(?=\\s+|$)",H=new I(H,"ig"))}if(v){B="^(?:"+v[0];for(let ie=1;ie<v.length;ie++)B+="|"+v[ie];B+=")$",B=new I(B,"i")}const j=c.Boolean,F={v:!1},Y=function(ie){const ae=ie.cloneNode(!1);if(ae.nodeType===3||a.isBreak(ae))return ae;if(w)return null;const de=!B&&b||B&&B.test(ae.nodeName);if(de&&!x)return F.v=!0,null;const be=ae.style.cssText;let ce="";U&&be.length>0&&(ce=be.replace(U,"").trim(),ce!==be&&(F.v=!0));const pe=ae.className;let Se="";return H&&pe.length>0&&(Se=pe.replace(H,"").trim(),Se!==pe&&(F.v=!0)),b&&(H||!pe)&&(U||!be)&&!ce&&!Se&&de?(F.v=!0,null):ce||Se||ae.nodeName!==L||j(U)!==j(be)||j(H)!==j(pe)?(U&&be.length>0&&(ae.style.cssText=ce),ae.style.cssText||ae.removeAttribute("style"),H&&pe.length>0&&(ae.className=Se.trim()),ae.className.trim()||ae.removeAttribute("class"),!ae.style.cssText&&!ae.className&&(ae.nodeName===L||de)?(F.v=!0,null):ae):(F.v=!0,null)},q=this.getSelectedElements(null);g=this.getRange(),k=g.startContainer,N=g.startOffset,T=g.endContainer,D=g.endOffset,a.getFormatElement(k,null)||(k=a.getChildElement(q[0],function(ie){return ie.nodeType===3},!1),N=0),a.getFormatElement(T,null)||(T=a.getChildElement(q[q.length-1],function(ie){return ie.nodeType===3},!1),D=T.textContent.length);const G=a.getFormatElement(k,null)===a.getFormatElement(T,null),$=q.length-(G?0:1);O=d.cloneNode(!1);const Z=w||b&&function(ie){for(let ae=0,de=ie.length;ae<de;ae++)if(a._isMaintainedNode(ie[ae])||a._isSizeNode(ie[ae]))return!0;return!1}(v),ee=b||a._isSizeNode(O),te=this._util_getMaintainedNode.bind(a,Z,ee),se=this._util_isMaintainedNode.bind(a,Z,ee);if(G){this._resetCommonListCell(q[0],h)&&(g=this.setRange(k,N,T,D));const ie=this._nodeChange_oneLine(q[0],O,Y,k,N,T,D,w,b,g.collapsed,F,te,se);R.container=ie.startContainer,R.offset=ie.startOffset,P.container=ie.endContainer,P.offset=ie.endOffset,R.container===P.container&&a.onlyZeroWidthSpace(R.container)&&(R.offset=P.offset=1),this._setCommonListStyle(ie.ancestor,null)}else{let ie=!1;$>0&&this._resetCommonListCell(q[$],h)&&(ie=!0),this._resetCommonListCell(q[0],h)&&(ie=!0),ie&&this.setRange(k,N,T,D),$>0&&(O=d.cloneNode(!1),P=this._nodeChange_endLine(q[$],O,Y,T,D,w,b,F,te,se));for(let ae=$-1,de;ae>0;ae--)this._resetCommonListCell(q[ae],h),O=d.cloneNode(!1),de=this._nodeChange_middleLine(q[ae],O,Y,w,b,F,P.container),de.endContainer&&de.ancestor.contains(de.endContainer)&&(P.ancestor=null,P.container=de.endContainer),this._setCommonListStyle(de.ancestor,null);O=d.cloneNode(!1),R=this._nodeChange_startLine(q[0],O,Y,k,N,w,b,F,te,se,P.container),R.endContainer&&(P.ancestor=null,P.container=R.endContainer),$<=0?P=R:P.container||(P.ancestor=null,P.container=R.container,P.offset=R.container.textContent.length),this._setCommonListStyle(R.ancestor,null),this._setCommonListStyle(P.ancestor||a.getFormatElement(P.container),null)}this.controllersOff(),this.setRange(R.container,R.offset,P.container,P.offset),this.history.push(!1)},_resetCommonListCell:function(d,h){if(!a.isListCell(d))return;h||(h=this._listKebab);const v=a.getArrayItem(d.childNodes,function(I){return!a.isBreak(I)},!0),x=d.style,g=[],b=[],w=a.getValues(x);for(let I=0,L=this._listKebab.length;I<L;I++)w.indexOf(this._listKebab[I])>-1&&h.indexOf(this._listKebab[I])>-1&&(g.push(this._listCamel[I]),b.push(this._listKebab[I]));if(!g.length)return;const k=a.createElement("SPAN");for(let I=0,L=g.length;I<L;I++)k.style[g[I]]=x[b[I]],x.removeProperty(b[I]);let N=k.cloneNode(!1),T=null,D=!1;for(let I=0,L=v.length,R,P;I<L;I++)R=v[I],!s._textTagsMap[R.nodeName.toLowerCase()]&&(P=a.getValues(R.style),P.length===0||g.some(function(O){return P.indexOf(O)===-1})&&P.some(function(O){})?(T=R.nextSibling,N.appendChild(R)):N.childNodes.length>0&&(d.insertBefore(N,T),N=k.cloneNode(!1),T=null,D=!0));return N.childNodes.length>0&&(d.insertBefore(N,T),D=!0),x.length||d.removeAttribute("style"),D},_setCommonListStyle:function(d,h){if(!a.isListCell(d))return;const v=a.getArrayItem((h||d).childNodes,function(N){return!a.isBreak(N)},!0);if(h=v[0],!h||v.length>1||h.nodeType!==1)return;const x=h.style,g=d.style,b=h.nodeName.toLowerCase();let w=!1;s._textTagsMap[b]===s._defaultCommand.bold.toLowerCase()&&(g.fontWeight="bold"),s._textTagsMap[b]===s._defaultCommand.italic.toLowerCase()&&(g.fontStyle="italic");const k=a.getValues(x);if(k.length>0)for(let N=0,T=this._listCamel.length;N<T;N++)k.indexOf(this._listKebab[N])>-1&&(g[this._listCamel[N]]=x[this._listCamel[N]],x.removeProperty(this._listKebab[N]),w=!0);if(this._setCommonListStyle(d,h),!!w&&!x.length){const N=h.childNodes,T=h.parentNode,D=h.nextSibling;for(;N.length>0;)T.insertBefore(N[0],D);a.removeItem(h)}},_stripRemoveNode:function(d){const h=d.parentNode;if(!d||d.nodeType===3||!h)return;const v=d.childNodes;for(;v[0];)h.insertBefore(v[0],d);h.removeChild(d)},_util_getMaintainedNode:function(d,h,v){return!v||d?null:this.getParentElement(v,this._isMaintainedNode.bind(this))||(h?null:this.getParentElement(v,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(d,h,v){if(!v||d||v.nodeType!==1)return!1;const x=this._isMaintainedNode(v);return this.getParentElement(v,this._isMaintainedNode.bind(this))?x:x||(h?!1:this._isSizeNode(v))},_nodeChange_oneLine:function(d,h,v,x,g,b,w,k,N,T,D,I,L){let R=x.parentNode;for(;!R.nextSibling&&!R.previousSibling&&!a.isFormatElement(R.parentNode)&&!a.isWysiwygDiv(R.parentNode)&&R.nodeName!==h.nodeName;)R=R.parentNode;if(!N&&R===b.parentNode&&R.nodeName===h.nodeName&&a.onlyZeroWidthSpace(x.textContent.slice(0,g))&&a.onlyZeroWidthSpace(b.textContent.slice(w))){const Ie=R.childNodes;let Xe=!0;for(let X=0,re=Ie.length,oe,xe,ve,ue;X<re;X++){if(oe=Ie[X],ue=!a.onlyZeroWidthSpace(oe),oe===x){xe=!0;continue}if(oe===b){ve=!0;continue}if(!xe&&ue||xe&&ve&&ue){Xe=!1;break}}if(Xe)return a.copyTagAttributes(R,h),{ancestor:d,startContainer:x,startOffset:g,endContainer:b,endOffset:w}}D.v=!1;const P=d,O=[h],U=d.cloneNode(!1),H=x===b;let B=x,j=g,F=b,Y=w,q=!1,G=!1,$,Z,ee,te,se;const ie=c.RegExp;function ae(Ie){const Xe=new ie("(?:;|^|\\s)(?:"+te+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let X="";return Xe&&Ie.style.cssText.length>0&&(X=Xe.test(Ie.style.cssText)),!X}if(function Ie(Xe,X){const re=Xe.childNodes;for(let oe=0,xe=re.length,ve;oe<xe;oe++){let ue=re[oe];if(!ue)continue;let fe=X,De;if(!q&&ue===B){let he=U;se=I(ue);const Oe=a.createTextNode(B.nodeType===1?"":B.substringData(0,j)),Ve=a.createTextNode(B.nodeType===1?"":B.substringData(j,H&&Y>=j?Y-j:B.data.length-j));if(se){const nt=I(X);if(nt&&nt.parentNode!==he){let ft=nt,bt=null;for(;ft.parentNode!==he;){for(X=bt=ft.parentNode.cloneNode(!1);ft.childNodes[0];)bt.appendChild(ft.childNodes[0]);ft.appendChild(bt),ft=ft.parentNode}ft.parentNode.appendChild(nt)}se=se.cloneNode(!1)}a.onlyZeroWidthSpace(Oe)||X.appendChild(Oe);const We=I(X);for(We&&(se=We),se&&(he=se),Z=ue,$=[],te="";Z!==he&&Z!==P&&Z!==null;)ve=L(Z)?null:v(Z),ve&&Z.nodeType===1&&ae(Z)&&($.push(ve),te+=Z.style.cssText.substr(0,Z.style.cssText.indexOf(":"))+"|"),Z=Z.parentNode;const mt=$.pop()||Ve;for(ee=Z=mt;$.length>0;)Z=$.pop(),ee.appendChild(Z),ee=Z;if(h.appendChild(mt),he.appendChild(h),se&&!I(F)&&(h=h.cloneNode(!1),U.appendChild(h),O.push(h)),B=Ve,j=0,q=!0,Z!==Ve&&Z.appendChild(B),!H)continue}if(!G&&ue===F){se=I(ue);const he=a.createTextNode(F.nodeType===1?"":F.substringData(Y,F.length-Y)),Oe=a.createTextNode(H||F.nodeType===1?"":F.substringData(0,Y));if(se?se=se.cloneNode(!1):L(h.parentNode)&&!se&&(h=h.cloneNode(!1),U.appendChild(h),O.push(h)),!a.onlyZeroWidthSpace(he)){Z=ue,te="",$=[];const We=[];for(;Z!==U&&Z!==P&&Z!==null;)Z.nodeType===1&&ae(Z)&&(L(Z)?We.push(Z.cloneNode(!1)):$.push(Z.cloneNode(!1)),te+=Z.style.cssText.substr(0,Z.style.cssText.indexOf(":"))+"|"),Z=Z.parentNode;for($=$.concat(We),De=ee=Z=$.pop()||he;$.length>0;)Z=$.pop(),ee.appendChild(Z),ee=Z;U.appendChild(De),Z.textContent=he.data}if(se&&De){const We=I(De);We&&(se=We)}for(Z=ue,$=[],te="";Z!==U&&Z!==P&&Z!==null;)ve=L(Z)?null:v(Z),ve&&Z.nodeType===1&&ae(Z)&&($.push(ve),te+=Z.style.cssText.substr(0,Z.style.cssText.indexOf(":"))+"|"),Z=Z.parentNode;const Ve=$.pop()||Oe;for(ee=Z=Ve;$.length>0;)Z=$.pop(),ee.appendChild(Z),ee=Z;se?(h=h.cloneNode(!1),h.appendChild(Ve),se.insertBefore(h,se.firstChild),U.appendChild(se),O.push(h),se=null):h.appendChild(Ve),F=Oe,Y=Oe.data.length,G=!0,!k&&T&&(h=Oe,Oe.textContent=a.zeroWidthSpace),Z!==Oe&&Z.appendChild(F);continue}if(q){if(ue.nodeType===1&&!a.isBreak(ue)){a._isIgnoreNodeChange(ue)?(U.appendChild(ue.cloneNode(!0)),T||(h=h.cloneNode(!1),U.appendChild(h),O.push(h))):Ie(ue,ue);continue}Z=ue,$=[],te="";const he=[];for(;Z.parentNode!==null&&Z!==P&&Z!==h;)ve=G?Z.cloneNode(!1):v(Z),Z.nodeType===1&&!a.isBreak(ue)&&ve&&ae(Z)&&(L(Z)?se||he.push(ve):$.push(ve),te+=Z.style.cssText.substr(0,Z.style.cssText.indexOf(":"))+"|"),Z=Z.parentNode;$=$.concat(he);const Oe=$.pop()||ue;for(ee=Z=Oe;$.length>0;)Z=$.pop(),ee.appendChild(Z),ee=Z;if(L(h.parentNode)&&!L(Oe)&&!a.onlyZeroWidthSpace(h)&&(h=h.cloneNode(!1),U.appendChild(h),O.push(h)),!G&&!se&&L(Oe)){h=h.cloneNode(!1);const Ve=Oe.childNodes;for(let We=0,mt=Ve.length;We<mt;We++)h.appendChild(Ve[We]);Oe.appendChild(h),U.appendChild(Oe),O.push(h),h.children.length>0?X=Z:X=h}else Oe===ue?G?X=U:X=h:G?(U.appendChild(Oe),X=Z):(h.appendChild(Oe),X=Z);if(se&&ue.nodeType===3)if(I(ue)){const Ve=a.getParentElement(X,(function(We){return this._isMaintainedNode(We.parentNode)||We.parentNode===U}).bind(a));se.appendChild(Ve),h=Ve.cloneNode(!1),O.push(h),U.appendChild(h)}else se=null}De=ue.cloneNode(!1),X.appendChild(De),ue.nodeType===1&&!a.isBreak(ue)&&(fe=De),Ie(ue,fe)}}(d,U),N&&!k&&!D.v)return{ancestor:d,startContainer:x,startOffset:g,endContainer:b,endOffset:w};if(k=k&&N,k)for(let Ie=0;Ie<O.length;Ie++){let Xe=O[Ie],X,re,oe;if(T)X=a.createTextNode(a.zeroWidthSpace),U.replaceChild(X,Xe);else{const xe=Xe.childNodes;for(re=xe[0];xe[0];)oe=xe[0],U.insertBefore(oe,Xe);a.removeItem(Xe)}Ie===0&&(T?B=F=X:(B=re,F=oe))}else{if(N)for(let Ie=0;Ie<O.length;Ie++)this._stripRemoveNode(O[Ie]);T&&(B=F=h)}a.removeEmptyNode(U,h,!1),T&&(j=B.textContent.length,Y=F.textContent.length);const de=k||F.textContent.length===0;!a.isBreak(F)&&F.textContent.length===0&&(a.removeItem(F),F=B),Y=de?F.textContent.length:Y;const be={s:0,e:0},ce=a.getNodePath(B,U,be),pe=!F.parentNode;pe&&(F=B);const Se={s:0,e:0},Re=a.getNodePath(F,U,!pe&&!de?Se:null);j+=be.s,Y=T?j:pe?B.textContent.length:de?Y+be.s:Y+Se.s;const Fe=a.mergeSameTags(U,[ce,Re],!0);return d.parentNode.replaceChild(U,d),B=a.getNodeFromPath(ce,U),F=a.getNodeFromPath(Re,U),{ancestor:U,startContainer:B,startOffset:j+Fe[0],endContainer:F,endOffset:Y+Fe[1]}},_nodeChange_startLine:function(d,h,v,x,g,b,w,k,N,T,D){let I=x.parentNode;for(;!I.nextSibling&&!I.previousSibling&&!a.isFormatElement(I.parentNode)&&!a.isWysiwygDiv(I.parentNode)&&I.nodeName!==h.nodeName;)I=I.parentNode;if(!w&&I.nodeName===h.nodeName&&!a.isFormatElement(I)&&!I.nextSibling&&a.onlyZeroWidthSpace(x.textContent.slice(0,g))){let q=!0,G=x.previousSibling;for(;G;){if(!a.onlyZeroWidthSpace(G)){q=!1;break}G=G.previousSibling}if(q)return a.copyTagAttributes(I,h),{ancestor:d,container:x,offset:g}}k.v=!1;const L=d,R=[h],P=d.cloneNode(!1);let O=x,U=g,H=!1,B,j,F,Y;if(function q(G,$){const Z=G.childNodes;for(let ee=0,te=Z.length,se,ie;ee<te;ee++){const ae=Z[ee];if(!ae)continue;let de=$;if(H&&!a.isBreak(ae)){if(ae.nodeType===1){if(a._isIgnoreNodeChange(ae)){if(h=h.cloneNode(!1),ie=ae.cloneNode(!0),P.appendChild(ie),P.appendChild(h),R.push(h),D&&ae.contains(D)){const Se=a.getNodePath(D,ae);D=a.getNodeFromPath(Se,ie)}}else q(ae,ae);continue}j=ae,B=[];const be=[];for(;j.parentNode!==null&&j!==L&&j!==h;)se=v(j),j.nodeType===1&&se&&(T(j)?Y||be.push(se):B.push(se)),j=j.parentNode;B=B.concat(be);const ce=B.length>0,pe=B.pop()||ae;for(F=j=pe;B.length>0;)j=B.pop(),F.appendChild(j),F=j;if(T(h.parentNode)&&!T(pe)&&(h=h.cloneNode(!1),P.appendChild(h),R.push(h)),!Y&&T(pe)){h=h.cloneNode(!1);const Se=pe.childNodes;for(let Re=0,Fe=Se.length;Re<Fe;Re++)h.appendChild(Se[Re]);pe.appendChild(h),P.appendChild(pe),$=T(j)?h:j,R.push(h)}else ce?(h.appendChild(pe),$=j):$=h;if(Y&&ae.nodeType===3)if(N(ae)){const Se=a.getParentElement($,(function(Re){return this._isMaintainedNode(Re.parentNode)||Re.parentNode===P}).bind(a));Y.appendChild(Se),h=Se.cloneNode(!1),R.push(h),P.appendChild(h)}else Y=null}if(!H&&ae===O){let be=P;Y=N(ae);const ce=a.createTextNode(O.nodeType===1?"":O.substringData(0,U)),pe=a.createTextNode(O.nodeType===1?"":O.substringData(U,O.length-U));if(Y){const Fe=N($);if(Fe&&Fe.parentNode!==be){let Ie=Fe,Xe=null;for(;Ie.parentNode!==be;){for($=Xe=Ie.parentNode.cloneNode(!1);Ie.childNodes[0];)Xe.appendChild(Ie.childNodes[0]);Ie.appendChild(Xe),Ie=Ie.parentNode}Ie.parentNode.appendChild(Fe)}Y=Y.cloneNode(!1)}a.onlyZeroWidthSpace(ce)||$.appendChild(ce);const Se=N($);for(Se&&(Y=Se),Y&&(be=Y),j=$,B=[];j!==be&&j!==null;)se=v(j),j.nodeType===1&&se&&B.push(se),j=j.parentNode;const Re=B.pop()||$;for(F=j=Re;B.length>0;)j=B.pop(),F.appendChild(j),F=j;Re!==$?(h.appendChild(Re),$=j):$=h,a.isBreak(ae)&&h.appendChild(ae.cloneNode(!1)),be.appendChild(h),O=pe,U=0,H=!0,$.appendChild(O);continue}se=H?v(ae):ae.cloneNode(!1),se&&($.appendChild(se),ae.nodeType===1&&!a.isBreak(ae)&&(de=se)),q(ae,de)}}(d,P),w&&!b&&!k.v)return{ancestor:d,container:x,offset:g,endContainer:D};if(b=b&&w,b)for(let q=0;q<R.length;q++){let G=R[q];const $=G.childNodes,Z=$[0];for(;$[0];)P.insertBefore($[0],G);a.removeItem(G),q===0&&(O=Z)}else if(w){h=h.firstChild;for(let q=0;q<R.length;q++)this._stripRemoveNode(R[q])}if(!b&&P.childNodes.length===0)d.childNodes?O=d.childNodes[0]:(O=a.createTextNode(a.zeroWidthSpace),d.appendChild(O));else{a.removeEmptyNode(P,h,!1),a.onlyZeroWidthSpace(P.textContent)&&(O=P.firstChild,U=0);const q={s:0,e:0},G=a.getNodePath(O,P,q);U+=q.s;const $=a.mergeSameTags(P,[G],!0);d.parentNode.replaceChild(P,d),O=a.getNodeFromPath(G,P),U+=$[0]}return{ancestor:P,container:O,offset:U,endContainer:D}},_nodeChange_middleLine:function(d,h,v,x,g,b,w){if(!g){let D=null;w&&d.contains(w)&&(D=a.getNodePath(w,d));const I=d.cloneNode(!0),L=h.nodeName,R=h.style.cssText,P=h.className;let O=I.childNodes,U=0,H=O.length;for(let B;U<H&&(B=O[U],B.nodeType!==3);U++)if(B.nodeName===L)B.style.cssText+=R,a.addClass(B,P);else{if(!a.isBreak(B)&&a._isIgnoreNodeChange(B))continue;if(H===1){O=B.childNodes,H=O.length,U=-1;continue}else break}if(H>0&&U===H)return d.innerHTML=I.innerHTML,{ancestor:d,endContainer:D?a.getNodeFromPath(D,d):null}}b.v=!1;const k=d.cloneNode(!1),N=[h];let T=!0;if(function D(I,L){const R=I.childNodes;for(let P=0,O=R.length,U,H;P<O;P++){let B=R[P];if(!B)continue;let j=L;if(!a.isBreak(B)&&a._isIgnoreNodeChange(B)){if(h.childNodes.length>0&&(k.appendChild(h),h=h.cloneNode(!1)),H=B.cloneNode(!0),k.appendChild(H),k.appendChild(h),N.push(h),L=h,w&&B.contains(w)){const F=a.getNodePath(w,B);w=a.getNodeFromPath(F,H)}continue}else U=v(B),U&&(T=!1,L.appendChild(U),B.nodeType===1&&(j=U));a.isBreak(B)||D(B,j)}}(d,h),T||g&&!x&&!b.v)return{ancestor:d,endContainer:w};if(k.appendChild(h),x&&g)for(let D=0;D<N.length;D++){let I=N[D];const L=I.childNodes;for(;L[0];)k.insertBefore(L[0],I);a.removeItem(I)}else if(g){h=h.firstChild;for(let D=0;D<N.length;D++)this._stripRemoveNode(N[D])}return a.removeEmptyNode(k,h,!1),a.mergeSameTags(k,null,!0),d.parentNode.replaceChild(k,d),{ancestor:k,endContainer:w}},_nodeChange_endLine:function(d,h,v,x,g,b,w,k,N,T){let D=x.parentNode;for(;!D.nextSibling&&!D.previousSibling&&!a.isFormatElement(D.parentNode)&&!a.isWysiwygDiv(D.parentNode)&&D.nodeName!==h.nodeName;)D=D.parentNode;if(!w&&D.nodeName===h.nodeName&&!a.isFormatElement(D)&&!D.previousSibling&&a.onlyZeroWidthSpace(x.textContent.slice(g))){let Y=!0,q=x.nextSibling;for(;q;){if(!a.onlyZeroWidthSpace(q)){Y=!1;break}q=q.nextSibling}if(Y)return a.copyTagAttributes(D,h),{ancestor:d,container:x,offset:g}}k.v=!1;const I=d,L=[h],R=d.cloneNode(!1);let P=x,O=g,U=!1,H,B,j,F;if(function Y(q,G){const $=q.childNodes;for(let Z=$.length-1,ee;0<=Z;Z--){const te=$[Z];if(!te)continue;let se=G;if(U&&!a.isBreak(te)){if(te.nodeType===1){if(a._isIgnoreNodeChange(te)){h=h.cloneNode(!1);const be=te.cloneNode(!0);R.insertBefore(be,G),R.insertBefore(h,be),L.push(h)}else Y(te,te);continue}B=te,H=[];const ie=[];for(;B.parentNode!==null&&B!==I&&B!==h;)ee=v(B),ee&&B.nodeType===1&&(T(B)?F||ie.push(ee):H.push(ee)),B=B.parentNode;H=H.concat(ie);const ae=H.length>0,de=H.pop()||te;for(j=B=de;H.length>0;)B=H.pop(),j.appendChild(B),j=B;if(T(h.parentNode)&&!T(de)&&(h=h.cloneNode(!1),R.insertBefore(h,R.firstChild),L.push(h)),!F&&T(de)){h=h.cloneNode(!1);const be=de.childNodes;for(let ce=0,pe=be.length;ce<pe;ce++)h.appendChild(be[ce]);de.appendChild(h),R.insertBefore(de,R.firstChild),L.push(h),h.children.length>0?G=B:G=h}else ae?(h.insertBefore(de,h.firstChild),G=B):G=h;if(F&&te.nodeType===3)if(N(te)){const be=a.getParentElement(G,(function(ce){return this._isMaintainedNode(ce.parentNode)||ce.parentNode===R}).bind(a));F.appendChild(be),h=be.cloneNode(!1),L.push(h),R.insertBefore(h,R.firstChild)}else F=null}if(!U&&te===P){F=N(te);const ie=a.createTextNode(P.nodeType===1?"":P.substringData(O,P.length-O)),ae=a.createTextNode(P.nodeType===1?"":P.substringData(0,O));if(F){F=F.cloneNode(!1);const be=N(G);if(be&&be.parentNode!==R){let ce=be,pe=null;for(;ce.parentNode!==R;){for(G=pe=ce.parentNode.cloneNode(!1);ce.childNodes[0];)pe.appendChild(ce.childNodes[0]);ce.appendChild(pe),ce=ce.parentNode}ce.parentNode.insertBefore(be,ce.parentNode.firstChild)}F=F.cloneNode(!1)}else T(h.parentNode)&&!F&&(h=h.cloneNode(!1),R.appendChild(h),L.push(h));for(a.onlyZeroWidthSpace(ie)||G.insertBefore(ie,G.firstChild),B=G,H=[];B!==R&&B!==null;)ee=T(B)?null:v(B),ee&&B.nodeType===1&&H.push(ee),B=B.parentNode;const de=H.pop()||G;for(j=B=de;H.length>0;)B=H.pop(),j.appendChild(B),j=B;de!==G?(h.insertBefore(de,h.firstChild),G=B):G=h,a.isBreak(te)&&h.appendChild(te.cloneNode(!1)),F?(F.insertBefore(h,F.firstChild),R.insertBefore(F,R.firstChild),F=null):R.insertBefore(h,R.firstChild),P=ae,O=ae.data.length,U=!0,G.insertBefore(P,G.firstChild);continue}ee=U?v(te):te.cloneNode(!1),ee&&(G.insertBefore(ee,G.firstChild),te.nodeType===1&&!a.isBreak(te)&&(se=ee)),Y(te,se)}}(d,R),w&&!b&&!k.v)return{ancestor:d,container:x,offset:g};if(b=b&&w,b)for(let Y=0;Y<L.length;Y++){let q=L[Y];const G=q.childNodes;let $=null;for(;G[0];)$=G[0],R.insertBefore($,q);a.removeItem(q),Y===L.length-1&&(P=$,O=$.textContent.length)}else if(w){h=h.firstChild;for(let Y=0;Y<L.length;Y++)this._stripRemoveNode(L[Y])}if(!b&&R.childNodes.length===0)d.childNodes?P=d.childNodes[0]:(P=a.createTextNode(a.zeroWidthSpace),d.appendChild(P));else{if(!w&&h.textContent.length===0)return a.removeEmptyNode(R,null,!1),{ancestor:null,container:null,offset:0};a.removeEmptyNode(R,h,!1),a.onlyZeroWidthSpace(R.textContent)?(P=R.firstChild,O=P.textContent.length):a.onlyZeroWidthSpace(P)&&(P=h,O=1);const Y={s:0,e:0},q=a.getNodePath(P,R,Y);O+=Y.s;const G=a.mergeSameTags(R,[q],!0);d.parentNode.replaceChild(R,d),P=a.getNodeFromPath(q,R),O+=G[0]}return{ancestor:R,container:P,offset:P.nodeType===1&&O===1?P.childNodes.length:O}},actionCall:function(d,h,v){if(h){if(/more/i.test(h)){if(v!==this._moreLayerActiveButton){const x=t.element.toolbar.querySelector("."+d);x&&(this._moreLayerActiveButton&&this.moreLayerOff(),this._moreLayerActiveButton=v,x.style.display="block",m._showToolbarBalloon(),m._showToolbarInline()),a.addClass(v,"on")}else t.element.toolbar.querySelector("."+this._moreLayerActiveButton.getAttribute("data-command"))&&(this.moreLayerOff(),m._showToolbarBalloon(),m._showToolbarInline());return}if(/container/.test(h)&&(this._menuTray[d]===null||v!==this.containerActiveButton)){this.callPlugin(d,this.containerOn.bind(this,v),v);return}if(this.isReadOnly&&a.arrayIncludes(this.resizingDisabledButtons,v))return;if(/submenu/.test(h)&&(this._menuTray[d]===null||v!==this.submenuActiveButton)){this.callPlugin(d,this.submenuOn.bind(this,v),v);return}else if(/dialog/.test(h)){this.callPlugin(d,this.plugins[d].open.bind(this),v);return}else/command/.test(h)?this.callPlugin(d,this.plugins[d].action.bind(this),v):/fileBrowser/.test(h)&&this.callPlugin(d,this.plugins[d].open.bind(this,null),v)}else d&&this.commandHandler(v,d);/submenu/.test(h)?this.submenuOff():/command/.test(h)||(this.submenuOff(),this.containerOff())},commandHandler:function(d,h){if(!(u.isReadOnly&&!/copy|cut|selectAll|codeView|fullScreen|print|preview|showBlocks/.test(h)))switch(h){case"copy":case"cut":this.execCommand(h);break;case"paste":break;case"selectAll":this.containerOff();const v=t.element.wysiwyg;let x=a.getChildElement(v.firstChild,function(N){return N.childNodes.length===0||N.nodeType===3},!1)||v.firstChild,g=a.getChildElement(v.lastChild,function(N){return N.childNodes.length===0||N.nodeType===3},!0)||v.lastChild;if(!x||!g)return;if(a.isMedia(x)){const N=this.getFileComponent(x),T=a.createElement("BR"),D=a.createElement(s.defaultTag);D.appendChild(T),x=N?N.component:x,x.parentNode.insertBefore(D,x),x=T}if(a.isMedia(g)){const N=a.createElement("BR"),T=a.createElement(s.defaultTag);T.appendChild(N),v.appendChild(T),g=N}m._showToolbarBalloon(this.setRange(x,0,g,g.textContent.length));break;case"codeView":this.toggleCodeView();break;case"fullScreen":this.toggleFullScreen(d);break;case"indent":case"outdent":this.indent(h);break;case"undo":this.history.undo();break;case"redo":this.history.redo();break;case"removeFormat":this.removeFormat(),this.focus();break;case"print":this.print();break;case"preview":this.preview();break;case"showBlocks":this.toggleDisplayBlocks();break;case"dir":this.setDir(s.rtl?"ltr":"rtl");break;case"dir_ltr":this.setDir("ltr");break;case"dir_rtl":this.setDir("rtl");break;case"save":if(typeof s.callBackSave=="function")s.callBackSave(this.getContents(!1),this._variable.isChanged);else if(this._variable.isChanged&&typeof y.save=="function")y.save();else throw Error("[SUNEDITOR.core.commandHandler.fail] Please register call back function in creation option. (callBackSave : Function)");this._variable.isChanged=!1,t.tool.save&&t.tool.save.setAttribute("disabled",!0);break;default:h=s._defaultCommand[h.toLowerCase()]||h,this.commandMap[h]||(this.commandMap[h]=d);const b=this._variable.currentNodesMap,w=b.indexOf(h)>-1?null:a.createElement(h);let k=h;/^SUB$/i.test(h)&&b.indexOf("SUP")>-1?k="SUP":/^SUP$/i.test(h)&&b.indexOf("SUB")>-1&&(k="SUB"),this.nodeChange(w,this._commandMapStyles[h]||null,[k],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(d){const h=this.getRange(),v=this.getSelectedElements(null),x=[],g=d!=="indent",b=s.rtl?"marginRight":"marginLeft";let w=h.startContainer,k=h.endContainer,N=h.startOffset,T=h.endOffset;for(let D=0,I=v.length,L,R;D<I;D++)L=v[D],!a.isListCell(L)||!this.plugins.list?(R=/\d+/.test(L.style[b])?a.getNumber(L.style[b],0):0,g?R-=25:R+=25,a.setStyle(L,b,R<=0?"":R+"px")):(g||L.previousElementSibling)&&x.push(L);x.length>0&&this.plugins.list.editInsideList.call(this,g,x),this.effectNode=null,this.setRange(w,N,k,T),this.history.push(!1)},toggleDisplayBlocks:function(){const d=t.element.wysiwyg;a.toggleClass(d,"se-show-block"),a.hasClass(d,"se-show-block")?a.addClass(this._styleCommandMap.showBlocks,"active"):a.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const d=this._variable.isCodeView;this.controllersOff(),a.setDisabledButtons(!d,this.codeViewDisabledButtons),d?(a.isNonEditable(t.element.wysiwygFrame)||this._setCodeDataToEditor(),t.element.wysiwygFrame.scrollTop=0,t.element.code.style.display="none",t.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),s.height==="auto"&&!s.codeMirrorEditor&&(t.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(s.mode)&&(t.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,m._hideToolbar())),this.nativeFocus(),a.removeClass(this._styleCommandMap.codeView,"active"),a.isNonEditable(t.element.wysiwygFrame)||(this.history.push(!1),this.history._resetCachingButton())):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable.isFullScreen?t.element.code.style.height="100%":s.height==="auto"&&!s.codeMirrorEditor&&(t.element.code.style.height=t.element.code.scrollHeight>0?t.element.code.scrollHeight+"px":"auto"),s.codeMirrorEditor&&s.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(t.element._arrow.style.display="none",t.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,m._showToolbarInline())),this._variable._range=null,t.element.code.focus(),a.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),this.isReadOnly&&a.setDisabledButtons(!0,this.resizingDisabledButtons),typeof y.toggleCodeView=="function"&&y.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const d=this._getCodeView();if(s.fullPage){const h=this._parser.parseFromString(d,"text/html");if(!this.options.__allowedScriptTag){const g=h.head.children;for(let b=0,w=g.length;b<w;b++)/^script$/i.test(g[b].tagName)&&(h.head.removeChild(g[b]),b--,w--)}let v=h.head.innerHTML;(!h.head.querySelector('link[rel="stylesheet"]')||this.options.height==="auto"&&!h.head.querySelector("style"))&&(v+=a._setIframeCssTags(this.options)),this._wd.head.innerHTML=v,this._wd.body.innerHTML=this.convertContentsForEditor(h.body.innerHTML);const x=h.body.attributes;for(let g=0,b=x.length;g<b;g++)x[g].name!=="contenteditable"&&this._wd.body.setAttribute(x[g].name,x[g].value);if(!a.hasClass(this._wd.body,"sun-editor-editable")){const g=s._editableClass.split(" ");for(let b=0;b<g.length;b++)a.addClass(this._wd.body,s._editableClass[b])}}else t.element.wysiwyg.innerHTML=d.length>0?this.convertContentsForEditor(d):"<"+s.defaultTag+"><br></"+s.defaultTag+">"},_setEditorDataToCodeView:function(){const d=this.convertHTMLForCodeView(t.element.wysiwyg,!1);let h="";if(s.fullPage){const v=a.getAttributesToString(this._wd.body,null);h=`<!DOCTYPE html>
|
|
@@ -617,8 +617,8 @@ You can add a description to the \`${es}\` by passing a \`${Pb}\` component as a
|
|
|
617
617
|
|
|
618
618
|
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${es}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
619
619
|
|
|
620
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return C.useEffect(()=>{var i;document.getElementById((i=t.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(n)},[n,t]),null},jD=Eb,FD=Tb,HD=Nb,zb=Mb,jb=Ab,Fb=Ib,Hb=Bb,$b=Rb,Vb=Lb;const $D=jD,VD=FD,Wb=HD,md=C.forwardRef(({className:t,...n},r)=>p.jsx(zb,{className:Q("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n,ref:r}));md.displayName=zb.displayName;const Ub=C.forwardRef(({className:t,...n},r)=>p.jsxs(Wb,{children:[p.jsx(md,{}),p.jsx(jb,{ref:r,className:Q("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...n})]}));Ub.displayName=jb.displayName;const qb=({className:t,...n})=>p.jsx("div",{className:Q("flex flex-col space-y-2 text-center sm:text-left",t),...n});qb.displayName="AlertDialogHeader";const Yb=({className:t,...n})=>p.jsx("div",{className:Q("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...n});Yb.displayName="AlertDialogFooter";const Gb=C.forwardRef(({className:t,...n},r)=>p.jsx($b,{ref:r,className:Q("text-lg font-semibold",t),...n}));Gb.displayName=$b.displayName;const Zb=C.forwardRef(({className:t,...n},r)=>p.jsx(Vb,{ref:r,className:Q("text-sm text-muted-foreground",t),...n}));Zb.displayName=Vb.displayName;const Xb=C.forwardRef(({className:t,...n},r)=>p.jsx(Fb,{ref:r,className:Q(ts(),t),...n}));Xb.displayName=Fb.displayName;const Kb=C.forwardRef(({className:t,...n},r)=>p.jsx(Hb,{ref:r,className:Q(ts({variant:"outline"}),"mt-2 sm:mt-0",t),...n}));Kb.displayName=Hb.displayName;const pd=C.forwardRef(({className:t,containerClassName:n,...r},i)=>p.jsx("div",{className:Q("relative w-full overflow-auto",n),children:p.jsx("table",{ref:i,className:Q("w-full caption-bottom text-sm",t),...r})}));pd.displayName="Table";const gd=C.forwardRef(({className:t,...n},r)=>p.jsx("thead",{ref:r,className:Q("[&_tr]:border-b",t),...n}));gd.displayName="TableHeader";const vd=C.forwardRef(({className:t,...n},r)=>p.jsx("tbody",{ref:r,className:Q("[&_tr:last-child]:border-0",t),...n}));vd.displayName="TableBody";const Qb=C.forwardRef(({className:t,...n},r)=>p.jsx("tfoot",{ref:r,className:Q("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...n}));Qb.displayName="TableFooter";const Gi=C.forwardRef(({className:t,...n},r)=>p.jsx("tr",{ref:r,className:Q("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...n}));Gi.displayName="TableRow";const Zi=C.forwardRef(({className:t,...n},r)=>p.jsx("th",{ref:r,className:Q("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...n}));Zi.displayName="TableHead";const Gn=C.forwardRef(({className:t,...n},r)=>p.jsx("td",{ref:r,className:Q("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...n}));Gn.displayName="TableCell";const Jb=C.forwardRef(({className:t,...n},r)=>p.jsx("caption",{ref:r,className:Q("mt-4 text-sm text-muted-foreground",t),...n}));Jb.displayName="TableCaption";const bd=C.forwardRef(({options:t=[],value:n,onChange:r,onSearch:i,placeholder:s="Select...",searchPlaceholder:o="Search...",loading:l=!1,disabled:c=!1,multiple:a=!1,clearable:f=!0,className:u,renderOption:m,renderValue:y,getOptionLabel:_=N=>(N==null?void 0:N.label)||(N==null?void 0:N.name)||String(N),getOptionValue:S=N=>(N==null?void 0:N.value)||(N==null?void 0:N.id)||N,filterOption:E,onLoadMore:d,hasMore:h=!1,loadingMore:v=!1,noOptionsMessage:x="No options found",loadingMessage:g="Loading...",triggerClassName:b,...w},k)=>{const[N,T]=C.useState(!1),[D,I]=C.useState(""),[L,R]=C.useState(0),P=C.useRef(null),O=C.useRef(null),U=C.useMemo(()=>D?E?t.filter(ce=>E(ce,D)):t.filter(ce=>_(ce).toLowerCase().includes(D.toLowerCase())):t,[t,D,E,_]),H=C.useRef(null),[B,j]=C.useState(h),[F,Y]=C.useState(v);C.useEffect(()=>{j(h)},[h]),C.useEffect(()=>{Y(v)},[v]);const q=C.useCallback(ce=>{if(!d||F||!B)return;const{scrollTop:pe,scrollHeight:Se,clientHeight:Re}=ce.target;Se-pe-Re<50&&(Y(!0),d().finally(()=>Y(!1)))},[d,F,B]),G=C.useMemo(()=>P1(ce=>{i==null||i(ce)},300),[i]),$=ce=>{const pe=ce.target.value;I(pe),R(0),G(pe)},Z=ce=>{if(a){const pe=Array.isArray(n)?n:[],Se=S(ce);pe.some(Fe=>S(Fe)===Se)?r==null||r(pe.filter(Fe=>S(Fe)!==Se)):r==null||r([...pe,ce])}else r==null||r(ce),T(!1),I("")},ee=ce=>{ce.stopPropagation(),r==null||r(a?[]:null),I(""),i==null||i("")},te=()=>{if(!a)return;const ce=Array.isArray(n)?n:[];if(U.every(Se=>ce.some(Re=>S(Re)===S(Se)))){const Se=new Set(U.map(Re=>S(Re)));r==null||r(ce.filter(Re=>!Se.has(S(Re))))}else{const Se=U.filter(Re=>!ce.some(Fe=>S(Fe)===S(Re)));r==null||r([...ce,...Se])}},se=ce=>{if(!N){(ce.key==="Enter"||ce.key===" "||ce.key==="ArrowDown")&&(ce.preventDefault(),T(!0));return}switch(ce.key){case"ArrowDown":ce.preventDefault(),R(pe=>Math.min(pe+1,U.length-1));break;case"ArrowUp":ce.preventDefault(),R(pe=>Math.max(pe-1,0));break;case"Enter":ce.preventDefault(),U[L]&&Z(U[L]);break;case"Escape":ce.preventDefault(),T(!1),D&&(I(""),i==null||i(""));break}};C.useEffect(()=>{const ce=pe=>{P.current&&!P.current.contains(pe.target)&&(T(!1),D&&(I(""),i==null||i("")))};return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[]);const ie=ce=>a?(Array.isArray(n)?n:[]).some(Re=>(typeof Re=="object"&&Re!==null?S(Re):Re)===S(ce)):n?(typeof n=="object"&&n!==null?S(n):n)===S(ce):!1,ae=a?Array.isArray(n)&&n.length>0:!!n,de=(ce,pe)=>{if(ce.stopPropagation(),!a)return;const Se=Array.isArray(n)?n:[],Re=S(pe);r==null||r(Se.filter(Fe=>S(Fe)!==Re))},be=()=>{if(!ae)return p.jsx("span",{className:"text-muted-foreground",children:s});if(y)return y(n);if(a){const pe=Array.isArray(n)?n:[];return p.jsx("div",{className:"flex flex-wrap gap-1 max-h-20 overflow-y-auto overflow-x-hidden pr-1 scrollbar-thin",children:pe.map(Se=>{const Re=t.find(Ie=>{const Xe=S(Ie),X=typeof Se=="object"&&Se!==null?S(Se):Se;return Xe===X}),Fe=Re?_(Re):typeof Se=="object"&&Se!==null?_(Se):String(Se);return p.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-blue-500/10 text-blue-500 dark:bg-blue-500/20 dark:text-blue-400 rounded text-sm flex-shrink-0",children:[Fe,p.jsx(er,{className:"h-3 w-3 cursor-pointer hover:text-blue-600",onClick:Ie=>de(Ie,Se)})]},typeof Se=="object"?S(Se):Se)})})}const ce=t.find(pe=>{const Se=S(pe),Re=typeof n=="object"&&n!==null?S(n):n;return Se===Re});if(ce)return _(ce);if(typeof n=="object"&&n!==null){const pe=_(n);if(pe&&pe!=="[object Object]"&&pe!=="undefined")return pe}return typeof n=="string"||typeof n=="number"?String(n):p.jsx("span",{className:"text-muted-foreground",children:s})};return p.jsxs("div",{ref:P,className:Q("relative w-full",u),...w,children:[p.jsxs("button",{ref:k,type:"button",role:"combobox","aria-expanded":N,"aria-haspopup":"listbox",disabled:c,onClick:()=>T(!N),onKeyDown:se,className:Q("flex min-h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",N&&"ring-2 ring-offset-2",b),children:[p.jsx("span",{className:"flex-1 text-left truncate",children:be()}),p.jsxs("div",{className:"flex items-center gap-1",children:[f&&ae&&!c&&p.jsx(er,{className:"h-4 w-4 opacity-50 hover:opacity-100 cursor-pointer",onClick:ee}),p.jsx(Ma,{className:Q("h-4 w-4 opacity-50 transition-transform",N&&"rotate-180")})]})]}),N&&p.jsxs("div",{className:"absolute z-50 mt-1 w-full rounded-md border border-border bg-popover shadow-md animate-in fade-in-0 zoom-in-95",children:[p.jsxs("div",{className:"flex items-center border-b px-3",children:[p.jsx(S0,{className:"h-4 w-4 shrink-0 opacity-50"}),p.jsx("input",{ref:O,type:"text",value:D,onChange:$,placeholder:o,className:"flex h-10 w-full bg-transparent py-3 pl-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",autoFocus:!0}),l&&p.jsx(Jn,{className:"h-4 w-4 animate-spin"})]}),a&&U.length>0&&p.jsxs("div",{onClick:te,className:"flex items-center gap-2 px-3 py-2 border-b cursor-pointer hover:bg-accent text-sm font-medium select-none",children:[p.jsx("div",{className:Q("flex h-4 w-4 items-center justify-center rounded-sm border border-input",Array.isArray(n)&&U.every(ce=>n.some(pe=>S(pe)===S(ce)))&&"bg-primary text-primary-foreground"),children:Array.isArray(n)&&U.every(ce=>n.some(pe=>S(pe)===S(ce)))&&p.jsx(_i,{className:"h-3 w-3"})}),"Select all",D?" matches":""]}),p.jsx("div",{ref:H,onScroll:q,className:"max-h-60 overflow-auto p-1",children:l&&U.length===0?p.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:g}):U.length===0?p.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:x}):p.jsxs(p.Fragment,{children:[U.map((ce,pe)=>p.jsxs("div",{role:"option","aria-selected":ie(ce),onClick:()=>Z(ce),onMouseEnter:()=>R(pe),className:Q("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",L===pe&&"bg-accent",ie(ce)&&"bg-primary/10"),children:[a&&p.jsx("div",{className:Q("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-input",ie(ce)&&"bg-primary text-primary-foreground"),children:ie(ce)&&p.jsx(_i,{className:"h-3 w-3"})}),m?m(ce):p.jsx("span",{className:"flex-1",children:_(ce)}),!a&&ie(ce)&&p.jsx(_i,{className:"ml-auto h-4 w-4"})]},S(ce))),F&&p.jsxs("div",{className:"py-2 text-center text-sm text-muted-foreground flex items-center justify-center gap-2",children:[p.jsx(Jn,{className:"h-4 w-4 animate-spin"}),"Loading more..."]})]})})]})]})});bd.displayName="SearchSelect";function WD({className:t,...n}){return p.jsx("div",{"data-slot":"input-group",role:"group",className:Q("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",t),...n})}const UD=ps("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function Lh({className:t,align:n="inline-start",...r}){return p.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":n,className:Q(UD({align:n}),t),onClick:i=>{var s,o;i.target.closest("button")||(o=(s=i.currentTarget.parentElement)==null?void 0:s.querySelector("input"))==null||o.focus()},...r})}function Ih({className:t,...n}){return p.jsx(ni,{"data-slot":"input-group-control",className:Q("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",t),...n})}function qD(t,n){return t??n}function Nl({description:t,helpText:n,error:r,hideOnError:i,className:s}){const o=qD(t,n);return!o||i&&r?null:p.jsx("p",{className:Q("text-xs text-muted-foreground",s),children:o})}const mi=C.forwardRef(({className:t,label:n,description:r,helpText:i,error:s,required:o,children:l,labelClassName:c,descriptionClassName:a,errorClassName:f,...u},m)=>{const y=C.useId();return p.jsxs("div",{ref:m,className:Q("space-y-2",t),...u,children:[n&&p.jsxs(br,{className:Q(s&&"text-destructive","block mb-2",c),children:[n,o&&p.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),C.Children.map(l,_=>C.isValidElement(_)?C.cloneElement(_,{id:y,"aria-invalid":!!s,className:Q(_.props.className,s&&"border-destructive focus-visible:ring-destructive")}):_),p.jsx(Nl,{description:r,helpText:i,error:s,hideOnError:!0,className:Q("text-sm mt-1",a)}),s&&p.jsx("p",{className:Q("text-xs text-destructive mt-1",f),children:s})]})});mi.displayName="FormField";const _a=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,inputClassName:l,onChange:c,emitValue:a=!0,type:f,value:u,min:m=-1/0,max:y=1/0,step:_=1,disabled:S,allowNegative:E=!1,width:d="w-36",labelClassName:h,descriptionClassName:v,errorClassName:x,containerClassName:g,buttonClassName:b,icon:w,iconPosition:k="prefix",...N},T)=>{const D=P=>{if(f==="number"){const O=P.target.value;if(O===""){a?c==null||c(""):c==null||c(P);return}if(E){if(O==="-"&&m<0){a?c==null||c(O):c==null||c(P);return}}else if(!/^[0-9]*\.?[0-9]*$/.test(O))return;if(!(E?/^-?[0-9]*\.?[0-9]*$/:/^[0-9]*\.?[0-9]*$/).test(O))return;if(O.endsWith(".")){a?c==null||c(O):c==null||c(P);return}const H=Number(O);if(!isNaN(H)){if(!E&&H<0)return;a?c==null||c(H):c==null||c(P)}}else a?c==null||c(P.target.value):c==null||c(P)},I=P=>{var O;if(f==="number"){const U=P.target.value;if(U===""||U==="-"||U.endsWith(".")){let B=0;m!==-1/0&&m>0?B=m:E?m!==-1/0&&(B=m):B=m!==-1/0?Math.max(0,m):0,a?c==null||c(B):c==null||c(P);return}const H=Number(U);if(!isNaN(H)){let B=H;y!==1/0&&(B=Math.min(y,B)),m!==-1/0&&(B=Math.max(m,B)),!E&&B<0&&(B=0),a?c==null||c(B):c==null||c(P)}}(O=N.onBlur)==null||O.call(N,P)},L=P=>{let O;u===""||u===null||u===void 0?O=(!E&&m<0,Math.max(0,m)):O=Number(u),isNaN(O)&&(O=0);const U=O+P;if(!E&&U<0){a?c==null||c(0):c==null||c(e);return}let H=U;y!==1/0&&(H=Math.min(y,H)),m!==-1/0&&(H=Math.max(m,H)),!E&&H<0&&(H=0),a?c==null||c(H):c==null||c(e)},R=f==="number";return p.jsxs("div",{className:`flex flex-col gap-1 ${o||""}`,children:[t&&p.jsxs(br,{className:Q("text-sm font-medium",i?"text-destructive":"text-foreground"),children:[t,s&&p.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),p.jsx("div",{className:"relative",children:R?p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{type:"button",onClick:()=>L(-_),className:Q("h-10 w-10 flex items-center justify-center rounded-md border border-input bg-background text-foreground transition-colors",S?"opacity-50 cursor-not-allowed":"hover:bg-muted active:bg-muted/80 disabled:opacity-30 disabled:cursor-not-allowed"),disabled:S||m!==-1/0&&u!==""&&Number(u)<=m||!E&&Number(u||0)<=0,children:p.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 12H4"})})}),p.jsx("input",{ref:T,type:"text",inputMode:"numeric",value:u,onChange:D,onBlur:I,disabled:S,className:Q(`flex h-10 ${d} rounded-md border border-input bg-background px-3 py-2 text-sm text-center font-medium text-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,i&&"border-destructive focus-visible:ring-destructive",l),...N}),p.jsx("button",{type:"button",onClick:()=>L(_),className:Q("h-10 w-10 flex items-center justify-center rounded-md border border-input bg-background text-foreground transition-colors",S?"opacity-50 cursor-not-allowed":"hover:bg-muted active:bg-muted/80 disabled:opacity-30 disabled:cursor-not-allowed"),disabled:S||y!==1/0&&u!==""&&Number(u)>=y,children:p.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})})})]}):w?p.jsx(WD,{className:Q("h-10",i&&"border-destructive",g),children:k==="postfix"?p.jsxs(p.Fragment,{children:[p.jsx(Ih,{ref:T,type:f,value:u,onChange:D,disabled:S,"aria-invalid":!!i,className:l,...N}),p.jsx(Lh,{align:"inline-end",children:w})]}):p.jsxs(p.Fragment,{children:[p.jsx(Lh,{align:"inline-start",children:w}),p.jsx(Ih,{ref:T,type:f,value:u,onChange:D,disabled:S,"aria-invalid":!!i,className:l,...N})]})}):p.jsx(ni,{ref:T,type:f,value:u,onChange:D,disabled:S,className:Q(l,S&&"opacity-100 cursor-not-allowed bg-muted",i&&"border-destructive focus-visible:ring-destructive"),...N})}),p.jsx(Nl,{description:n,helpText:r,error:i,hideOnError:!0}),i&&p.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[p.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:p.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),i]})]})});_a.displayName="QInput";const yd=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,textareaClassName:l,onChange:c,emitValue:a=!0,labelClassName:f,descriptionClassName:u,errorClassName:m,...y},_)=>{const S=E=>{a?c==null||c(E.target.value):c==null||c(E)};return p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(k0,{ref:_,className:Q(i&&"border-destructive focus-visible:ring-destructive",l),onChange:S,...y})})});yd.displayName="QTextarea";const xd=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,options:o=[],placeholder:l="Select...",className:c,value:a,onChange:f,getOptionLabel:u,getOptionValue:m,optionLabel:y,optionValue:_,labelClassName:S,descriptionClassName:E,errorClassName:d,selectTriggerClassName:h,selectContentClassName:v,selectItemClassName:x,...g},b)=>{const w=u||(typeof y=="function"?y:y?N=>N==null?void 0:N[y]:N=>(N==null?void 0:N.label)||(N==null?void 0:N.name)||String(N)),k=m||(typeof _=="function"?_:_?N=>N==null?void 0:N[_]:N=>(N==null?void 0:N.value)||(N==null?void 0:N.id)||N);return p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:c,children:p.jsxs($0,{value:a,onValueChange:f,...g,children:[p.jsx(Ua,{ref:b,className:Q(i&&"border-destructive focus:ring-destructive"),children:p.jsx(V0,{placeholder:l})}),p.jsx(qa,{children:o.map(N=>p.jsx(Ya,{value:String(k(N)),children:w(N)},k(N)))})]})})});xd.displayName="QSelect";const ey=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,value:l,onChange:c,options:a=[],getOptionLabel:f,getOptionValue:u,optionLabel:m,optionValue:y,onSearch:_,labelClassName:S,descriptionClassName:E,errorClassName:d,searchSelectClassName:h,searchSelectTriggerClassName:v,multiple:x=!1,onLoadMore:g,hasMore:b=!1,loadingMore:w=!1,...k},N)=>{const T=C.useRef(new Map),D=f||(typeof m=="function"?m:m?P=>P==null?void 0:P[m]:P=>(P==null?void 0:P.label)||(P==null?void 0:P.name)||String(P)),I=u||(typeof y=="function"?y:y?P=>P==null?void 0:P[y]:P=>(P==null?void 0:P.value)||(P==null?void 0:P.id)||P);C.useEffect(()=>{a.forEach(P=>{if(P&&typeof P=="object"){const O=I(P);O!=null&&T.current.set(O,P)}})},[a,I]);const L=C.useMemo(()=>{if(l==null)return x?[]:null;const P=O=>{if(typeof O=="object"&&O!==null){const H=I(O);return H!=null&&T.current.set(H,O),O}const U=a.find(H=>I(H)===O);return U||T.current.get(O)||null};if(x){if(Array.isArray(l))return l.map(P).filter(Boolean);{const O=P(l);return O?[O]:[]}}else return typeof l=="object"&&l!==null?l:P(l)},[l,a,I,x]),R=P=>{if(x)if(!P||!Array.isArray(P)||P.length===0)c==null||c([]);else{const O=P.map(U=>{if(U==null)return null;const H=I(U);return H!=null&&typeof U=="object"&&T.current.set(H,U),H}).filter(U=>U!=null);c==null||c(O)}else if(P==null)c==null||c(null);else{const O=I(P);O!=null&&typeof P=="object"&&T.current.set(O,P),c==null||c(O)}};return p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(bd,{ref:N,value:L,onChange:R,options:a,getOptionLabel:D,getOptionValue:I,onSearch:_,multiple:x,className:Q(i&&"border-destructive"),onLoadMore:g,hasMore:b,loadingMore:w,triggerClassName:Q(i&&"border-destructive focus-visible:ring-destructive"),...k})})}),wd=C.forwardRef(({label:t,description:n,helpText:r,error:i,className:s,checked:o,onCheckedChange:l,onChange:c,labelClassName:a,descriptionClassName:f,errorClassName:u,switchClassName:m,switchThumbClassName:y,..._},S)=>{const E=C.useId(),d=h=>{c==null||c(h),l==null||l(h)};return p.jsxs("div",{className:Q("flex flex-col flex-start justify-between gap-3",s),children:[p.jsxs("div",{className:"space-y-0.5",children:[t&&p.jsx(br,{htmlFor:E,className:"text-sm font-medium cursor-pointer",children:t}),p.jsx(Nl,{description:n,helpText:r,className:f}),i&&p.jsx("p",{className:"text-xs text-destructive",children:i})]}),p.jsx(D0,{ref:S,id:E,checked:o,onCheckedChange:d,..._})]})});wd.displayName="QSwitch";const ty=C.forwardRef(({label:t,description:n,helpText:r,error:i,className:s,checked:o,onCheckedChange:l,labelClassName:c,descriptionClassName:a,errorClassName:f,checkboxClassName:u,...m},y)=>{const _=C.useId();return p.jsxs("div",{className:Q("flex items-start gap-2",s),children:[p.jsx(ss,{ref:y,id:_,checked:o,onCheckedChange:l,className:"mt-0.5",...m}),p.jsxs("div",{className:"space-y-0.5 leading-none",children:[t&&p.jsx(br,{htmlFor:_,className:"text-sm font-medium cursor-pointer",children:t}),p.jsx(Nl,{description:n,helpText:r,className:a}),i&&p.jsx("p",{className:"text-xs text-destructive",children:i})]})]})});ty.displayName="QCheckbox";const ny=C.forwardRef(({onSubmit:t,className:n,children:r,...i},s)=>{const o=l=>{l.preventDefault(),t==null||t(l)};return p.jsx("form",{ref:s,onSubmit:o,className:Q("space-y-4",n),...i,children:r})});ny.displayName="QForm";const ry=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,value:l,onChange:c,sendUTC:a=!1,placeholder:f="Pick a date",clearable:u=!0,...m},y)=>p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(_u,{ref:y,date:l,onDateChange:c,placeholder:f,clearable:u,sendUTC:a,...m})}));ry.displayName="QDatePicker";const iy=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,value:l,onChange:c,sendUTC:a=!1,placeholder:f="Pick a date range",clearable:u=!0,labelClassName:m,descriptionClassName:y,errorClassName:_,popoverContentClassName:S,showExtendedPresets:E=!1,presets:d,...h},v)=>p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(Su,{ref:v,dateRange:l,onDateRangeChange:c,placeholder:f,clearable:u,sendUTC:a,popoverContentClassName:S,showExtendedPresets:E,presets:d,...h})}));iy.displayName="QDateRangePicker";const sy=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,value:l,onChange:c,labelClassName:a,descriptionClassName:f,errorClassName:u,editorClassName:m,editorToolbarClassName:y,placeholder:_="Start writing...",height:S="200px",...E},d)=>p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(Xu,{ref:d,value:l,onChange:c,placeholder:_,height:S,...E})}));sy.displayName="QRichTextEditor";const Cd=({currentPage:t=1,totalPages:n=1,totalItems:r=0,pageSize:i=15,pageSizeOptions:s=[15,20,50,100],onPageChange:o,onPageSizeChange:l,showPageSizeSelector:c=!0,showInfo:a=!0,className:f})=>{const u=(t-1)*i+1,m=Math.min(t*i,r),y=t>1,_=t<n,S=()=>{const E=[];if(n<=5)for(let h=1;h<=n;h++)E.push(h);else{E.push(1),t>3&&E.push("...");const h=Math.max(2,t-1),v=Math.min(n-1,t+1);for(let x=h;x<=v;x++)E.push(x);t<n-2&&E.push("..."),n>1&&E.push(n)}return E};return p.jsxs("div",{className:Q("flex flex-col sm:flex-row items-center justify-between gap-4 px-2 py-4",f),children:[p.jsxs("div",{className:"flex items-center gap-4",children:[c&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"Rows per page"}),p.jsxs($0,{value:String(i),onValueChange:E=>l==null?void 0:l(Number(E)),children:[p.jsx(Ua,{className:"h-8 w-[70px] cursor-pointer",children:p.jsx(V0,{placeholder:i})}),p.jsx(qa,{side:"top",children:s.map(E=>p.jsx(Ya,{value:String(E),children:E},E))})]})]}),a&&r>0&&p.jsxs("span",{className:"text-sm text-muted-foreground",children:["Showing ",u," to ",m," of ",r," results"]})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsxs(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(1),disabled:!y,children:[p.jsx(W5,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"First page"})]}),p.jsxs(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(t-1),disabled:!y,children:[p.jsx(Ai,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Previous page"})]}),p.jsx("div",{className:"flex items-center gap-1",children:S().map((E,d)=>E==="..."?p.jsx("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${d}`):p.jsx(Ke,{variant:t===E?"default":"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(E),children:E},E))}),p.jsxs(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(t+1),disabled:!_,children:[p.jsx(In,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Next page"})]}),p.jsxs(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(n),disabled:!_,children:[p.jsx(U5,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Last page"})]})]})]})};Cd.displayName="Pagination";const Ml=({variant:t="spinner",size:n="default",text:r,className:i,fullScreen:s=!1,overlay:o=!1})=>{const l={sm:"h-4 w-4",default:"h-8 w-8",lg:"h-12 w-12",xl:"h-16 w-16"},c=Q("flex flex-col items-center justify-center gap-3",s&&"fixed inset-0 z-50",o&&"bg-background/80 backdrop-blur-sm",i),a=()=>{switch(t){case"spinner":return p.jsx(Jn,{className:Q("animate-spin text-primary",l[n])});case"dots":return p.jsx("div",{className:"flex gap-1",children:[0,1,2].map(f=>p.jsx("div",{className:Q("rounded-full bg-primary animate-bounce",n==="sm"&&"h-1.5 w-1.5",n==="default"&&"h-2 w-2",n==="lg"&&"h-3 w-3",n==="xl"&&"h-4 w-4"),style:{animationDelay:`${f*.15}s`}},f))});case"pulse":return p.jsx("div",{className:Q("rounded-full bg-primary animate-pulse",l[n])});case"skeleton":return p.jsxs("div",{className:"space-y-3 w-full max-w-sm",children:[p.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),p.jsx("div",{className:"h-4 bg-muted rounded animate-pulse w-3/4"}),p.jsx("div",{className:"h-4 bg-muted rounded animate-pulse w-1/2"})]});default:return p.jsx(Jn,{className:Q("animate-spin text-primary",l[n])})}};return p.jsxs("div",{className:c,children:[a(),r&&p.jsx("p",{className:"text-sm text-muted-foreground animate-pulse",children:r})]})};Ml.displayName="Loading";const _d=({loading:t,children:n,text:r,className:i})=>p.jsxs("div",{className:Q("relative",i),children:[n,t&&p.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-lg",children:p.jsx(Ml,{text:r})})]});_d.displayName="LoadingOverlay";const oy=C.forwardRef(({loading:t,loadingText:n,children:r,disabled:i,className:s,...o},l)=>p.jsx(Ke,{ref:l,disabled:i||t,className:s,...o,children:t?p.jsxs(p.Fragment,{children:[p.jsx(Jn,{className:"mr-2 h-4 w-4 animate-spin"}),n||"Loading..."]}):r}));oy.displayName="LoadingButton";const Ss=({icon:t=Qd,title:n="No data found",description:r="There are no items to display.",action:i,actionLabel:s,onAction:o,variant:l="default",className:c,children:a})=>{const f={default:{icon:Qd,title:"No data found",description:"There are no items to display."},search:{icon:S0,title:"No results found",description:"Try adjusting your search or filters to find what you're looking for."},empty:{icon:B1,title:"Get started",description:"Create your first item to get started."},error:{icon:na,title:"Something went wrong",description:"There was an error loading the data. Please try again."}},u=f[l]||f.default,m=t||u.icon,y=n||u.title,_=r||u.description;return p.jsxs("div",{className:Q("flex flex-col items-center justify-center py-12 px-4 text-center",c),children:[p.jsx("div",{className:"rounded-full bg-muted p-4 mb-4",children:p.jsx(m,{className:"h-8 w-8 text-muted-foreground"})}),p.jsx("h3",{className:"text-lg font-semibold mb-2",children:y}),p.jsx("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm",children:_}),a,(i||o)&&p.jsx(Ke,{onClick:o,className:"cursor-pointer",children:s||"Take Action"})]})};Ss.displayName="EmptyState";const Sd=({searchTerm:t,onClear:n,className:r})=>p.jsx(Ss,{variant:"search",title:`No results for "${t}"`,description:"Try searching with different keywords or check your filters.",className:r,children:n&&p.jsx(Ke,{variant:"outline",onClick:n,className:"cursor-pointer",children:"Clear Search"})});Sd.displayName="SearchEmptyState";const ay=({itemName:t="item",onCreate:n,className:r})=>p.jsx(Ss,{variant:"empty",icon:B1,title:`No ${t}s yet`,description:`Create your first ${t} to get started.`,onAction:n,actionLabel:`Create ${t}`,className:r});ay.displayName="CreateEmptyState";const ly=({error:t,onRetry:n,className:r})=>p.jsx(Ss,{variant:"error",title:"Error loading data",description:(t==null?void 0:t.message)||"Something went wrong. Please try again.",onAction:n,actionLabel:"Try Again",className:r});ly.displayName="ErrorState";const Al=({open:t,onOpenChange:n,onClose:r,title:i,description:s,children:o,footer:l,size:c="default",showClose:a=!0,className:f,...u})=>{const m={sm:"max-w-sm",default:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[95vw]"},y=_=>{n==null||n(_),_||r==null||r()};return p.jsx(Zp,{open:t,onOpenChange:y,...u,children:p.jsxs(J0,{className:Q(m[c],f),children:[(i||s)&&p.jsxs(eu,{children:[i&&p.jsx(tu,{className:"line-clamp-3 wrap-break-word",children:i}),s&&p.jsx(nu,{className:"line-clamp-3 wrap-break-word",children:s})]}),o,l&&p.jsx(Qa,{children:l})]})})};Al.displayName="Modal";const kd=({open:t,onOpenChange:n,onConfirm:r,onCancel:i,title:s="Are you sure?",description:o="This action cannot be undone.",confirmText:l="Confirm",cancelText:c="Cancel",variant:a="default",loading:f=!1,className:u})=>{const m=async()=>{await(r==null?void 0:r())},y=()=>{i==null||i(),n==null||n(!1)};return p.jsx(Al,{open:t,onOpenChange:n,title:s,description:o,size:"default",className:u,footer:p.jsxs("div",{className:"flex gap-2 justify-end",children:[p.jsx(Ke,{variant:"outline",onClick:y,disabled:f,className:"cursor-pointer",children:c}),p.jsx(Ke,{variant:a==="destructive"?"destructive":"default",onClick:m,disabled:f,className:"cursor-pointer",children:f?"Loading...":l})]})})};kd.displayName="ConfirmModal";const ms=({open:t,onOpenChange:n,onConfirm:r,title:i,description:s,itemName:o="item",loading:l=!1})=>p.jsx(kd,{open:t,onOpenChange:n,onConfirm:r,title:i||`Delete ${o}?`,description:s||`Are you sure you want to delete this ${o}? This action cannot be undone.`,confirmText:"Delete",variant:"destructive",loading:l});ms.displayName="DeleteConfirmModal";const cy=({open:t,onOpenChange:n,onSubmit:r,title:i,description:s,children:o,submitText:l="Save",cancelText:c="Cancel",loading:a=!1,size:f="default",className:u})=>{const m=async y=>{y==null||y.preventDefault(),await(r==null?void 0:r())};return p.jsx(Al,{open:t,onOpenChange:n,title:i,description:s,size:f,className:u,children:p.jsxs("form",{onSubmit:m,children:[p.jsx("div",{className:"py-4",children:o}),p.jsxs(Qa,{children:[p.jsx(Ke,{type:"button",variant:"outline",onClick:()=>n==null?void 0:n(!1),disabled:a,className:"cursor-pointer",children:c}),p.jsx(Ke,{type:"submit",disabled:a,className:"cursor-pointer",children:a?"Saving...":l})]})]})})};cy.displayName="FormModal";const f0={view:0,other:1,edit:2,delete:3},Oh=t=>{if(t.kind in f0)return t.kind;const n=typeof t.label=="string"?t.label.trim():"";return/^view( details?)?$/i.test(n)?"view":/^edit\b/i.test(n)?"edit":/^delete\b/i.test(n)||/^remove$/i.test(n)?"delete":"other"},uy=(t=[])=>[...t].sort((n,r)=>f0[Oh(n)]-f0[Oh(r)]),Bh=({text:t,maxLines:n=1,className:r,showTooltip:i=!0})=>{const s=C.useRef(null),[o,l]=C.useState(!1);C.useEffect(()=>{const f=()=>{if(!s.current)return;const u=s.current,m=u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth;l(m)};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[t,n]);const c=n===1?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{display:"-webkit-box",WebkitLineClamp:n,WebkitBoxOrient:"vertical",overflow:"hidden"},a=p.jsx("span",{ref:s,className:Q("block max-w-full",r),style:c,children:t});return!i||!o?a:p.jsxs(sl,{delayDuration:300,children:[p.jsx(ol,{asChild:!0,children:a}),p.jsx(uo,{side:"top",align:"start",className:"max-w-xs sm:max-w-sm md:max-w-md lg:max-w-lg break-words",children:p.jsx("p",{className:"text-sm",children:t})})]})},Ed=({data:t=[],columns:n=[],loading:r=!1,error:i=null,pagination:s=null,currentPage:o=1,pageSize:l=15,totalItems:c=0,totalPages:a=1,onPageChange:f,onPageSizeChange:u,sortable:m=!0,sortColumn:y=null,sortDirection:_=null,onSort:S,openInNewTab:E=!1,searchable:d=!0,searchValue:h="",onSearchChange:v,searchPlaceholder:x="Search...",filters:g,toolbarActions:b,selectable:w=!1,selectedRows:k=[],onSelectionChange:N,showBulkDelete:T=!1,onBulkDelete:D,bulkDeleteLabel:I="Delete selected",bulkDeleteLoading:L=!1,actions:R=[],onRowClick:P,striped:O=!1,hover:U=!0,compact:H=!1,className:B,emptyTitle:j="No data found",emptyDescription:F="There are no items to display.",emptyAction:Y,onEmptyAction:q,getRowKey:G=fe=>fe.id||fe._id,showSerialNumber:$=!0,serialNumberHeader:Z="SN",onViewClick:ee,onViewLink:te,onBeforeNavigate:se,clickableColumns:ie=[],enableTextClamping:ae=!0,defaultMaxLines:de=1,tableClassName:be,tableHeaderClassName:ce,tableBodyClassName:pe,tableRowClassName:Se,tableHeadClassName:Re,tableCellClassName:Fe,headerRowClassName:Ie,statusRowClassName:Xe,paginationClassName:X,stickyPagination:re=!1,stickyPaginationClassName:oe,stickyHeader:xe=!1,stickyHeaderClassName:ve,stickyHeaderOffset:ue})=>{const[fe,De]=C.useState(h),he=C.useRef(null),[Oe,Ve]=C.useState(!1),We=!r&&t.length>0&&s!==!1;C.useEffect(()=>{if(!re||!We){Ve(!1);return}const Ae=he.current;if(!Ae||typeof IntersectionObserver>"u")return;const ye=new IntersectionObserver(([Ce])=>Ve(Ce.intersectionRatio<1),{threshold:[1],rootMargin:"0px 0px -1px 0px"});return ye.observe(Ae),()=>ye.disconnect()},[re,We]);const mt=xe&&Q("sticky z-10 bg-muted shadow-[inset_0_-1px_0_0_var(--color-border)]",ve),nt=xe?{top:ue==null?"var(--rcu-header-offset, 0px)":typeof ue=="number"?`${ue}px`:ue}:void 0;C.useEffect(()=>{const Ae=setTimeout(()=>{v&&fe!==h&&v(fe)},300);return()=>clearTimeout(Ae)},[fe]);const ft=Ae=>{if(!m||!Ae.sortable)return;const ye=Ae.sortKey||Ae.accessor||Ae.key;let Ce="asc";y===ye&&(_==="asc"?Ce="desc":_==="desc"&&(Ce=null)),S==null||S(Ce?ye:null,Ce)},bt=t.map(G),xt=new Set(k),qe=bt.filter(Ae=>xt.has(Ae)).length,wt=bt.length>0&&qe===bt.length,yt=qe>0&&!wt,Ue=Ae=>{if(Ae===!0){const ye=new Set(k);bt.forEach(Ce=>ye.add(Ce)),N==null||N([...ye])}else{const ye=new Set(bt);N==null||N(k.filter(Ce=>!ye.has(Ce)))}},rt=(Ae,ye)=>{if(ye){if(xt.has(Ae))return;N==null||N([...k,Ae])}else N==null||N(k.filter(Ce=>Ce!==Ae))},He=Ae=>(o-1)*l+Ae+1,Ye=Ae=>{const ye=Ae.accessor||Ae.key||"";return ie.includes("*")?!0:ie.length>0?ie.includes(ye):ye==="name"||ye==="title"},ht=(Ae,ye)=>!(!ae||Ae.disableClamping||typeof ye!="string"||ye.length<30),ot=(Ae,ye,Ce)=>{const at=Ae.accessor||Ae.key,Je=at?typeof at=="function"?at(ye):ye[at]:void 0;if(Ae.render)return Ae.render(Je,ye,Ce);if(Ae.format)return Ae.format(Je,ye);if(Je!==null&&typeof Je=="object")return"-";if(Ye(Ae)&&(ee||te)&&Je){const Vn=typeof Je=="string"&&ht(Ae,Je)?p.jsx(Bh,{text:Je,maxLines:Ae.maxLines||de}):Je;if(te){const on=te(ye);return!E&&se?p.jsx("a",{href:on,onClick:Wn=>{Wn.preventDefault(),Wn.stopPropagation(),se(on)},className:"underline font-medium hover:font-bold flex items-center gap-2 cursor-pointer max-w-full text-left text-foreground",children:Vn}):p.jsx("a",{href:on,target:E?"_blank":"_self",rel:"noopener noreferrer",onClick:Wn=>Wn.stopPropagation(),className:"underline font-medium hover:font-bold flex items-center gap-2 cursor-pointer max-w-full text-left text-foreground",children:Vn})}return p.jsx("button",{onClick:on=>{on.stopPropagation(),ee(ye)},className:"underline font-medium hover:font-bold",children:Vn})}return typeof Je=="string"&&ht(Ae,Je)?p.jsx(Bh,{text:Je,maxLines:Ae.maxLines||de}):Je??"-"},kt=Ae=>{if(!m||!Ae.sortable)return null;const ye=Ae.sortKey||Ae.accessor||Ae.key;return y!==ye?p.jsx(Kd,{className:"ml-2 h-3.5 w-3.5 opacity-40 hover:opacity-100"}):_?_==="asc"?p.jsx($5,{className:"ml-2 h-3.5 w-3.5 text-primary"}):p.jsx(H5,{className:"ml-2 h-3.5 w-3.5 text-primary"}):p.jsx(Kd,{className:"ml-2 h-3.5 w-3.5 opacity-40"})},$n=Ae=>{if(!R||R.length===0)return null;const ye=uy(R).filter(Ce=>Ce.hidden?typeof Ce.hidden=="function"?!Ce.hidden(Ae):!Ce.hidden:!0);return ye.length===0?null:p.jsxs(_l,{children:[p.jsx(Sl,{asChild:!0,children:p.jsxs(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted cursor-pointer",children:[p.jsx(K5,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Open menu"})]})}),p.jsxs(So,{align:"end",className:"w-40",children:[p.jsx(kl,{className:"text-xs font-semibold text-muted-foreground",children:"Actions"}),p.jsx(fs,{}),ye.map((Ce,at)=>p.jsxs(ds,{onClick:()=>{var Je;return(Je=Ce.onClick)==null?void 0:Je.call(Ce,Ae)},className:Q("text-sm cursor-pointer",Ce.variant==="destructive"&&"text-red-600 focus:text-red-600 focus:bg-red-50"),disabled:Ce.disabled,children:[Ce.icon&&p.jsx(Ce.icon,{className:"mr-2 h-4 w-4"}),Ce.label]},Ce.label||at))]})]})},gn=()=>{const Ae=Math.min(l||8,10);return Array.from({length:Ae}).map((ye,Ce)=>p.jsxs(Gi,{className:Q("border-b border-border",Se),children:[w&&p.jsx(Gn,{className:Q("pl-4",Fe),children:p.jsx(Ps,{className:"h-4 w-4 rounded"})}),$&&p.jsx(Gn,{className:Q(H&&"py-2",Fe),children:p.jsx(Ps,{className:"h-4 w-6"})}),n.map((at,Je)=>p.jsx(Gn,{className:Q(H?"py-2":"py-3",Fe),children:p.jsx(Ps,{className:"h-4",style:{width:`${60+Je*17%40}%`}})},at.accessor||Je)),R&&R.length>0&&p.jsx(Gn,{className:Q("text-right pr-4",Fe),children:p.jsx(Ps,{className:"h-8 w-8 rounded-md ml-auto"})})]},`skeleton-${Ce}`))},vn=n.length+(w?1:0)+($?1:0)+(R!=null&&R.length?1:0);return p.jsx(cu,{children:p.jsxs("div",{className:Q("w-full space-y-4",B),children:[(d||k.length>0||g||b)&&p.jsxs("div",{className:"flex items-center justify-between gap-4",children:[p.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[d&&p.jsxs("div",{className:"relative w-80",children:[p.jsx(S0,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),p.jsx(ni,{placeholder:x,value:fe,onChange:Ae=>De(Ae.target.value),className:"pl-10 pr-10 h-10 border-gray-300"}),fe&&p.jsx("button",{onClick:()=>{De(""),v==null||v("")},className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors cursor-pointer",children:p.jsx(er,{className:"h-4 w-4"})})]}),g&&p.jsx("div",{className:"flex items-center gap-2",children:C.Children.map(g,Ae=>p.jsx("div",{className:"w-[200px]",children:Ae}))})]}),w&&k.length>0&&p.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-primary/10 border border-primary/20 rounded-md",children:[p.jsxs("span",{className:"text-sm font-medium",children:[k.length," selected"]}),T&&D&&p.jsxs(sl,{delayDuration:300,children:[p.jsx(ol,{asChild:!0,children:p.jsx(Ke,{variant:"ghost",size:"icon",onClick:()=>D(k),disabled:L,"aria-label":I,className:"h-7 w-7 text-red-600 hover:text-red-600 hover:bg-red-50 cursor-pointer",children:L?p.jsx(Jn,{className:"h-4 w-4 animate-spin"}):p.jsx(Aa,{className:"h-4 w-4"})})}),p.jsx(uo,{side:"top",children:I})]}),p.jsx(Ke,{variant:"ghost",size:"sm",onClick:()=>N==null?void 0:N([]),className:"h-7 text-xs text-primary hover:text-primary hover:bg-primary/10 cursor-pointer",children:"Clear"})]}),b&&p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:b})]}),p.jsx("div",{className:Q("bg-card rounded-lg border border-border shadow-sm",xe?"overflow-clip":"overflow-hidden"),children:p.jsxs(pd,{className:be,containerClassName:xe?"overflow-visible":void 0,children:[p.jsx(gd,{className:ce,children:p.jsxs(Gi,{className:Q("bg-muted border-b border-border dark:hover:bg-muted",Ie),children:[w&&p.jsx(Zi,{className:Q("w-12 pl-4",mt,Re),style:nt,children:p.jsx(ss,{checked:wt,indeterminate:yt,onCheckedChange:Ue,"aria-label":wt?"Deselect all rows":"Select all rows",className:"border-gray-300 cursor-pointer"})}),$&&p.jsx(Zi,{className:Q("w-16 text-xs font-semibold text-muted-foreground uppercase tracking-wider",mt,Re),style:nt,children:Z}),n.map((Ae,ye)=>p.jsx(Zi,{className:Q("text-xs font-semibold text-muted-foreground uppercase tracking-wider",Ae.headerClassName,m&&Ae.sortable&&"cursor-pointer select-none",mt,Re),style:{width:Ae.width,minWidth:Ae.minWidth,maxWidth:Ae.maxWidth,...nt},onClick:()=>ft(Ae),children:p.jsxs("div",{className:"flex items-center",children:[Ae.header||Ae.label,kt(Ae)]})},Ae.accessor||ye)),R&&R.length>0&&p.jsx(Zi,{className:Q("w-16 text-xs font-semibold text-gray-600 uppercase tracking-wider text-right pr-4",mt,Re),style:nt,children:"Actions"})]})}),p.jsx(vd,{className:pe,children:r?gn():t.length===0?p.jsx(Gi,{className:Q(Xe,Se),children:p.jsx(Gn,{colSpan:vn,className:Q("h-48",Fe),children:fe?p.jsx(Sd,{searchTerm:fe,onClear:()=>{De(""),v==null||v("")}}):p.jsx(Ss,{title:j,description:F,onAction:q,actionLabel:Y})})}):t.map((Ae,ye)=>{const Ce=G(Ae),at=xt.has(Ce);return p.jsxs(Gi,{"data-state":at?"selected":void 0,className:Q("border-b border-border transition-colors",O&&ye%2===1&&"bg-gray-50",P&&"cursor-pointer",U&&!P&&at&&"bg-primary/20",Se),onClick:()=>P==null?void 0:P(Ae),children:[w&&p.jsx(Gn,{onClick:Je=>Je.stopPropagation(),className:Q("pl-4",Fe),children:p.jsx(ss,{checked:at,onCheckedChange:Je=>rt(Ce,Je===!0),"aria-label":at?"Deselect row":"Select row",className:"border-gray-300 cursor-pointer"})}),$&&p.jsx(Gn,{className:Q("text-muted-foreground font-medium",H&&"py-2",Fe),children:He(ye)}),n.map((Je,Vn)=>p.jsx(Gn,{className:Q("text-foreground",H?"py-2":"py-3",Je.cellClassName,Fe),style:{maxWidth:Je.maxWidth||"300px",minWidth:Je.minWidth},children:ot(Je,Ae,ye)},Je.accessor||Vn)),R&&R.length>0&&p.jsx(Gn,{onClick:Je=>Je.stopPropagation(),className:Q("text-right pr-4",Fe),children:$n(Ae)})]},Ce)})})]})}),We&&p.jsx("div",{ref:he,className:Q(re&&["sticky bottom-0 z-20 bg-background rounded-b-lg",Oe&&"border-t border-border shadow-[0_-2px_6px_-2px_rgba(0,0,0,0.12)]"],oe),children:p.jsx(Cd,{currentPage:o,totalPages:a,totalItems:c,pageSize:l,onPageChange:f,onPageSizeChange:u,className:X})})]})})};Ed.displayName="DataTable";const YD=F3.create((t,n)=>({sidebarOpen:!0,sidebarCollapsed:!1,modals:{},toasts:[],theme:"light",globalLoading:!1,toggleSidebar:()=>{t(r=>({sidebarOpen:!r.sidebarOpen}))},setSidebarOpen:r=>{t({sidebarOpen:r})},toggleSidebarCollapse:()=>{t(r=>({sidebarCollapsed:!r.sidebarCollapsed}))},setSidebarCollapsed:r=>{t({sidebarCollapsed:r})},openModal:(r,i=null)=>{t(s=>({modals:{...s.modals,[r]:{isOpen:!0,data:i}}}))},closeModal:r=>{t(i=>({modals:{...i.modals,[r]:{isOpen:!1,data:null}}}))},getModalState:r=>n().modals[r]||{isOpen:!1,data:null},addToast:r=>{const i=Date.now(),s={id:i,...r};return t(o=>({toasts:[...o.toasts,s]})),r.duration!==0&&setTimeout(()=>{n().removeToast(i)},r.duration||5e3),i},removeToast:r=>{t(i=>({toasts:i.toasts.filter(s=>s.id!==r)}))},clearToasts:()=>{t({toasts:[]})},setTheme:r=>{t({theme:r}),document.documentElement.classList.toggle("dark",r==="dark"),localStorage.setItem("theme",r)},toggleTheme:()=>{const r=n().theme==="light"?"dark":"light";n().setTheme(r)},initTheme:()=>{const r=localStorage.getItem("theme"),i=window.matchMedia("(prefers-color-scheme: dark)").matches,s=r||(i?"dark":"light");n().setTheme(s)},setGlobalLoading:r=>{t({globalLoading:r})}}));function Dl(){const{addToast:t,removeToast:n,toasts:r,clearToasts:i}=YD(),s=V.useCallback(u=>t(u),[t]),o=V.useCallback((u,m={})=>t({type:"success",message:u,...m}),[t]),l=V.useCallback((u,m={})=>t({type:"error",message:u,...m}),[t]),c=V.useCallback((u,m={})=>t({type:"warning",message:u,...m}),[t]),a=V.useCallback((u,m={})=>t({type:"info",message:u,...m}),[t]),f=V.useCallback(u=>{n(u)},[n]);return{toast:s,success:o,error:l,warning:c,info:a,dismiss:f,toasts:r,clearAll:i}}const dy=({store:t,data:n,loading:r=!1,error:i=null,skipInitialFetch:s=!1,columns:o=[],currentPage:l=1,pageSize:c=15,totalItems:a=0,totalPages:f=1,onPageChange:u,onPageSizeChange:m,sortColumn:y,sortDirection:_,onSort:S,searchValue:E="",onSearchChange:d,searchPlaceholder:h="Search...",openInNewTab:v=!1,selectable:x=!1,selectedRows:g,onSelectionChange:b,showBulkDelete:w=!1,onBulkDelete:k,bulkDeleteLabel:N="Delete selected",onCreate:T,onView:D,onEdit:I,onDelete:L,onRefresh:R,onExport:P,tableClassName:O,tableHeaderClassName:U,tableBodyClassName:H,tableRowClassName:B,tableHeadClassName:j,tableCellClassName:F,headerRowClassName:Y,statusRowClassName:q,paginationClassName:G,stickyPagination:$=!1,stickyPaginationClassName:Z,stickyHeader:ee=!1,stickyHeaderClassName:te,stickyHeaderOffset:se,createButtonClassName:ie,refreshButtonClassName:ae,exportButtonClassName:de,bulkActionButtonClassName:be,createPath:ce,detailPath:pe,editPath:Se,getBreadcrumbName:Re,customBreadcrumbPaths:Fe,getCustomBreadcrumbPath:Ie,additionalActions:Xe=[],bulkActions:X=[],title:re,description:oe,createLabel:xe="Create",refreshLabel:ve="Refresh",exportLabel:ue="Export",viewLabel:fe="View",editLabel:De="Edit",deleteLabel:he="Delete",itemName:Oe="item",getRowKey:Ve=kt=>kt.uuid||kt.id||kt._id,showHeader:We=!0,showToolbar:mt=!0,compact:nt=!1,className:ft,deleteConfirmTitle:bt,deleteConfirmDescription:xt,getDeleteItemName:qe,filters:wt,headerActions:yt,searchable:Ue=!0,showEditButton:rt=!0,showDeleteButton:He=!0,getParentPath:Ye,preserveLocationState:ht=!1,clickableColumns:ot=[]})=>{const kt=Gt.useNavigate(),[$n,gn]=Gt.useSearchParams(),{success:vn,error:Ae}=Dl(),[ye,Ce]=C.useState(!1),[at,Je]=C.useState(null),[Vn,on]=C.useState(!1),[Wn,ks]=C.useState(!1),[To,Ii]=C.useState(!1),[sr,Il]=C.useState(""),Tr=C.useRef(!1),me=C.useRef(sr),ge=C.useRef(!0),ke=Gt.useLocation(),Le=We&&(re||oe),it=()=>Math.max(window.scrollY||0,document.documentElement.scrollTop||0,document.body.scrollTop||0),Rt=Ne=>{window.scrollTo(0,Ne),document.documentElement.scrollTop=Ne,document.body.scrollTop=Ne},en=()=>Math.max(document.documentElement.scrollHeight||0,document.body.scrollHeight||0),Oi=(t==null?void 0:t.items)??n??[],or=(t==null?void 0:t.loading)??r,Un=(t==null?void 0:t.error)??i,Ht=(t==null?void 0:t.pagination)??{page:l,pageSize:c,total:a,totalPages:f},Nr=Ht.page??l,f3=Ht.pageSize??c,h3=Ht.total??a,m3=Ht.totalPages??f,[p3,g3]=C.useState([]),Ol=g!==void 0,An=Ol?g:p3,jd=C.useCallback(Ne=>{Ol||g3(Ne),b==null||b(Ne)},[Ol,b]),Nt=t==null?void 0:t.fetchList,pi=t==null?void 0:t.delete,Mr=t==null?void 0:t.setPage,Bl=t==null?void 0:t.setPageSize,gi=t==null?void 0:t.setFilters,v3=(t==null?void 0:t.sortColumn)??y,b3=(t==null?void 0:t.sortDirection)??_,y3=(t==null?void 0:t.setSort)??S;C.useEffect(()=>{if(Nt&&!Tr.current)if(Tr.current=!0,s)Tr.current=!0;else{const Ne=parseInt($n.get("page"),10);Ne>0&&Mr&&Mr(Ne),Nt()}},[Nt]),C.useEffect(()=>{if(!ge.current||or||!Tr.current)return;ge.current=!1;const Ne=`scrollPos:${ke.pathname}`,ut=sessionStorage.getItem(Ne);if(!ut)return;sessionStorage.removeItem(Ne);const St=parseInt(ut,10);if(!(St>0))return;let Dn=0;const Rn=40,Bi=()=>{const No=en()-window.innerHeight;if(No>=St||Dn>=Rn){Rt(Math.min(St,Math.max(No,0)));return}Dn++,setTimeout(Bi,50)};requestAnimationFrame(Bi)},[or,ke.pathname]),C.useEffect(()=>{if(!Nt||!Tr.current||me.current===sr)return;const Ne=setTimeout(()=>{Ue&&(me.current=sr,gi==null||gi({search:sr}),Nr!==1&&(Mr==null||Mr(1),gn(ut=>{const St=new URLSearchParams(ut);return St.delete("page"),St},{replace:!0})),Nt==null||Nt())},300);return()=>clearTimeout(Ne)},[sr,Ue,Nr,gi,Mr,Nt]);const x3=C.useCallback(Ne=>{Mr?(Mr(Ne),Nt==null||Nt(),gn(ut=>{const St=new URLSearchParams(ut);return Ne<=1?St.delete("page"):St.set("page",String(Ne)),St},{replace:!0})):u==null||u(Ne)},[Mr,Nt,u,gn]),w3=C.useCallback(Ne=>{Bl?(Bl(Ne),Nt==null||Nt(),gn(ut=>{const St=new URLSearchParams(ut);return St.delete("page"),St},{replace:!0})):m==null||m(Ne)},[Bl,Nt,m,gn]),C3=C.useCallback(Ne=>{gi?Il(Ne):d==null||d(Ne)},[gi,d]),Fd=C.useCallback(()=>{if(ce){const Ne=ht?(ke==null?void 0:ke.state)||{}:{},ut=Ie?Ie({}):Fe,St=Ye?Ye({}):null,Dn=ce.split("/").filter(Boolean)[0],Rn=ut||(St?{[Dn]:St}:void 0);kt(ce,{state:{...Ne,...Rn&&{customBreadcrumbPaths:Rn},...St&&{parentPath:St}}})}else T==null||T()},[ce,kt,T,Fe,Ie,Ye,ht,ke==null?void 0:ke.state]),zl=C.useCallback(Ne=>{if(pe){const ut=Re?Re(Ne):void 0,St=ht?(ke==null?void 0:ke.state)||{}:{},Dn=Ie?Ie(Ne):Fe,Rn=Ye?Ye(Ne):null,Bi=`${pe}/${Ve(Ne)}`;v?window.open(Bi,"_blank","noopener,noreferrer"):(sessionStorage.setItem(`scrollPos:${ke.pathname}`,String(it())),kt(Bi,{state:{...St,...ut&&{breadcrumbName:ut},...Dn&&{customBreadcrumbPaths:Dn},...Rn&&{parentPath:Rn}}}))}else D==null||D(Ne)},[pe,kt,Ve,D,Re,Fe,Ie,Ye,ht,ke==null?void 0:ke.state,v]),Hd=C.useCallback(Ne=>{if(Se){const ut=Re?Re(Ne):void 0,St=ht?(ke==null?void 0:ke.state)||{}:{},Dn=Ie?Ie(Ne):Fe,Rn=Ye?Ye(Ne):null,No=Se.split("?")[0].split("/").filter(Boolean)[0],Ud=Dn||(Rn?{[No]:Rn}:void 0);sessionStorage.setItem(`scrollPos:${ke.pathname}`,String(it())),kt(`${Se}/${Ve(Ne)}/edit`,{state:{...St,...ut&&{breadcrumbName:ut},...Ud&&{customBreadcrumbPaths:Ud},...Rn&&{parentPath:Rn}}})}else I==null||I(Ne)},[Se,kt,Ve,I,Re,Fe,Ie,Ye,ht,ke==null?void 0:ke.state]),_3=C.useCallback(()=>{Nt?Nt():R==null||R()},[Nt,R]),S3=C.useCallback(Ne=>{sessionStorage.setItem(`scrollPos:${ke.pathname}`,String(it())),kt(Ne)},[kt,ke.pathname]),$d=C.useCallback(Ne=>{Je(Ne),Ce(!0)},[]),k3=async()=>{var Ne;if(at){on(!0);try{pi?(await pi(Ve(at)),Nt==null||Nt(),vn(`${re} Deleted successfully`)):L&&(await L(at),vn(`${re} Deleted successfully`)),Ce(!1),Je(null)}catch(ut){Ae(((Ne=ut==null?void 0:ut.data)==null?void 0:Ne.message)||`Failed to delete ${Fl}`),console.error("Delete error:",ut)}finally{on(!1)}}},E3=async()=>{var Ne;if(An.length!==0){Ii(!0);try{if(k)await k(An);else if(pi)for(const ut of An)await pi(ut);Nt==null||Nt(),vn(`${An.length} ${Oe}${An.length===1?"":"s"} deleted successfully`),jd([]),ks(!1)}catch(ut){Ae(((Ne=ut==null?void 0:ut.data)==null?void 0:Ne.message)||`Failed to delete the selected ${Oe}s`),console.error("Bulk delete error:",ut)}finally{Ii(!1)}}},T3=C.useCallback((Ne,ut)=>{var St,Dn;t?((St=t.setSort)==null||St.call(t,Ne,ut),(Dn=t.fetchList)==null||Dn.call(t)):S==null||S(Ne,ut)},[t,S]),N3=C.useMemo(()=>{const Ne=[];return(pe||D)&&Ne.push({kind:"view",label:fe,icon:j1,onClick:zl}),Ne.push(...Xe),(Se||I)&&rt&&Ne.push({kind:"edit",label:De,icon:$1,onClick:Hd}),(pi||L)&&He&&Ne.push({kind:"delete",label:he,icon:Aa,variant:"destructive",onClick:$d}),Ne},[pe,Se,D,I,pi,L,fe,De,he,zl,Hd,$d,Xe,rt,He]),jl=ce||T,M3=Nt||R,A3=Ne=>!Ne||typeof Ne!="string"?Ne:Ne.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),D3=(Ne,ut=80)=>Ne.length>ut?Ne.slice(0,ut).trimEnd()+"…":Ne,Fl=C.useMemo(()=>{if(!at)return Oe;const Ne=qe?qe(at):at.name||at.title||Oe;return D3(A3(Ne)||Oe)},[at,qe,Oe]),Vd=()=>mt?p.jsxs("div",{className:"flex items-center gap-2",children:[yt,x&&An.length>0&&X.length>0&&p.jsx(p.Fragment,{children:X.map((Ne,ut)=>p.jsxs(Ke,{variant:Ne.variant||"outline",size:"sm",onClick:()=>{var St;return(St=Ne.onClick)==null?void 0:St.call(Ne,An)},disabled:Ne.disabled,className:Q("cursor-pointer",Ne.className,be),children:[Ne.icon&&p.jsx(Ne.icon,{className:"mr-2 h-4 w-4"}),Ne.label]},Ne.label||ut))}),P&&(C.isValidElement(P)?P:p.jsxs(Ke,{variant:"outline",size:"sm",onClick:P,className:Q("cursor-pointer",de),children:[p.jsx(Ks,{className:"mr-2 h-4 w-4"}),ue]})),M3&&p.jsxs(Ke,{variant:"outline",size:"sm",onClick:_3,disabled:or,className:Q("cursor-pointer",ae),children:[p.jsx(na,{className:Q("mr-2 h-4 w-4",or&&"animate-spin")}),ve]}),jl&&p.jsxs(Ke,{size:"sm",onClick:Fd,className:Q("cursor-pointer",ie),children:[p.jsx(sx,{className:"mr-2 h-4 w-4"}),xe]})]}):null,Wd=p.jsxs(p.Fragment,{children:[p.jsx(Ed,{data:Oi,columns:o,loading:or,error:Un,currentPage:Nr,pageSize:f3,totalItems:h3,totalPages:m3,onPageChange:x3,onPageSizeChange:w3,sortColumn:v3,sortDirection:b3,onSort:t?T3:y3,searchable:Ue,searchValue:gi?sr:E,filters:wt,onSearchChange:C3,searchPlaceholder:h,toolbarActions:!Le&&mt?Vd():null,selectable:x,selectedRows:An,onSelectionChange:jd,showBulkDelete:w&&!!(k||pi),onBulkDelete:()=>ks(!0),bulkDeleteLabel:N,bulkDeleteLoading:To,actions:N3,openInNewTab:v,onViewLink:pe?Ne=>`${pe}/${Ve(Ne)}`:void 0,onBeforeNavigate:v?void 0:S3,onViewClick:!pe&&D?zl:void 0,clickableColumns:ot,getRowKey:Ve,compact:nt,emptyTitle:`No ${Oe}s found`,emptyDescription:`Create your first ${Oe} to get started.`,emptyAction:jl?`Create ${Oe}`:void 0,onEmptyAction:jl?Fd:void 0,tableClassName:O,tableHeaderClassName:U,tableBodyClassName:H,tableRowClassName:B,tableHeadClassName:j,tableCellClassName:F,headerRowClassName:Y,statusRowClassName:q,paginationClassName:G,stickyPagination:$,stickyPaginationClassName:Z,stickyHeader:ee,stickyHeaderClassName:te,stickyHeaderOffset:se}),p.jsx(ms,{open:ye,onOpenChange:Ce,onConfirm:k3,title:bt||`Delete ${Oe}`,description:xt||`Are you sure you want to delete "${Fl}"? This action cannot be undone.`,itemName:Fl,loading:Vn}),p.jsx(ms,{open:Wn,onOpenChange:ks,onConfirm:E3,title:`Delete ${An.length} ${Oe}${An.length===1?"":"s"}`,description:`Are you sure you want to delete ${An.length} selected ${Oe}${An.length===1?"":"s"}? This action cannot be undone.`,loading:To})]});return Le?p.jsxs(yn,{className:Q("border-none shadow-none pt-0! bg-none!",ft),children:[p.jsxs(ns,{className:"flex flex-row items-center justify-between space-y-0 px-0 pb-6",children:[p.jsxs("div",{children:[re&&p.jsx(rs,{className:"text-xl font-semibold tracking-tight",children:re}),oe&&p.jsx(is,{children:oe})]}),Vd()]}),p.jsx(xn,{className:"px-0",children:Wd})]}):p.jsx("div",{className:ft,children:Wd})};dy.displayName="CrudList";var Eo=t=>t.type==="checkbox",Ci=t=>t instanceof Date,hn=t=>t==null;const fy=t=>typeof t=="object";var Zt=t=>!hn(t)&&!Array.isArray(t)&&fy(t)&&!Ci(t),GD=t=>Zt(t)&&t.target?Eo(t.target)?t.target.checked:t.target.value:t,ZD=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,XD=(t,n)=>t.has(ZD(n)),KD=t=>{const n=t.constructor&&t.constructor.prototype;return Zt(n)&&n.hasOwnProperty("isPrototypeOf")},Td=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function tn(t){let n;const r=Array.isArray(t),i=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)n=new Date(t);else if(!(Td&&(t instanceof Blob||i))&&(r||Zt(t)))if(n=r?[]:Object.create(Object.getPrototypeOf(t)),!r&&!KD(t))n=t;else for(const s in t)t.hasOwnProperty(s)&&(n[s]=tn(t[s]));else return t;return n}var Rl=t=>/^\w*$/.test(t),$t=t=>t===void 0,Nd=t=>Array.isArray(t)?t.filter(Boolean):[],Md=t=>Nd(t.replace(/["|']|\]/g,"").split(/\.|\[/)),je=(t,n,r)=>{if(!n||!Zt(t))return r;const i=(Rl(n)?[n]:Md(n)).reduce((s,o)=>hn(s)?s:s[o],t);return $t(i)||i===t?$t(t[n])?r:t[n]:i},lr=t=>typeof t=="boolean",Et=(t,n,r)=>{let i=-1;const s=Rl(n)?[n]:Md(n),o=s.length,l=o-1;for(;++i<o;){const c=s[i];let a=r;if(i!==l){const f=t[c];a=Zt(f)||Array.isArray(f)?f:isNaN(+s[i+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;t[c]=a,t=t[c]}};const zh={BLUR:"blur",FOCUS_OUT:"focusout"},Xn={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Rr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},QD=V.createContext(null);QD.displayName="HookFormContext";var JD=(t,n,r,i=!0)=>{const s={defaultValues:n._defaultValues};for(const o in t)Object.defineProperty(s,o,{get:()=>{const l=o;return n._proxyFormState[l]!==Xn.all&&(n._proxyFormState[l]=!i||Xn.all),t[l]}});return s};const eR=typeof window<"u"?V.useLayoutEffect:V.useEffect;var Sn=t=>typeof t=="string",tR=(t,n,r,i,s)=>Sn(t)?(i&&n.watch.add(t),je(r,t,s)):Array.isArray(t)?t.map(o=>(i&&n.watch.add(o),je(r,o))):(i&&(n.watchAll=!0),r),h0=t=>hn(t)||!fy(t);function Qr(t,n,r=new WeakSet){if(h0(t)||h0(n))return Object.is(t,n);if(Ci(t)&&Ci(n))return t.getTime()===n.getTime();const i=Object.keys(t),s=Object.keys(n);if(i.length!==s.length)return!1;if(r.has(t)||r.has(n))return!0;r.add(t),r.add(n);for(const o of i){const l=t[o];if(!s.includes(o))return!1;if(o!=="ref"){const c=n[o];if(Ci(l)&&Ci(c)||Zt(l)&&Zt(c)||Array.isArray(l)&&Array.isArray(c)?!Qr(l,c,r):!Object.is(l,c))return!1}}return!0}var hy=(t,n,r,i,s)=>n?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[i]:s||!0}}:{},Fs=t=>Array.isArray(t)?t:[t],jh=()=>{let t=[];return{get observers(){return t},next:s=>{for(const o of t)o.next&&o.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(o=>o!==s)}}),unsubscribe:()=>{t=[]}}};function my(t,n){const r={};for(const i in t)if(t.hasOwnProperty(i)){const s=t[i],o=n[i];if(s&&Zt(s)&&o){const l=my(s,o);Zt(l)&&(r[i]=l)}else t[i]&&(r[i]=o)}return r}var ln=t=>Zt(t)&&!Object.keys(t).length,Ad=t=>t.type==="file",Kn=t=>typeof t=="function",Sa=t=>{if(!Td)return!1;const n=t?t.ownerDocument:0;return t instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},py=t=>t.type==="select-multiple",Dd=t=>t.type==="radio",nR=t=>Dd(t)||Eo(t),Sc=t=>Sa(t)&&t.isConnected;function rR(t,n){const r=n.slice(0,-1).length;let i=0;for(;i<r;)t=$t(t)?i++:t[n[i++]];return t}function iR(t){for(const n in t)if(t.hasOwnProperty(n)&&!$t(t[n]))return!1;return!0}function Yt(t,n){const r=Array.isArray(n)?n:Rl(n)?[n]:Md(n),i=r.length===1?t:rR(t,r),s=r.length-1,o=r[s];return i&&delete i[o],s!==0&&(Zt(i)&&ln(i)||Array.isArray(i)&&iR(i))&&Yt(t,r.slice(0,-1)),t}var sR=t=>{for(const n in t)if(Kn(t[n]))return!0;return!1};function gy(t){return Array.isArray(t)||Zt(t)&&!sR(t)}function m0(t,n={}){for(const r in t){const i=t[r];gy(i)?(n[r]=Array.isArray(i)?[]:{},m0(i,n[r])):$t(i)||(n[r]=!0)}return n}function qi(t,n,r){r||(r=m0(n));for(const i in t){const s=t[i];if(gy(s))$t(n)||h0(r[i])?r[i]=m0(s,Array.isArray(s)?[]:{}):qi(s,hn(n)?{}:n[i],r[i]);else{const o=n[i];r[i]=!Qr(s,o)}}return r}const Fh={value:!1,isValid:!1},Hh={value:!0,isValid:!0};var vy=t=>{if(Array.isArray(t)){if(t.length>1){const n=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:n,isValid:!!n.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!$t(t[0].attributes.value)?$t(t[0].value)||t[0].value===""?Hh:{value:t[0].value,isValid:!0}:Hh:Fh}return Fh},by=(t,{valueAsNumber:n,valueAsDate:r,setValueAs:i})=>$t(t)?t:n?t===""?NaN:t&&+t:r&&Sn(t)?new Date(t):i?i(t):t;const $h={isValid:!1,value:null};var yy=t=>Array.isArray(t)?t.reduce((n,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:n,$h):$h;function Vh(t){const n=t.ref;return Ad(n)?n.files:Dd(n)?yy(t.refs).value:py(n)?[...n.selectedOptions].map(({value:r})=>r):Eo(n)?vy(t.refs).value:by($t(n.value)?t.ref.value:n.value,t)}var oR=(t,n,r,i)=>{const s={};for(const o of t){const l=je(n,o);l&&Et(s,o,l._f)}return{criteriaMode:r,names:[...t],fields:s,shouldUseNativeValidation:i}},ka=t=>t instanceof RegExp,As=t=>$t(t)?t:ka(t)?t.source:Zt(t)?ka(t.value)?t.value.source:t.value:t,Wh=t=>({isOnSubmit:!t||t===Xn.onSubmit,isOnBlur:t===Xn.onBlur,isOnChange:t===Xn.onChange,isOnAll:t===Xn.all,isOnTouch:t===Xn.onTouched});const Uh="AsyncFunction";var aR=t=>!!t&&!!t.validate&&!!(Kn(t.validate)&&t.validate.constructor.name===Uh||Zt(t.validate)&&Object.values(t.validate).find(n=>n.constructor.name===Uh)),lR=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),qh=(t,n,r)=>!r&&(n.watchAll||n.watch.has(t)||[...n.watch].some(i=>t.startsWith(i)&&/^\.\w+/.test(t.slice(i.length))));const Hs=(t,n,r,i)=>{for(const s of r||Object.keys(t)){const o=je(t,s);if(o){const{_f:l,...c}=o;if(l){if(l.refs&&l.refs[0]&&n(l.refs[0],s)&&!i)return!0;if(l.ref&&n(l.ref,l.name)&&!i)return!0;if(Hs(c,n))break}else if(Zt(c)&&Hs(c,n))break}}};function Yh(t,n,r){const i=je(t,r);if(i||Rl(r))return{error:i,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),l=je(n,o),c=je(t,o);if(l&&!Array.isArray(l)&&r!==o)return{name:r};if(c&&c.type)return{name:o,error:c};if(c&&c.root&&c.root.type)return{name:`${o}.root`,error:c.root};s.pop()}return{name:r}}var cR=(t,n,r,i)=>{r(t);const{name:s,...o}=t;return ln(o)||Object.keys(o).length>=Object.keys(n).length||Object.keys(o).find(l=>n[l]===(!i||Xn.all))},uR=(t,n,r)=>!t||!n||t===n||Fs(t).some(i=>i&&(r?i===n:i.startsWith(n)||n.startsWith(i))),dR=(t,n,r,i,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(n||t):(r?i.isOnBlur:s.isOnBlur)?!t:(r?i.isOnChange:s.isOnChange)?t:!0,fR=(t,n)=>!Nd(je(t,n)).length&&Yt(t,n),hR=(t,n,r)=>{const i=Fs(je(t,r));return Et(i,"root",n[r]),Et(t,r,i),t};function Gh(t,n,r="validate"){if(Sn(t)||Array.isArray(t)&&t.every(Sn)||lr(t)&&!t)return{type:r,message:Sn(t)?t:"",ref:n}}var Wi=t=>Zt(t)&&!ka(t)?t:{value:t,message:""},Zh=async(t,n,r,i,s,o)=>{const{ref:l,refs:c,required:a,maxLength:f,minLength:u,min:m,max:y,pattern:_,validate:S,name:E,valueAsNumber:d,mount:h}=t._f,v=je(r,E);if(!h||n.has(E))return{};const x=c?c[0]:l,g=L=>{s&&x.reportValidity&&(x.setCustomValidity(lr(L)?"":L||""),x.reportValidity())},b={},w=Dd(l),k=Eo(l),N=w||k,T=(d||Ad(l))&&$t(l.value)&&$t(v)||Sa(l)&&l.value===""||v===""||Array.isArray(v)&&!v.length,D=hy.bind(null,E,i,b),I=(L,R,P,O=Rr.maxLength,U=Rr.minLength)=>{const H=L?R:P;b[E]={type:L?O:U,message:H,ref:l,...D(L?O:U,H)}};if(o?!Array.isArray(v)||!v.length:a&&(!N&&(T||hn(v))||lr(v)&&!v||k&&!vy(c).isValid||w&&!yy(c).isValid)){const{value:L,message:R}=Sn(a)?{value:!!a,message:a}:Wi(a);if(L&&(b[E]={type:Rr.required,message:R,ref:x,...D(Rr.required,R)},!i))return g(R),b}if(!T&&(!hn(m)||!hn(y))){let L,R;const P=Wi(y),O=Wi(m);if(!hn(v)&&!isNaN(v)){const U=l.valueAsNumber||v&&+v;hn(P.value)||(L=U>P.value),hn(O.value)||(R=U<O.value)}else{const U=l.valueAsDate||new Date(v),H=F=>new Date(new Date().toDateString()+" "+F),B=l.type=="time",j=l.type=="week";Sn(P.value)&&v&&(L=B?H(v)>H(P.value):j?v>P.value:U>new Date(P.value)),Sn(O.value)&&v&&(R=B?H(v)<H(O.value):j?v<O.value:U<new Date(O.value))}if((L||R)&&(I(!!L,P.message,O.message,Rr.max,Rr.min),!i))return g(b[E].message),b}if((f||u)&&!T&&(Sn(v)||o&&Array.isArray(v))){const L=Wi(f),R=Wi(u),P=!hn(L.value)&&v.length>+L.value,O=!hn(R.value)&&v.length<+R.value;if((P||O)&&(I(P,L.message,R.message),!i))return g(b[E].message),b}if(_&&!T&&Sn(v)){const{value:L,message:R}=Wi(_);if(ka(L)&&!v.match(L)&&(b[E]={type:Rr.pattern,message:R,ref:l,...D(Rr.pattern,R)},!i))return g(R),b}if(S){if(Kn(S)){const L=await S(v,r),R=Gh(L,x);if(R&&(b[E]={...R,...D(Rr.validate,R.message)},!i))return g(R.message),b}else if(Zt(S)){let L={};for(const R in S){if(!ln(L)&&!i)break;const P=Gh(await S[R](v,r),x,R);P&&(L={...P,...D(R,P.message)},g(P.message),i&&(b[E]=L))}if(!ln(L)&&(b[E]={ref:x,...L},!i))return b}}return g(!0),b};const mR={mode:Xn.onSubmit,reValidateMode:Xn.onChange,shouldFocusError:!0};function pR(t={}){let n={...mR,...t},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Kn(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},i={},s=Zt(n.defaultValues)||Zt(n.values)?tn(n.defaultValues||n.values)||{}:{},o=n.shouldUnregister?{}:tn(s),l={action:!1,mount:!1,watch:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},a,f=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let m={...u};const y={array:jh(),state:jh()},_=n.criteriaMode===Xn.all,S=X=>re=>{clearTimeout(f),f=setTimeout(X,re)},E=async X=>{if(!n.disabled&&(u.isValid||m.isValid||X)){const re=n.resolver?ln((await k()).errors):await T(i,!0);re!==r.isValid&&y.state.next({isValid:re})}},d=(X,re)=>{!n.disabled&&(u.isValidating||u.validatingFields||m.isValidating||m.validatingFields)&&((X||Array.from(c.mount)).forEach(oe=>{oe&&(re?Et(r.validatingFields,oe,re):Yt(r.validatingFields,oe))}),y.state.next({validatingFields:r.validatingFields,isValidating:!ln(r.validatingFields)}))},h=(X,re=[],oe,xe,ve=!0,ue=!0)=>{if(xe&&oe&&!n.disabled){if(l.action=!0,ue&&Array.isArray(je(i,X))){const fe=oe(je(i,X),xe.argA,xe.argB);ve&&Et(i,X,fe)}if(ue&&Array.isArray(je(r.errors,X))){const fe=oe(je(r.errors,X),xe.argA,xe.argB);ve&&Et(r.errors,X,fe),fR(r.errors,X)}if((u.touchedFields||m.touchedFields)&&ue&&Array.isArray(je(r.touchedFields,X))){const fe=oe(je(r.touchedFields,X),xe.argA,xe.argB);ve&&Et(r.touchedFields,X,fe)}(u.dirtyFields||m.dirtyFields)&&(r.dirtyFields=qi(s,o)),y.state.next({name:X,isDirty:I(X,re),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Et(o,X,re)},v=(X,re)=>{Et(r.errors,X,re),y.state.next({errors:r.errors})},x=X=>{r.errors=X,y.state.next({errors:r.errors,isValid:!1})},g=(X,re,oe,xe)=>{const ve=je(i,X);if(ve){const ue=je(o,X,$t(oe)?je(s,X):oe);$t(ue)||xe&&xe.defaultChecked||re?Et(o,X,re?ue:Vh(ve._f)):P(X,ue),l.mount&&!l.action&&E()}},b=(X,re,oe,xe,ve)=>{let ue=!1,fe=!1;const De={name:X};if(!n.disabled){if(!oe||xe){(u.isDirty||m.isDirty)&&(fe=r.isDirty,r.isDirty=De.isDirty=I(),ue=fe!==De.isDirty);const he=Qr(je(s,X),re);fe=!!je(r.dirtyFields,X),he?Yt(r.dirtyFields,X):Et(r.dirtyFields,X,!0),De.dirtyFields=r.dirtyFields,ue=ue||(u.dirtyFields||m.dirtyFields)&&fe!==!he}if(oe){const he=je(r.touchedFields,X);he||(Et(r.touchedFields,X,oe),De.touchedFields=r.touchedFields,ue=ue||(u.touchedFields||m.touchedFields)&&he!==oe)}ue&&ve&&y.state.next(De)}return ue?De:{}},w=(X,re,oe,xe)=>{const ve=je(r.errors,X),ue=(u.isValid||m.isValid)&&lr(re)&&r.isValid!==re;if(n.delayError&&oe?(a=S(()=>v(X,oe)),a(n.delayError)):(clearTimeout(f),a=null,oe?Et(r.errors,X,oe):Yt(r.errors,X)),(oe?!Qr(ve,oe):ve)||!ln(xe)||ue){const fe={...xe,...ue&&lr(re)?{isValid:re}:{},errors:r.errors,name:X};r={...r,...fe},y.state.next(fe)}},k=async X=>{d(X,!0);const re=await n.resolver(o,n.context,oR(X||c.mount,i,n.criteriaMode,n.shouldUseNativeValidation));return d(X),re},N=async X=>{const{errors:re}=await k(X);if(X)for(const oe of X){const xe=je(re,oe);xe?Et(r.errors,oe,xe):Yt(r.errors,oe)}else r.errors=re;return re},T=async(X,re,oe={valid:!0})=>{for(const xe in X){const ve=X[xe];if(ve){const{_f:ue,...fe}=ve;if(ue){const De=c.array.has(ue.name),he=ve._f&&aR(ve._f);he&&u.validatingFields&&d([ue.name],!0);const Oe=await Zh(ve,c.disabled,o,_,n.shouldUseNativeValidation&&!re,De);if(he&&u.validatingFields&&d([ue.name]),Oe[ue.name]&&(oe.valid=!1,re))break;!re&&(je(Oe,ue.name)?De?hR(r.errors,Oe,ue.name):Et(r.errors,ue.name,Oe[ue.name]):Yt(r.errors,ue.name))}!ln(fe)&&await T(fe,re,oe)}}return oe.valid},D=()=>{for(const X of c.unMount){const re=je(i,X);re&&(re._f.refs?re._f.refs.every(oe=>!Sc(oe)):!Sc(re._f.ref))&&te(X)}c.unMount=new Set},I=(X,re)=>!n.disabled&&(X&&re&&Et(o,X,re),!Qr(F(),s)),L=(X,re,oe)=>tR(X,c,{...l.mount?o:$t(re)?s:Sn(X)?{[X]:re}:re},oe,re),R=X=>Nd(je(l.mount?o:s,X,n.shouldUnregister?je(s,X,[]):[])),P=(X,re,oe={})=>{const xe=je(i,X);let ve=re;if(xe){const ue=xe._f;ue&&(!ue.disabled&&Et(o,X,by(re,ue)),ve=Sa(ue.ref)&&hn(re)?"":re,py(ue.ref)?[...ue.ref.options].forEach(fe=>fe.selected=ve.includes(fe.value)):ue.refs?Eo(ue.ref)?ue.refs.forEach(fe=>{(!fe.defaultChecked||!fe.disabled)&&(Array.isArray(ve)?fe.checked=!!ve.find(De=>De===fe.value):fe.checked=ve===fe.value||!!ve)}):ue.refs.forEach(fe=>fe.checked=fe.value===ve):Ad(ue.ref)?ue.ref.value="":(ue.ref.value=ve,ue.ref.type||y.state.next({name:X,values:tn(o)})))}(oe.shouldDirty||oe.shouldTouch)&&b(X,ve,oe.shouldTouch,oe.shouldDirty,!0),oe.shouldValidate&&j(X)},O=(X,re,oe)=>{for(const xe in re){if(!re.hasOwnProperty(xe))return;const ve=re[xe],ue=X+"."+xe,fe=je(i,ue);(c.array.has(X)||Zt(ve)||fe&&!fe._f)&&!Ci(ve)?O(ue,ve,oe):P(ue,ve,oe)}},U=(X,re,oe={})=>{const xe=je(i,X),ve=c.array.has(X),ue=tn(re);Et(o,X,ue),ve?(y.array.next({name:X,values:tn(o)}),(u.isDirty||u.dirtyFields||m.isDirty||m.dirtyFields)&&oe.shouldDirty&&y.state.next({name:X,dirtyFields:qi(s,o),isDirty:I(X,ue)})):xe&&!xe._f&&!hn(ue)?O(X,ue,oe):P(X,ue,oe),qh(X,c)&&y.state.next({...r,name:X}),y.state.next({name:l.mount?X:void 0,values:tn(o)})},H=async X=>{l.mount=!0;const re=X.target;let oe=re.name,xe=!0;const ve=je(i,oe),ue=he=>{xe=Number.isNaN(he)||Ci(he)&&isNaN(he.getTime())||Qr(he,je(o,oe,he))},fe=Wh(n.mode),De=Wh(n.reValidateMode);if(ve){let he,Oe;const Ve=re.type?Vh(ve._f):GD(X),We=X.type===zh.BLUR||X.type===zh.FOCUS_OUT,mt=!lR(ve._f)&&!n.resolver&&!je(r.errors,oe)&&!ve._f.deps||dR(We,je(r.touchedFields,oe),r.isSubmitted,De,fe),nt=qh(oe,c,We);Et(o,oe,Ve),We?(!re||!re.readOnly)&&(ve._f.onBlur&&ve._f.onBlur(X),a&&a(0)):ve._f.onChange&&ve._f.onChange(X);const ft=b(oe,Ve,We),bt=!ln(ft)||nt;if(!We&&y.state.next({name:oe,type:X.type,values:tn(o)}),mt)return(u.isValid||m.isValid)&&(n.mode==="onBlur"?We&&E():We||E()),bt&&y.state.next({name:oe,...nt?{}:ft});if(!We&&nt&&y.state.next({...r}),n.resolver){const{errors:xt}=await k([oe]);if(ue(Ve),xe){const qe=Yh(r.errors,i,oe),wt=Yh(xt,i,qe.name||oe);he=wt.error,oe=wt.name,Oe=ln(xt)}}else d([oe],!0),he=(await Zh(ve,c.disabled,o,_,n.shouldUseNativeValidation))[oe],d([oe]),ue(Ve),xe&&(he?Oe=!1:(u.isValid||m.isValid)&&(Oe=await T(i,!0)));xe&&(ve._f.deps&&(!Array.isArray(ve._f.deps)||ve._f.deps.length>0)&&j(ve._f.deps),w(oe,Oe,he,ft))}},B=(X,re)=>{if(je(r.errors,re)&&X.focus)return X.focus(),1},j=async(X,re={})=>{let oe,xe;const ve=Fs(X);if(n.resolver){const ue=await N($t(X)?X:ve);oe=ln(ue),xe=X?!ve.some(fe=>je(ue,fe)):oe}else X?(xe=(await Promise.all(ve.map(async ue=>{const fe=je(i,ue);return await T(fe&&fe._f?{[ue]:fe}:fe)}))).every(Boolean),!(!xe&&!r.isValid)&&E()):xe=oe=await T(i);return y.state.next({...!Sn(X)||(u.isValid||m.isValid)&&oe!==r.isValid?{}:{name:X},...n.resolver||!X?{isValid:oe}:{},errors:r.errors}),re.shouldFocus&&!xe&&Hs(i,B,X?ve:c.mount),xe},F=(X,re)=>{let oe={...l.mount?o:s};return re&&(oe=my(re.dirtyFields?r.dirtyFields:r.touchedFields,oe)),$t(X)?oe:Sn(X)?je(oe,X):X.map(xe=>je(oe,xe))},Y=(X,re)=>({invalid:!!je((re||r).errors,X),isDirty:!!je((re||r).dirtyFields,X),error:je((re||r).errors,X),isValidating:!!je(r.validatingFields,X),isTouched:!!je((re||r).touchedFields,X)}),q=X=>{X&&Fs(X).forEach(re=>Yt(r.errors,re)),y.state.next({errors:X?r.errors:{}})},G=(X,re,oe)=>{const xe=(je(i,X,{_f:{}})._f||{}).ref,ve=je(r.errors,X)||{},{ref:ue,message:fe,type:De,...he}=ve;Et(r.errors,X,{...he,...re,ref:xe}),y.state.next({name:X,errors:r.errors,isValid:!1}),oe&&oe.shouldFocus&&xe&&xe.focus&&xe.focus()},$=(X,re)=>Kn(X)?y.state.subscribe({next:oe=>"values"in oe&&X(L(void 0,re),oe)}):L(X,re,!0),Z=X=>y.state.subscribe({next:re=>{uR(X.name,re.name,X.exact)&&cR(re,X.formState||u,Fe,X.reRenderRoot)&&X.callback({values:{...o},...r,...re,defaultValues:s})}}).unsubscribe,ee=X=>(l.mount=!0,m={...m,...X.formState},Z({...X,formState:m})),te=(X,re={})=>{for(const oe of X?Fs(X):c.mount)c.mount.delete(oe),c.array.delete(oe),re.keepValue||(Yt(i,oe),Yt(o,oe)),!re.keepError&&Yt(r.errors,oe),!re.keepDirty&&Yt(r.dirtyFields,oe),!re.keepTouched&&Yt(r.touchedFields,oe),!re.keepIsValidating&&Yt(r.validatingFields,oe),!n.shouldUnregister&&!re.keepDefaultValue&&Yt(s,oe);y.state.next({values:tn(o)}),y.state.next({...r,...re.keepDirty?{isDirty:I()}:{}}),!re.keepIsValid&&E()},se=({disabled:X,name:re})=>{(lr(X)&&l.mount||X||c.disabled.has(re))&&(X?c.disabled.add(re):c.disabled.delete(re))},ie=(X,re={})=>{let oe=je(i,X);const xe=lr(re.disabled)||lr(n.disabled);return Et(i,X,{...oe||{},_f:{...oe&&oe._f?oe._f:{ref:{name:X}},name:X,mount:!0,...re}}),c.mount.add(X),oe?se({disabled:lr(re.disabled)?re.disabled:n.disabled,name:X}):g(X,!0,re.value),{...xe?{disabled:re.disabled||n.disabled}:{},...n.progressive?{required:!!re.required,min:As(re.min),max:As(re.max),minLength:As(re.minLength),maxLength:As(re.maxLength),pattern:As(re.pattern)}:{},name:X,onChange:H,onBlur:H,ref:ve=>{if(ve){ie(X,re),oe=je(i,X);const ue=$t(ve.value)&&ve.querySelectorAll&&ve.querySelectorAll("input,select,textarea")[0]||ve,fe=nR(ue),De=oe._f.refs||[];if(fe?De.find(he=>he===ue):ue===oe._f.ref)return;Et(i,X,{_f:{...oe._f,...fe?{refs:[...De.filter(Sc),ue,...Array.isArray(je(s,X))?[{}]:[]],ref:{type:ue.type,name:X}}:{ref:ue}}}),g(X,!1,void 0,ue)}else oe=je(i,X,{}),oe._f&&(oe._f.mount=!1),(n.shouldUnregister||re.shouldUnregister)&&!(XD(c.array,X)&&l.action)&&c.unMount.add(X)}}},ae=()=>n.shouldFocusError&&Hs(i,B,c.mount),de=X=>{lr(X)&&(y.state.next({disabled:X}),Hs(i,(re,oe)=>{const xe=je(i,oe);xe&&(re.disabled=xe._f.disabled||X,Array.isArray(xe._f.refs)&&xe._f.refs.forEach(ve=>{ve.disabled=xe._f.disabled||X}))},0,!1))},be=(X,re)=>async oe=>{let xe;oe&&(oe.preventDefault&&oe.preventDefault(),oe.persist&&oe.persist());let ve=tn(o);if(y.state.next({isSubmitting:!0}),n.resolver){const{errors:ue,values:fe}=await k();r.errors=ue,ve=tn(fe)}else await T(i);if(c.disabled.size)for(const ue of c.disabled)Yt(ve,ue);if(Yt(r.errors,"root"),ln(r.errors)){y.state.next({errors:{}});try{await X(ve,oe)}catch(ue){xe=ue}}else re&&await re({...r.errors},oe),ae(),setTimeout(ae);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ln(r.errors)&&!xe,submitCount:r.submitCount+1,errors:r.errors}),xe)throw xe},ce=(X,re={})=>{je(i,X)&&($t(re.defaultValue)?U(X,tn(je(s,X))):(U(X,re.defaultValue),Et(s,X,tn(re.defaultValue))),re.keepTouched||Yt(r.touchedFields,X),re.keepDirty||(Yt(r.dirtyFields,X),r.isDirty=re.defaultValue?I(X,tn(je(s,X))):I()),re.keepError||(Yt(r.errors,X),u.isValid&&E()),y.state.next({...r}))},pe=(X,re={})=>{const oe=X?tn(X):s,xe=tn(oe),ve=ln(X),ue=ve?s:xe;if(re.keepDefaultValues||(s=oe),!re.keepValues){if(re.keepDirtyValues){const fe=new Set([...c.mount,...Object.keys(qi(s,o))]);for(const De of Array.from(fe))je(r.dirtyFields,De)?Et(ue,De,je(o,De)):U(De,je(ue,De))}else{if(Td&&$t(X))for(const fe of c.mount){const De=je(i,fe);if(De&&De._f){const he=Array.isArray(De._f.refs)?De._f.refs[0]:De._f.ref;if(Sa(he)){const Oe=he.closest("form");if(Oe){Oe.reset();break}}}}if(re.keepFieldsRef)for(const fe of c.mount)U(fe,je(ue,fe));else i={}}o=n.shouldUnregister?re.keepDefaultValues?tn(s):{}:tn(ue),y.array.next({values:{...ue}}),y.state.next({values:{...ue}})}c={mount:re.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!u.isValid||!!re.keepIsValid||!!re.keepDirtyValues||!n.shouldUnregister&&!ln(ue),l.watch=!!n.shouldUnregister,l.action=!1,re.keepErrors||(r.errors={}),y.state.next({submitCount:re.keepSubmitCount?r.submitCount:0,isDirty:ve?!1:re.keepDirty?r.isDirty:!!(re.keepDefaultValues&&!Qr(X,s)),isSubmitted:re.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:ve?{}:re.keepDirtyValues?re.keepDefaultValues&&o?qi(s,o):r.dirtyFields:re.keepDefaultValues&&X?qi(s,X):re.keepDirty?r.dirtyFields:{},touchedFields:re.keepTouched?r.touchedFields:{},errors:re.keepErrors?r.errors:{},isSubmitSuccessful:re.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Se=(X,re)=>pe(Kn(X)?X(o):X,re),Re=(X,re={})=>{const oe=je(i,X),xe=oe&&oe._f;if(xe){const ve=xe.refs?xe.refs[0]:xe.ref;ve.focus&&(ve.focus(),re.shouldSelect&&Kn(ve.select)&&ve.select())}},Fe=X=>{r={...r,...X}},Xe={control:{register:ie,unregister:te,getFieldState:Y,handleSubmit:be,setError:G,_subscribe:Z,_runSchema:k,_focusError:ae,_getWatch:L,_getDirty:I,_setValid:E,_setFieldArray:h,_setDisabledField:se,_setErrors:x,_getFieldArray:R,_reset:pe,_resetDefaultValues:()=>Kn(n.defaultValues)&&n.defaultValues().then(X=>{Se(X,n.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:de,_subjects:y,_proxyFormState:u,get _fields(){return i},get _formValues(){return o},get _state(){return l},set _state(X){l=X},get _defaultValues(){return s},get _names(){return c},set _names(X){c=X},get _formState(){return r},get _options(){return n},set _options(X){n={...n,...X}}},subscribe:ee,trigger:j,register:ie,handleSubmit:be,watch:$,setValue:U,getValues:F,reset:Se,resetField:ce,clearErrors:q,unregister:te,setError:G,setFocus:Re,getFieldState:Y};return{...Xe,formControl:Xe}}function gR(t={}){const n=V.useRef(void 0),r=V.useRef(void 0),[i,s]=V.useState({isDirty:!1,isValidating:!1,isLoading:Kn(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Kn(t.defaultValues)?void 0:t.defaultValues});if(!n.current)if(t.formControl)n.current={...t.formControl,formState:i},t.defaultValues&&!Kn(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:l,...c}=pR(t);n.current={...c,formState:i}}const o=n.current.control;return o._options=t,eR(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(c=>({...c,isReady:!0})),o._formState.isReady=!0,l},[o]),V.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),V.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),V.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),V.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),V.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==i.isDirty&&o._subjects.state.next({isDirty:l})}},[o,i.isDirty]),V.useEffect(()=>{var l;t.values&&!Qr(t.values,r.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((l=o._options.resetOptions)===null||l===void 0)&&l.keepIsValid||o._setValid(),r.current=t.values,s(c=>({...c}))):o._resetDefaultValues()},[o,t.values]),V.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),n.current.formState=JD(i,o),n.current}const Xh=(t,n,r)=>{if(t&&"reportValidity"in t){const i=je(r,n);t.setCustomValidity(i&&i.message||""),t.reportValidity()}},xy=(t,n)=>{for(const r in n.fields){const i=n.fields[r];i&&i.ref&&"reportValidity"in i.ref?Xh(i.ref,r,t):i.refs&&i.refs.forEach(s=>Xh(s,r,t))}},vR=(t,n)=>{n.shouldUseNativeValidation&&xy(t,n);const r={};for(const i in t){const s=je(n.fields,i),o=Object.assign(t[i]||{},{ref:s&&s.ref});if(bR(n.names||Object.keys(t),i)){const l=Object.assign({},je(r,i));Et(l,"root",o),Et(r,i,l)}else Et(r,i,o)}return r},bR=(t,n)=>t.some(r=>r.startsWith(n+"."));var yR=function(t,n){for(var r={};t.length;){var i=t[0],s=i.code,o=i.message,l=i.path.join(".");if(!r[l])if("unionErrors"in i){var c=i.unionErrors[0].errors[0];r[l]={message:c.message,type:c.code}}else r[l]={message:o,type:s};if("unionErrors"in i&&i.unionErrors.forEach(function(u){return u.errors.forEach(function(m){return t.push(m)})}),n){var a=r[l].types,f=a&&a[i.code];r[l]=hy(l,n,r,s,f?[].concat(f,i.message):i.message)}t.shift()}return r},xR=function(t,n,r){return r===void 0&&(r={}),function(i,s,o){try{return Promise.resolve(function(l,c){try{var a=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](i,n)).then(function(f){return o.shouldUseNativeValidation&&xy({},o),{errors:{},values:r.raw?i:f}})}catch(f){return c(f)}return a&&a.then?a.then(void 0,c):a}(0,function(l){if(function(c){return Array.isArray(c==null?void 0:c.errors)}(l))return{values:{},errors:vR(yR(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const wy=V.createContext();function Cy({children:t}){const[n,r]=V.useState({}),i=V.useCallback((l,c)=>{r(a=>({...a,[l]:c}))},[]),s=V.useCallback(l=>n[l],[n]),o=V.useCallback(l=>{r(c=>{const a={...c};return delete a[l],a})},[]);return p.jsx(wy.Provider,{value:{breadcrumbNames:n,setBreadcrumbName:i,getBreadcrumbName:s,clearBreadcrumbName:o},children:t})}function Pl(){const t=V.useContext(wy);if(!t)throw new Error("useBreadcrumb must be used within BreadcrumbProvider");return t}const wR='[aria-invalid="true"], p.text-destructive',Kh='input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [contenteditable="true"], [tabindex]:not([tabindex="-1"])';function Qh(t){t&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{var i,s;const n=t.querySelector(wR);if(!n)return;n.scrollIntoView({behavior:"smooth",block:"center"});const r=n.matches(Kh)?n:(i=n.parentElement)==null?void 0:i.querySelector(Kh);(s=r==null?void 0:r.focus)==null||s.call(r,{preventScroll:!0})})})}const _y=t=>{const n=[];return C.Children.forEach(t,r=>{var o,l,c;if(!C.isValidElement(r))return;const i=(o=r.props)==null?void 0:o.name,s=(l=r.props)==null?void 0:l.required;i&&s&&n.push({name:i,label:r.props.label||i}),(c=r.props)!=null&&c.children&&n.push(..._y(r.props.children))}),n},Sy=({useStore:t,fields:n=[],defaultValues:r={},validationSchema:i,children:s,onSubmit:o,onCancel:l,onBack:c,onBeforeSubmit:a,onAfterCreate:f,initialData:u=null,loading:m=!1,submitting:y=!1,title:_,description:S,submitLabel:E="Save",cancelLabel:d="Cancel",backLabel:h="Back",columns:v=1,showHeader:x=!0,showFooter:g=!0,showBack:b=!0,showCard:w=!0,listPath:k,icon:N,className:T,getBreadcrumbName:D,...I})=>{var ue;const L=Gt.useNavigate(),{uuid:R}=Gt.useParams(),{success:P,error:O}=Dl(),{setBreadcrumbName:U,clearBreadcrumbName:H}=Pl(),B=!!R,j=t==null?void 0:t(),F=j==null?void 0:j.form,Y=(j==null?void 0:j.loading)??!1,q=((ue=j==null?void 0:j.form)==null?void 0:ue.isSubmitting)??!1,G=(j==null?void 0:j.fetchAndPopulateForm)||(j==null?void 0:j.fetchById)||(j==null?void 0:j.fetchOne),$=j==null?void 0:j.create,Z=j==null?void 0:j.update,ee=j==null?void 0:j.resetForm,te=m||Y,se=y||q,ie=C.useRef(null),ae=C.useRef(!1),de=C.useRef(null);C.useEffect(()=>{B&&R&&G&&R!==de.current&&(de.current=R,ae.current=!0,G(R))},[R,B,G]),C.useEffect(()=>{!B&&ee&&ee()},[B,ee]),C.useEffect(()=>()=>{ee&&setTimeout(()=>{ee()},0),ae.current=!1,de.current=null},[]),C.useEffect(()=>{if(B&&R&&D&&(F!=null&&F.values)){const fe=F.values;if(fe&&Object.entries(fe).some(([he,Oe])=>Oe!==""&&Oe!==null&&Oe!==void 0&&he!=="uuid")){const he=D(fe);he&&U(R,he)}}},[R,B,F==null?void 0:F.values,D,U]),C.useEffect(()=>{const fe=R;return()=>{fe&&H(fe)}},[R,H]);const be=C.useCallback(()=>{ee&&ee(),c?c():L(k||-1)},[c,k,L,ee]),ce=C.useCallback(()=>{ee&&ee(),l?l():be()},[l,be,ee]),pe=async fe=>{var Ve,We,mt,nt,ft,bt,xt;(Ve=fe==null?void 0:fe.preventDefault)==null||Ve.call(fe);const De=(F==null?void 0:F.values)||{},he=_y(s),Oe={};if(he.forEach(({name:qe,label:wt})=>{const yt=De[qe];(yt==null||yt===""||Array.isArray(yt)&&yt.length===0||typeof yt=="object"&&!Array.isArray(yt)&&yt!==null&&Object.keys(yt).length===0)&&(Oe[qe]=`${wt} is required`)}),Object.keys(Oe).length>0){j==null||j.setFormErrors(Oe),Qh(ie.current);return}j==null||j.setFormErrors({});try{let qe=De;if(a&&(qe=a(qe)),B)await(Z==null?void 0:Z(R,qe)),P(`${_||"Item"} updated successfully`),ee&&ee(),be();else{const wt=await($==null?void 0:$(qe));P(`${_||"Item"} created successfully`),ee&&ee(),f&&wt?f(wt,L):be()}}catch(qe){const wt=((mt=(We=qe==null?void 0:qe.data)==null?void 0:We.error)==null?void 0:mt.details)||((nt=qe==null?void 0:qe.error)==null?void 0:nt.details),yt=((bt=(ft=qe==null?void 0:qe.data)==null?void 0:ft.error)==null?void 0:bt.message)||((xt=qe==null?void 0:qe.data)==null?void 0:xt.message)||(qe==null?void 0:qe.message)||"Something went wrong";wt&&Object.keys(wt).length>0?O(null,{details:wt}):O(yt)}};if(t&&s){const fe=B?`Edit ${_}`:`Create ${_}`,De=p.jsxs("form",{ref:ie,onSubmit:pe,children:[s,g&&p.jsxs("div",{className:"flex items-center justify-end gap-2 mt-6 pt-4 border-t",children:[p.jsxs(Ke,{type:"button",variant:"outline",onClick:ce,className:"cursor-pointer",disabled:se,children:[p.jsx(er,{className:"mr-2 h-4 w-4"}),d]}),p.jsx(Ke,{type:"submit",className:"cursor-pointer",disabled:se||te,children:se?p.jsxs(p.Fragment,{children:[p.jsx(Jn,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):p.jsxs(p.Fragment,{children:[p.jsx(Jd,{className:"mr-2 h-4 w-4"}),E]})})]})]});return w?p.jsxs(yn,{className:T,...I,children:[p.jsx(ns,{children:p.jsxs("div",{className:"flex items-center gap-4",children:[b&&p.jsx(Ke,{variant:"ghost",size:"icon",onClick:be,className:"cursor-pointer",children:p.jsx(cr,{className:"h-4 w-4"})}),p.jsxs("div",{children:[p.jsx(rs,{className:"text-lg font-semibold text-foreground",children:fe}),S&&p.jsx(is,{children:S})]})]})}),p.jsx(xn,{children:De})]}):p.jsxs("div",{className:Q("space-y-6",T),...I,children:[p.jsxs("div",{className:"flex items-center gap-4",children:[b&&p.jsx(Ke,{variant:"ghost",size:"icon",onClick:be,children:p.jsx(cr,{className:"h-4 w-4"})}),N&&p.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:p.jsx(N,{className:"h-5 w-5 text-primary"})}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:fe}),S&&p.jsx("p",{className:"text-muted-foreground",children:S})]})]}),De]})}const Se=gR({defaultValues:u||r,resolver:i?xR(i):void 0,mode:"onBlur"}),{handleSubmit:Re,formState:{errors:Fe},reset:Ie,watch:Xe,setValue:X}=Se;C.useEffect(()=>{u&&Ie(u)},[u,Ie]);const re=async fe=>{var De,he,Oe,Ve,We,mt;try{await(o==null?void 0:o(fe))}catch(nt){const ft=((he=(De=nt==null?void 0:nt.data)==null?void 0:De.error)==null?void 0:he.details)||((Oe=nt==null?void 0:nt.error)==null?void 0:Oe.details),bt=((We=(Ve=nt==null?void 0:nt.data)==null?void 0:Ve.error)==null?void 0:We.message)||((mt=nt==null?void 0:nt.data)==null?void 0:mt.message)||(nt==null?void 0:nt.message)||"Something went wrong";ft&&Object.keys(ft).length>0?O(null,{details:ft}):O(bt)}},oe=fe=>{var Ue;const{name:De,type:he="text",label:Oe,placeholder:Ve,description:We,required:mt,disabled:nt,options:ft=[],className:bt,...xt}=fe,qe=(Ue=Fe[De])==null?void 0:Ue.message,wt=Xe(De),yt={label:Oe,placeholder:Ve,description:We,error:qe,required:mt,disabled:nt||te||se,className:bt};switch(he){case"text":case"email":case"password":case"number":case"url":case"tel":return p.jsx(_a,{...yt,type:he,emitValue:!1,...Se.register(De),...xt});case"textarea":return p.jsx(yd,{...yt,emitValue:!1,...Se.register(De),...xt});case"select":return p.jsx(xd,{...yt,options:ft,value:wt,onChange:ht=>X(De,ht,{shouldValidate:!0}),...xt});case"search-select":return p.jsx(ey,{...yt,options:ft,value:wt,onChange:ht=>X(De,ht,{shouldValidate:!0}),...xt});case"switch":return p.jsx(wd,{...yt,checked:wt,onCheckedChange:ht=>X(De,ht,{shouldValidate:!0}),...xt});case"section":const{title:rt,description:He,icon:Ye}=fe;return p.jsx("div",{className:"col-span-full mb-4 mt-8",children:p.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-2 border-b border-border/50",children:[Ye&&p.jsx("div",{className:"flex-shrink-0 h-8 w-8 rounded-lg bg-primary/10 flex items-center justify-center",children:p.jsx(Ye,{className:"h-4 w-4 text-primary"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("h3",{className:"text-lg font-semibold text-foreground tracking-tight",children:rt}),He&&p.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:He})]})]})},`section-${rt}`);case"custom":return fe.render?fe.render({form:Se,field:fe,error:qe,value:wt}):null;default:return p.jsx(_a,{...yt,type:"text",emitValue:!1,...Se.register(De),...xt})}},xe=Q("grid gap-4",v===1&&"grid-cols-1",v===2&&"grid-cols-1 md:grid-cols-2",v===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",v===4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-4"),ve=p.jsxs("form",{ref:ie,onSubmit:Re(re,()=>Qh(ie.current)),children:[p.jsx("div",{className:xe,children:n.map(fe=>{if(fe.hidden&&(typeof fe.hidden=="function"?fe.hidden(Xe()):fe.hidden))return null;const De=fe.colSpan||1,he=Q(De===2&&"md:col-span-2",De===3&&"md:col-span-2 lg:col-span-3",De===4&&"md:col-span-2 lg:col-span-4",De==="full"&&"col-span-full");return p.jsx("div",{className:he,children:oe(fe)},fe.name||`section-${fe.title}`)})}),g&&p.jsxs("div",{className:"flex gap-2 mt-6 pt-4 border-t",children:[l&&p.jsxs(Ke,{type:"button",variant:"outline",className:"cursor-pointer",onClick:l,disabled:se,children:[p.jsx(er,{className:"mr-2 h-4 w-4"}),d]}),p.jsx(Ke,{type:"submit",className:"cursor-pointer",disabled:se||te,children:se?p.jsxs(p.Fragment,{children:[p.jsx(Jn,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):p.jsxs(p.Fragment,{children:[p.jsx(Jd,{className:"mr-2 h-4 w-4"}),E]})})]})]});return x&&(_||S||b)?p.jsxs(yn,{className:T,...I,children:[p.jsx(ns,{children:p.jsxs("div",{className:"flex items-center gap-4",children:[b&&c&&p.jsx(Ke,{variant:"ghost",size:"icon",onClick:c,children:p.jsx(cr,{className:"h-4 w-4"})}),p.jsxs("div",{children:[_&&p.jsx(rs,{children:_}),S&&p.jsx(is,{children:S})]})]})}),p.jsx(xn,{children:ve})]}):p.jsx("div",{className:T,...I,children:ve})};Sy.displayName="CrudForm";function CR({brandName:t="Your Brand",brandLogo:n,brandDescription:r="Welcome back",quote:i,quoteAuthor:s,copyright:o,leftPanelClassName:l,rightPanelClassName:c,leftPanelContent:a,rightPanelContent:f,showLeftPanel:u=!0,children:m}){const y=new Date().getFullYear(),_=o||`© ${y} ${t}. All rights reserved.`,S=p.jsxs("div",{className:"flex flex-col h-full p-8 lg:p-12 text-white",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[n&&p.jsx("div",{className:"h-10 w-10 rounded-lg bg-white/20 flex items-center justify-center",children:p.jsx("span",{className:"text-white font-bold text-xl",children:t.charAt(0)})}),p.jsx("span",{className:"text-xl font-semibold",children:t})]}),p.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[i&&p.jsxs("div",{className:"max-w-md",children:[p.jsxs("blockquote",{className:"text-2xl lg:text-3xl font-light leading-relaxed",children:['"',i,'"']}),s&&p.jsxs("p",{className:"mt-4 text-white/70",children:["— ",s]})]}),!i&&r&&p.jsx("div",{className:"text-center",children:p.jsx("p",{className:"text-2xl lg:text-3xl font-light",children:r})})]}),p.jsx("div",{className:"text-sm text-white/60",children:_})]});return p.jsxs("div",{className:"min-h-screen flex",children:[u&&p.jsx("div",{className:Q("hidden lg:flex lg:w-1/2 bg-gray-900",l),children:a||S}),p.jsx("div",{className:Q("w-full flex items-center justify-center p-8",u?"lg:w-1/2":"",c),children:p.jsx("div",{className:"w-full max-w-md",children:f||m||p.jsx(Gt.Outlet,{})})})]})}function _R({onSubmit:t,isLoading:n=!1,error:r,title:i="Login",subtitle:s="Enter your email below to login to your account",emailLabel:o="Email",emailPlaceholder:l="m@example.com",passwordLabel:c="Password",rememberMeLabel:a="Remember me",forgotPasswordText:f="Forgot your password?",forgotPasswordPath:u="/forgot-password",submitButtonText:m="Login",signUpText:y="Don't have an account?",signUpLinkText:_="Sign up",signUpPath:S="/register",showRememberMe:E=!0,showForgotPassword:d=!0,showSignUp:h=!0,logo:v,className:x,children:g}){const[b,w]=V.useState(""),[k,N]=V.useState(""),[T,D]=V.useState(!1),[I,L]=V.useState(!1),R=async P=>{P.preventDefault(),t&&await t({email:b,password:k,rememberMe:T})};return p.jsxs("div",{className:Q("space-y-6",x),children:[v&&p.jsx("div",{className:"flex justify-center",children:v}),p.jsxs("div",{className:"space-y-2 text-center",children:[p.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:i}),s&&p.jsx("p",{className:"text-sm text-muted-foreground",children:s})]}),r&&p.jsx("div",{className:"p-3 text-sm text-destructive bg-destructive/10 rounded-md",children:r}),p.jsxs("form",{onSubmit:R,className:"space-y-4 w-full",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(br,{htmlFor:"email",children:o}),p.jsx(ni,{id:"email",type:"email",placeholder:l,value:b,onChange:P=>w(P.target.value),required:!0,autoComplete:"email"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsx(br,{htmlFor:"password",children:c})}),p.jsxs("div",{className:"relative",children:[p.jsx(ni,{id:"password",type:I?"text":"password",value:k,onChange:P=>N(P.target.value),required:!0,placeholder:"Enter you password",autoComplete:"current-password",className:"pr-10"}),p.jsx("button",{type:"button",onClick:()=>L(!I),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":I?"Hide password":"Show password",children:I?p.jsx(j1,{className:"h-4 w-4"}):p.jsx(Q5,{className:"h-4 w-4"})})]})]}),E&&p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(ss,{id:"remember",checked:T,onCheckedChange:D}),p.jsx(br,{htmlFor:"remember",className:"text-sm font-normal cursor-pointer",children:a})]}),g,p.jsx(Ke,{type:"submit",className:"w-full",disabled:n,children:n?"Signing in...":m}),d&&u&&p.jsx("div",{className:"text-center",children:p.jsx(Gt.Link,{to:u,className:"text-sm text-muted-foreground hover:text-primary underline-offset-4 hover:underline font-semibold",children:f})})]})]})}const ky=V.createContext(null);function Rd(){const t=V.useContext(ky);if(!t)throw new Error("useSidebarContext must be used within a SidebarProvider");return t}function Ey({defaultOpen:t=!1,defaultCollapsed:n=!1,children:r}){const[i,s]=V.useState(t),[o,l]=V.useState(n),c=V.useCallback(()=>{s(y=>!y)},[]),a=V.useCallback(y=>{s(y)},[]),f=V.useCallback(()=>{l(y=>!y)},[]),u=V.useCallback(y=>{l(y)},[]),m={isOpen:i,isCollapsed:o,toggle:c,setOpen:a,toggleCollapse:f,setCollapsed:u};return p.jsx(ky.Provider,{value:m,children:r})}function SR(t,n=[]){let r=[];function i(o,l){const c=C.createContext(l),a=r.length;r=[...r,l];const f=m=>{var h;const{scope:y,children:_,...S}=m,E=((h=y==null?void 0:y[t])==null?void 0:h[a])||c,d=C.useMemo(()=>S,Object.values(S));return p.jsx(E.Provider,{value:d,children:_})};f.displayName=o+"Provider";function u(m,y){var E;const _=((E=y==null?void 0:y[t])==null?void 0:E[a])||c,S=C.useContext(_);if(S)return S;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[f,u]}const s=()=>{const o=r.map(l=>C.createContext(l));return function(c){const a=(c==null?void 0:c[t])||o;return C.useMemo(()=>({[`__scope${t}`]:{...c,[t]:a}}),[c,a])}};return s.scopeName=t,[i,kR(s,...n)]}function kR(...t){const n=t[0];if(t.length===1)return n;const r=()=>{const i=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const l=i.reduce((c,{useScope:a,scopeName:f})=>{const m=a(o)[`__scope${f}`];return{...c,...m}},{});return C.useMemo(()=>({[`__scope${n.scopeName}`]:l}),[l])}};return r.scopeName=n.scopeName,r}function ER(t){const n=TR(t),r=C.forwardRef((i,s)=>{const{children:o,...l}=i,c=C.Children.toArray(o),a=c.find(MR);if(a){const f=a.props.children,u=c.map(m=>m===a?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:m);return p.jsx(n,{...l,ref:s,children:C.isValidElement(f)?C.cloneElement(f,void 0,u):null})}return p.jsx(n,{...l,ref:s,children:o})});return r.displayName=`${t}.Slot`,r}function TR(t){const n=C.forwardRef((r,i)=>{const{children:s,...o}=r;if(C.isValidElement(s)){const l=DR(s),c=AR(o,s.props);return s.type!==C.Fragment&&(c.ref=i?zt(i,l):l),C.cloneElement(s,c)}return C.Children.count(s)>1?C.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var NR=Symbol("radix.slottable");function MR(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===NR}function AR(t,n){const r={...n};for(const i in n){const s=t[i],o=n[i];/^on[A-Z]/.test(i)?s&&o?r[i]=(...c)=>{const a=o(...c);return s(...c),a}:s&&(r[i]=s):i==="style"?r[i]={...s,...o}:i==="className"&&(r[i]=[s,o].filter(Boolean).join(" "))}return{...t,...r}}function DR(t){var i,s;let n=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var RR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pd=RR.reduce((t,n)=>{const r=ER(`Primitive.${n}`),i=C.forwardRef((s,o)=>{const{asChild:l,...c}=s,a=l?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...c,ref:o})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{}),Ll="Collapsible",[PR]=SR(Ll),[LR,Ld]=PR(Ll),Ty=C.forwardRef((t,n)=>{const{__scopeCollapsible:r,open:i,defaultOpen:s,disabled:o,onOpenChange:l,...c}=t,[a,f]=zn({prop:i,defaultProp:s??!1,onChange:l,caller:Ll});return p.jsx(LR,{scope:r,disabled:o,contentId:un(),open:a,onOpenToggle:C.useCallback(()=>f(u=>!u),[f]),children:p.jsx(Pd.div,{"data-state":Od(a),"data-disabled":o?"":void 0,...c,ref:n})})});Ty.displayName=Ll;var Ny="CollapsibleTrigger",My=C.forwardRef((t,n)=>{const{__scopeCollapsible:r,...i}=t,s=Ld(Ny,r);return p.jsx(Pd.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Od(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:n,onClick:Me(t.onClick,s.onOpenToggle)})});My.displayName=Ny;var Id="CollapsibleContent",Ay=C.forwardRef((t,n)=>{const{forceMount:r,...i}=t,s=Ld(Id,t.__scopeCollapsible);return p.jsx(nn,{present:r||s.open,children:({present:o})=>p.jsx(IR,{...i,ref:n,present:o})})});Ay.displayName=Id;var IR=C.forwardRef((t,n)=>{const{__scopeCollapsible:r,present:i,children:s,...o}=t,l=Ld(Id,r),[c,a]=C.useState(i),f=C.useRef(null),u=st(n,f),m=C.useRef(0),y=m.current,_=C.useRef(0),S=_.current,E=l.open||c,d=C.useRef(E),h=C.useRef(void 0);return C.useEffect(()=>{const v=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(v)},[]),qt(()=>{const v=f.current;if(v){h.current=h.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const x=v.getBoundingClientRect();m.current=x.height,_.current=x.width,d.current||(v.style.transitionDuration=h.current.transitionDuration,v.style.animationName=h.current.animationName),a(i)}},[l.open,i]),p.jsx(Pd.div,{"data-state":Od(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!E,...o,ref:u,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":S?`${S}px`:void 0,...t.style},children:E&&s})});function Od(t){return t?"open":"closed"}var OR=Ty,BR=My,zR=Ay;function kc(t){return p.jsx(OR,{"data-slot":"collapsible",...t})}function Ec(t){return p.jsx(BR,{"data-slot":"collapsible-trigger",...t})}function Tc(t){return p.jsx(zR,{"data-slot":"collapsible-content",...t})}function Dy({items:t=[],brandName:n="Brand",brandLogo:r,brandPath:i="/dashboard",user:s,onLogout:o,userMenuItems:l=[],showUserProfile:c=!0,className:a,collapsedWidth:f="w-16",expandedWidth:u="w-60",renderItem:m,headerSlot:y,footerSlot:_,onExpandedChange:S,onPinnedChange:E}){var I,L;const{isOpen:d,setOpen:h}=Rd(),v=Gt.useLocation(),[x,g]=V.useState(!1),[b,w]=V.useState(!1),k=b||x;V.useEffect(()=>{S&&S(k)},[k,S]),V.useEffect(()=>{E&&E(b)},[b,E]);const N=(R,P=!1)=>{if(R.title)return p.jsxs("div",{className:"mt-6",children:[k&&p.jsx("h3",{className:"px-3 text-xs font-medium text-sidebar-foreground/50 uppercase tracking-wider mb-2",children:R.title}),!k&&p.jsx(Js,{className:"my-3 bg-sidebar-border"})]},R.title);if(m)return m(R,{isCollapsed:!k,isSubItem:P,location:v});const O=R.icon,U=R.children&&R.children.length>0,H=R.path&&(v.pathname===R.path||v.pathname.startsWith(R.path+"/")),B=U&&R.children.some(j=>v.pathname===j.path||v.pathname.startsWith(j.path+"/"));return U?k?p.jsx(kc,{defaultOpen:B,className:"group/collapsible",children:p.jsxs("div",{children:[p.jsx(Ec,{asChild:!0,children:p.jsxs("button",{className:Q("w-full flex items-center gap-3 rounded-lg transition-all duration-150 text-sm cursor-pointer",B?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground","px-3 py-2 h-10"),title:R.label,children:[O&&p.jsx(O,{className:"h-5 w-5 flex-shrink-0"}),p.jsx("span",{className:"flex-1 text-left truncate",children:R.label}),p.jsx(In,{className:"h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90 flex-shrink-0"})]})}),p.jsx(Tc,{className:"overflow-hidden",children:p.jsx("div",{className:"ml-4 mt-1 space-y-0.5",children:R.children.map(j=>{const F=j.icon,Y=v.pathname===j.path||v.pathname.startsWith(j.path+"/");return j.children&&j.children.length>0?p.jsxs(kc,{defaultOpen:j.children.some(G=>v.pathname===G.path||v.pathname.startsWith(G.path+"/")),className:"group/collapsible-child",children:[p.jsx(Ec,{asChild:!0,children:p.jsxs("button",{className:Q("w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9 cursor-pointer",Y?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:j.label,children:[F&&p.jsx(F,{className:"h-4 w-4 flex-shrink-0"}),p.jsx("span",{className:"flex-1 text-left truncate",children:j.label}),p.jsx(In,{className:"h-3.5 w-3.5 transition-transform duration-200 group-data-[state=open]/collapsible-child:rotate-90 flex-shrink-0"})]})}),p.jsx(Tc,{className:"overflow-hidden",children:p.jsx("div",{className:"ml-4 mt-1 space-y-0.5",children:R.children.map(G=>{const $=G.icon,Z=G.children&&G.children.length>0,ee=v.pathname===G.path||v.pathname.startsWith((G.path||"")+"/"),te=Z&&G.children.some(se=>v.pathname===se.path||v.pathname.startsWith((se.path||"")+"/"));return Z?p.jsxs(kc,{defaultOpen:te,className:"group/collapsible-child",children:[p.jsx(Ec,{asChild:!0,children:p.jsxs("button",{className:Q("w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9 cursor-pointer",te?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:G.label,children:[$&&p.jsx($,{className:"h-4 w-4 flex-shrink-0"}),p.jsx("span",{className:"flex-1 text-left truncate",children:G.label}),p.jsx(In,{className:"h-3.5 w-3.5 transition-transform duration-200 group-data-[state=open]/collapsible-child:rotate-90 flex-shrink-0"})]})}),p.jsx(Tc,{children:p.jsx("div",{className:"ml-4 mt-1 space-y-0.5",children:G.children.map(se=>{const ie=se.icon,ae=v.pathname===se.path||v.pathname.startsWith((se.path||"")+"/");return p.jsxs(Gt.Link,{to:se.path,className:Q("flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9",ae?"bg-sidebar-primary text-sidebar-primary-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:se.label,children:[ie&&p.jsx(ie,{className:"h-3.5 w-3.5 flex-shrink-0"}),p.jsx("span",{className:"truncate",children:se.label})]},se.path||se.label)})})})]},G.label):p.jsxs(Gt.Link,{to:G.path,className:Q("flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9",ee?"bg-sidebar-primary text-sidebar-primary-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:G.label,children:[$&&p.jsx($,{className:"h-4 w-4 flex-shrink-0"}),p.jsx("span",{className:"truncate",children:G.label})]},G.path||G.label)})})})]},j.label):p.jsxs(Gt.Link,{to:j.path,className:Q("flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9",Y?"bg-sidebar-primary text-sidebar-primary-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:j.label,children:[F&&p.jsx(F,{className:"h-4 w-4 flex-shrink-0"}),p.jsx("span",{className:"truncate",children:j.label})]},j.path||j.label)})})})]})},R.label):p.jsx("div",{className:Q("w-full flex items-center gap-3 rounded-lg transition-all duration-150 text-sm cursor-default",B?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground","justify-center p-2 h-10"),title:R.label,children:O&&p.jsx(O,{className:"h-5 w-5 flex-shrink-0"})},R.label):p.jsxs(Gt.Link,{to:R.path,className:Q("flex items-center gap-3 rounded-lg transition-all duration-150 text-sm",H?"bg-sidebar-primary text-sidebar-primary-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground",k?"px-3 py-2 h-10":"justify-center p-2 h-10"),title:R.label,children:[O&&p.jsx(O,{className:"h-5 w-5 flex-shrink-0"}),p.jsx("span",{className:Q("truncate",!k&&"hidden"),children:R.label})]},R.path||R.label)},T=p.jsxs("div",{className:"flex items-center justify-between h-14 px-3 border-b border-sidebar-border",children:[p.jsxs(Gt.Link,{to:i,className:Q("flex items-center gap-2 min-w-0",!k&&"mx-auto"),children:[r||p.jsx("div",{className:Q("rounded-md bg-sidebar-primary flex items-center justify-center flex-shrink-0","h-8 w-8"),children:p.jsx("span",{className:"text-sidebar-primary-foreground font-semibold text-sm",children:n.charAt(0)})}),p.jsx("span",{className:Q("font-semibold text-sidebar-foreground overflow-hidden text-ellipsis whitespace-nowrap",!k&&"hidden"),children:n})]}),p.jsx("button",{onClick:()=>h(!1),className:"p-1.5 rounded-lg hover:bg-sidebar-accent lg:hidden flex-shrink-0",children:p.jsx(er,{className:"h-4 w-4 text-sidebar-foreground"})}),k&&p.jsx("button",{onClick:()=>w(!b),className:Q("hidden lg:flex p-1.5 rounded-lg hover:bg-sidebar-accent transition-colors flex-shrink-0 items-center justify-center",b&&"bg-sidebar-accent"),title:b?"Unpin sidebar":"Pin sidebar",children:b?p.jsx(Ai,{className:"h-4 w-4 text-sidebar-foreground"}):p.jsx(In,{className:"h-4 w-4 text-sidebar-foreground"})})]}),D=s&&c&&p.jsx("div",{className:"px-3 py-3 border-t border-sidebar-border",children:p.jsxs(_l,{children:[p.jsx(Sl,{asChild:!0,children:p.jsxs("button",{className:Q("w-full flex items-center gap-3 rounded-lg transition-colors hover:bg-sidebar-accent",k?"px-2 py-2":"justify-center p-2"),children:[p.jsxs(su,{className:"h-8 w-8 flex-shrink-0",children:[p.jsx(ou,{src:s.avatar,alt:s.firstName||"User"}),p.jsx(au,{className:"bg-sidebar-primary text-sidebar-primary-foreground text-xs",children:s.name?s.name:`${((I=s.firstName)==null?void 0:I[0])||"U"}${((L=s.lastName)==null?void 0:L[0])||""}`})]}),k&&p.jsxs("div",{className:"flex-1 text-left min-w-0",children:[p.jsx("p",{className:"text-sm font-medium text-sidebar-foreground truncate",children:s.name?s.name:`${s.firstName} ${s.lastName}`}),p.jsx("p",{className:"text-xs text-sidebar-foreground/50 truncate",children:s.email})]})]})}),p.jsxs(So,{align:"end",className:"w-56",children:[p.jsx(kl,{children:"My Account"}),p.jsx(fs,{}),l.map((R,P)=>p.jsx(ds,{asChild:!!R.path,onClick:R.onClick,children:R.path?p.jsx(Gt.Link,{to:R.path,children:R.label}):R.label},P)),l.length>0&&p.jsx(fs,{}),o&&p.jsx(ds,{onClick:o,className:"text-destructive",children:"Log out"})]})]})});return p.jsxs(p.Fragment,{children:[d&&p.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 lg:hidden",onClick:()=>h(!1)}),p.jsxs("aside",{onMouseEnter:()=>!b&&g(!0),onMouseLeave:()=>!b&&g(!1),className:Q("fixed top-0 left-0 z-50 h-full bg-sidebar border-r border-sidebar-border flex flex-col overflow-hidden","transition-[width] duration-200 ease-in-out",d?"translate-x-0":"-translate-x-full",k?u:f,"lg:translate-x-0",k&&!b&&"shadow-lg",a),children:[y||T,p.jsx("nav",{className:"flex-1 overflow-y-auto px-3 py-3",children:p.jsx("div",{className:"space-y-1",children:t.map(R=>N(R))})}),_||D]})]})}function Ry({pathNames:t={},showBreadcrumbs:n=!0,showMenuButton:r=!0,className:i,leftSlot:s,rightSlot:o,breadcrumbsSlot:l,centerSlot:c,children:a,maxBreadcrumbLength:f=50}){const{toggle:u}=Rd(),m=Gt.useLocation(),{getBreadcrumbName:y}=Pl(),_={dashboard:"Dashboard",users:"Users",roles:"Roles",permissions:"Permissions",settings:"Settings",profile:"Profile",create:"Create",edit:"Edit","tenant-grades":"Tenant Grades","tenant-edit-subjects":"Tenant Edit Subjects","tenant-publication-books":"Tenant Publication Books",...t},S=({name:h,isLast:v,path:x})=>{const g=h.length>f,b=g?h.slice(0,f).trim()+"...":h,w=v?p.jsx("span",{className:"font-medium text-foreground",children:b}):p.jsx(Gt.Link,{to:x,className:"text-muted-foreground hover:text-foreground transition-colors",children:b});return g?p.jsxs(sl,{delayDuration:300,children:[p.jsx(ol,{asChild:!0,children:p.jsx("span",{className:"cursor-default",children:w})}),p.jsx(uo,{side:"bottom",className:"max-w-[300px]",children:p.jsx("p",{children:h})})]}):w},E=()=>{const h=m.pathname.split("/").filter(Boolean),v=new URLSearchParams(m.search);return p.jsx(cu,{children:p.jsx("nav",{className:"flex items-center gap-1 text-sm",children:h.map((x,g)=>{var T,D,I;let b="/"+h.slice(0,g+1).join("/");const w=g===h.length-1,k=/^\d+$/.test(x);if((D=(T=m.state)==null?void 0:T.customBreadcrumbPaths)!=null&&D[x])b=m.state.customBreadcrumbPaths[x];else if(!w&&!k&&((I=m.state)!=null&&I.parentPath)){const L=h[g+1];L&&/^\d+$/.test(L)&&(b=m.state.parentPath)}else if(!w&&v.get("tenant")){const L=v.get("tenant");x==="tenant-publication-books"?b=`/tenants/${L}?tab=books`:x==="tenant-grades"?b=`/tenants/${L}?tab=grade`:x==="tenant-edit-subjects"&&(b=`/tenants/${L}?tab=subjects`)}let N;return k?N=y(x)||x:N=_[x]||x,p.jsxs("div",{className:"flex items-center gap-1",children:[g>0&&p.jsx(In,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),p.jsx(S,{name:N,isLast:w,path:b})]},`${x}-${g}`)})})})},d=()=>s||l||(n?p.jsx(E,{}):null);return p.jsxs("header",{className:Q("sticky top-0 z-30 bg-background",i),children:[p.jsxs("div",{className:"flex items-center h-14 px-4 md:px-6",children:[r&&p.jsx("button",{onClick:u,className:"p-2 -ml-2 rounded-lg hover:bg-muted lg:hidden",children:p.jsx(nx,{className:"h-5 w-5"})}),p.jsx("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:d()}),c&&p.jsx("div",{className:"flex items-center gap-2",children:c}),o&&p.jsx("div",{className:"flex items-center gap-2",children:o}),a]}),p.jsx(Js,{})]})}const jR={success:q5,error:z1,warning:O1,info:ta},Jh={success:"bg-green-500 text-white",error:"bg-red-500 text-white",warning:"bg-yellow-500 text-white",info:"bg-blue-500 text-white"};function Py(){const{toasts:t,dismiss:n}=Dl();return p.jsx("div",{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2 max-w-sm",children:t.map(r=>{const i=jR[r.type]||ta;return p.jsxs("div",{className:Q("flex items-start gap-3 p-4 rounded-lg shadow-lg","animate-in slide-in-from-right-full duration-300",Jh[r.type]||Jh.info),children:[p.jsx(i,{className:"h-5 w-5 flex-shrink-0 mt-0.5"}),p.jsxs("div",{className:"flex-1",children:[r.title&&p.jsx("p",{className:"font-medium",children:r.title}),p.jsx("p",{className:"text-sm opacity-90",children:r.message}),r.details&&Object.keys(r.details).length>0&&p.jsx("ul",{className:Q("space-y-0.5",r.message&&"mt-1.5 pt-1.5 border-t border-white/20"),children:Object.entries(r.details).map(([s,o])=>(Array.isArray(o)?o:[o]).map((l,c)=>p.jsxs("li",{className:"text-xs flex gap-1",children:[p.jsxs("span",{className:"font-semibold capitalize shrink-0",children:[s.replace(/_/g," "),":"]}),p.jsx("span",{className:"opacity-90",children:l})]},`${s}-${c}`)))})]}),p.jsx("button",{onClick:()=>n(r.id),className:"p-1 hover:bg-white/20 rounded transition-colors cursor-pointer",children:p.jsx(er,{className:"h-4 w-4"})})]},r.id)})})}const Ly=V.createContext(null);function Iy({children:t}){const[n,r]=V.useState(null),i=V.useCallback(o=>{r(o)},[]),s=V.useCallback(()=>{r(null)},[]);return p.jsx(Ly.Provider,{value:{slot:n,setSlot:i,clearSlot:s},children:t})}function Oy(){const t=V.useContext(Ly);if(!t)throw new Error("useHeaderSlot must be used within HeaderSlotProvider");return t}function FR({sidebarProps:t,headerProps:n,showHeader:r=!0,showSidebar:i=!0,contentClassName:s,mainSlot:o,children:l}){const[c,a]=V.useState(!1),{slot:f}=Oy();return p.jsxs("div",{className:"min-h-screen bg-background dark:bg-background",style:{"--rcu-header-offset":r?"calc(3.5rem + 1px)":"0px"},children:[i&&p.jsx(Dy,{...t,onPinnedChange:a}),p.jsxs("div",{className:Q("transition-all duration-150 ease-out",i&&(c?"lg:ml-60":"lg:ml-16")),children:[r&&p.jsx(Ry,{...n,...f&&{showBreadcrumbs:!1,leftSlot:f}}),p.jsx("main",{id:"dashboard-main-content",className:Q("p-4 md:p-6",s),children:o||l||p.jsx(Gt.Outlet,{})})]}),p.jsx(Py,{})]})}function HR({sidebarProps:t={},headerProps:n={},defaultOpen:r=!1,defaultCollapsed:i=!1,showHeader:s=!0,showSidebar:o=!0,contentClassName:l,mainSlot:c,children:a}){return p.jsx(Ey,{defaultOpen:r,defaultCollapsed:i,children:p.jsx(Cy,{children:p.jsx(Iy,{children:p.jsx(FR,{sidebarProps:t,headerProps:n,showHeader:s,showSidebar:o,contentClassName:l,mainSlot:c,children:a})})})})}function $R(t){var r,i,s;if(!t)return{code:500,message:"An unexpected error occurred.",detail:null};const n=(t==null?void 0:t.data)??((r=t==null?void 0:t.response)==null?void 0:r.data)??t;return(i=n==null?void 0:n.error)!=null&&i.code?{code:n.error.code,message:n.error.message||"Something went wrong.",detail:((s=n.error.details)==null?void 0:s.error)||null}:{code:(t==null?void 0:t.status)||(t==null?void 0:t.statusCode)||500,message:typeof t=="string"?t:(t==null?void 0:t.message)||"Something went wrong.",detail:null}}function e1({error:t,onBack:n,onRetry:r,backLabel:i="Go Back",className:s}){const{code:o,message:l,detail:c}=$R(t),[a,f]=C.useState(!1),u=o>=500,m=()=>{const y=[`Error Code: ${o}`,`Message: ${l}`,c?`Detail: ${c}`:""].filter(Boolean).join(`
|
|
621
|
-
`);navigator.clipboard.writeText(y).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)})};return p.jsxs("div",{className:Q("flex flex-col items-center justify-center min-h-[400px] py-16 px-4",s),children:[p.jsxs("div",{className:"relative mb-6",children:[p.jsx("div",{className:"absolute inset-0 rounded-full bg-destructive/10 blur-xl scale-150"}),p.jsx("div",{className:"relative flex items-center justify-center h-20 w-20 rounded-full bg-destructive/10 border border-destructive/20",children:p.jsx(ax,{className:"h-9 w-9 text-destructive"})})]}),p.jsxs(Yi,{variant:"destructive",className:"mb-3 text-xs font-mono tracking-widest px-3 py-1",children:[u?"SERVER ERROR":"ERROR"," · ",o]}),p.jsx("h2",{className:"text-xl font-semibold text-foreground text-center mb-2",children:u?"Something went wrong on our end":"An error occurred"}),p.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md mb-6 leading-relaxed",children:l}),c&&p.jsxs("div",{className:"w-full max-w-lg mb-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[p.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Technical Detail"}),p.jsx("button",{onClick:m,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:a?p.jsxs(p.Fragment,{children:[p.jsx(_i,{className:"h-3 w-3"})," Copied"]}):p.jsxs(p.Fragment,{children:[p.jsx(Z5,{className:"h-3 w-3"})," Copy"]})})]}),p.jsx("div",{className:"rounded-md border border-destructive/20 bg-destructive/5 px-4 py-3",children:p.jsx("code",{className:"text-xs text-destructive font-mono break-all leading-relaxed",children:c})})]}),p.jsxs("div",{className:"flex items-center gap-3 flex-wrap justify-center",children:[n&&p.jsxs(Ke,{variant:"outline",onClick:n,className:"cursor-pointer gap-2",children:[p.jsx(cr,{className:"h-4 w-4"}),i]}),r&&p.jsxs(Ke,{onClick:r,className:"cursor-pointer gap-2",children:[p.jsx(na,{className:"h-4 w-4"}),"Try Again"]}),!n&&!r&&p.jsxs(Ke,{variant:"outline",onClick:()=>window.location.reload(),className:"cursor-pointer gap-2",children:[p.jsx(na,{className:"h-4 w-4"}),"Reload Page"]})]})]})}const By=({useStore:t,children:n,data:r=null,paramName:i="uuid",loading:s=!1,error:o=null,fields:l=[],onBack:c,onEdit:a,onDelete:f,listPath:u,editPath:m,title:y,description:_,editLabel:S="Edit",deleteLabel:E="Delete",backLabel:d="Back",itemName:h="item",getItemName:v,showBackButton:x=!0,additionalActions:g=[],getBreadcrumbName:b,customBreadcrumbPaths:w,getCustomBreadcrumbPath:k,getParentPath:N,preserveLocationState:T=!1,showEditButton:D=!0,showDeleteButton:I=!0,showHeader:L=!0,showMeta:R=!0,showCard:P=!0,columns:O=2,icon:U,className:H,cardClassName:B,cardHeaderClassName:j,cardContentClassName:F,headerClassName:Y,titleClassName:q,descriptionClassName:G,fieldsGridClassName:$,fieldItemClassName:Z,fieldLabelClassName:ee,fieldValueClassName:te,metaClassName:se,metaItemClassName:ie,backButtonClassName:ae,actionsDropdownClassName:de,actionsDropdownItemClassName:be,loadingStateClassName:ce,errorStateClassName:pe,emptyStateClassName:Se,...Re})=>{const Fe=Gt.useNavigate(),Ie=Gt.useLocation(),X=Gt.useParams()[i??"uuid"],re=VR(),oe=t==null?void 0:t(),xe=oe==null?void 0:oe.currentItem,ve=(oe==null?void 0:oe.loading)??!1,ue=oe==null?void 0:oe.error,fe=(oe==null?void 0:oe.fetchById)||(oe==null?void 0:oe.fetchOne),De=oe==null?void 0:oe.delete,he=r||xe,Oe=s||ve,Ve=o||ue,[We,mt]=C.useState(!1),[nt,ft]=C.useState(!1),bt=typeof window<"u"&&window.history.length<=1,xt=x&&!bt;C.useEffect(()=>{X&&fe&&fe(X)},[X]),C.useEffect(()=>{if(X&&he&&b&&(re!=null&&re.setBreadcrumbName)){const ye=b(he);ye&&re.setBreadcrumbName(X,ye)}},[X,he,b,re==null?void 0:re.setBreadcrumbName]);const qe=()=>{c?c():Fe(u||-1)},wt=C.useCallback(()=>{if(a)a(he);else if(m&&X){const ye=b?b(he):void 0,Ce=T?(Ie==null?void 0:Ie.state)||{}:{},at=k?k(he):w,Je=N?N(he):null,on=m.split("?")[0].split("/").filter(Boolean)[0],Wn=at||(Je?{[on]:Je}:void 0);Fe(`${m}/${X}/edit`,{state:{...Ce,...ye&&{breadcrumbName:ye},...Wn&&{customBreadcrumbPaths:Wn},...Je&&{parentPath:Je}}})}},[a,he,m,X,Fe,b,T,Ie==null?void 0:Ie.state,w,k,N]),yt=async()=>{ft(!0);try{f?await f(he):De&&X&&(await De(X),qe()),mt(!1)}catch(ye){console.error("Delete error:",ye)}finally{ft(!1)}},Ue=ye=>!ye||typeof ye!="string"?ye:ye.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),rt=(ye,Ce=80)=>ye.length>Ce?ye.slice(0,Ce).trimEnd()+"…":ye,He=(()=>{const ye=he&&v?v(he):(he==null?void 0:he.name)||(he==null?void 0:he.title)||h;return rt(Ue(ye)||h)})(),Ye=(a||m)&&D,ht=(f||De)&&I,ot=Ye||ht||g.length>0,kt=()=>{if(!ot)return null;const ye=uy([...g,...Ye?[{kind:"edit",label:S,icon:$1,onClick:wt,className:be}]:[],...ht?[{kind:"delete",label:E,icon:Aa,variant:"destructive",separator:!0,iconClassName:"h-4 w-4",onClick:()=>mt(!0)}]:[]]);return p.jsxs(_l,{children:[p.jsx(Sl,{asChild:!0,children:p.jsx(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer","aria-label":"More actions",children:p.jsx(X5,{className:"h-4 w-4"})})}),p.jsx(So,{align:"end",className:"w-44",children:ye.map((Ce,at)=>p.jsxs(C.Fragment,{children:[Ce.separator&&at>0&&p.jsx(fs,{}),p.jsxs(ds,{onClick:()=>{var Je;return(Je=Ce.onClick)==null?void 0:Je.call(Ce,he)},className:Q("cursor-pointer gap-2",Ce.variant==="destructive"&&"text-destructive focus:text-destructive focus:bg-destructive/10",Ce.className),children:[Ce.icon&&p.jsx(Ce.icon,{className:Ce.iconClassName||"h-4 w-4 text-muted-foreground"}),Ce.label]})]},Ce.label||at))})]})},$n=(ye,Ce)=>{if(ye.render)return he?ye.render(Ce,he):p.jsx("span",{className:"text-muted-foreground",children:"-"});if(Ce==null||Ce==="")return p.jsx("span",{className:"text-muted-foreground",children:"-"});switch(ye.type){case"badge":return p.jsx(Yi,{variant:ye.variant||"default",children:ye.format?ye.format(Ce):String(Ce)});case"status":{const at={active:"success",inactive:"secondary",pending:"warning",error:"destructive",...ye.statusColors};return p.jsx(Yi,{variant:at[Ce==null?void 0:Ce.toLowerCase()]||"default",children:ye.format?ye.format(Ce):String(Ce)})}case"boolean":{const at=!!Ce;return p.jsx(Yi,{variant:at?"success":"secondary",children:at?ye.trueLabel||"Yes":ye.falseLabel||"No"})}case"date":return _0(Ce);case"datetime":return Yo(Ce);case"currency":return new Intl.NumberFormat("en-US",{style:"currency",currency:ye.currency||"USD"}).format(Ce);case"number":return ye.format?ye.format(Ce):new Intl.NumberFormat().format(Ce);case"list":return Array.isArray(Ce)?p.jsx("div",{className:"flex flex-wrap gap-1",children:Ce.map((at,Je)=>p.jsx(Yi,{variant:"outline",children:ye.getItemLabel?ye.getItemLabel(at):String(at)},Je))}):String(Ce);case"link":return p.jsx("a",{href:Ce,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:ye.linkText||Ce});case"email":return p.jsx("a",{href:`mailto:${Ce}`,className:"text-primary hover:underline",children:Ce});case"phone":return p.jsx("a",{href:`tel:${Ce}`,className:"text-primary hover:underline",children:Ce});case"image":return p.jsx("img",{src:Ce,alt:ye.label||"Image",className:Q("rounded-md object-cover",ye.imageClassName||"h-20 w-20")});case"html":return p.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:Ce}});default:return ye.format?ye.format(Ce):String(Ce)}},gn=ye=>{if(he)return ye.accessor?typeof ye.accessor=="function"?ye.accessor(he):he[ye.accessor]:he[ye.name]},vn=Q("grid gap-6",O===1&&"grid-cols-1",O===2&&"grid-cols-1 md:grid-cols-2",O===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),Ae=p.jsxs(p.Fragment,{children:[p.jsx("div",{className:Q(vn,$),children:l.map(ye=>{if(ye.hidden&&(typeof ye.hidden=="function"?he&&ye.hidden(he):ye.hidden))return null;const Ce=gn(ye),at=ye.colSpan||1,Je=Q(at===2&&"md:col-span-2",at===3&&"lg:col-span-3",at==="full"&&"col-span-full");return p.jsxs("div",{className:Q(Je,Z),children:[p.jsxs("dt",{className:Q("text-sm font-medium text-muted-foreground mb-1",ee),children:[ye.icon&&p.jsx(ye.icon,{className:"inline-block mr-2 h-4 w-4"}),ye.label]}),p.jsx("dd",{className:Q("text-sm",te),children:$n(ye,Ce)})]},ye.name||ye.accessor)})}),R&&he&&(he.created_at||he.updated_at||he.createdAt||he.updatedAt)&&p.jsxs(p.Fragment,{children:[p.jsx(Js,{className:"my-6"}),p.jsxs("div",{className:Q("flex flex-wrap gap-6 text-sm text-muted-foreground",se),children:[(he.created_at||he.createdAt)&&(he.created_at||he.createdAt)!==""&&p.jsxs("div",{className:Q("flex items-center gap-2",ie),children:[p.jsx(ea,{className:"h-4 w-4"}),p.jsxs("span",{children:["Created:"," ",Yo(he.created_at||he.createdAt)]})]}),(he.updated_at||he.updatedAt)&&(he.updated_at||he.updatedAt)!==""&&p.jsxs("div",{className:Q("flex items-center gap-2",ie),children:[p.jsx(ea,{className:"h-4 w-4"}),p.jsxs("span",{children:["Updated:"," ",Yo(he.updated_at||he.updatedAt)]})]}),(he.uuid||he.id||he._id)&&p.jsxs("div",{className:Q("flex items-center gap-2",ie),children:[p.jsx(J5,{className:"h-4 w-4"}),p.jsxs("span",{children:["ID: ",he.uuid||he.id||he._id]})]})]})]})]});return Ve?p.jsx("div",{className:Q("space-y-6",H),children:p.jsx(e1,{error:Ve,onBack:xt?qe:void 0,onRetry:()=>fe==null?void 0:fe(X),backLabel:d})}):t&&n&&typeof n=="function"?Oe?p.jsx("div",{className:Q("space-y-6",H),children:p.jsx(yn,{className:Q(ce),children:p.jsx(xn,{className:"py-12",children:p.jsx(Ml,{text:`Loading ${h}...`})})})}):Ve?p.jsx("div",{className:Q("space-y-6",H),children:p.jsx(yn,{className:Q(H,pe),children:p.jsxs(xn,{className:"py-12 text-center",children:[p.jsx("p",{className:"text-destructive",children:(Ve==null?void 0:Ve.message)||"An error occurred"}),p.jsxs(Ke,{variant:"outline",onClick:qe,className:"mt-4 cursor-pointer",children:[p.jsx(cr,{className:"mr-2 h-4 w-4"}),d]})]})})}):he?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:Q("space-y-6",H),...Re,children:[L&&p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:Q("flex items-center gap-3",Y),children:[xt&&p.jsx(Ke,{variant:"ghost",size:"icon",onClick:qe,className:Q("h-8 w-8 cursor-pointer",ae),children:p.jsx(cr,{className:"h-4 w-4"})}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:he&&b&&`${b(he)}`}),_&&p.jsx("p",{className:"text-muted-foreground text-sm",children:_})]})]}),p.jsx(kt,{})]}),n(he)]}),p.jsx(ms,{open:We,onOpenChange:mt,onConfirm:yt,itemName:He,loading:nt})]}):p.jsx("div",{className:Q("space-y-6",H),children:p.jsx(yn,{children:p.jsxs(xn,{className:"py-12 text-center",children:[p.jsxs("p",{className:"text-muted-foreground",children:["No ",h," found"]}),p.jsxs(Ke,{variant:"outline",onClick:qe,className:"mt-4 cursor-pointer",children:[p.jsx(cr,{className:"mr-2 h-4 w-4"}),d]})]})})}):Ve?p.jsx(yn,{className:Q(H,B),children:p.jsx(xn,{className:"py-4",children:p.jsx(e1,{error:Ve,onBack:xt?qe:void 0,onRetry:()=>fe==null?void 0:fe(X),backLabel:d})})}):Oe?p.jsx(yn,{className:H,children:p.jsx(xn,{className:"py-12",children:p.jsx(_d,{text:`Loading ${h}...`})})}):Ve?p.jsx(yn,{className:H,children:p.jsxs(xn,{className:"py-12 text-center",children:[p.jsx("p",{className:"text-destructive",children:(Ve==null?void 0:Ve.message)||"An error occurred"}),p.jsxs(Ke,{variant:"outline",onClick:qe,className:"mt-4 cursor-pointer",children:[p.jsx(cr,{className:"mr-2 h-4 w-4"}),d]})]})}):he?p.jsxs(p.Fragment,{children:[p.jsxs(yn,{className:H,...Re,children:[L&&p.jsxs(ns,{className:Q("flex flex-row items-center justify-between space-y-0 pb-4",j),children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(Ke,{variant:"ghost",size:"icon",onClick:qe,className:Q("h-8 w-8 cursor-pointer",de),children:p.jsx(cr,{className:"h-4 w-4"})}),p.jsxs("div",{children:[y&&p.jsx(rs,{className:Q("text-xl font-semibold tracking-tight",q),children:y}),_&&p.jsx(is,{className:Q(G),children:_})]})]}),p.jsx(kt,{})]}),p.jsx(xn,{children:Ae})]}),p.jsx(ms,{open:We,onOpenChange:mt,onConfirm:yt,itemName:He,loading:nt})]}):p.jsx(yn,{className:H,children:p.jsxs(xn,{className:"py-12 text-center",children:[p.jsxs("p",{className:"text-muted-foreground",children:["No ",h," found"]}),p.jsxs(Ke,{variant:"outline",onClick:qe,className:"mt-4 cursor-pointer",children:[p.jsx(cr,{className:"mr-2 h-4 w-4"}),d]})]})})};function VR(){try{return Pl()}catch{return null}}By.displayName="CrudDetail";const zy=t=>{const{name:n="crud",apiClient:r,endpoint:i,transformResponse:s=m=>m,transformRequest:o=m=>m,initialState:l={},extraActions:c={},idField:a="id",listKey:f="results",countKey:u="count"}=t;if(!r)throw new Error("createCrudStore: apiClient is required");if(!i)throw new Error("createCrudStore: endpoint is required");return m=>m((y,_)=>({items:[],item:null,loading:!1,submitting:!1,error:null,page:1,pageSize:15,totalItems:0,totalPages:0,sortColumn:null,sortDirection:null,search:"",filters:{},selectedIds:[],...l,pageMemory:{},setPage:S=>y(E=>({page:S,pageMemory:{...E.pageMemory,[JSON.stringify(Object.entries(E.filters||{}).sort())]:S}})),setPageSize:S=>y({pageSize:S,page:1}),setSearch:S=>y({search:S,page:1}),setFilters:S=>y(E=>({filters:S,page:E.pageMemory[JSON.stringify(Object.entries(S||{}).sort())]||1})),setSort:(S,E)=>y({sortColumn:S,sortDirection:E}),setSelectedIds:S=>y({selectedIds:S}),clearSelection:()=>y({selectedIds:[]}),clearError:()=>y({error:null}),reset:()=>y({items:[],item:null,loading:!1,submitting:!1,error:null,page:1,pageMemory:{},search:"",filters:{},selectedIds:[],sortColumn:null,sortDirection:null}),fetchList:async(S={})=>{var d,h,v,x;const E=_();if(!E.loading){y({loading:!0,error:null});try{const g={page:E.page,page_size:E.pageSize,search:E.search||void 0,ordering:E.sortColumn?`${E.sortDirection==="desc"?"-":""}${E.sortColumn}`:void 0,...E.filters,...S};Object.keys(g).forEach(D=>{(g[D]===void 0||g[D]==="")&&delete g[D]});const w=(await r.get(i,{params:g})).data,k=w[f]||w.data||(Array.isArray(w)?w:[]),N=w[u]||w.total||k.length,T=Math.ceil(N/E.pageSize);return y({items:k.map(s),totalItems:N,totalPages:T,loading:!1}),{items:k,totalItems:N,totalPages:T}}catch(g){const b=((h=(d=g.response)==null?void 0:d.data)==null?void 0:h.message)||((x=(v=g.response)==null?void 0:v.data)==null?void 0:x.detail)||g.message||"Failed to fetch items";throw y({error:{message:b,original:g},loading:!1}),g}}},fetchOne:async S=>{var E,d,h,v;if(!_().loading){y({loading:!0,error:null,item:null});try{const x=await r.get(`${i}/${S}/`),g=s(x.data);return y({item:g,loading:!1}),g}catch(x){const g=((d=(E=x.response)==null?void 0:E.data)==null?void 0:d.message)||((v=(h=x.response)==null?void 0:h.data)==null?void 0:v.detail)||x.message||"Failed to fetch item";throw y({error:{message:g,original:x},loading:!1}),x}}},create:async S=>{var E,d,h,v,x;if(!_().submitting){y({submitting:!0,error:null});try{const g=o(S),b=await r.post(`${i}/`,g),w=s(b.data);return y(k=>({items:[w,...k.items],totalItems:k.totalItems+1,submitting:!1})),w}catch(g){const b=((d=(E=g.response)==null?void 0:E.data)==null?void 0:d.message)||((v=(h=g.response)==null?void 0:h.data)==null?void 0:v.detail)||g.message||"Failed to create item",w=((x=g.response)==null?void 0:x.data)||{};throw y({error:{message:b,fieldErrors:w,original:g},submitting:!1}),g}}},update:async(S,E)=>{var d,h,v,x,g;if(!_().submitting){y({submitting:!0,error:null});try{const b=o(E),w=await r.patch(`${i}/${S}/`,b),k=s(w.data);return y(N=>{var T;return{items:N.items.map(D=>D[a]===S?k:D),item:((T=N.item)==null?void 0:T[a])===S?k:N.item,submitting:!1}}),k}catch(b){const w=((h=(d=b.response)==null?void 0:d.data)==null?void 0:h.message)||((x=(v=b.response)==null?void 0:v.data)==null?void 0:x.detail)||b.message||"Failed to update item",k=((g=b.response)==null?void 0:g.data)||{};throw y({error:{message:w,fieldErrors:k,original:b},submitting:!1}),b}}},delete:async S=>{var E,d,h,v;if(!_().submitting){y({submitting:!0,error:null});try{return await r.delete(`${i}/${S}/`),y(x=>{var g;return{items:x.items.filter(b=>b[a]!==S),totalItems:x.totalItems-1,item:((g=x.item)==null?void 0:g[a])===S?null:x.item,selectedIds:x.selectedIds.filter(b=>b!==S),submitting:!1}}),!0}catch(x){const g=((d=(E=x.response)==null?void 0:E.data)==null?void 0:d.message)||((v=(h=x.response)==null?void 0:h.data)==null?void 0:v.detail)||x.message||"Failed to delete item";throw y({error:{message:g,original:x},submitting:!1}),x}}},bulkDelete:async S=>{var E,d,h,v;y({submitting:!0,error:null});try{return await Promise.all(S.map(x=>r.delete(`${i}/${x}/`))),y(x=>({items:x.items.filter(g=>!S.includes(g[a])),totalItems:x.totalItems-S.length,selectedIds:[],submitting:!1})),!0}catch(x){const g=((d=(E=x.response)==null?void 0:E.data)==null?void 0:d.message)||((v=(h=x.response)==null?void 0:h.data)==null?void 0:v.detail)||x.message||"Failed to delete items";throw y({error:{message:g,original:x},submitting:!1}),x}},replace:async(S,E)=>{var d,h,v,x,g;y({submitting:!0,error:null});try{const b=o(E),w=await r.put(`${i}/${S}/`,b),k=s(w.data);return y(N=>{var T;return{items:N.items.map(D=>D[a]===S?k:D),item:((T=N.item)==null?void 0:T[a])===S?k:N.item,submitting:!1}}),k}catch(b){const w=((h=(d=b.response)==null?void 0:d.data)==null?void 0:h.message)||((x=(v=b.response)==null?void 0:v.data)==null?void 0:x.detail)||b.message||"Failed to update item",k=((g=b.response)==null?void 0:g.data)||{};throw y({error:{message:w,fieldErrors:k,original:b},submitting:!1}),b}},...c}))},WR=t=>{const{create:n}=require("zustand");return n(zy(t))},UR=ps("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",success:"bg-success text-success-foreground shadow-sm hover:bg-success/90"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),bn=C.forwardRef(({className:t,variant:n,size:r,asChild:i=!1,...s},o)=>{const l=i?k1:"button";return p.jsx(l,{className:Q(UR({variant:n,size:r,className:t})),ref:o,...s})});bn.displayName="Button";function Bd({label:t}){return p.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-15",children:[p.jsx("style",{children:"@keyframes csp{to{transform:rotate(360deg)}}"}),p.jsxs("div",{className:"relative w-11 h-11",children:[p.jsx("div",{className:"w-11 h-11 rounded-full border-2 border-[#e8dcc8] dark:border-[#3a352c] border-t-[#8b5e3c] dark:border-t-[#d9a86c]",style:{animation:"csp 1s linear infinite"}}),p.jsx(Na,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-4 w-4 text-[#8b5e3c] dark:text-[#d9a86c]"})]}),p.jsx("p",{className:"font-serif text-[13px] text-[#9e8870] dark:text-[#a99a86] m-0",children:t})]})}function qR(){return p.jsxs(p.Fragment,{children:[p.jsx("style",{children:"@keyframes psp{to{transform:rotate(360deg)}}"}),p.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-[#e8dcc8] dark:border-[#3a352c] border-t-[#8b5e3c] dark:border-t-[#d9a86c]",style:{animation:"psp 1s linear infinite"}})]})}function zd({message:t,downloadUrl:n}){return p.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-15 text-slate-500 dark:text-slate-400",children:[p.jsx(I1,{className:"h-9 w-9"}),p.jsx("p",{className:"text-sm",children:t}),n&&p.jsx("a",{href:n,download:!0,children:p.jsxs(bn,{variant:"outline",size:"sm",children:[p.jsx(Ks,{size:13,style:{marginRight:4}})," Download instead"]})})]})}const t1="http://www.idpf.org/2008/embedding",n1="http://ns.adobe.com/pdf/enc#RC",p0=t=>new DOMParser().parseFromString(t,"application/xml");async function g0(t,n){const r=t.file(n);return r?r.async("string"):null}async function YR(t){var a;const n=await g0(t,"META-INF/container.xml"),r=n&&((a=p0(n).querySelector("rootfile"))==null?void 0:a.getAttribute("full-path")),i=r&&await g0(t,r);if(!i)return null;const s=p0(i).documentElement,o=s.getAttribute("unique-identifier"),l=Array.from(s.getElementsByTagNameNS("*","identifier")),c=l.find(f=>f.getAttribute("id")===o)??l[0];return(c==null?void 0:c.textContent)??null}async function GR(t){var i;if(!((i=globalThis.crypto)!=null&&i.subtle))return null;const n=t.replace(/[ \t\r\n]/g,""),r=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(n));return new Uint8Array(r)}function ZR(t){const n=t.replace(/^urn:uuid:/i,"").replace(/[^0-9a-f]/gi,"");return n.length!==32?null:Uint8Array.from(n.match(/../g),r=>parseInt(r,16))}function XR(t,n,r){const i=t.slice(),s=Math.min(r,i.length);for(let o=0;o<s;o++)i[o]^=n[o%n.length];return i}async function KR(t){try{const n=await g0(t,"META-INF/encryption.xml");if(!n)return;const r=Array.from(p0(n).getElementsByTagNameNS("*","EncryptedData")).map(o=>{var l,c;return{algorithm:(l=o.getElementsByTagNameNS("*","EncryptionMethod")[0])==null?void 0:l.getAttribute("Algorithm"),path:(c=o.getElementsByTagNameNS("*","CipherReference")[0])==null?void 0:c.getAttribute("URI")}}).filter(o=>o.path&&(o.algorithm===t1||o.algorithm===n1));if(!r.length)return;const i=await YR(t);if(!i)return;const s={[t1]:{key:await GR(i),length:1040},[n1]:{key:ZR(i),length:1024}};await Promise.all(r.map(async({algorithm:o,path:l})=>{const{key:c,length:a}=s[o],f=decodeURIComponent(l).replace(/^\//,""),u=t.file(f);if(!c||!u)return;const m=await u.async("uint8array");t.file(f,XR(m,c,a))}))}catch(n){console.warn("Could not unscramble this book's fonts:",n)}}const v0=/preeti|kantipur|pcs\s*nepali|shreenath/i,jy=[["k|m","फ्र"],["p“m","ऊँ"],["km","फ"],["Km","फ्"],["qm","क्र"],["Qm","क्त"],["pm","ऊ"],["/m","रु"]];new RegExp(jy.map(([t])=>t.replace(/[|/]/g,"\\$&")).join("|"),"g");Object.fromEntries(jy);const Fy=t=>{var n;return((n=t==null?void 0:t.split(",")[0])==null?void 0:n.replace(/["']/g,"").trim().toLowerCase())??""};function r1(t,n=[]){const r=Fy(t);return!!r&&(v0.test(r)||n.includes(r))}async function QR(t){const n=new Set,r=t.file(/\.css$/i);return await Promise.all(r.map(async i=>{var o,l;const s=await i.async("string");for(const[c]of s.matchAll(/@font-face\s*\{[^}]*\}/gi)){const a=(o=c.match(/font-family\s*:\s*([^;}]+)/i))==null?void 0:o[1],f=((l=c.match(/src\s*:\s*([^;}]+)/i))==null?void 0:l[1])??"";a&&(v0.test(f)||v0.test(a))&&n.add(Fy(a))}})),[...n]}const JR="data-legacy-font-families";function eP(t,n){var r;(r=t==null?void 0:t.documentElement)==null||r.setAttribute(JR,n.join("|"))}const tP=1600,Hy="epub-locations:v1:",nP=800,i1=400,rP=600,iP="reader-base",sP=`
|
|
620
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return C.useEffect(()=>{var i;document.getElementById((i=t.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(n)},[n,t]),null},jD=Eb,FD=Tb,HD=Nb,zb=Mb,jb=Ab,Fb=Ib,Hb=Bb,$b=Rb,Vb=Lb;const $D=jD,VD=FD,Wb=HD,md=C.forwardRef(({className:t,...n},r)=>p.jsx(zb,{className:Q("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n,ref:r}));md.displayName=zb.displayName;const Ub=C.forwardRef(({className:t,...n},r)=>p.jsxs(Wb,{children:[p.jsx(md,{}),p.jsx(jb,{ref:r,className:Q("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...n})]}));Ub.displayName=jb.displayName;const qb=({className:t,...n})=>p.jsx("div",{className:Q("flex flex-col space-y-2 text-center sm:text-left",t),...n});qb.displayName="AlertDialogHeader";const Yb=({className:t,...n})=>p.jsx("div",{className:Q("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...n});Yb.displayName="AlertDialogFooter";const Gb=C.forwardRef(({className:t,...n},r)=>p.jsx($b,{ref:r,className:Q("text-lg font-semibold",t),...n}));Gb.displayName=$b.displayName;const Zb=C.forwardRef(({className:t,...n},r)=>p.jsx(Vb,{ref:r,className:Q("text-sm text-muted-foreground",t),...n}));Zb.displayName=Vb.displayName;const Xb=C.forwardRef(({className:t,...n},r)=>p.jsx(Fb,{ref:r,className:Q(ts(),t),...n}));Xb.displayName=Fb.displayName;const Kb=C.forwardRef(({className:t,...n},r)=>p.jsx(Hb,{ref:r,className:Q(ts({variant:"outline"}),"mt-2 sm:mt-0",t),...n}));Kb.displayName=Hb.displayName;const pd=C.forwardRef(({className:t,containerClassName:n,...r},i)=>p.jsx("div",{className:Q("relative w-full overflow-auto",n),children:p.jsx("table",{ref:i,className:Q("w-full caption-bottom text-sm",t),...r})}));pd.displayName="Table";const gd=C.forwardRef(({className:t,...n},r)=>p.jsx("thead",{ref:r,className:Q("[&_tr]:border-b",t),...n}));gd.displayName="TableHeader";const vd=C.forwardRef(({className:t,...n},r)=>p.jsx("tbody",{ref:r,className:Q("[&_tr:last-child]:border-0",t),...n}));vd.displayName="TableBody";const Qb=C.forwardRef(({className:t,...n},r)=>p.jsx("tfoot",{ref:r,className:Q("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...n}));Qb.displayName="TableFooter";const Gi=C.forwardRef(({className:t,...n},r)=>p.jsx("tr",{ref:r,className:Q("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...n}));Gi.displayName="TableRow";const Zi=C.forwardRef(({className:t,...n},r)=>p.jsx("th",{ref:r,className:Q("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...n}));Zi.displayName="TableHead";const Gn=C.forwardRef(({className:t,...n},r)=>p.jsx("td",{ref:r,className:Q("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...n}));Gn.displayName="TableCell";const Jb=C.forwardRef(({className:t,...n},r)=>p.jsx("caption",{ref:r,className:Q("mt-4 text-sm text-muted-foreground",t),...n}));Jb.displayName="TableCaption";const bd=C.forwardRef(({options:t=[],value:n,onChange:r,onSearch:i,placeholder:s="Select...",searchPlaceholder:o="Search...",loading:l=!1,disabled:c=!1,multiple:a=!1,clearable:f=!0,className:u,renderOption:m,renderValue:y,getOptionLabel:_=N=>(N==null?void 0:N.label)||(N==null?void 0:N.name)||String(N),getOptionValue:S=N=>(N==null?void 0:N.value)||(N==null?void 0:N.id)||N,filterOption:E,onLoadMore:d,hasMore:h=!1,loadingMore:v=!1,noOptionsMessage:x="No options found",loadingMessage:g="Loading...",triggerClassName:b,...w},k)=>{const[N,T]=C.useState(!1),[D,I]=C.useState(""),[L,R]=C.useState(0),P=C.useRef(null),O=C.useRef(null),U=C.useMemo(()=>D?E?t.filter(ce=>E(ce,D)):t.filter(ce=>_(ce).toLowerCase().includes(D.toLowerCase())):t,[t,D,E,_]),H=C.useRef(null),[B,j]=C.useState(h),[F,Y]=C.useState(v);C.useEffect(()=>{j(h)},[h]),C.useEffect(()=>{Y(v)},[v]);const q=C.useCallback(ce=>{if(!d||F||!B)return;const{scrollTop:pe,scrollHeight:Se,clientHeight:Re}=ce.target;Se-pe-Re<50&&(Y(!0),d().finally(()=>Y(!1)))},[d,F,B]),G=C.useMemo(()=>P1(ce=>{i==null||i(ce)},300),[i]),$=ce=>{const pe=ce.target.value;I(pe),R(0),G(pe)},Z=ce=>{if(a){const pe=Array.isArray(n)?n:[],Se=S(ce);pe.some(Fe=>S(Fe)===Se)?r==null||r(pe.filter(Fe=>S(Fe)!==Se)):r==null||r([...pe,ce])}else r==null||r(ce),T(!1),I("")},ee=ce=>{ce.stopPropagation(),r==null||r(a?[]:null),I(""),i==null||i("")},te=()=>{if(!a)return;const ce=Array.isArray(n)?n:[];if(U.every(Se=>ce.some(Re=>S(Re)===S(Se)))){const Se=new Set(U.map(Re=>S(Re)));r==null||r(ce.filter(Re=>!Se.has(S(Re))))}else{const Se=U.filter(Re=>!ce.some(Fe=>S(Fe)===S(Re)));r==null||r([...ce,...Se])}},se=ce=>{if(!N){(ce.key==="Enter"||ce.key===" "||ce.key==="ArrowDown")&&(ce.preventDefault(),T(!0));return}switch(ce.key){case"ArrowDown":ce.preventDefault(),R(pe=>Math.min(pe+1,U.length-1));break;case"ArrowUp":ce.preventDefault(),R(pe=>Math.max(pe-1,0));break;case"Enter":ce.preventDefault(),U[L]&&Z(U[L]);break;case"Escape":ce.preventDefault(),T(!1),D&&(I(""),i==null||i(""));break}};C.useEffect(()=>{const ce=pe=>{P.current&&!P.current.contains(pe.target)&&(T(!1),D&&(I(""),i==null||i("")))};return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[]);const ie=ce=>a?(Array.isArray(n)?n:[]).some(Re=>(typeof Re=="object"&&Re!==null?S(Re):Re)===S(ce)):n?(typeof n=="object"&&n!==null?S(n):n)===S(ce):!1,ae=a?Array.isArray(n)&&n.length>0:!!n,de=(ce,pe)=>{if(ce.stopPropagation(),!a)return;const Se=Array.isArray(n)?n:[],Re=S(pe);r==null||r(Se.filter(Fe=>S(Fe)!==Re))},be=()=>{if(!ae)return p.jsx("span",{className:"text-muted-foreground",children:s});if(y)return y(n);if(a){const pe=Array.isArray(n)?n:[];return p.jsx("div",{className:"flex flex-wrap gap-1 max-h-20 overflow-y-auto overflow-x-hidden pr-1 scrollbar-thin",children:pe.map(Se=>{const Re=t.find(Ie=>{const Xe=S(Ie),X=typeof Se=="object"&&Se!==null?S(Se):Se;return Xe===X}),Fe=Re?_(Re):typeof Se=="object"&&Se!==null?_(Se):String(Se);return p.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-blue-500/10 text-blue-500 dark:bg-blue-500/20 dark:text-blue-400 rounded text-sm flex-shrink-0",children:[Fe,p.jsx(er,{className:"h-3 w-3 cursor-pointer hover:text-blue-600",onClick:Ie=>de(Ie,Se)})]},typeof Se=="object"?S(Se):Se)})})}const ce=t.find(pe=>{const Se=S(pe),Re=typeof n=="object"&&n!==null?S(n):n;return Se===Re});if(ce)return _(ce);if(typeof n=="object"&&n!==null){const pe=_(n);if(pe&&pe!=="[object Object]"&&pe!=="undefined")return pe}return typeof n=="string"||typeof n=="number"?String(n):p.jsx("span",{className:"text-muted-foreground",children:s})};return p.jsxs("div",{ref:P,className:Q("relative w-full",u),...w,children:[p.jsxs("button",{ref:k,type:"button",role:"combobox","aria-expanded":N,"aria-haspopup":"listbox",disabled:c,onClick:()=>T(!N),onKeyDown:se,className:Q("flex min-h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",N&&"ring-2 ring-offset-2",b),children:[p.jsx("span",{className:"flex-1 text-left truncate",children:be()}),p.jsxs("div",{className:"flex items-center gap-1",children:[f&&ae&&!c&&p.jsx(er,{className:"h-4 w-4 opacity-50 hover:opacity-100 cursor-pointer",onClick:ee}),p.jsx(Ma,{className:Q("h-4 w-4 opacity-50 transition-transform",N&&"rotate-180")})]})]}),N&&p.jsxs("div",{className:"absolute z-50 mt-1 w-full rounded-md border border-border bg-popover shadow-md animate-in fade-in-0 zoom-in-95",children:[p.jsxs("div",{className:"flex items-center border-b px-3",children:[p.jsx(S0,{className:"h-4 w-4 shrink-0 opacity-50"}),p.jsx("input",{ref:O,type:"text",value:D,onChange:$,placeholder:o,className:"flex h-10 w-full bg-transparent py-3 pl-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",autoFocus:!0}),l&&p.jsx(Jn,{className:"h-4 w-4 animate-spin"})]}),a&&U.length>0&&p.jsxs("div",{onClick:te,className:"flex items-center gap-2 px-3 py-2 border-b cursor-pointer hover:bg-accent text-sm font-medium select-none",children:[p.jsx("div",{className:Q("flex h-4 w-4 items-center justify-center rounded-sm border border-input",Array.isArray(n)&&U.every(ce=>n.some(pe=>S(pe)===S(ce)))&&"bg-primary text-primary-foreground"),children:Array.isArray(n)&&U.every(ce=>n.some(pe=>S(pe)===S(ce)))&&p.jsx(_i,{className:"h-3 w-3"})}),"Select all",D?" matches":""]}),p.jsx("div",{ref:H,onScroll:q,className:"max-h-60 overflow-auto p-1",children:l&&U.length===0?p.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:g}):U.length===0?p.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:x}):p.jsxs(p.Fragment,{children:[U.map((ce,pe)=>p.jsxs("div",{role:"option","aria-selected":ie(ce),onClick:()=>Z(ce),onMouseEnter:()=>R(pe),className:Q("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",L===pe&&"bg-accent",ie(ce)&&"bg-primary/10"),children:[a&&p.jsx("div",{className:Q("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-input",ie(ce)&&"bg-primary text-primary-foreground"),children:ie(ce)&&p.jsx(_i,{className:"h-3 w-3"})}),m?m(ce):p.jsx("span",{className:"flex-1",children:_(ce)}),!a&&ie(ce)&&p.jsx(_i,{className:"ml-auto h-4 w-4"})]},S(ce))),F&&p.jsxs("div",{className:"py-2 text-center text-sm text-muted-foreground flex items-center justify-center gap-2",children:[p.jsx(Jn,{className:"h-4 w-4 animate-spin"}),"Loading more..."]})]})})]})]})});bd.displayName="SearchSelect";function WD({className:t,...n}){return p.jsx("div",{"data-slot":"input-group",role:"group",className:Q("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",t),...n})}const UD=ps("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function Lh({className:t,align:n="inline-start",...r}){return p.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":n,className:Q(UD({align:n}),t),onClick:i=>{var s,o;i.target.closest("button")||(o=(s=i.currentTarget.parentElement)==null?void 0:s.querySelector("input"))==null||o.focus()},...r})}function Ih({className:t,...n}){return p.jsx(ni,{"data-slot":"input-group-control",className:Q("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",t),...n})}function qD(t,n){return t??n}function Nl({description:t,helpText:n,error:r,hideOnError:i,className:s}){const o=qD(t,n);return!o||i&&r?null:p.jsx("p",{className:Q("text-xs text-muted-foreground",s),children:o})}const mi=C.forwardRef(({className:t,label:n,description:r,helpText:i,error:s,required:o,children:l,labelClassName:c,descriptionClassName:a,errorClassName:f,...u},m)=>{const y=C.useId();return p.jsxs("div",{ref:m,className:Q("space-y-2",t),...u,children:[n&&p.jsxs(br,{className:Q(s&&"text-destructive","block mb-2",c),children:[n,o&&p.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),C.Children.map(l,_=>C.isValidElement(_)?C.cloneElement(_,{id:y,"aria-invalid":!!s,className:Q(_.props.className,s&&"border-destructive focus-visible:ring-destructive")}):_),p.jsx(Nl,{description:r,helpText:i,error:s,hideOnError:!0,className:Q("text-sm mt-1",a)}),s&&p.jsx("p",{className:Q("text-xs text-destructive mt-1",f),children:s})]})});mi.displayName="FormField";const _a=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,inputClassName:l,onChange:c,emitValue:a=!0,type:f,value:u,min:m=-1/0,max:y=1/0,step:_=1,disabled:S,allowNegative:E=!1,width:d="w-36",labelClassName:h,descriptionClassName:v,errorClassName:x,containerClassName:g,buttonClassName:b,icon:w,iconPosition:k="prefix",...N},T)=>{const D=P=>{if(f==="number"){const O=P.target.value;if(O===""){a?c==null||c(""):c==null||c(P);return}if(E){if(O==="-"&&m<0){a?c==null||c(O):c==null||c(P);return}}else if(!/^[0-9]*\.?[0-9]*$/.test(O))return;if(!(E?/^-?[0-9]*\.?[0-9]*$/:/^[0-9]*\.?[0-9]*$/).test(O))return;if(O.endsWith(".")){a?c==null||c(O):c==null||c(P);return}const H=Number(O);if(!isNaN(H)){if(!E&&H<0)return;a?c==null||c(H):c==null||c(P)}}else a?c==null||c(P.target.value):c==null||c(P)},I=P=>{var O;if(f==="number"){const U=P.target.value;if(U===""||U==="-"||U.endsWith(".")){let B=0;m!==-1/0&&m>0?B=m:E?m!==-1/0&&(B=m):B=m!==-1/0?Math.max(0,m):0,a?c==null||c(B):c==null||c(P);return}const H=Number(U);if(!isNaN(H)){let B=H;y!==1/0&&(B=Math.min(y,B)),m!==-1/0&&(B=Math.max(m,B)),!E&&B<0&&(B=0),a?c==null||c(B):c==null||c(P)}}(O=N.onBlur)==null||O.call(N,P)},L=P=>{let O;u===""||u===null||u===void 0?O=(!E&&m<0,Math.max(0,m)):O=Number(u),isNaN(O)&&(O=0);const U=O+P;if(!E&&U<0){a?c==null||c(0):c==null||c(e);return}let H=U;y!==1/0&&(H=Math.min(y,H)),m!==-1/0&&(H=Math.max(m,H)),!E&&H<0&&(H=0),a?c==null||c(H):c==null||c(e)},R=f==="number";return p.jsxs("div",{className:`flex flex-col gap-1 ${o||""}`,children:[t&&p.jsxs(br,{className:Q("text-sm font-medium",i?"text-destructive":"text-foreground"),children:[t,s&&p.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),p.jsx("div",{className:"relative",children:R?p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{type:"button",onClick:()=>L(-_),className:Q("h-10 w-10 flex items-center justify-center rounded-md border border-input bg-background text-foreground transition-colors",S?"opacity-50 cursor-not-allowed":"hover:bg-muted active:bg-muted/80 disabled:opacity-30 disabled:cursor-not-allowed"),disabled:S||m!==-1/0&&u!==""&&Number(u)<=m||!E&&Number(u||0)<=0,children:p.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 12H4"})})}),p.jsx("input",{ref:T,type:"text",inputMode:"numeric",value:u,onChange:D,onBlur:I,disabled:S,className:Q(`flex h-10 ${d} rounded-md border border-input bg-background px-3 py-2 text-sm text-center font-medium text-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,i&&"border-destructive focus-visible:ring-destructive",l),...N}),p.jsx("button",{type:"button",onClick:()=>L(_),className:Q("h-10 w-10 flex items-center justify-center rounded-md border border-input bg-background text-foreground transition-colors",S?"opacity-50 cursor-not-allowed":"hover:bg-muted active:bg-muted/80 disabled:opacity-30 disabled:cursor-not-allowed"),disabled:S||y!==1/0&&u!==""&&Number(u)>=y,children:p.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})})})]}):w?p.jsx(WD,{className:Q("h-10",i&&"border-destructive",g),children:k==="postfix"?p.jsxs(p.Fragment,{children:[p.jsx(Ih,{ref:T,type:f,value:u,onChange:D,disabled:S,"aria-invalid":!!i,className:l,...N}),p.jsx(Lh,{align:"inline-end",children:w})]}):p.jsxs(p.Fragment,{children:[p.jsx(Lh,{align:"inline-start",children:w}),p.jsx(Ih,{ref:T,type:f,value:u,onChange:D,disabled:S,"aria-invalid":!!i,className:l,...N})]})}):p.jsx(ni,{ref:T,type:f,value:u,onChange:D,disabled:S,className:Q(l,S&&"opacity-100 cursor-not-allowed bg-muted",i&&"border-destructive focus-visible:ring-destructive"),...N})}),p.jsx(Nl,{description:n,helpText:r,error:i,hideOnError:!0}),i&&p.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[p.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:p.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),i]})]})});_a.displayName="QInput";const yd=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,textareaClassName:l,onChange:c,emitValue:a=!0,labelClassName:f,descriptionClassName:u,errorClassName:m,...y},_)=>{const S=E=>{a?c==null||c(E.target.value):c==null||c(E)};return p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(k0,{ref:_,className:Q(i&&"border-destructive focus-visible:ring-destructive",l),onChange:S,...y})})});yd.displayName="QTextarea";const xd=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,options:o=[],placeholder:l="Select...",className:c,value:a,onChange:f,getOptionLabel:u,getOptionValue:m,optionLabel:y,optionValue:_,labelClassName:S,descriptionClassName:E,errorClassName:d,selectTriggerClassName:h,selectContentClassName:v,selectItemClassName:x,...g},b)=>{const w=u||(typeof y=="function"?y:y?N=>N==null?void 0:N[y]:N=>(N==null?void 0:N.label)||(N==null?void 0:N.name)||String(N)),k=m||(typeof _=="function"?_:_?N=>N==null?void 0:N[_]:N=>(N==null?void 0:N.value)||(N==null?void 0:N.id)||N);return p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:c,children:p.jsxs($0,{value:a,onValueChange:f,...g,children:[p.jsx(Ua,{ref:b,className:Q(i&&"border-destructive focus:ring-destructive"),children:p.jsx(V0,{placeholder:l})}),p.jsx(qa,{children:o.map(N=>p.jsx(Ya,{value:String(k(N)),children:w(N)},k(N)))})]})})});xd.displayName="QSelect";const ey=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,value:l,onChange:c,options:a=[],getOptionLabel:f,getOptionValue:u,optionLabel:m,optionValue:y,onSearch:_,labelClassName:S,descriptionClassName:E,errorClassName:d,searchSelectClassName:h,searchSelectTriggerClassName:v,multiple:x=!1,onLoadMore:g,hasMore:b=!1,loadingMore:w=!1,...k},N)=>{const T=C.useRef(new Map),D=f||(typeof m=="function"?m:m?P=>P==null?void 0:P[m]:P=>(P==null?void 0:P.label)||(P==null?void 0:P.name)||String(P)),I=u||(typeof y=="function"?y:y?P=>P==null?void 0:P[y]:P=>(P==null?void 0:P.value)||(P==null?void 0:P.id)||P);C.useEffect(()=>{a.forEach(P=>{if(P&&typeof P=="object"){const O=I(P);O!=null&&T.current.set(O,P)}})},[a,I]);const L=C.useMemo(()=>{if(l==null)return x?[]:null;const P=O=>{if(typeof O=="object"&&O!==null){const H=I(O);return H!=null&&T.current.set(H,O),O}const U=a.find(H=>I(H)===O);return U||T.current.get(O)||null};if(x){if(Array.isArray(l))return l.map(P).filter(Boolean);{const O=P(l);return O?[O]:[]}}else return typeof l=="object"&&l!==null?l:P(l)},[l,a,I,x]),R=P=>{if(x)if(!P||!Array.isArray(P)||P.length===0)c==null||c([]);else{const O=P.map(U=>{if(U==null)return null;const H=I(U);return H!=null&&typeof U=="object"&&T.current.set(H,U),H}).filter(U=>U!=null);c==null||c(O)}else if(P==null)c==null||c(null);else{const O=I(P);O!=null&&typeof P=="object"&&T.current.set(O,P),c==null||c(O)}};return p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(bd,{ref:N,value:L,onChange:R,options:a,getOptionLabel:D,getOptionValue:I,onSearch:_,multiple:x,className:Q(i&&"border-destructive"),onLoadMore:g,hasMore:b,loadingMore:w,triggerClassName:Q(i&&"border-destructive focus-visible:ring-destructive"),...k})})}),wd=C.forwardRef(({label:t,description:n,helpText:r,error:i,className:s,checked:o,onCheckedChange:l,onChange:c,labelClassName:a,descriptionClassName:f,errorClassName:u,switchClassName:m,switchThumbClassName:y,..._},S)=>{const E=C.useId(),d=h=>{c==null||c(h),l==null||l(h)};return p.jsxs("div",{className:Q("flex flex-col flex-start justify-between gap-3",s),children:[p.jsxs("div",{className:"space-y-0.5",children:[t&&p.jsx(br,{htmlFor:E,className:"text-sm font-medium cursor-pointer",children:t}),p.jsx(Nl,{description:n,helpText:r,className:f}),i&&p.jsx("p",{className:"text-xs text-destructive",children:i})]}),p.jsx(D0,{ref:S,id:E,checked:o,onCheckedChange:d,..._})]})});wd.displayName="QSwitch";const ty=C.forwardRef(({label:t,description:n,helpText:r,error:i,className:s,checked:o,onCheckedChange:l,labelClassName:c,descriptionClassName:a,errorClassName:f,checkboxClassName:u,...m},y)=>{const _=C.useId();return p.jsxs("div",{className:Q("flex items-start gap-2",s),children:[p.jsx(ss,{ref:y,id:_,checked:o,onCheckedChange:l,className:"mt-0.5",...m}),p.jsxs("div",{className:"space-y-0.5 leading-none",children:[t&&p.jsx(br,{htmlFor:_,className:"text-sm font-medium cursor-pointer",children:t}),p.jsx(Nl,{description:n,helpText:r,className:a}),i&&p.jsx("p",{className:"text-xs text-destructive",children:i})]})]})});ty.displayName="QCheckbox";const ny=C.forwardRef(({onSubmit:t,className:n,children:r,...i},s)=>{const o=l=>{l.preventDefault(),t==null||t(l)};return p.jsx("form",{ref:s,onSubmit:o,className:Q("space-y-4",n),...i,children:r})});ny.displayName="QForm";const ry=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,value:l,onChange:c,sendUTC:a=!1,placeholder:f="Pick a date",clearable:u=!0,...m},y)=>p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(_u,{ref:y,date:l,onDateChange:c,placeholder:f,clearable:u,sendUTC:a,...m})}));ry.displayName="QDatePicker";const iy=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,value:l,onChange:c,sendUTC:a=!1,placeholder:f="Pick a date range",clearable:u=!0,labelClassName:m,descriptionClassName:y,errorClassName:_,popoverContentClassName:S,showExtendedPresets:E=!1,presets:d,...h},v)=>p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(Su,{ref:v,dateRange:l,onDateRangeChange:c,placeholder:f,clearable:u,sendUTC:a,popoverContentClassName:S,showExtendedPresets:E,presets:d,...h})}));iy.displayName="QDateRangePicker";const sy=C.forwardRef(({label:t,description:n,helpText:r,error:i,required:s,className:o,value:l,onChange:c,labelClassName:a,descriptionClassName:f,errorClassName:u,editorClassName:m,editorToolbarClassName:y,placeholder:_="Start writing...",height:S="200px",...E},d)=>p.jsx(mi,{label:t,description:n,helpText:r,error:i,required:s,className:o,children:p.jsx(Xu,{ref:d,value:l,onChange:c,placeholder:_,height:S,...E})}));sy.displayName="QRichTextEditor";const Cd=({currentPage:t=1,totalPages:n=1,totalItems:r=0,pageSize:i=15,pageSizeOptions:s=[15,20,50,100],onPageChange:o,onPageSizeChange:l,showPageSizeSelector:c=!0,showInfo:a=!0,className:f})=>{const u=(t-1)*i+1,m=Math.min(t*i,r),y=t>1,_=t<n,S=()=>{const E=[];if(n<=5)for(let h=1;h<=n;h++)E.push(h);else{E.push(1),t>3&&E.push("...");const h=Math.max(2,t-1),v=Math.min(n-1,t+1);for(let x=h;x<=v;x++)E.push(x);t<n-2&&E.push("..."),n>1&&E.push(n)}return E};return p.jsxs("div",{className:Q("flex flex-col sm:flex-row items-center justify-between gap-4 px-2 py-4",f),children:[p.jsxs("div",{className:"flex items-center gap-4",children:[c&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"Rows per page"}),p.jsxs($0,{value:String(i),onValueChange:E=>l==null?void 0:l(Number(E)),children:[p.jsx(Ua,{className:"h-8 w-[70px] cursor-pointer",children:p.jsx(V0,{placeholder:i})}),p.jsx(qa,{side:"top",children:s.map(E=>p.jsx(Ya,{value:String(E),children:E},E))})]})]}),a&&r>0&&p.jsxs("span",{className:"text-sm text-muted-foreground",children:["Showing ",u," to ",m," of ",r," results"]})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsxs(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(1),disabled:!y,children:[p.jsx(W5,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"First page"})]}),p.jsxs(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(t-1),disabled:!y,children:[p.jsx(Ai,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Previous page"})]}),p.jsx("div",{className:"flex items-center gap-1",children:S().map((E,d)=>E==="..."?p.jsx("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${d}`):p.jsx(Ke,{variant:t===E?"default":"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(E),children:E},E))}),p.jsxs(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(t+1),disabled:!_,children:[p.jsx(In,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Next page"})]}),p.jsxs(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer",onClick:()=>o==null?void 0:o(n),disabled:!_,children:[p.jsx(U5,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Last page"})]})]})]})};Cd.displayName="Pagination";const Ml=({variant:t="spinner",size:n="default",text:r,className:i,fullScreen:s=!1,overlay:o=!1})=>{const l={sm:"h-4 w-4",default:"h-8 w-8",lg:"h-12 w-12",xl:"h-16 w-16"},c=Q("flex flex-col items-center justify-center gap-3",s&&"fixed inset-0 z-50",o&&"bg-background/80 backdrop-blur-sm",i),a=()=>{switch(t){case"spinner":return p.jsx(Jn,{className:Q("animate-spin text-primary",l[n])});case"dots":return p.jsx("div",{className:"flex gap-1",children:[0,1,2].map(f=>p.jsx("div",{className:Q("rounded-full bg-primary animate-bounce",n==="sm"&&"h-1.5 w-1.5",n==="default"&&"h-2 w-2",n==="lg"&&"h-3 w-3",n==="xl"&&"h-4 w-4"),style:{animationDelay:`${f*.15}s`}},f))});case"pulse":return p.jsx("div",{className:Q("rounded-full bg-primary animate-pulse",l[n])});case"skeleton":return p.jsxs("div",{className:"space-y-3 w-full max-w-sm",children:[p.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),p.jsx("div",{className:"h-4 bg-muted rounded animate-pulse w-3/4"}),p.jsx("div",{className:"h-4 bg-muted rounded animate-pulse w-1/2"})]});default:return p.jsx(Jn,{className:Q("animate-spin text-primary",l[n])})}};return p.jsxs("div",{className:c,children:[a(),r&&p.jsx("p",{className:"text-sm text-muted-foreground animate-pulse",children:r})]})};Ml.displayName="Loading";const _d=({loading:t,children:n,text:r,className:i})=>p.jsxs("div",{className:Q("relative",i),children:[n,t&&p.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-lg",children:p.jsx(Ml,{text:r})})]});_d.displayName="LoadingOverlay";const oy=C.forwardRef(({loading:t,loadingText:n,children:r,disabled:i,className:s,...o},l)=>p.jsx(Ke,{ref:l,disabled:i||t,className:s,...o,children:t?p.jsxs(p.Fragment,{children:[p.jsx(Jn,{className:"mr-2 h-4 w-4 animate-spin"}),n||"Loading..."]}):r}));oy.displayName="LoadingButton";const Ss=({icon:t=Qd,title:n="No data found",description:r="There are no items to display.",action:i,actionLabel:s,onAction:o,variant:l="default",className:c,children:a})=>{const f={default:{icon:Qd,title:"No data found",description:"There are no items to display."},search:{icon:S0,title:"No results found",description:"Try adjusting your search or filters to find what you're looking for."},empty:{icon:B1,title:"Get started",description:"Create your first item to get started."},error:{icon:na,title:"Something went wrong",description:"There was an error loading the data. Please try again."}},u=f[l]||f.default,m=t||u.icon,y=n||u.title,_=r||u.description;return p.jsxs("div",{className:Q("flex flex-col items-center justify-center py-12 px-4 text-center",c),children:[p.jsx("div",{className:"rounded-full bg-muted p-4 mb-4",children:p.jsx(m,{className:"h-8 w-8 text-muted-foreground"})}),p.jsx("h3",{className:"text-lg font-semibold mb-2",children:y}),p.jsx("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm",children:_}),a,(i||o)&&p.jsx(Ke,{onClick:o,className:"cursor-pointer",children:s||"Take Action"})]})};Ss.displayName="EmptyState";const Sd=({searchTerm:t,onClear:n,className:r})=>p.jsx(Ss,{variant:"search",title:`No results for "${t}"`,description:"Try searching with different keywords or check your filters.",className:r,children:n&&p.jsx(Ke,{variant:"outline",onClick:n,className:"cursor-pointer",children:"Clear Search"})});Sd.displayName="SearchEmptyState";const ay=({itemName:t="item",onCreate:n,className:r})=>p.jsx(Ss,{variant:"empty",icon:B1,title:`No ${t}s yet`,description:`Create your first ${t} to get started.`,onAction:n,actionLabel:`Create ${t}`,className:r});ay.displayName="CreateEmptyState";const ly=({error:t,onRetry:n,className:r})=>p.jsx(Ss,{variant:"error",title:"Error loading data",description:(t==null?void 0:t.message)||"Something went wrong. Please try again.",onAction:n,actionLabel:"Try Again",className:r});ly.displayName="ErrorState";const Al=({open:t,onOpenChange:n,onClose:r,title:i,description:s,children:o,footer:l,size:c="default",showClose:a=!0,className:f,...u})=>{const m={sm:"max-w-sm",default:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[95vw]"},y=_=>{n==null||n(_),_||r==null||r()};return p.jsx(Zp,{open:t,onOpenChange:y,...u,children:p.jsxs(J0,{className:Q(m[c],f),children:[(i||s)&&p.jsxs(eu,{children:[i&&p.jsx(tu,{className:"line-clamp-3 wrap-break-word",children:i}),s&&p.jsx(nu,{className:"line-clamp-3 wrap-break-word",children:s})]}),o,l&&p.jsx(Qa,{children:l})]})})};Al.displayName="Modal";const kd=({open:t,onOpenChange:n,onConfirm:r,onCancel:i,title:s="Are you sure?",description:o="This action cannot be undone.",confirmText:l="Confirm",cancelText:c="Cancel",variant:a="default",loading:f=!1,className:u})=>{const m=async()=>{await(r==null?void 0:r())},y=()=>{i==null||i(),n==null||n(!1)};return p.jsx(Al,{open:t,onOpenChange:n,title:s,description:o,size:"default",className:u,footer:p.jsxs("div",{className:"flex gap-2 justify-end",children:[p.jsx(Ke,{variant:"outline",onClick:y,disabled:f,className:"cursor-pointer",children:c}),p.jsx(Ke,{variant:a==="destructive"?"destructive":"default",onClick:m,disabled:f,className:"cursor-pointer",children:f?"Loading...":l})]})})};kd.displayName="ConfirmModal";const ms=({open:t,onOpenChange:n,onConfirm:r,title:i,description:s,itemName:o="item",loading:l=!1})=>p.jsx(kd,{open:t,onOpenChange:n,onConfirm:r,title:i||`Delete ${o}?`,description:s||`Are you sure you want to delete this ${o}? This action cannot be undone.`,confirmText:"Delete",variant:"destructive",loading:l});ms.displayName="DeleteConfirmModal";const cy=({open:t,onOpenChange:n,onSubmit:r,title:i,description:s,children:o,submitText:l="Save",cancelText:c="Cancel",loading:a=!1,size:f="default",className:u})=>{const m=async y=>{y==null||y.preventDefault(),await(r==null?void 0:r())};return p.jsx(Al,{open:t,onOpenChange:n,title:i,description:s,size:f,className:u,children:p.jsxs("form",{onSubmit:m,children:[p.jsx("div",{className:"py-4",children:o}),p.jsxs(Qa,{children:[p.jsx(Ke,{type:"button",variant:"outline",onClick:()=>n==null?void 0:n(!1),disabled:a,className:"cursor-pointer",children:c}),p.jsx(Ke,{type:"submit",disabled:a,className:"cursor-pointer",children:a?"Saving...":l})]})]})})};cy.displayName="FormModal";const f0={view:0,other:1,edit:2,delete:3},Oh=t=>{if(t.kind in f0)return t.kind;const n=typeof t.label=="string"?t.label.trim():"";return/^view( details?)?$/i.test(n)?"view":/^edit\b/i.test(n)?"edit":/^delete\b/i.test(n)||/^remove$/i.test(n)?"delete":"other"},uy=(t=[])=>[...t].sort((n,r)=>f0[Oh(n)]-f0[Oh(r)]),Bh=({text:t,maxLines:n=1,className:r,showTooltip:i=!0})=>{const s=C.useRef(null),[o,l]=C.useState(!1);C.useEffect(()=>{const f=()=>{if(!s.current)return;const u=s.current,m=u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth;l(m)};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[t,n]);const c=n===1?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{display:"-webkit-box",WebkitLineClamp:n,WebkitBoxOrient:"vertical",overflow:"hidden"},a=p.jsx("span",{ref:s,className:Q("block max-w-full",r),style:c,children:t});return!i||!o?a:p.jsxs(sl,{delayDuration:300,children:[p.jsx(ol,{asChild:!0,children:a}),p.jsx(uo,{side:"top",align:"start",className:"max-w-xs sm:max-w-sm md:max-w-md lg:max-w-lg break-words",children:p.jsx("p",{className:"text-sm",children:t})})]})},Ed=({data:t=[],columns:n=[],loading:r=!1,error:i=null,pagination:s=null,currentPage:o=1,pageSize:l=15,totalItems:c=0,totalPages:a=1,onPageChange:f,onPageSizeChange:u,sortable:m=!0,sortColumn:y=null,sortDirection:_=null,onSort:S,openInNewTab:E=!1,searchable:d=!0,searchValue:h="",onSearchChange:v,searchPlaceholder:x="Search...",filters:g,toolbarActions:b,selectable:w=!1,selectedRows:k=[],onSelectionChange:N,showBulkDelete:T=!1,onBulkDelete:D,bulkDeleteLabel:I="Delete selected",bulkDeleteLoading:L=!1,actions:R=[],onRowClick:P,striped:O=!1,hover:U=!0,compact:H=!1,className:B,emptyTitle:j="No data found",emptyDescription:F="There are no items to display.",emptyAction:Y,onEmptyAction:q,getRowKey:G=fe=>fe.id||fe._id,showSerialNumber:$=!0,serialNumberHeader:Z="SN",onViewClick:ee,onViewLink:te,onBeforeNavigate:se,clickableColumns:ie=[],enableTextClamping:ae=!0,defaultMaxLines:de=1,tableClassName:be,tableHeaderClassName:ce,tableBodyClassName:pe,tableRowClassName:Se,tableHeadClassName:Re,tableCellClassName:Fe,headerRowClassName:Ie,statusRowClassName:Xe,paginationClassName:X,stickyPagination:re=!1,stickyPaginationClassName:oe,stickyHeader:xe=!1,stickyHeaderClassName:ve,stickyHeaderOffset:ue})=>{const[fe,De]=C.useState(h),he=C.useRef(null),[Oe,Ve]=C.useState(!1),We=!r&&t.length>0&&s!==!1;C.useEffect(()=>{if(!re||!We){Ve(!1);return}const Ae=he.current;if(!Ae||typeof IntersectionObserver>"u")return;const ye=new IntersectionObserver(([Ce])=>Ve(Ce.intersectionRatio<1),{threshold:[1],rootMargin:"0px 0px -1px 0px"});return ye.observe(Ae),()=>ye.disconnect()},[re,We]);const mt=xe&&Q("sticky z-10 bg-muted shadow-[inset_0_-1px_0_0_var(--color-border)]",ve),nt=xe?{top:ue==null?"var(--rcu-header-offset, 0px)":typeof ue=="number"?`${ue}px`:ue}:void 0;C.useEffect(()=>{const Ae=setTimeout(()=>{v&&fe!==h&&v(fe)},300);return()=>clearTimeout(Ae)},[fe]);const ft=Ae=>{if(!m||!Ae.sortable)return;const ye=Ae.sortKey||Ae.accessor||Ae.key;let Ce="asc";y===ye&&(_==="asc"?Ce="desc":_==="desc"&&(Ce=null)),S==null||S(Ce?ye:null,Ce)},bt=t.map(G),xt=new Set(k),qe=bt.filter(Ae=>xt.has(Ae)).length,wt=bt.length>0&&qe===bt.length,yt=qe>0&&!wt,Ue=Ae=>{if(Ae===!0){const ye=new Set(k);bt.forEach(Ce=>ye.add(Ce)),N==null||N([...ye])}else{const ye=new Set(bt);N==null||N(k.filter(Ce=>!ye.has(Ce)))}},rt=(Ae,ye)=>{if(ye){if(xt.has(Ae))return;N==null||N([...k,Ae])}else N==null||N(k.filter(Ce=>Ce!==Ae))},He=Ae=>(o-1)*l+Ae+1,Ye=Ae=>{const ye=Ae.accessor||Ae.key||"";return ie.includes("*")?!0:ie.length>0?ie.includes(ye):ye==="name"||ye==="title"},ht=(Ae,ye)=>!(!ae||Ae.disableClamping||typeof ye!="string"||ye.length<30),ot=(Ae,ye,Ce)=>{const at=Ae.accessor||Ae.key,Je=at?typeof at=="function"?at(ye):ye[at]:void 0;if(Ae.render)return Ae.render(Je,ye,Ce);if(Ae.format)return Ae.format(Je,ye);if(Je!==null&&typeof Je=="object")return"-";if(Ye(Ae)&&(ee||te)&&Je){const Vn=typeof Je=="string"&&ht(Ae,Je)?p.jsx(Bh,{text:Je,maxLines:Ae.maxLines||de}):Je;if(te){const on=te(ye);return!E&&se?p.jsx("a",{href:on,onClick:Wn=>{Wn.preventDefault(),Wn.stopPropagation(),se(on)},className:"underline font-medium hover:font-bold flex items-center gap-2 cursor-pointer max-w-full text-left text-foreground",children:Vn}):p.jsx("a",{href:on,target:E?"_blank":"_self",rel:"noopener noreferrer",onClick:Wn=>Wn.stopPropagation(),className:"underline font-medium hover:font-bold flex items-center gap-2 cursor-pointer max-w-full text-left text-foreground",children:Vn})}return p.jsx("button",{onClick:on=>{on.stopPropagation(),ee(ye)},className:"underline font-medium hover:font-bold",children:Vn})}return typeof Je=="string"&&ht(Ae,Je)?p.jsx(Bh,{text:Je,maxLines:Ae.maxLines||de}):Je??"-"},kt=Ae=>{if(!m||!Ae.sortable)return null;const ye=Ae.sortKey||Ae.accessor||Ae.key;return y!==ye?p.jsx(Kd,{className:"ml-2 h-3.5 w-3.5 opacity-40 hover:opacity-100"}):_?_==="asc"?p.jsx($5,{className:"ml-2 h-3.5 w-3.5 text-primary"}):p.jsx(H5,{className:"ml-2 h-3.5 w-3.5 text-primary"}):p.jsx(Kd,{className:"ml-2 h-3.5 w-3.5 opacity-40"})},$n=Ae=>{if(!R||R.length===0)return null;const ye=uy(R).filter(Ce=>Ce.hidden?typeof Ce.hidden=="function"?!Ce.hidden(Ae):!Ce.hidden:!0);return ye.length===0?null:p.jsxs(_l,{children:[p.jsx(Sl,{asChild:!0,children:p.jsxs(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted cursor-pointer",children:[p.jsx(K5,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Open menu"})]})}),p.jsxs(So,{align:"end",className:"w-40",children:[p.jsx(kl,{className:"text-xs font-semibold text-muted-foreground",children:"Actions"}),p.jsx(fs,{}),ye.map((Ce,at)=>p.jsxs(ds,{onClick:()=>{var Je;return(Je=Ce.onClick)==null?void 0:Je.call(Ce,Ae)},className:Q("text-sm cursor-pointer",Ce.variant==="destructive"&&"text-red-600 focus:text-red-600 focus:bg-red-50"),disabled:Ce.disabled,children:[Ce.icon&&p.jsx(Ce.icon,{className:"mr-2 h-4 w-4"}),Ce.label]},Ce.label||at))]})]})},gn=()=>{const Ae=Math.min(l||8,10);return Array.from({length:Ae}).map((ye,Ce)=>p.jsxs(Gi,{className:Q("border-b border-border",Se),children:[w&&p.jsx(Gn,{className:Q("pl-4",Fe),children:p.jsx(Ps,{className:"h-4 w-4 rounded"})}),$&&p.jsx(Gn,{className:Q(H&&"py-2",Fe),children:p.jsx(Ps,{className:"h-4 w-6"})}),n.map((at,Je)=>p.jsx(Gn,{className:Q(H?"py-2":"py-3",Fe),children:p.jsx(Ps,{className:"h-4",style:{width:`${60+Je*17%40}%`}})},at.accessor||Je)),R&&R.length>0&&p.jsx(Gn,{className:Q("text-right pr-4",Fe),children:p.jsx(Ps,{className:"h-8 w-8 rounded-md ml-auto"})})]},`skeleton-${Ce}`))},vn=n.length+(w?1:0)+($?1:0)+(R!=null&&R.length?1:0);return p.jsx(cu,{children:p.jsxs("div",{className:Q("w-full space-y-4",B),children:[(d||k.length>0||g||b)&&p.jsxs("div",{className:"flex items-center justify-between gap-4",children:[p.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[d&&p.jsxs("div",{className:"relative w-80",children:[p.jsx(S0,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),p.jsx(ni,{placeholder:x,value:fe,onChange:Ae=>De(Ae.target.value),className:"pl-10 pr-10 h-10 border-gray-300"}),fe&&p.jsx("button",{onClick:()=>{De(""),v==null||v("")},className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors cursor-pointer",children:p.jsx(er,{className:"h-4 w-4"})})]}),g&&p.jsx("div",{className:"flex items-center gap-2",children:C.Children.map(g,Ae=>p.jsx("div",{className:"w-[200px]",children:Ae}))})]}),w&&k.length>0&&p.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-primary/10 border border-primary/20 rounded-md",children:[p.jsxs("span",{className:"text-sm font-medium",children:[k.length," selected"]}),T&&D&&p.jsxs(sl,{delayDuration:300,children:[p.jsx(ol,{asChild:!0,children:p.jsx(Ke,{variant:"ghost",size:"icon",onClick:()=>D(k),disabled:L,"aria-label":I,className:"h-7 w-7 text-red-600 hover:text-red-600 hover:bg-red-50 cursor-pointer",children:L?p.jsx(Jn,{className:"h-4 w-4 animate-spin"}):p.jsx(Aa,{className:"h-4 w-4"})})}),p.jsx(uo,{side:"top",children:I})]}),p.jsx(Ke,{variant:"ghost",size:"sm",onClick:()=>N==null?void 0:N([]),className:"h-7 text-xs text-primary hover:text-primary hover:bg-primary/10 cursor-pointer",children:"Clear"})]}),b&&p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:b})]}),p.jsx("div",{className:Q("bg-card rounded-lg border border-border shadow-sm",xe?"overflow-clip":"overflow-hidden"),children:p.jsxs(pd,{className:be,containerClassName:xe?"overflow-visible":void 0,children:[p.jsx(gd,{className:ce,children:p.jsxs(Gi,{className:Q("bg-muted border-b border-border dark:hover:bg-muted",Ie),children:[w&&p.jsx(Zi,{className:Q("w-12 pl-4",mt,Re),style:nt,children:p.jsx(ss,{checked:wt,indeterminate:yt,onCheckedChange:Ue,"aria-label":wt?"Deselect all rows":"Select all rows",className:"border-gray-300 cursor-pointer"})}),$&&p.jsx(Zi,{className:Q("w-16 text-xs font-semibold text-muted-foreground uppercase tracking-wider",mt,Re),style:nt,children:Z}),n.map((Ae,ye)=>p.jsx(Zi,{className:Q("text-xs font-semibold text-muted-foreground uppercase tracking-wider",Ae.headerClassName,m&&Ae.sortable&&"cursor-pointer select-none",mt,Re),style:{width:Ae.width,minWidth:Ae.minWidth,maxWidth:Ae.maxWidth,...nt},onClick:()=>ft(Ae),children:p.jsxs("div",{className:"flex items-center",children:[Ae.header||Ae.label,kt(Ae)]})},Ae.accessor||ye)),R&&R.length>0&&p.jsx(Zi,{className:Q("w-16 text-xs font-semibold text-gray-600 uppercase tracking-wider text-right pr-4",mt,Re),style:nt,children:"Actions"})]})}),p.jsx(vd,{className:pe,children:r?gn():t.length===0?p.jsx(Gi,{className:Q(Xe,Se),children:p.jsx(Gn,{colSpan:vn,className:Q("h-48",Fe),children:fe?p.jsx(Sd,{searchTerm:fe,onClear:()=>{De(""),v==null||v("")}}):p.jsx(Ss,{title:j,description:F,onAction:q,actionLabel:Y})})}):t.map((Ae,ye)=>{const Ce=G(Ae),at=xt.has(Ce);return p.jsxs(Gi,{"data-state":at?"selected":void 0,className:Q("border-b border-border transition-colors",O&&ye%2===1&&"bg-gray-50",P&&"cursor-pointer",U&&!P&&at&&"bg-primary/20",Se),onClick:()=>P==null?void 0:P(Ae),children:[w&&p.jsx(Gn,{onClick:Je=>Je.stopPropagation(),className:Q("pl-4",Fe),children:p.jsx(ss,{checked:at,onCheckedChange:Je=>rt(Ce,Je===!0),"aria-label":at?"Deselect row":"Select row",className:"border-gray-300 cursor-pointer"})}),$&&p.jsx(Gn,{className:Q("text-muted-foreground font-medium",H&&"py-2",Fe),children:He(ye)}),n.map((Je,Vn)=>p.jsx(Gn,{className:Q("text-foreground",H?"py-2":"py-3",Je.cellClassName,Fe),style:{maxWidth:Je.maxWidth||"300px",minWidth:Je.minWidth},children:ot(Je,Ae,ye)},Je.accessor||Vn)),R&&R.length>0&&p.jsx(Gn,{onClick:Je=>Je.stopPropagation(),className:Q("text-right pr-4",Fe),children:$n(Ae)})]},Ce)})})]})}),We&&p.jsx("div",{ref:he,className:Q(re&&["sticky bottom-0 z-20 bg-background rounded-b-lg",Oe&&"border-t border-border shadow-[0_-2px_6px_-2px_rgba(0,0,0,0.12)]"],oe),children:p.jsx(Cd,{currentPage:o,totalPages:a,totalItems:c,pageSize:l,onPageChange:f,onPageSizeChange:u,className:X})})]})})};Ed.displayName="DataTable";const YD=F3.create((t,n)=>({sidebarOpen:!0,sidebarCollapsed:!1,modals:{},toasts:[],theme:"light",globalLoading:!1,toggleSidebar:()=>{t(r=>({sidebarOpen:!r.sidebarOpen}))},setSidebarOpen:r=>{t({sidebarOpen:r})},toggleSidebarCollapse:()=>{t(r=>({sidebarCollapsed:!r.sidebarCollapsed}))},setSidebarCollapsed:r=>{t({sidebarCollapsed:r})},openModal:(r,i=null)=>{t(s=>({modals:{...s.modals,[r]:{isOpen:!0,data:i}}}))},closeModal:r=>{t(i=>({modals:{...i.modals,[r]:{isOpen:!1,data:null}}}))},getModalState:r=>n().modals[r]||{isOpen:!1,data:null},addToast:r=>{const i=Date.now(),s={id:i,...r};return t(o=>({toasts:[...o.toasts,s]})),r.duration!==0&&setTimeout(()=>{n().removeToast(i)},r.duration||5e3),i},removeToast:r=>{t(i=>({toasts:i.toasts.filter(s=>s.id!==r)}))},clearToasts:()=>{t({toasts:[]})},setTheme:r=>{t({theme:r}),document.documentElement.classList.toggle("dark",r==="dark"),localStorage.setItem("theme",r)},toggleTheme:()=>{const r=n().theme==="light"?"dark":"light";n().setTheme(r)},initTheme:()=>{const r=localStorage.getItem("theme"),i=window.matchMedia("(prefers-color-scheme: dark)").matches,s=r||(i?"dark":"light");n().setTheme(s)},setGlobalLoading:r=>{t({globalLoading:r})}}));function Dl(){const{addToast:t,removeToast:n,toasts:r,clearToasts:i}=YD(),s=V.useCallback(u=>t(u),[t]),o=V.useCallback((u,m={})=>t({type:"success",message:u,...m}),[t]),l=V.useCallback((u,m={})=>t({type:"error",message:u,...m}),[t]),c=V.useCallback((u,m={})=>t({type:"warning",message:u,...m}),[t]),a=V.useCallback((u,m={})=>t({type:"info",message:u,...m}),[t]),f=V.useCallback(u=>{n(u)},[n]);return{toast:s,success:o,error:l,warning:c,info:a,dismiss:f,toasts:r,clearAll:i}}const dy=({store:t,data:n,loading:r=!1,error:i=null,skipInitialFetch:s=!1,columns:o=[],currentPage:l=1,pageSize:c=15,totalItems:a=0,totalPages:f=1,onPageChange:u,onPageSizeChange:m,sortColumn:y,sortDirection:_,onSort:S,searchValue:E="",onSearchChange:d,searchPlaceholder:h="Search...",openInNewTab:v=!1,selectable:x=!1,selectedRows:g,onSelectionChange:b,showBulkDelete:w=!1,onBulkDelete:k,bulkDeleteLabel:N="Delete selected",onCreate:T,onView:D,onEdit:I,onDelete:L,onRefresh:R,onExport:P,tableClassName:O,tableHeaderClassName:U,tableBodyClassName:H,tableRowClassName:B,tableHeadClassName:j,tableCellClassName:F,headerRowClassName:Y,statusRowClassName:q,paginationClassName:G,stickyPagination:$=!1,stickyPaginationClassName:Z,stickyHeader:ee=!1,stickyHeaderClassName:te,stickyHeaderOffset:se,createButtonClassName:ie,refreshButtonClassName:ae,exportButtonClassName:de,bulkActionButtonClassName:be,createPath:ce,detailPath:pe,editPath:Se,getBreadcrumbName:Re,customBreadcrumbPaths:Fe,getCustomBreadcrumbPath:Ie,additionalActions:Xe=[],bulkActions:X=[],title:re,description:oe,createLabel:xe="Create",refreshLabel:ve="Refresh",exportLabel:ue="Export",viewLabel:fe="View",editLabel:De="Edit",deleteLabel:he="Delete",itemName:Oe="item",getRowKey:Ve=kt=>kt.uuid||kt.id||kt._id,showHeader:We=!0,showToolbar:mt=!0,compact:nt=!1,className:ft,deleteConfirmTitle:bt,deleteConfirmDescription:xt,getDeleteItemName:qe,filters:wt,headerActions:yt,searchable:Ue=!0,showEditButton:rt=!0,showDeleteButton:He=!0,getParentPath:Ye,preserveLocationState:ht=!1,clickableColumns:ot=[]})=>{const kt=Gt.useNavigate(),[$n,gn]=Gt.useSearchParams(),{success:vn,error:Ae}=Dl(),[ye,Ce]=C.useState(!1),[at,Je]=C.useState(null),[Vn,on]=C.useState(!1),[Wn,ks]=C.useState(!1),[To,Ii]=C.useState(!1),[sr,Il]=C.useState(""),Tr=C.useRef(!1),me=C.useRef(sr),ge=C.useRef(!0),ke=Gt.useLocation(),Le=We&&(re||oe),it=()=>Math.max(window.scrollY||0,document.documentElement.scrollTop||0,document.body.scrollTop||0),Rt=Ne=>{window.scrollTo(0,Ne),document.documentElement.scrollTop=Ne,document.body.scrollTop=Ne},en=()=>Math.max(document.documentElement.scrollHeight||0,document.body.scrollHeight||0),Oi=(t==null?void 0:t.items)??n??[],or=(t==null?void 0:t.loading)??r,Un=(t==null?void 0:t.error)??i,Ht=(t==null?void 0:t.pagination)??{page:l,pageSize:c,total:a,totalPages:f},Nr=Ht.page??l,f3=Ht.pageSize??c,h3=Ht.total??a,m3=Ht.totalPages??f,[p3,g3]=C.useState([]),Ol=g!==void 0,An=Ol?g:p3,jd=C.useCallback(Ne=>{Ol||g3(Ne),b==null||b(Ne)},[Ol,b]),Nt=t==null?void 0:t.fetchList,pi=t==null?void 0:t.delete,Mr=t==null?void 0:t.setPage,Bl=t==null?void 0:t.setPageSize,gi=t==null?void 0:t.setFilters,v3=(t==null?void 0:t.sortColumn)??y,b3=(t==null?void 0:t.sortDirection)??_,y3=(t==null?void 0:t.setSort)??S;C.useEffect(()=>{if(Nt&&!Tr.current)if(Tr.current=!0,s)Tr.current=!0;else{const Ne=parseInt($n.get("page"),10);Ne>0&&Mr&&Mr(Ne),Nt()}},[Nt]),C.useEffect(()=>{if(!ge.current||or||!Tr.current)return;ge.current=!1;const Ne=`scrollPos:${ke.pathname}`,ut=sessionStorage.getItem(Ne);if(!ut)return;sessionStorage.removeItem(Ne);const St=parseInt(ut,10);if(!(St>0))return;let Dn=0;const Rn=40,Bi=()=>{const No=en()-window.innerHeight;if(No>=St||Dn>=Rn){Rt(Math.min(St,Math.max(No,0)));return}Dn++,setTimeout(Bi,50)};requestAnimationFrame(Bi)},[or,ke.pathname]),C.useEffect(()=>{if(!Nt||!Tr.current||me.current===sr)return;const Ne=setTimeout(()=>{Ue&&(me.current=sr,gi==null||gi({search:sr}),Nr!==1&&(Mr==null||Mr(1),gn(ut=>{const St=new URLSearchParams(ut);return St.delete("page"),St},{replace:!0})),Nt==null||Nt())},300);return()=>clearTimeout(Ne)},[sr,Ue,Nr,gi,Mr,Nt]);const x3=C.useCallback(Ne=>{Mr?(Mr(Ne),Nt==null||Nt(),gn(ut=>{const St=new URLSearchParams(ut);return Ne<=1?St.delete("page"):St.set("page",String(Ne)),St},{replace:!0})):u==null||u(Ne)},[Mr,Nt,u,gn]),w3=C.useCallback(Ne=>{Bl?(Bl(Ne),Nt==null||Nt(),gn(ut=>{const St=new URLSearchParams(ut);return St.delete("page"),St},{replace:!0})):m==null||m(Ne)},[Bl,Nt,m,gn]),C3=C.useCallback(Ne=>{gi?Il(Ne):d==null||d(Ne)},[gi,d]),Fd=C.useCallback(()=>{if(ce){const Ne=ht?(ke==null?void 0:ke.state)||{}:{},ut=Ie?Ie({}):Fe,St=Ye?Ye({}):null,Dn=ce.split("/").filter(Boolean)[0],Rn=ut||(St?{[Dn]:St}:void 0);kt(ce,{state:{...Ne,...Rn&&{customBreadcrumbPaths:Rn},...St&&{parentPath:St}}})}else T==null||T()},[ce,kt,T,Fe,Ie,Ye,ht,ke==null?void 0:ke.state]),zl=C.useCallback(Ne=>{if(pe){const ut=Re?Re(Ne):void 0,St=ht?(ke==null?void 0:ke.state)||{}:{},Dn=Ie?Ie(Ne):Fe,Rn=Ye?Ye(Ne):null,Bi=`${pe}/${Ve(Ne)}`;v?window.open(Bi,"_blank","noopener,noreferrer"):(sessionStorage.setItem(`scrollPos:${ke.pathname}`,String(it())),kt(Bi,{state:{...St,...ut&&{breadcrumbName:ut},...Dn&&{customBreadcrumbPaths:Dn},...Rn&&{parentPath:Rn}}}))}else D==null||D(Ne)},[pe,kt,Ve,D,Re,Fe,Ie,Ye,ht,ke==null?void 0:ke.state,v]),Hd=C.useCallback(Ne=>{if(Se){const ut=Re?Re(Ne):void 0,St=ht?(ke==null?void 0:ke.state)||{}:{},Dn=Ie?Ie(Ne):Fe,Rn=Ye?Ye(Ne):null,No=Se.split("?")[0].split("/").filter(Boolean)[0],Ud=Dn||(Rn?{[No]:Rn}:void 0);sessionStorage.setItem(`scrollPos:${ke.pathname}`,String(it())),kt(`${Se}/${Ve(Ne)}/edit`,{state:{...St,...ut&&{breadcrumbName:ut},...Ud&&{customBreadcrumbPaths:Ud},...Rn&&{parentPath:Rn}}})}else I==null||I(Ne)},[Se,kt,Ve,I,Re,Fe,Ie,Ye,ht,ke==null?void 0:ke.state]),_3=C.useCallback(()=>{Nt?Nt():R==null||R()},[Nt,R]),S3=C.useCallback(Ne=>{sessionStorage.setItem(`scrollPos:${ke.pathname}`,String(it())),kt(Ne)},[kt,ke.pathname]),$d=C.useCallback(Ne=>{Je(Ne),Ce(!0)},[]),k3=async()=>{var Ne;if(at){on(!0);try{pi?(await pi(Ve(at)),Nt==null||Nt(),vn(`${re} Deleted successfully`)):L&&(await L(at),vn(`${re} Deleted successfully`)),Ce(!1),Je(null)}catch(ut){Ae(((Ne=ut==null?void 0:ut.data)==null?void 0:Ne.message)||`Failed to delete ${Fl}`),console.error("Delete error:",ut)}finally{on(!1)}}},E3=async()=>{var Ne;if(An.length!==0){Ii(!0);try{if(k)await k(An);else if(pi)for(const ut of An)await pi(ut);Nt==null||Nt(),vn(`${An.length} ${Oe}${An.length===1?"":"s"} deleted successfully`),jd([]),ks(!1)}catch(ut){Ae(((Ne=ut==null?void 0:ut.data)==null?void 0:Ne.message)||`Failed to delete the selected ${Oe}s`),console.error("Bulk delete error:",ut)}finally{Ii(!1)}}},T3=C.useCallback((Ne,ut)=>{var St,Dn;t?((St=t.setSort)==null||St.call(t,Ne,ut),(Dn=t.fetchList)==null||Dn.call(t)):S==null||S(Ne,ut)},[t,S]),N3=C.useMemo(()=>{const Ne=[];return(pe||D)&&Ne.push({kind:"view",label:fe,icon:j1,onClick:zl}),Ne.push(...Xe),(Se||I)&&rt&&Ne.push({kind:"edit",label:De,icon:$1,onClick:Hd}),(pi||L)&&He&&Ne.push({kind:"delete",label:he,icon:Aa,variant:"destructive",onClick:$d}),Ne},[pe,Se,D,I,pi,L,fe,De,he,zl,Hd,$d,Xe,rt,He]),jl=ce||T,M3=Nt||R,A3=Ne=>!Ne||typeof Ne!="string"?Ne:Ne.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),D3=(Ne,ut=80)=>Ne.length>ut?Ne.slice(0,ut).trimEnd()+"…":Ne,Fl=C.useMemo(()=>{if(!at)return Oe;const Ne=qe?qe(at):at.name||at.title||Oe;return D3(A3(Ne)||Oe)},[at,qe,Oe]),Vd=()=>mt?p.jsxs("div",{className:"flex items-center gap-2",children:[yt,x&&An.length>0&&X.length>0&&p.jsx(p.Fragment,{children:X.map((Ne,ut)=>p.jsxs(Ke,{variant:Ne.variant||"outline",size:"sm",onClick:()=>{var St;return(St=Ne.onClick)==null?void 0:St.call(Ne,An)},disabled:Ne.disabled,className:Q("cursor-pointer",Ne.className,be),children:[Ne.icon&&p.jsx(Ne.icon,{className:"mr-2 h-4 w-4"}),Ne.label]},Ne.label||ut))}),P&&(C.isValidElement(P)?P:p.jsxs(Ke,{variant:"outline",size:"sm",onClick:P,className:Q("cursor-pointer",de),children:[p.jsx(Ks,{className:"mr-2 h-4 w-4"}),ue]})),M3&&p.jsxs(Ke,{variant:"outline",size:"sm",onClick:_3,disabled:or,className:Q("cursor-pointer",ae),children:[p.jsx(na,{className:Q("mr-2 h-4 w-4",or&&"animate-spin")}),ve]}),jl&&p.jsxs(Ke,{size:"sm",onClick:Fd,className:Q("cursor-pointer",ie),children:[p.jsx(sx,{className:"mr-2 h-4 w-4"}),xe]})]}):null,Wd=p.jsxs(p.Fragment,{children:[p.jsx(Ed,{data:Oi,columns:o,loading:or,error:Un,currentPage:Nr,pageSize:f3,totalItems:h3,totalPages:m3,onPageChange:x3,onPageSizeChange:w3,sortColumn:v3,sortDirection:b3,onSort:t?T3:y3,searchable:Ue,searchValue:gi?sr:E,filters:wt,onSearchChange:C3,searchPlaceholder:h,toolbarActions:!Le&&mt?Vd():null,selectable:x,selectedRows:An,onSelectionChange:jd,showBulkDelete:w&&!!(k||pi),onBulkDelete:()=>ks(!0),bulkDeleteLabel:N,bulkDeleteLoading:To,actions:N3,openInNewTab:v,onViewLink:pe?Ne=>`${pe}/${Ve(Ne)}`:void 0,onBeforeNavigate:v?void 0:S3,onViewClick:!pe&&D?zl:void 0,clickableColumns:ot,getRowKey:Ve,compact:nt,emptyTitle:`No ${Oe}s found`,emptyDescription:`Create your first ${Oe} to get started.`,emptyAction:jl?`Create ${Oe}`:void 0,onEmptyAction:jl?Fd:void 0,tableClassName:O,tableHeaderClassName:U,tableBodyClassName:H,tableRowClassName:B,tableHeadClassName:j,tableCellClassName:F,headerRowClassName:Y,statusRowClassName:q,paginationClassName:G,stickyPagination:$,stickyPaginationClassName:Z,stickyHeader:ee,stickyHeaderClassName:te,stickyHeaderOffset:se}),p.jsx(ms,{open:ye,onOpenChange:Ce,onConfirm:k3,title:bt||`Delete ${Oe}`,description:xt||`Are you sure you want to delete "${Fl}"? This action cannot be undone.`,itemName:Fl,loading:Vn}),p.jsx(ms,{open:Wn,onOpenChange:ks,onConfirm:E3,title:`Delete ${An.length} ${Oe}${An.length===1?"":"s"}`,description:`Are you sure you want to delete ${An.length} selected ${Oe}${An.length===1?"":"s"}? This action cannot be undone.`,loading:To})]});return Le?p.jsxs(yn,{className:Q("border-none shadow-none pt-0! bg-none!",ft),children:[p.jsxs(ns,{className:"flex flex-row items-center justify-between space-y-0 px-0 pb-6",children:[p.jsxs("div",{children:[re&&p.jsx(rs,{className:"text-xl font-semibold tracking-tight",children:re}),oe&&p.jsx(is,{children:oe})]}),Vd()]}),p.jsx(xn,{className:"px-0",children:Wd})]}):p.jsx("div",{className:ft,children:Wd})};dy.displayName="CrudList";var Eo=t=>t.type==="checkbox",Ci=t=>t instanceof Date,hn=t=>t==null;const fy=t=>typeof t=="object";var Zt=t=>!hn(t)&&!Array.isArray(t)&&fy(t)&&!Ci(t),GD=t=>Zt(t)&&t.target?Eo(t.target)?t.target.checked:t.target.value:t,ZD=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,XD=(t,n)=>t.has(ZD(n)),KD=t=>{const n=t.constructor&&t.constructor.prototype;return Zt(n)&&n.hasOwnProperty("isPrototypeOf")},Td=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function tn(t){let n;const r=Array.isArray(t),i=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)n=new Date(t);else if(!(Td&&(t instanceof Blob||i))&&(r||Zt(t)))if(n=r?[]:Object.create(Object.getPrototypeOf(t)),!r&&!KD(t))n=t;else for(const s in t)t.hasOwnProperty(s)&&(n[s]=tn(t[s]));else return t;return n}var Rl=t=>/^\w*$/.test(t),$t=t=>t===void 0,Nd=t=>Array.isArray(t)?t.filter(Boolean):[],Md=t=>Nd(t.replace(/["|']|\]/g,"").split(/\.|\[/)),je=(t,n,r)=>{if(!n||!Zt(t))return r;const i=(Rl(n)?[n]:Md(n)).reduce((s,o)=>hn(s)?s:s[o],t);return $t(i)||i===t?$t(t[n])?r:t[n]:i},lr=t=>typeof t=="boolean",Et=(t,n,r)=>{let i=-1;const s=Rl(n)?[n]:Md(n),o=s.length,l=o-1;for(;++i<o;){const c=s[i];let a=r;if(i!==l){const f=t[c];a=Zt(f)||Array.isArray(f)?f:isNaN(+s[i+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;t[c]=a,t=t[c]}};const zh={BLUR:"blur",FOCUS_OUT:"focusout"},Xn={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Rr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},QD=V.createContext(null);QD.displayName="HookFormContext";var JD=(t,n,r,i=!0)=>{const s={defaultValues:n._defaultValues};for(const o in t)Object.defineProperty(s,o,{get:()=>{const l=o;return n._proxyFormState[l]!==Xn.all&&(n._proxyFormState[l]=!i||Xn.all),t[l]}});return s};const eR=typeof window<"u"?V.useLayoutEffect:V.useEffect;var Sn=t=>typeof t=="string",tR=(t,n,r,i,s)=>Sn(t)?(i&&n.watch.add(t),je(r,t,s)):Array.isArray(t)?t.map(o=>(i&&n.watch.add(o),je(r,o))):(i&&(n.watchAll=!0),r),h0=t=>hn(t)||!fy(t);function Qr(t,n,r=new WeakSet){if(h0(t)||h0(n))return Object.is(t,n);if(Ci(t)&&Ci(n))return t.getTime()===n.getTime();const i=Object.keys(t),s=Object.keys(n);if(i.length!==s.length)return!1;if(r.has(t)||r.has(n))return!0;r.add(t),r.add(n);for(const o of i){const l=t[o];if(!s.includes(o))return!1;if(o!=="ref"){const c=n[o];if(Ci(l)&&Ci(c)||Zt(l)&&Zt(c)||Array.isArray(l)&&Array.isArray(c)?!Qr(l,c,r):!Object.is(l,c))return!1}}return!0}var hy=(t,n,r,i,s)=>n?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[i]:s||!0}}:{},Fs=t=>Array.isArray(t)?t:[t],jh=()=>{let t=[];return{get observers(){return t},next:s=>{for(const o of t)o.next&&o.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(o=>o!==s)}}),unsubscribe:()=>{t=[]}}};function my(t,n){const r={};for(const i in t)if(t.hasOwnProperty(i)){const s=t[i],o=n[i];if(s&&Zt(s)&&o){const l=my(s,o);Zt(l)&&(r[i]=l)}else t[i]&&(r[i]=o)}return r}var ln=t=>Zt(t)&&!Object.keys(t).length,Ad=t=>t.type==="file",Kn=t=>typeof t=="function",Sa=t=>{if(!Td)return!1;const n=t?t.ownerDocument:0;return t instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},py=t=>t.type==="select-multiple",Dd=t=>t.type==="radio",nR=t=>Dd(t)||Eo(t),Sc=t=>Sa(t)&&t.isConnected;function rR(t,n){const r=n.slice(0,-1).length;let i=0;for(;i<r;)t=$t(t)?i++:t[n[i++]];return t}function iR(t){for(const n in t)if(t.hasOwnProperty(n)&&!$t(t[n]))return!1;return!0}function Yt(t,n){const r=Array.isArray(n)?n:Rl(n)?[n]:Md(n),i=r.length===1?t:rR(t,r),s=r.length-1,o=r[s];return i&&delete i[o],s!==0&&(Zt(i)&&ln(i)||Array.isArray(i)&&iR(i))&&Yt(t,r.slice(0,-1)),t}var sR=t=>{for(const n in t)if(Kn(t[n]))return!0;return!1};function gy(t){return Array.isArray(t)||Zt(t)&&!sR(t)}function m0(t,n={}){for(const r in t){const i=t[r];gy(i)?(n[r]=Array.isArray(i)?[]:{},m0(i,n[r])):$t(i)||(n[r]=!0)}return n}function qi(t,n,r){r||(r=m0(n));for(const i in t){const s=t[i];if(gy(s))$t(n)||h0(r[i])?r[i]=m0(s,Array.isArray(s)?[]:{}):qi(s,hn(n)?{}:n[i],r[i]);else{const o=n[i];r[i]=!Qr(s,o)}}return r}const Fh={value:!1,isValid:!1},Hh={value:!0,isValid:!0};var vy=t=>{if(Array.isArray(t)){if(t.length>1){const n=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:n,isValid:!!n.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!$t(t[0].attributes.value)?$t(t[0].value)||t[0].value===""?Hh:{value:t[0].value,isValid:!0}:Hh:Fh}return Fh},by=(t,{valueAsNumber:n,valueAsDate:r,setValueAs:i})=>$t(t)?t:n?t===""?NaN:t&&+t:r&&Sn(t)?new Date(t):i?i(t):t;const $h={isValid:!1,value:null};var yy=t=>Array.isArray(t)?t.reduce((n,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:n,$h):$h;function Vh(t){const n=t.ref;return Ad(n)?n.files:Dd(n)?yy(t.refs).value:py(n)?[...n.selectedOptions].map(({value:r})=>r):Eo(n)?vy(t.refs).value:by($t(n.value)?t.ref.value:n.value,t)}var oR=(t,n,r,i)=>{const s={};for(const o of t){const l=je(n,o);l&&Et(s,o,l._f)}return{criteriaMode:r,names:[...t],fields:s,shouldUseNativeValidation:i}},ka=t=>t instanceof RegExp,As=t=>$t(t)?t:ka(t)?t.source:Zt(t)?ka(t.value)?t.value.source:t.value:t,Wh=t=>({isOnSubmit:!t||t===Xn.onSubmit,isOnBlur:t===Xn.onBlur,isOnChange:t===Xn.onChange,isOnAll:t===Xn.all,isOnTouch:t===Xn.onTouched});const Uh="AsyncFunction";var aR=t=>!!t&&!!t.validate&&!!(Kn(t.validate)&&t.validate.constructor.name===Uh||Zt(t.validate)&&Object.values(t.validate).find(n=>n.constructor.name===Uh)),lR=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),qh=(t,n,r)=>!r&&(n.watchAll||n.watch.has(t)||[...n.watch].some(i=>t.startsWith(i)&&/^\.\w+/.test(t.slice(i.length))));const Hs=(t,n,r,i)=>{for(const s of r||Object.keys(t)){const o=je(t,s);if(o){const{_f:l,...c}=o;if(l){if(l.refs&&l.refs[0]&&n(l.refs[0],s)&&!i)return!0;if(l.ref&&n(l.ref,l.name)&&!i)return!0;if(Hs(c,n))break}else if(Zt(c)&&Hs(c,n))break}}};function Yh(t,n,r){const i=je(t,r);if(i||Rl(r))return{error:i,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),l=je(n,o),c=je(t,o);if(l&&!Array.isArray(l)&&r!==o)return{name:r};if(c&&c.type)return{name:o,error:c};if(c&&c.root&&c.root.type)return{name:`${o}.root`,error:c.root};s.pop()}return{name:r}}var cR=(t,n,r,i)=>{r(t);const{name:s,...o}=t;return ln(o)||Object.keys(o).length>=Object.keys(n).length||Object.keys(o).find(l=>n[l]===(!i||Xn.all))},uR=(t,n,r)=>!t||!n||t===n||Fs(t).some(i=>i&&(r?i===n:i.startsWith(n)||n.startsWith(i))),dR=(t,n,r,i,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(n||t):(r?i.isOnBlur:s.isOnBlur)?!t:(r?i.isOnChange:s.isOnChange)?t:!0,fR=(t,n)=>!Nd(je(t,n)).length&&Yt(t,n),hR=(t,n,r)=>{const i=Fs(je(t,r));return Et(i,"root",n[r]),Et(t,r,i),t};function Gh(t,n,r="validate"){if(Sn(t)||Array.isArray(t)&&t.every(Sn)||lr(t)&&!t)return{type:r,message:Sn(t)?t:"",ref:n}}var Wi=t=>Zt(t)&&!ka(t)?t:{value:t,message:""},Zh=async(t,n,r,i,s,o)=>{const{ref:l,refs:c,required:a,maxLength:f,minLength:u,min:m,max:y,pattern:_,validate:S,name:E,valueAsNumber:d,mount:h}=t._f,v=je(r,E);if(!h||n.has(E))return{};const x=c?c[0]:l,g=L=>{s&&x.reportValidity&&(x.setCustomValidity(lr(L)?"":L||""),x.reportValidity())},b={},w=Dd(l),k=Eo(l),N=w||k,T=(d||Ad(l))&&$t(l.value)&&$t(v)||Sa(l)&&l.value===""||v===""||Array.isArray(v)&&!v.length,D=hy.bind(null,E,i,b),I=(L,R,P,O=Rr.maxLength,U=Rr.minLength)=>{const H=L?R:P;b[E]={type:L?O:U,message:H,ref:l,...D(L?O:U,H)}};if(o?!Array.isArray(v)||!v.length:a&&(!N&&(T||hn(v))||lr(v)&&!v||k&&!vy(c).isValid||w&&!yy(c).isValid)){const{value:L,message:R}=Sn(a)?{value:!!a,message:a}:Wi(a);if(L&&(b[E]={type:Rr.required,message:R,ref:x,...D(Rr.required,R)},!i))return g(R),b}if(!T&&(!hn(m)||!hn(y))){let L,R;const P=Wi(y),O=Wi(m);if(!hn(v)&&!isNaN(v)){const U=l.valueAsNumber||v&&+v;hn(P.value)||(L=U>P.value),hn(O.value)||(R=U<O.value)}else{const U=l.valueAsDate||new Date(v),H=F=>new Date(new Date().toDateString()+" "+F),B=l.type=="time",j=l.type=="week";Sn(P.value)&&v&&(L=B?H(v)>H(P.value):j?v>P.value:U>new Date(P.value)),Sn(O.value)&&v&&(R=B?H(v)<H(O.value):j?v<O.value:U<new Date(O.value))}if((L||R)&&(I(!!L,P.message,O.message,Rr.max,Rr.min),!i))return g(b[E].message),b}if((f||u)&&!T&&(Sn(v)||o&&Array.isArray(v))){const L=Wi(f),R=Wi(u),P=!hn(L.value)&&v.length>+L.value,O=!hn(R.value)&&v.length<+R.value;if((P||O)&&(I(P,L.message,R.message),!i))return g(b[E].message),b}if(_&&!T&&Sn(v)){const{value:L,message:R}=Wi(_);if(ka(L)&&!v.match(L)&&(b[E]={type:Rr.pattern,message:R,ref:l,...D(Rr.pattern,R)},!i))return g(R),b}if(S){if(Kn(S)){const L=await S(v,r),R=Gh(L,x);if(R&&(b[E]={...R,...D(Rr.validate,R.message)},!i))return g(R.message),b}else if(Zt(S)){let L={};for(const R in S){if(!ln(L)&&!i)break;const P=Gh(await S[R](v,r),x,R);P&&(L={...P,...D(R,P.message)},g(P.message),i&&(b[E]=L))}if(!ln(L)&&(b[E]={ref:x,...L},!i))return b}}return g(!0),b};const mR={mode:Xn.onSubmit,reValidateMode:Xn.onChange,shouldFocusError:!0};function pR(t={}){let n={...mR,...t},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Kn(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},i={},s=Zt(n.defaultValues)||Zt(n.values)?tn(n.defaultValues||n.values)||{}:{},o=n.shouldUnregister?{}:tn(s),l={action:!1,mount:!1,watch:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},a,f=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let m={...u};const y={array:jh(),state:jh()},_=n.criteriaMode===Xn.all,S=X=>re=>{clearTimeout(f),f=setTimeout(X,re)},E=async X=>{if(!n.disabled&&(u.isValid||m.isValid||X)){const re=n.resolver?ln((await k()).errors):await T(i,!0);re!==r.isValid&&y.state.next({isValid:re})}},d=(X,re)=>{!n.disabled&&(u.isValidating||u.validatingFields||m.isValidating||m.validatingFields)&&((X||Array.from(c.mount)).forEach(oe=>{oe&&(re?Et(r.validatingFields,oe,re):Yt(r.validatingFields,oe))}),y.state.next({validatingFields:r.validatingFields,isValidating:!ln(r.validatingFields)}))},h=(X,re=[],oe,xe,ve=!0,ue=!0)=>{if(xe&&oe&&!n.disabled){if(l.action=!0,ue&&Array.isArray(je(i,X))){const fe=oe(je(i,X),xe.argA,xe.argB);ve&&Et(i,X,fe)}if(ue&&Array.isArray(je(r.errors,X))){const fe=oe(je(r.errors,X),xe.argA,xe.argB);ve&&Et(r.errors,X,fe),fR(r.errors,X)}if((u.touchedFields||m.touchedFields)&&ue&&Array.isArray(je(r.touchedFields,X))){const fe=oe(je(r.touchedFields,X),xe.argA,xe.argB);ve&&Et(r.touchedFields,X,fe)}(u.dirtyFields||m.dirtyFields)&&(r.dirtyFields=qi(s,o)),y.state.next({name:X,isDirty:I(X,re),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Et(o,X,re)},v=(X,re)=>{Et(r.errors,X,re),y.state.next({errors:r.errors})},x=X=>{r.errors=X,y.state.next({errors:r.errors,isValid:!1})},g=(X,re,oe,xe)=>{const ve=je(i,X);if(ve){const ue=je(o,X,$t(oe)?je(s,X):oe);$t(ue)||xe&&xe.defaultChecked||re?Et(o,X,re?ue:Vh(ve._f)):P(X,ue),l.mount&&!l.action&&E()}},b=(X,re,oe,xe,ve)=>{let ue=!1,fe=!1;const De={name:X};if(!n.disabled){if(!oe||xe){(u.isDirty||m.isDirty)&&(fe=r.isDirty,r.isDirty=De.isDirty=I(),ue=fe!==De.isDirty);const he=Qr(je(s,X),re);fe=!!je(r.dirtyFields,X),he?Yt(r.dirtyFields,X):Et(r.dirtyFields,X,!0),De.dirtyFields=r.dirtyFields,ue=ue||(u.dirtyFields||m.dirtyFields)&&fe!==!he}if(oe){const he=je(r.touchedFields,X);he||(Et(r.touchedFields,X,oe),De.touchedFields=r.touchedFields,ue=ue||(u.touchedFields||m.touchedFields)&&he!==oe)}ue&&ve&&y.state.next(De)}return ue?De:{}},w=(X,re,oe,xe)=>{const ve=je(r.errors,X),ue=(u.isValid||m.isValid)&&lr(re)&&r.isValid!==re;if(n.delayError&&oe?(a=S(()=>v(X,oe)),a(n.delayError)):(clearTimeout(f),a=null,oe?Et(r.errors,X,oe):Yt(r.errors,X)),(oe?!Qr(ve,oe):ve)||!ln(xe)||ue){const fe={...xe,...ue&&lr(re)?{isValid:re}:{},errors:r.errors,name:X};r={...r,...fe},y.state.next(fe)}},k=async X=>{d(X,!0);const re=await n.resolver(o,n.context,oR(X||c.mount,i,n.criteriaMode,n.shouldUseNativeValidation));return d(X),re},N=async X=>{const{errors:re}=await k(X);if(X)for(const oe of X){const xe=je(re,oe);xe?Et(r.errors,oe,xe):Yt(r.errors,oe)}else r.errors=re;return re},T=async(X,re,oe={valid:!0})=>{for(const xe in X){const ve=X[xe];if(ve){const{_f:ue,...fe}=ve;if(ue){const De=c.array.has(ue.name),he=ve._f&&aR(ve._f);he&&u.validatingFields&&d([ue.name],!0);const Oe=await Zh(ve,c.disabled,o,_,n.shouldUseNativeValidation&&!re,De);if(he&&u.validatingFields&&d([ue.name]),Oe[ue.name]&&(oe.valid=!1,re))break;!re&&(je(Oe,ue.name)?De?hR(r.errors,Oe,ue.name):Et(r.errors,ue.name,Oe[ue.name]):Yt(r.errors,ue.name))}!ln(fe)&&await T(fe,re,oe)}}return oe.valid},D=()=>{for(const X of c.unMount){const re=je(i,X);re&&(re._f.refs?re._f.refs.every(oe=>!Sc(oe)):!Sc(re._f.ref))&&te(X)}c.unMount=new Set},I=(X,re)=>!n.disabled&&(X&&re&&Et(o,X,re),!Qr(F(),s)),L=(X,re,oe)=>tR(X,c,{...l.mount?o:$t(re)?s:Sn(X)?{[X]:re}:re},oe,re),R=X=>Nd(je(l.mount?o:s,X,n.shouldUnregister?je(s,X,[]):[])),P=(X,re,oe={})=>{const xe=je(i,X);let ve=re;if(xe){const ue=xe._f;ue&&(!ue.disabled&&Et(o,X,by(re,ue)),ve=Sa(ue.ref)&&hn(re)?"":re,py(ue.ref)?[...ue.ref.options].forEach(fe=>fe.selected=ve.includes(fe.value)):ue.refs?Eo(ue.ref)?ue.refs.forEach(fe=>{(!fe.defaultChecked||!fe.disabled)&&(Array.isArray(ve)?fe.checked=!!ve.find(De=>De===fe.value):fe.checked=ve===fe.value||!!ve)}):ue.refs.forEach(fe=>fe.checked=fe.value===ve):Ad(ue.ref)?ue.ref.value="":(ue.ref.value=ve,ue.ref.type||y.state.next({name:X,values:tn(o)})))}(oe.shouldDirty||oe.shouldTouch)&&b(X,ve,oe.shouldTouch,oe.shouldDirty,!0),oe.shouldValidate&&j(X)},O=(X,re,oe)=>{for(const xe in re){if(!re.hasOwnProperty(xe))return;const ve=re[xe],ue=X+"."+xe,fe=je(i,ue);(c.array.has(X)||Zt(ve)||fe&&!fe._f)&&!Ci(ve)?O(ue,ve,oe):P(ue,ve,oe)}},U=(X,re,oe={})=>{const xe=je(i,X),ve=c.array.has(X),ue=tn(re);Et(o,X,ue),ve?(y.array.next({name:X,values:tn(o)}),(u.isDirty||u.dirtyFields||m.isDirty||m.dirtyFields)&&oe.shouldDirty&&y.state.next({name:X,dirtyFields:qi(s,o),isDirty:I(X,ue)})):xe&&!xe._f&&!hn(ue)?O(X,ue,oe):P(X,ue,oe),qh(X,c)&&y.state.next({...r,name:X}),y.state.next({name:l.mount?X:void 0,values:tn(o)})},H=async X=>{l.mount=!0;const re=X.target;let oe=re.name,xe=!0;const ve=je(i,oe),ue=he=>{xe=Number.isNaN(he)||Ci(he)&&isNaN(he.getTime())||Qr(he,je(o,oe,he))},fe=Wh(n.mode),De=Wh(n.reValidateMode);if(ve){let he,Oe;const Ve=re.type?Vh(ve._f):GD(X),We=X.type===zh.BLUR||X.type===zh.FOCUS_OUT,mt=!lR(ve._f)&&!n.resolver&&!je(r.errors,oe)&&!ve._f.deps||dR(We,je(r.touchedFields,oe),r.isSubmitted,De,fe),nt=qh(oe,c,We);Et(o,oe,Ve),We?(!re||!re.readOnly)&&(ve._f.onBlur&&ve._f.onBlur(X),a&&a(0)):ve._f.onChange&&ve._f.onChange(X);const ft=b(oe,Ve,We),bt=!ln(ft)||nt;if(!We&&y.state.next({name:oe,type:X.type,values:tn(o)}),mt)return(u.isValid||m.isValid)&&(n.mode==="onBlur"?We&&E():We||E()),bt&&y.state.next({name:oe,...nt?{}:ft});if(!We&&nt&&y.state.next({...r}),n.resolver){const{errors:xt}=await k([oe]);if(ue(Ve),xe){const qe=Yh(r.errors,i,oe),wt=Yh(xt,i,qe.name||oe);he=wt.error,oe=wt.name,Oe=ln(xt)}}else d([oe],!0),he=(await Zh(ve,c.disabled,o,_,n.shouldUseNativeValidation))[oe],d([oe]),ue(Ve),xe&&(he?Oe=!1:(u.isValid||m.isValid)&&(Oe=await T(i,!0)));xe&&(ve._f.deps&&(!Array.isArray(ve._f.deps)||ve._f.deps.length>0)&&j(ve._f.deps),w(oe,Oe,he,ft))}},B=(X,re)=>{if(je(r.errors,re)&&X.focus)return X.focus(),1},j=async(X,re={})=>{let oe,xe;const ve=Fs(X);if(n.resolver){const ue=await N($t(X)?X:ve);oe=ln(ue),xe=X?!ve.some(fe=>je(ue,fe)):oe}else X?(xe=(await Promise.all(ve.map(async ue=>{const fe=je(i,ue);return await T(fe&&fe._f?{[ue]:fe}:fe)}))).every(Boolean),!(!xe&&!r.isValid)&&E()):xe=oe=await T(i);return y.state.next({...!Sn(X)||(u.isValid||m.isValid)&&oe!==r.isValid?{}:{name:X},...n.resolver||!X?{isValid:oe}:{},errors:r.errors}),re.shouldFocus&&!xe&&Hs(i,B,X?ve:c.mount),xe},F=(X,re)=>{let oe={...l.mount?o:s};return re&&(oe=my(re.dirtyFields?r.dirtyFields:r.touchedFields,oe)),$t(X)?oe:Sn(X)?je(oe,X):X.map(xe=>je(oe,xe))},Y=(X,re)=>({invalid:!!je((re||r).errors,X),isDirty:!!je((re||r).dirtyFields,X),error:je((re||r).errors,X),isValidating:!!je(r.validatingFields,X),isTouched:!!je((re||r).touchedFields,X)}),q=X=>{X&&Fs(X).forEach(re=>Yt(r.errors,re)),y.state.next({errors:X?r.errors:{}})},G=(X,re,oe)=>{const xe=(je(i,X,{_f:{}})._f||{}).ref,ve=je(r.errors,X)||{},{ref:ue,message:fe,type:De,...he}=ve;Et(r.errors,X,{...he,...re,ref:xe}),y.state.next({name:X,errors:r.errors,isValid:!1}),oe&&oe.shouldFocus&&xe&&xe.focus&&xe.focus()},$=(X,re)=>Kn(X)?y.state.subscribe({next:oe=>"values"in oe&&X(L(void 0,re),oe)}):L(X,re,!0),Z=X=>y.state.subscribe({next:re=>{uR(X.name,re.name,X.exact)&&cR(re,X.formState||u,Fe,X.reRenderRoot)&&X.callback({values:{...o},...r,...re,defaultValues:s})}}).unsubscribe,ee=X=>(l.mount=!0,m={...m,...X.formState},Z({...X,formState:m})),te=(X,re={})=>{for(const oe of X?Fs(X):c.mount)c.mount.delete(oe),c.array.delete(oe),re.keepValue||(Yt(i,oe),Yt(o,oe)),!re.keepError&&Yt(r.errors,oe),!re.keepDirty&&Yt(r.dirtyFields,oe),!re.keepTouched&&Yt(r.touchedFields,oe),!re.keepIsValidating&&Yt(r.validatingFields,oe),!n.shouldUnregister&&!re.keepDefaultValue&&Yt(s,oe);y.state.next({values:tn(o)}),y.state.next({...r,...re.keepDirty?{isDirty:I()}:{}}),!re.keepIsValid&&E()},se=({disabled:X,name:re})=>{(lr(X)&&l.mount||X||c.disabled.has(re))&&(X?c.disabled.add(re):c.disabled.delete(re))},ie=(X,re={})=>{let oe=je(i,X);const xe=lr(re.disabled)||lr(n.disabled);return Et(i,X,{...oe||{},_f:{...oe&&oe._f?oe._f:{ref:{name:X}},name:X,mount:!0,...re}}),c.mount.add(X),oe?se({disabled:lr(re.disabled)?re.disabled:n.disabled,name:X}):g(X,!0,re.value),{...xe?{disabled:re.disabled||n.disabled}:{},...n.progressive?{required:!!re.required,min:As(re.min),max:As(re.max),minLength:As(re.minLength),maxLength:As(re.maxLength),pattern:As(re.pattern)}:{},name:X,onChange:H,onBlur:H,ref:ve=>{if(ve){ie(X,re),oe=je(i,X);const ue=$t(ve.value)&&ve.querySelectorAll&&ve.querySelectorAll("input,select,textarea")[0]||ve,fe=nR(ue),De=oe._f.refs||[];if(fe?De.find(he=>he===ue):ue===oe._f.ref)return;Et(i,X,{_f:{...oe._f,...fe?{refs:[...De.filter(Sc),ue,...Array.isArray(je(s,X))?[{}]:[]],ref:{type:ue.type,name:X}}:{ref:ue}}}),g(X,!1,void 0,ue)}else oe=je(i,X,{}),oe._f&&(oe._f.mount=!1),(n.shouldUnregister||re.shouldUnregister)&&!(XD(c.array,X)&&l.action)&&c.unMount.add(X)}}},ae=()=>n.shouldFocusError&&Hs(i,B,c.mount),de=X=>{lr(X)&&(y.state.next({disabled:X}),Hs(i,(re,oe)=>{const xe=je(i,oe);xe&&(re.disabled=xe._f.disabled||X,Array.isArray(xe._f.refs)&&xe._f.refs.forEach(ve=>{ve.disabled=xe._f.disabled||X}))},0,!1))},be=(X,re)=>async oe=>{let xe;oe&&(oe.preventDefault&&oe.preventDefault(),oe.persist&&oe.persist());let ve=tn(o);if(y.state.next({isSubmitting:!0}),n.resolver){const{errors:ue,values:fe}=await k();r.errors=ue,ve=tn(fe)}else await T(i);if(c.disabled.size)for(const ue of c.disabled)Yt(ve,ue);if(Yt(r.errors,"root"),ln(r.errors)){y.state.next({errors:{}});try{await X(ve,oe)}catch(ue){xe=ue}}else re&&await re({...r.errors},oe),ae(),setTimeout(ae);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ln(r.errors)&&!xe,submitCount:r.submitCount+1,errors:r.errors}),xe)throw xe},ce=(X,re={})=>{je(i,X)&&($t(re.defaultValue)?U(X,tn(je(s,X))):(U(X,re.defaultValue),Et(s,X,tn(re.defaultValue))),re.keepTouched||Yt(r.touchedFields,X),re.keepDirty||(Yt(r.dirtyFields,X),r.isDirty=re.defaultValue?I(X,tn(je(s,X))):I()),re.keepError||(Yt(r.errors,X),u.isValid&&E()),y.state.next({...r}))},pe=(X,re={})=>{const oe=X?tn(X):s,xe=tn(oe),ve=ln(X),ue=ve?s:xe;if(re.keepDefaultValues||(s=oe),!re.keepValues){if(re.keepDirtyValues){const fe=new Set([...c.mount,...Object.keys(qi(s,o))]);for(const De of Array.from(fe))je(r.dirtyFields,De)?Et(ue,De,je(o,De)):U(De,je(ue,De))}else{if(Td&&$t(X))for(const fe of c.mount){const De=je(i,fe);if(De&&De._f){const he=Array.isArray(De._f.refs)?De._f.refs[0]:De._f.ref;if(Sa(he)){const Oe=he.closest("form");if(Oe){Oe.reset();break}}}}if(re.keepFieldsRef)for(const fe of c.mount)U(fe,je(ue,fe));else i={}}o=n.shouldUnregister?re.keepDefaultValues?tn(s):{}:tn(ue),y.array.next({values:{...ue}}),y.state.next({values:{...ue}})}c={mount:re.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!u.isValid||!!re.keepIsValid||!!re.keepDirtyValues||!n.shouldUnregister&&!ln(ue),l.watch=!!n.shouldUnregister,l.action=!1,re.keepErrors||(r.errors={}),y.state.next({submitCount:re.keepSubmitCount?r.submitCount:0,isDirty:ve?!1:re.keepDirty?r.isDirty:!!(re.keepDefaultValues&&!Qr(X,s)),isSubmitted:re.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:ve?{}:re.keepDirtyValues?re.keepDefaultValues&&o?qi(s,o):r.dirtyFields:re.keepDefaultValues&&X?qi(s,X):re.keepDirty?r.dirtyFields:{},touchedFields:re.keepTouched?r.touchedFields:{},errors:re.keepErrors?r.errors:{},isSubmitSuccessful:re.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Se=(X,re)=>pe(Kn(X)?X(o):X,re),Re=(X,re={})=>{const oe=je(i,X),xe=oe&&oe._f;if(xe){const ve=xe.refs?xe.refs[0]:xe.ref;ve.focus&&(ve.focus(),re.shouldSelect&&Kn(ve.select)&&ve.select())}},Fe=X=>{r={...r,...X}},Xe={control:{register:ie,unregister:te,getFieldState:Y,handleSubmit:be,setError:G,_subscribe:Z,_runSchema:k,_focusError:ae,_getWatch:L,_getDirty:I,_setValid:E,_setFieldArray:h,_setDisabledField:se,_setErrors:x,_getFieldArray:R,_reset:pe,_resetDefaultValues:()=>Kn(n.defaultValues)&&n.defaultValues().then(X=>{Se(X,n.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:de,_subjects:y,_proxyFormState:u,get _fields(){return i},get _formValues(){return o},get _state(){return l},set _state(X){l=X},get _defaultValues(){return s},get _names(){return c},set _names(X){c=X},get _formState(){return r},get _options(){return n},set _options(X){n={...n,...X}}},subscribe:ee,trigger:j,register:ie,handleSubmit:be,watch:$,setValue:U,getValues:F,reset:Se,resetField:ce,clearErrors:q,unregister:te,setError:G,setFocus:Re,getFieldState:Y};return{...Xe,formControl:Xe}}function gR(t={}){const n=V.useRef(void 0),r=V.useRef(void 0),[i,s]=V.useState({isDirty:!1,isValidating:!1,isLoading:Kn(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Kn(t.defaultValues)?void 0:t.defaultValues});if(!n.current)if(t.formControl)n.current={...t.formControl,formState:i},t.defaultValues&&!Kn(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:l,...c}=pR(t);n.current={...c,formState:i}}const o=n.current.control;return o._options=t,eR(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(c=>({...c,isReady:!0})),o._formState.isReady=!0,l},[o]),V.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),V.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),V.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),V.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),V.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==i.isDirty&&o._subjects.state.next({isDirty:l})}},[o,i.isDirty]),V.useEffect(()=>{var l;t.values&&!Qr(t.values,r.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((l=o._options.resetOptions)===null||l===void 0)&&l.keepIsValid||o._setValid(),r.current=t.values,s(c=>({...c}))):o._resetDefaultValues()},[o,t.values]),V.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),n.current.formState=JD(i,o),n.current}const Xh=(t,n,r)=>{if(t&&"reportValidity"in t){const i=je(r,n);t.setCustomValidity(i&&i.message||""),t.reportValidity()}},xy=(t,n)=>{for(const r in n.fields){const i=n.fields[r];i&&i.ref&&"reportValidity"in i.ref?Xh(i.ref,r,t):i.refs&&i.refs.forEach(s=>Xh(s,r,t))}},vR=(t,n)=>{n.shouldUseNativeValidation&&xy(t,n);const r={};for(const i in t){const s=je(n.fields,i),o=Object.assign(t[i]||{},{ref:s&&s.ref});if(bR(n.names||Object.keys(t),i)){const l=Object.assign({},je(r,i));Et(l,"root",o),Et(r,i,l)}else Et(r,i,o)}return r},bR=(t,n)=>t.some(r=>r.startsWith(n+"."));var yR=function(t,n){for(var r={};t.length;){var i=t[0],s=i.code,o=i.message,l=i.path.join(".");if(!r[l])if("unionErrors"in i){var c=i.unionErrors[0].errors[0];r[l]={message:c.message,type:c.code}}else r[l]={message:o,type:s};if("unionErrors"in i&&i.unionErrors.forEach(function(u){return u.errors.forEach(function(m){return t.push(m)})}),n){var a=r[l].types,f=a&&a[i.code];r[l]=hy(l,n,r,s,f?[].concat(f,i.message):i.message)}t.shift()}return r},xR=function(t,n,r){return r===void 0&&(r={}),function(i,s,o){try{return Promise.resolve(function(l,c){try{var a=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](i,n)).then(function(f){return o.shouldUseNativeValidation&&xy({},o),{errors:{},values:r.raw?i:f}})}catch(f){return c(f)}return a&&a.then?a.then(void 0,c):a}(0,function(l){if(function(c){return Array.isArray(c==null?void 0:c.errors)}(l))return{values:{},errors:vR(yR(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const wy=V.createContext();function Cy({children:t}){const[n,r]=V.useState({}),i=V.useCallback((l,c)=>{r(a=>({...a,[l]:c}))},[]),s=V.useCallback(l=>n[l],[n]),o=V.useCallback(l=>{r(c=>{const a={...c};return delete a[l],a})},[]);return p.jsx(wy.Provider,{value:{breadcrumbNames:n,setBreadcrumbName:i,getBreadcrumbName:s,clearBreadcrumbName:o},children:t})}function Pl(){const t=V.useContext(wy);if(!t)throw new Error("useBreadcrumb must be used within BreadcrumbProvider");return t}const wR='[aria-invalid="true"], p.text-destructive',Kh='input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [contenteditable="true"], [tabindex]:not([tabindex="-1"])';function Qh(t){t&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{var i,s;const n=t.querySelector(wR);if(!n)return;n.scrollIntoView({behavior:"smooth",block:"center"});const r=n.matches(Kh)?n:(i=n.parentElement)==null?void 0:i.querySelector(Kh);(s=r==null?void 0:r.focus)==null||s.call(r,{preventScroll:!0})})})}const CR={email:"Enter a valid email address",url:"Enter a valid URL"},_R=t=>{const n={};return Array.from((t==null?void 0:t.elements)||[]).forEach(r=>{r.name&&r.willValidate&&r.validity.typeMismatch&&(n[r.name]=CR[r.type])}),n},_y=t=>{const n=[];return C.Children.forEach(t,r=>{var o,l,c;if(!C.isValidElement(r))return;const i=(o=r.props)==null?void 0:o.name,s=(l=r.props)==null?void 0:l.required;i&&s&&n.push({name:i,label:r.props.label||i}),(c=r.props)!=null&&c.children&&n.push(..._y(r.props.children))}),n},Sy=({useStore:t,fields:n=[],defaultValues:r={},validationSchema:i,children:s,onSubmit:o,onCancel:l,onBack:c,onBeforeSubmit:a,onAfterCreate:f,initialData:u=null,loading:m=!1,submitting:y=!1,title:_,description:S,submitLabel:E="Save",cancelLabel:d="Cancel",backLabel:h="Back",columns:v=1,showHeader:x=!0,showFooter:g=!0,showBack:b=!0,showCard:w=!0,listPath:k,icon:N,className:T,getBreadcrumbName:D,...I})=>{var ue;const L=Gt.useNavigate(),{uuid:R}=Gt.useParams(),{success:P,error:O}=Dl(),{setBreadcrumbName:U,clearBreadcrumbName:H}=Pl(),B=!!R,j=t==null?void 0:t(),F=j==null?void 0:j.form,Y=(j==null?void 0:j.loading)??!1,q=((ue=j==null?void 0:j.form)==null?void 0:ue.isSubmitting)??!1,G=(j==null?void 0:j.fetchAndPopulateForm)||(j==null?void 0:j.fetchById)||(j==null?void 0:j.fetchOne),$=j==null?void 0:j.create,Z=j==null?void 0:j.update,ee=j==null?void 0:j.resetForm,te=m||Y,se=y||q,ie=C.useRef(null),ae=C.useRef(!1),de=C.useRef(null);C.useEffect(()=>{B&&R&&G&&R!==de.current&&(de.current=R,ae.current=!0,G(R))},[R,B,G]),C.useEffect(()=>{!B&&ee&&ee()},[B,ee]),C.useEffect(()=>()=>{ee&&setTimeout(()=>{ee()},0),ae.current=!1,de.current=null},[]),C.useEffect(()=>{if(B&&R&&D&&(F!=null&&F.values)){const fe=F.values;if(fe&&Object.entries(fe).some(([he,Oe])=>Oe!==""&&Oe!==null&&Oe!==void 0&&he!=="uuid")){const he=D(fe);he&&U(R,he)}}},[R,B,F==null?void 0:F.values,D,U]),C.useEffect(()=>{const fe=R;return()=>{fe&&H(fe)}},[R,H]);const be=C.useCallback(()=>{ee&&ee(),c?c():L(k||-1)},[c,k,L,ee]),ce=C.useCallback(()=>{ee&&ee(),l?l():be()},[l,be,ee]),pe=async fe=>{var Ve,We,mt,nt,ft,bt,xt;(Ve=fe==null?void 0:fe.preventDefault)==null||Ve.call(fe);const De=(F==null?void 0:F.values)||{},he=_y(s),Oe=_R(ie.current);if(he.forEach(({name:qe,label:wt})=>{const yt=De[qe];(yt==null||yt===""||Array.isArray(yt)&&yt.length===0||typeof yt=="object"&&!Array.isArray(yt)&&yt!==null&&Object.keys(yt).length===0)&&(Oe[qe]=`${wt} is required`)}),Object.keys(Oe).length>0){j==null||j.setFormErrors(Oe),Qh(ie.current);return}j==null||j.setFormErrors({});try{let qe=De;if(a&&(qe=a(qe)),B)await(Z==null?void 0:Z(R,qe)),P(`${_||"Item"} updated successfully`),ee&&ee(),be();else{const wt=await($==null?void 0:$(qe));P(`${_||"Item"} created successfully`),ee&&ee(),f&&wt?f(wt,L):be()}}catch(qe){const wt=((mt=(We=qe==null?void 0:qe.data)==null?void 0:We.error)==null?void 0:mt.details)||((nt=qe==null?void 0:qe.error)==null?void 0:nt.details),yt=((bt=(ft=qe==null?void 0:qe.data)==null?void 0:ft.error)==null?void 0:bt.message)||((xt=qe==null?void 0:qe.data)==null?void 0:xt.message)||(qe==null?void 0:qe.message)||"Something went wrong";wt&&Object.keys(wt).length>0?O(null,{details:wt}):O(yt)}};if(t&&s){const fe=B?`Edit ${_}`:`Create ${_}`,De=p.jsxs("form",{ref:ie,onSubmit:pe,noValidate:!0,children:[s,g&&p.jsxs("div",{className:"flex items-center justify-end gap-2 mt-6 pt-4 border-t",children:[p.jsxs(Ke,{type:"button",variant:"outline",onClick:ce,className:"cursor-pointer",disabled:se,children:[p.jsx(er,{className:"mr-2 h-4 w-4"}),d]}),p.jsx(Ke,{type:"submit",className:"cursor-pointer",disabled:se||te,children:se?p.jsxs(p.Fragment,{children:[p.jsx(Jn,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):p.jsxs(p.Fragment,{children:[p.jsx(Jd,{className:"mr-2 h-4 w-4"}),E]})})]})]});return w?p.jsxs(yn,{className:T,...I,children:[p.jsx(ns,{children:p.jsxs("div",{className:"flex items-center gap-4",children:[b&&p.jsx(Ke,{variant:"ghost",size:"icon",onClick:be,className:"cursor-pointer",children:p.jsx(cr,{className:"h-4 w-4"})}),p.jsxs("div",{children:[p.jsx(rs,{className:"text-lg font-semibold text-foreground",children:fe}),S&&p.jsx(is,{children:S})]})]})}),p.jsx(xn,{children:De})]}):p.jsxs("div",{className:Q("space-y-6",T),...I,children:[p.jsxs("div",{className:"flex items-center gap-4",children:[b&&p.jsx(Ke,{variant:"ghost",size:"icon",onClick:be,children:p.jsx(cr,{className:"h-4 w-4"})}),N&&p.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:p.jsx(N,{className:"h-5 w-5 text-primary"})}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:fe}),S&&p.jsx("p",{className:"text-muted-foreground",children:S})]})]}),De]})}const Se=gR({defaultValues:u||r,resolver:i?xR(i):void 0,mode:"onBlur"}),{handleSubmit:Re,formState:{errors:Fe},reset:Ie,watch:Xe,setValue:X}=Se;C.useEffect(()=>{u&&Ie(u)},[u,Ie]);const re=async fe=>{var De,he,Oe,Ve,We,mt;try{await(o==null?void 0:o(fe))}catch(nt){const ft=((he=(De=nt==null?void 0:nt.data)==null?void 0:De.error)==null?void 0:he.details)||((Oe=nt==null?void 0:nt.error)==null?void 0:Oe.details),bt=((We=(Ve=nt==null?void 0:nt.data)==null?void 0:Ve.error)==null?void 0:We.message)||((mt=nt==null?void 0:nt.data)==null?void 0:mt.message)||(nt==null?void 0:nt.message)||"Something went wrong";ft&&Object.keys(ft).length>0?O(null,{details:ft}):O(bt)}},oe=fe=>{var Ue;const{name:De,type:he="text",label:Oe,placeholder:Ve,description:We,required:mt,disabled:nt,options:ft=[],className:bt,...xt}=fe,qe=(Ue=Fe[De])==null?void 0:Ue.message,wt=Xe(De),yt={label:Oe,placeholder:Ve,description:We,error:qe,required:mt,disabled:nt||te||se,className:bt};switch(he){case"text":case"email":case"password":case"number":case"url":case"tel":return p.jsx(_a,{...yt,type:he,emitValue:!1,...Se.register(De),...xt});case"textarea":return p.jsx(yd,{...yt,emitValue:!1,...Se.register(De),...xt});case"select":return p.jsx(xd,{...yt,options:ft,value:wt,onChange:ht=>X(De,ht,{shouldValidate:!0}),...xt});case"search-select":return p.jsx(ey,{...yt,options:ft,value:wt,onChange:ht=>X(De,ht,{shouldValidate:!0}),...xt});case"switch":return p.jsx(wd,{...yt,checked:wt,onCheckedChange:ht=>X(De,ht,{shouldValidate:!0}),...xt});case"section":const{title:rt,description:He,icon:Ye}=fe;return p.jsx("div",{className:"col-span-full mb-4 mt-8",children:p.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-2 border-b border-border/50",children:[Ye&&p.jsx("div",{className:"flex-shrink-0 h-8 w-8 rounded-lg bg-primary/10 flex items-center justify-center",children:p.jsx(Ye,{className:"h-4 w-4 text-primary"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("h3",{className:"text-lg font-semibold text-foreground tracking-tight",children:rt}),He&&p.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:He})]})]})},`section-${rt}`);case"custom":return fe.render?fe.render({form:Se,field:fe,error:qe,value:wt}):null;default:return p.jsx(_a,{...yt,type:"text",emitValue:!1,...Se.register(De),...xt})}},xe=Q("grid gap-4",v===1&&"grid-cols-1",v===2&&"grid-cols-1 md:grid-cols-2",v===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",v===4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-4"),ve=p.jsxs("form",{ref:ie,onSubmit:Re(re,()=>Qh(ie.current)),children:[p.jsx("div",{className:xe,children:n.map(fe=>{if(fe.hidden&&(typeof fe.hidden=="function"?fe.hidden(Xe()):fe.hidden))return null;const De=fe.colSpan||1,he=Q(De===2&&"md:col-span-2",De===3&&"md:col-span-2 lg:col-span-3",De===4&&"md:col-span-2 lg:col-span-4",De==="full"&&"col-span-full");return p.jsx("div",{className:he,children:oe(fe)},fe.name||`section-${fe.title}`)})}),g&&p.jsxs("div",{className:"flex gap-2 mt-6 pt-4 border-t",children:[l&&p.jsxs(Ke,{type:"button",variant:"outline",className:"cursor-pointer",onClick:l,disabled:se,children:[p.jsx(er,{className:"mr-2 h-4 w-4"}),d]}),p.jsx(Ke,{type:"submit",className:"cursor-pointer",disabled:se||te,children:se?p.jsxs(p.Fragment,{children:[p.jsx(Jn,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):p.jsxs(p.Fragment,{children:[p.jsx(Jd,{className:"mr-2 h-4 w-4"}),E]})})]})]});return x&&(_||S||b)?p.jsxs(yn,{className:T,...I,children:[p.jsx(ns,{children:p.jsxs("div",{className:"flex items-center gap-4",children:[b&&c&&p.jsx(Ke,{variant:"ghost",size:"icon",onClick:c,children:p.jsx(cr,{className:"h-4 w-4"})}),p.jsxs("div",{children:[_&&p.jsx(rs,{children:_}),S&&p.jsx(is,{children:S})]})]})}),p.jsx(xn,{children:ve})]}):p.jsx("div",{className:T,...I,children:ve})};Sy.displayName="CrudForm";function SR({brandName:t="Your Brand",brandLogo:n,brandDescription:r="Welcome back",quote:i,quoteAuthor:s,copyright:o,leftPanelClassName:l,rightPanelClassName:c,leftPanelContent:a,rightPanelContent:f,showLeftPanel:u=!0,children:m}){const y=new Date().getFullYear(),_=o||`© ${y} ${t}. All rights reserved.`,S=p.jsxs("div",{className:"flex flex-col h-full p-8 lg:p-12 text-white",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[n&&p.jsx("div",{className:"h-10 w-10 rounded-lg bg-white/20 flex items-center justify-center",children:p.jsx("span",{className:"text-white font-bold text-xl",children:t.charAt(0)})}),p.jsx("span",{className:"text-xl font-semibold",children:t})]}),p.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[i&&p.jsxs("div",{className:"max-w-md",children:[p.jsxs("blockquote",{className:"text-2xl lg:text-3xl font-light leading-relaxed",children:['"',i,'"']}),s&&p.jsxs("p",{className:"mt-4 text-white/70",children:["— ",s]})]}),!i&&r&&p.jsx("div",{className:"text-center",children:p.jsx("p",{className:"text-2xl lg:text-3xl font-light",children:r})})]}),p.jsx("div",{className:"text-sm text-white/60",children:_})]});return p.jsxs("div",{className:"min-h-screen flex",children:[u&&p.jsx("div",{className:Q("hidden lg:flex lg:w-1/2 bg-gray-900",l),children:a||S}),p.jsx("div",{className:Q("w-full flex items-center justify-center p-8",u?"lg:w-1/2":"",c),children:p.jsx("div",{className:"w-full max-w-md",children:f||m||p.jsx(Gt.Outlet,{})})})]})}function kR({onSubmit:t,isLoading:n=!1,error:r,title:i="Login",subtitle:s="Enter your email below to login to your account",emailLabel:o="Email",emailPlaceholder:l="m@example.com",passwordLabel:c="Password",rememberMeLabel:a="Remember me",forgotPasswordText:f="Forgot your password?",forgotPasswordPath:u="/forgot-password",submitButtonText:m="Login",signUpText:y="Don't have an account?",signUpLinkText:_="Sign up",signUpPath:S="/register",showRememberMe:E=!0,showForgotPassword:d=!0,showSignUp:h=!0,logo:v,className:x,children:g}){const[b,w]=V.useState(""),[k,N]=V.useState(""),[T,D]=V.useState(!1),[I,L]=V.useState(!1),R=async P=>{P.preventDefault(),t&&await t({email:b,password:k,rememberMe:T})};return p.jsxs("div",{className:Q("space-y-6",x),children:[v&&p.jsx("div",{className:"flex justify-center",children:v}),p.jsxs("div",{className:"space-y-2 text-center",children:[p.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:i}),s&&p.jsx("p",{className:"text-sm text-muted-foreground",children:s})]}),r&&p.jsx("div",{className:"p-3 text-sm text-destructive bg-destructive/10 rounded-md",children:r}),p.jsxs("form",{onSubmit:R,className:"space-y-4 w-full",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(br,{htmlFor:"email",children:o}),p.jsx(ni,{id:"email",type:"email",placeholder:l,value:b,onChange:P=>w(P.target.value),required:!0,autoComplete:"email"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsx(br,{htmlFor:"password",children:c})}),p.jsxs("div",{className:"relative",children:[p.jsx(ni,{id:"password",type:I?"text":"password",value:k,onChange:P=>N(P.target.value),required:!0,placeholder:"Enter you password",autoComplete:"current-password",className:"pr-10"}),p.jsx("button",{type:"button",onClick:()=>L(!I),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":I?"Hide password":"Show password",children:I?p.jsx(j1,{className:"h-4 w-4"}):p.jsx(Q5,{className:"h-4 w-4"})})]})]}),E&&p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(ss,{id:"remember",checked:T,onCheckedChange:D}),p.jsx(br,{htmlFor:"remember",className:"text-sm font-normal cursor-pointer",children:a})]}),g,p.jsx(Ke,{type:"submit",className:"w-full",disabled:n,children:n?"Signing in...":m}),d&&u&&p.jsx("div",{className:"text-center",children:p.jsx(Gt.Link,{to:u,className:"text-sm text-muted-foreground hover:text-primary underline-offset-4 hover:underline font-semibold",children:f})})]})]})}const ky=V.createContext(null);function Rd(){const t=V.useContext(ky);if(!t)throw new Error("useSidebarContext must be used within a SidebarProvider");return t}function Ey({defaultOpen:t=!1,defaultCollapsed:n=!1,children:r}){const[i,s]=V.useState(t),[o,l]=V.useState(n),c=V.useCallback(()=>{s(y=>!y)},[]),a=V.useCallback(y=>{s(y)},[]),f=V.useCallback(()=>{l(y=>!y)},[]),u=V.useCallback(y=>{l(y)},[]),m={isOpen:i,isCollapsed:o,toggle:c,setOpen:a,toggleCollapse:f,setCollapsed:u};return p.jsx(ky.Provider,{value:m,children:r})}function ER(t,n=[]){let r=[];function i(o,l){const c=C.createContext(l),a=r.length;r=[...r,l];const f=m=>{var h;const{scope:y,children:_,...S}=m,E=((h=y==null?void 0:y[t])==null?void 0:h[a])||c,d=C.useMemo(()=>S,Object.values(S));return p.jsx(E.Provider,{value:d,children:_})};f.displayName=o+"Provider";function u(m,y){var E;const _=((E=y==null?void 0:y[t])==null?void 0:E[a])||c,S=C.useContext(_);if(S)return S;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[f,u]}const s=()=>{const o=r.map(l=>C.createContext(l));return function(c){const a=(c==null?void 0:c[t])||o;return C.useMemo(()=>({[`__scope${t}`]:{...c,[t]:a}}),[c,a])}};return s.scopeName=t,[i,TR(s,...n)]}function TR(...t){const n=t[0];if(t.length===1)return n;const r=()=>{const i=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const l=i.reduce((c,{useScope:a,scopeName:f})=>{const m=a(o)[`__scope${f}`];return{...c,...m}},{});return C.useMemo(()=>({[`__scope${n.scopeName}`]:l}),[l])}};return r.scopeName=n.scopeName,r}function NR(t){const n=MR(t),r=C.forwardRef((i,s)=>{const{children:o,...l}=i,c=C.Children.toArray(o),a=c.find(DR);if(a){const f=a.props.children,u=c.map(m=>m===a?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:m);return p.jsx(n,{...l,ref:s,children:C.isValidElement(f)?C.cloneElement(f,void 0,u):null})}return p.jsx(n,{...l,ref:s,children:o})});return r.displayName=`${t}.Slot`,r}function MR(t){const n=C.forwardRef((r,i)=>{const{children:s,...o}=r;if(C.isValidElement(s)){const l=PR(s),c=RR(o,s.props);return s.type!==C.Fragment&&(c.ref=i?zt(i,l):l),C.cloneElement(s,c)}return C.Children.count(s)>1?C.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var AR=Symbol("radix.slottable");function DR(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===AR}function RR(t,n){const r={...n};for(const i in n){const s=t[i],o=n[i];/^on[A-Z]/.test(i)?s&&o?r[i]=(...c)=>{const a=o(...c);return s(...c),a}:s&&(r[i]=s):i==="style"?r[i]={...s,...o}:i==="className"&&(r[i]=[s,o].filter(Boolean).join(" "))}return{...t,...r}}function PR(t){var i,s;let n=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var LR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pd=LR.reduce((t,n)=>{const r=NR(`Primitive.${n}`),i=C.forwardRef((s,o)=>{const{asChild:l,...c}=s,a=l?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...c,ref:o})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{}),Ll="Collapsible",[IR]=ER(Ll),[OR,Ld]=IR(Ll),Ty=C.forwardRef((t,n)=>{const{__scopeCollapsible:r,open:i,defaultOpen:s,disabled:o,onOpenChange:l,...c}=t,[a,f]=zn({prop:i,defaultProp:s??!1,onChange:l,caller:Ll});return p.jsx(OR,{scope:r,disabled:o,contentId:un(),open:a,onOpenToggle:C.useCallback(()=>f(u=>!u),[f]),children:p.jsx(Pd.div,{"data-state":Od(a),"data-disabled":o?"":void 0,...c,ref:n})})});Ty.displayName=Ll;var Ny="CollapsibleTrigger",My=C.forwardRef((t,n)=>{const{__scopeCollapsible:r,...i}=t,s=Ld(Ny,r);return p.jsx(Pd.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Od(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:n,onClick:Me(t.onClick,s.onOpenToggle)})});My.displayName=Ny;var Id="CollapsibleContent",Ay=C.forwardRef((t,n)=>{const{forceMount:r,...i}=t,s=Ld(Id,t.__scopeCollapsible);return p.jsx(nn,{present:r||s.open,children:({present:o})=>p.jsx(BR,{...i,ref:n,present:o})})});Ay.displayName=Id;var BR=C.forwardRef((t,n)=>{const{__scopeCollapsible:r,present:i,children:s,...o}=t,l=Ld(Id,r),[c,a]=C.useState(i),f=C.useRef(null),u=st(n,f),m=C.useRef(0),y=m.current,_=C.useRef(0),S=_.current,E=l.open||c,d=C.useRef(E),h=C.useRef(void 0);return C.useEffect(()=>{const v=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(v)},[]),qt(()=>{const v=f.current;if(v){h.current=h.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const x=v.getBoundingClientRect();m.current=x.height,_.current=x.width,d.current||(v.style.transitionDuration=h.current.transitionDuration,v.style.animationName=h.current.animationName),a(i)}},[l.open,i]),p.jsx(Pd.div,{"data-state":Od(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!E,...o,ref:u,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":S?`${S}px`:void 0,...t.style},children:E&&s})});function Od(t){return t?"open":"closed"}var zR=Ty,jR=My,FR=Ay;function kc(t){return p.jsx(zR,{"data-slot":"collapsible",...t})}function Ec(t){return p.jsx(jR,{"data-slot":"collapsible-trigger",...t})}function Tc(t){return p.jsx(FR,{"data-slot":"collapsible-content",...t})}function Dy({items:t=[],brandName:n="Brand",brandLogo:r,brandPath:i="/dashboard",user:s,onLogout:o,userMenuItems:l=[],showUserProfile:c=!0,className:a,collapsedWidth:f="w-16",expandedWidth:u="w-60",renderItem:m,headerSlot:y,footerSlot:_,onExpandedChange:S,onPinnedChange:E}){var I,L;const{isOpen:d,setOpen:h}=Rd(),v=Gt.useLocation(),[x,g]=V.useState(!1),[b,w]=V.useState(!1),k=b||x;V.useEffect(()=>{S&&S(k)},[k,S]),V.useEffect(()=>{E&&E(b)},[b,E]);const N=(R,P=!1)=>{if(R.title)return p.jsxs("div",{className:"mt-6",children:[k&&p.jsx("h3",{className:"px-3 text-xs font-medium text-sidebar-foreground/50 uppercase tracking-wider mb-2",children:R.title}),!k&&p.jsx(Js,{className:"my-3 bg-sidebar-border"})]},R.title);if(m)return m(R,{isCollapsed:!k,isSubItem:P,location:v});const O=R.icon,U=R.children&&R.children.length>0,H=R.path&&(v.pathname===R.path||v.pathname.startsWith(R.path+"/")),B=U&&R.children.some(j=>v.pathname===j.path||v.pathname.startsWith(j.path+"/"));return U?k?p.jsx(kc,{defaultOpen:B,className:"group/collapsible",children:p.jsxs("div",{children:[p.jsx(Ec,{asChild:!0,children:p.jsxs("button",{className:Q("w-full flex items-center gap-3 rounded-lg transition-all duration-150 text-sm cursor-pointer",B?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground","px-3 py-2 h-10"),title:R.label,children:[O&&p.jsx(O,{className:"h-5 w-5 flex-shrink-0"}),p.jsx("span",{className:"flex-1 text-left truncate",children:R.label}),p.jsx(In,{className:"h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90 flex-shrink-0"})]})}),p.jsx(Tc,{className:"overflow-hidden",children:p.jsx("div",{className:"ml-4 mt-1 space-y-0.5",children:R.children.map(j=>{const F=j.icon,Y=v.pathname===j.path||v.pathname.startsWith(j.path+"/");return j.children&&j.children.length>0?p.jsxs(kc,{defaultOpen:j.children.some(G=>v.pathname===G.path||v.pathname.startsWith(G.path+"/")),className:"group/collapsible-child",children:[p.jsx(Ec,{asChild:!0,children:p.jsxs("button",{className:Q("w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9 cursor-pointer",Y?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:j.label,children:[F&&p.jsx(F,{className:"h-4 w-4 flex-shrink-0"}),p.jsx("span",{className:"flex-1 text-left truncate",children:j.label}),p.jsx(In,{className:"h-3.5 w-3.5 transition-transform duration-200 group-data-[state=open]/collapsible-child:rotate-90 flex-shrink-0"})]})}),p.jsx(Tc,{className:"overflow-hidden",children:p.jsx("div",{className:"ml-4 mt-1 space-y-0.5",children:R.children.map(G=>{const $=G.icon,Z=G.children&&G.children.length>0,ee=v.pathname===G.path||v.pathname.startsWith((G.path||"")+"/"),te=Z&&G.children.some(se=>v.pathname===se.path||v.pathname.startsWith((se.path||"")+"/"));return Z?p.jsxs(kc,{defaultOpen:te,className:"group/collapsible-child",children:[p.jsx(Ec,{asChild:!0,children:p.jsxs("button",{className:Q("w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9 cursor-pointer",te?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:G.label,children:[$&&p.jsx($,{className:"h-4 w-4 flex-shrink-0"}),p.jsx("span",{className:"flex-1 text-left truncate",children:G.label}),p.jsx(In,{className:"h-3.5 w-3.5 transition-transform duration-200 group-data-[state=open]/collapsible-child:rotate-90 flex-shrink-0"})]})}),p.jsx(Tc,{children:p.jsx("div",{className:"ml-4 mt-1 space-y-0.5",children:G.children.map(se=>{const ie=se.icon,ae=v.pathname===se.path||v.pathname.startsWith((se.path||"")+"/");return p.jsxs(Gt.Link,{to:se.path,className:Q("flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9",ae?"bg-sidebar-primary text-sidebar-primary-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:se.label,children:[ie&&p.jsx(ie,{className:"h-3.5 w-3.5 flex-shrink-0"}),p.jsx("span",{className:"truncate",children:se.label})]},se.path||se.label)})})})]},G.label):p.jsxs(Gt.Link,{to:G.path,className:Q("flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9",ee?"bg-sidebar-primary text-sidebar-primary-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:G.label,children:[$&&p.jsx($,{className:"h-4 w-4 flex-shrink-0"}),p.jsx("span",{className:"truncate",children:G.label})]},G.path||G.label)})})})]},j.label):p.jsxs(Gt.Link,{to:j.path,className:Q("flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-150 text-sm h-9",Y?"bg-sidebar-primary text-sidebar-primary-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),title:j.label,children:[F&&p.jsx(F,{className:"h-4 w-4 flex-shrink-0"}),p.jsx("span",{className:"truncate",children:j.label})]},j.path||j.label)})})})]})},R.label):p.jsx("div",{className:Q("w-full flex items-center gap-3 rounded-lg transition-all duration-150 text-sm cursor-default",B?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground","justify-center p-2 h-10"),title:R.label,children:O&&p.jsx(O,{className:"h-5 w-5 flex-shrink-0"})},R.label):p.jsxs(Gt.Link,{to:R.path,className:Q("flex items-center gap-3 rounded-lg transition-all duration-150 text-sm",H?"bg-sidebar-primary text-sidebar-primary-foreground":"hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground",k?"px-3 py-2 h-10":"justify-center p-2 h-10"),title:R.label,children:[O&&p.jsx(O,{className:"h-5 w-5 flex-shrink-0"}),p.jsx("span",{className:Q("truncate",!k&&"hidden"),children:R.label})]},R.path||R.label)},T=p.jsxs("div",{className:"flex items-center justify-between h-14 px-3 border-b border-sidebar-border",children:[p.jsxs(Gt.Link,{to:i,className:Q("flex items-center gap-2 min-w-0",!k&&"mx-auto"),children:[r||p.jsx("div",{className:Q("rounded-md bg-sidebar-primary flex items-center justify-center flex-shrink-0","h-8 w-8"),children:p.jsx("span",{className:"text-sidebar-primary-foreground font-semibold text-sm",children:n.charAt(0)})}),p.jsx("span",{className:Q("font-semibold text-sidebar-foreground overflow-hidden text-ellipsis whitespace-nowrap",!k&&"hidden"),children:n})]}),p.jsx("button",{onClick:()=>h(!1),className:"p-1.5 rounded-lg hover:bg-sidebar-accent lg:hidden flex-shrink-0",children:p.jsx(er,{className:"h-4 w-4 text-sidebar-foreground"})}),k&&p.jsx("button",{onClick:()=>w(!b),className:Q("hidden lg:flex p-1.5 rounded-lg hover:bg-sidebar-accent transition-colors flex-shrink-0 items-center justify-center",b&&"bg-sidebar-accent"),title:b?"Unpin sidebar":"Pin sidebar",children:b?p.jsx(Ai,{className:"h-4 w-4 text-sidebar-foreground"}):p.jsx(In,{className:"h-4 w-4 text-sidebar-foreground"})})]}),D=s&&c&&p.jsx("div",{className:"px-3 py-3 border-t border-sidebar-border",children:p.jsxs(_l,{children:[p.jsx(Sl,{asChild:!0,children:p.jsxs("button",{className:Q("w-full flex items-center gap-3 rounded-lg transition-colors hover:bg-sidebar-accent",k?"px-2 py-2":"justify-center p-2"),children:[p.jsxs(su,{className:"h-8 w-8 flex-shrink-0",children:[p.jsx(ou,{src:s.avatar,alt:s.firstName||"User"}),p.jsx(au,{className:"bg-sidebar-primary text-sidebar-primary-foreground text-xs",children:s.name?s.name:`${((I=s.firstName)==null?void 0:I[0])||"U"}${((L=s.lastName)==null?void 0:L[0])||""}`})]}),k&&p.jsxs("div",{className:"flex-1 text-left min-w-0",children:[p.jsx("p",{className:"text-sm font-medium text-sidebar-foreground truncate",children:s.name?s.name:`${s.firstName} ${s.lastName}`}),p.jsx("p",{className:"text-xs text-sidebar-foreground/50 truncate",children:s.email})]})]})}),p.jsxs(So,{align:"end",className:"w-56",children:[p.jsx(kl,{children:"My Account"}),p.jsx(fs,{}),l.map((R,P)=>p.jsx(ds,{asChild:!!R.path,onClick:R.onClick,children:R.path?p.jsx(Gt.Link,{to:R.path,children:R.label}):R.label},P)),l.length>0&&p.jsx(fs,{}),o&&p.jsx(ds,{onClick:o,className:"text-destructive",children:"Log out"})]})]})});return p.jsxs(p.Fragment,{children:[d&&p.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 lg:hidden",onClick:()=>h(!1)}),p.jsxs("aside",{onMouseEnter:()=>!b&&g(!0),onMouseLeave:()=>!b&&g(!1),className:Q("fixed top-0 left-0 z-50 h-full bg-sidebar border-r border-sidebar-border flex flex-col overflow-hidden","transition-[width] duration-200 ease-in-out",d?"translate-x-0":"-translate-x-full",k?u:f,"lg:translate-x-0",k&&!b&&"shadow-lg",a),children:[y||T,p.jsx("nav",{className:"flex-1 overflow-y-auto px-3 py-3",children:p.jsx("div",{className:"space-y-1",children:t.map(R=>N(R))})}),_||D]})]})}function Ry({pathNames:t={},showBreadcrumbs:n=!0,showMenuButton:r=!0,className:i,leftSlot:s,rightSlot:o,breadcrumbsSlot:l,centerSlot:c,children:a,maxBreadcrumbLength:f=50}){const{toggle:u}=Rd(),m=Gt.useLocation(),{getBreadcrumbName:y}=Pl(),_={dashboard:"Dashboard",users:"Users",roles:"Roles",permissions:"Permissions",settings:"Settings",profile:"Profile",create:"Create",edit:"Edit","tenant-grades":"Tenant Grades","tenant-edit-subjects":"Tenant Edit Subjects","tenant-publication-books":"Tenant Publication Books",...t},S=({name:h,isLast:v,path:x})=>{const g=h.length>f,b=g?h.slice(0,f).trim()+"...":h,w=v?p.jsx("span",{className:"font-medium text-foreground",children:b}):p.jsx(Gt.Link,{to:x,className:"text-muted-foreground hover:text-foreground transition-colors",children:b});return g?p.jsxs(sl,{delayDuration:300,children:[p.jsx(ol,{asChild:!0,children:p.jsx("span",{className:"cursor-default",children:w})}),p.jsx(uo,{side:"bottom",className:"max-w-[300px]",children:p.jsx("p",{children:h})})]}):w},E=()=>{const h=m.pathname.split("/").filter(Boolean),v=new URLSearchParams(m.search);return p.jsx(cu,{children:p.jsx("nav",{className:"flex items-center gap-1 text-sm",children:h.map((x,g)=>{var T,D,I;let b="/"+h.slice(0,g+1).join("/");const w=g===h.length-1,k=/^\d+$/.test(x);if((D=(T=m.state)==null?void 0:T.customBreadcrumbPaths)!=null&&D[x])b=m.state.customBreadcrumbPaths[x];else if(!w&&!k&&((I=m.state)!=null&&I.parentPath)){const L=h[g+1];L&&/^\d+$/.test(L)&&(b=m.state.parentPath)}else if(!w&&v.get("tenant")){const L=v.get("tenant");x==="tenant-publication-books"?b=`/tenants/${L}?tab=books`:x==="tenant-grades"?b=`/tenants/${L}?tab=grade`:x==="tenant-edit-subjects"&&(b=`/tenants/${L}?tab=subjects`)}let N;return k?N=y(x)||x:N=_[x]||x,p.jsxs("div",{className:"flex items-center gap-1",children:[g>0&&p.jsx(In,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),p.jsx(S,{name:N,isLast:w,path:b})]},`${x}-${g}`)})})})},d=()=>s||l||(n?p.jsx(E,{}):null);return p.jsxs("header",{className:Q("sticky top-0 z-30 bg-background",i),children:[p.jsxs("div",{className:"flex items-center h-14 px-4 md:px-6",children:[r&&p.jsx("button",{onClick:u,className:"p-2 -ml-2 rounded-lg hover:bg-muted lg:hidden",children:p.jsx(nx,{className:"h-5 w-5"})}),p.jsx("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:d()}),c&&p.jsx("div",{className:"flex items-center gap-2",children:c}),o&&p.jsx("div",{className:"flex items-center gap-2",children:o}),a]}),p.jsx(Js,{})]})}const HR={success:q5,error:z1,warning:O1,info:ta},Jh={success:"bg-green-500 text-white",error:"bg-red-500 text-white",warning:"bg-yellow-500 text-white",info:"bg-blue-500 text-white"};function Py(){const{toasts:t,dismiss:n}=Dl();return p.jsx("div",{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2 max-w-sm",children:t.map(r=>{const i=HR[r.type]||ta;return p.jsxs("div",{className:Q("flex items-start gap-3 p-4 rounded-lg shadow-lg","animate-in slide-in-from-right-full duration-300",Jh[r.type]||Jh.info),children:[p.jsx(i,{className:"h-5 w-5 flex-shrink-0 mt-0.5"}),p.jsxs("div",{className:"flex-1",children:[r.title&&p.jsx("p",{className:"font-medium",children:r.title}),p.jsx("p",{className:"text-sm opacity-90",children:r.message}),r.details&&Object.keys(r.details).length>0&&p.jsx("ul",{className:Q("space-y-0.5",r.message&&"mt-1.5 pt-1.5 border-t border-white/20"),children:Object.entries(r.details).map(([s,o])=>(Array.isArray(o)?o:[o]).map((l,c)=>p.jsxs("li",{className:"text-xs flex gap-1",children:[p.jsxs("span",{className:"font-semibold capitalize shrink-0",children:[s.replace(/_/g," "),":"]}),p.jsx("span",{className:"opacity-90",children:l})]},`${s}-${c}`)))})]}),p.jsx("button",{onClick:()=>n(r.id),className:"p-1 hover:bg-white/20 rounded transition-colors cursor-pointer",children:p.jsx(er,{className:"h-4 w-4"})})]},r.id)})})}const Ly=V.createContext(null);function Iy({children:t}){const[n,r]=V.useState(null),i=V.useCallback(o=>{r(o)},[]),s=V.useCallback(()=>{r(null)},[]);return p.jsx(Ly.Provider,{value:{slot:n,setSlot:i,clearSlot:s},children:t})}function Oy(){const t=V.useContext(Ly);if(!t)throw new Error("useHeaderSlot must be used within HeaderSlotProvider");return t}function $R({sidebarProps:t,headerProps:n,showHeader:r=!0,showSidebar:i=!0,contentClassName:s,mainSlot:o,children:l}){const[c,a]=V.useState(!1),{slot:f}=Oy();return p.jsxs("div",{className:"min-h-screen bg-background dark:bg-background",style:{"--rcu-header-offset":r?"calc(3.5rem + 1px)":"0px"},children:[i&&p.jsx(Dy,{...t,onPinnedChange:a}),p.jsxs("div",{className:Q("transition-all duration-150 ease-out",i&&(c?"lg:ml-60":"lg:ml-16")),children:[r&&p.jsx(Ry,{...n,...f&&{showBreadcrumbs:!1,leftSlot:f}}),p.jsx("main",{id:"dashboard-main-content",className:Q("p-4 md:p-6",s),children:o||l||p.jsx(Gt.Outlet,{})})]}),p.jsx(Py,{})]})}function VR({sidebarProps:t={},headerProps:n={},defaultOpen:r=!1,defaultCollapsed:i=!1,showHeader:s=!0,showSidebar:o=!0,contentClassName:l,mainSlot:c,children:a}){return p.jsx(Ey,{defaultOpen:r,defaultCollapsed:i,children:p.jsx(Cy,{children:p.jsx(Iy,{children:p.jsx($R,{sidebarProps:t,headerProps:n,showHeader:s,showSidebar:o,contentClassName:l,mainSlot:c,children:a})})})})}function WR(t){var r,i,s;if(!t)return{code:500,message:"An unexpected error occurred.",detail:null};const n=(t==null?void 0:t.data)??((r=t==null?void 0:t.response)==null?void 0:r.data)??t;return(i=n==null?void 0:n.error)!=null&&i.code?{code:n.error.code,message:n.error.message||"Something went wrong.",detail:((s=n.error.details)==null?void 0:s.error)||null}:{code:(t==null?void 0:t.status)||(t==null?void 0:t.statusCode)||500,message:typeof t=="string"?t:(t==null?void 0:t.message)||"Something went wrong.",detail:null}}function e1({error:t,onBack:n,onRetry:r,backLabel:i="Go Back",className:s}){const{code:o,message:l,detail:c}=WR(t),[a,f]=C.useState(!1),u=o>=500,m=()=>{const y=[`Error Code: ${o}`,`Message: ${l}`,c?`Detail: ${c}`:""].filter(Boolean).join(`
|
|
621
|
+
`);navigator.clipboard.writeText(y).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)})};return p.jsxs("div",{className:Q("flex flex-col items-center justify-center min-h-[400px] py-16 px-4",s),children:[p.jsxs("div",{className:"relative mb-6",children:[p.jsx("div",{className:"absolute inset-0 rounded-full bg-destructive/10 blur-xl scale-150"}),p.jsx("div",{className:"relative flex items-center justify-center h-20 w-20 rounded-full bg-destructive/10 border border-destructive/20",children:p.jsx(ax,{className:"h-9 w-9 text-destructive"})})]}),p.jsxs(Yi,{variant:"destructive",className:"mb-3 text-xs font-mono tracking-widest px-3 py-1",children:[u?"SERVER ERROR":"ERROR"," · ",o]}),p.jsx("h2",{className:"text-xl font-semibold text-foreground text-center mb-2",children:u?"Something went wrong on our end":"An error occurred"}),p.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md mb-6 leading-relaxed",children:l}),c&&p.jsxs("div",{className:"w-full max-w-lg mb-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[p.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Technical Detail"}),p.jsx("button",{onClick:m,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:a?p.jsxs(p.Fragment,{children:[p.jsx(_i,{className:"h-3 w-3"})," Copied"]}):p.jsxs(p.Fragment,{children:[p.jsx(Z5,{className:"h-3 w-3"})," Copy"]})})]}),p.jsx("div",{className:"rounded-md border border-destructive/20 bg-destructive/5 px-4 py-3",children:p.jsx("code",{className:"text-xs text-destructive font-mono break-all leading-relaxed",children:c})})]}),p.jsxs("div",{className:"flex items-center gap-3 flex-wrap justify-center",children:[n&&p.jsxs(Ke,{variant:"outline",onClick:n,className:"cursor-pointer gap-2",children:[p.jsx(cr,{className:"h-4 w-4"}),i]}),r&&p.jsxs(Ke,{onClick:r,className:"cursor-pointer gap-2",children:[p.jsx(na,{className:"h-4 w-4"}),"Try Again"]}),!n&&!r&&p.jsxs(Ke,{variant:"outline",onClick:()=>window.location.reload(),className:"cursor-pointer gap-2",children:[p.jsx(na,{className:"h-4 w-4"}),"Reload Page"]})]})]})}const By=({useStore:t,children:n,data:r=null,paramName:i="uuid",loading:s=!1,error:o=null,fields:l=[],onBack:c,onEdit:a,onDelete:f,listPath:u,editPath:m,title:y,description:_,editLabel:S="Edit",deleteLabel:E="Delete",backLabel:d="Back",itemName:h="item",getItemName:v,showBackButton:x=!0,additionalActions:g=[],getBreadcrumbName:b,customBreadcrumbPaths:w,getCustomBreadcrumbPath:k,getParentPath:N,preserveLocationState:T=!1,showEditButton:D=!0,showDeleteButton:I=!0,showHeader:L=!0,showMeta:R=!0,showCard:P=!0,columns:O=2,icon:U,className:H,cardClassName:B,cardHeaderClassName:j,cardContentClassName:F,headerClassName:Y,titleClassName:q,descriptionClassName:G,fieldsGridClassName:$,fieldItemClassName:Z,fieldLabelClassName:ee,fieldValueClassName:te,metaClassName:se,metaItemClassName:ie,backButtonClassName:ae,actionsDropdownClassName:de,actionsDropdownItemClassName:be,loadingStateClassName:ce,errorStateClassName:pe,emptyStateClassName:Se,...Re})=>{const Fe=Gt.useNavigate(),Ie=Gt.useLocation(),X=Gt.useParams()[i??"uuid"],re=UR(),oe=t==null?void 0:t(),xe=oe==null?void 0:oe.currentItem,ve=(oe==null?void 0:oe.loading)??!1,ue=oe==null?void 0:oe.error,fe=(oe==null?void 0:oe.fetchById)||(oe==null?void 0:oe.fetchOne),De=oe==null?void 0:oe.delete,he=r||xe,Oe=s||ve,Ve=o||ue,[We,mt]=C.useState(!1),[nt,ft]=C.useState(!1),bt=typeof window<"u"&&window.history.length<=1,xt=x&&!bt;C.useEffect(()=>{X&&fe&&fe(X)},[X]),C.useEffect(()=>{if(X&&he&&b&&(re!=null&&re.setBreadcrumbName)){const ye=b(he);ye&&re.setBreadcrumbName(X,ye)}},[X,he,b,re==null?void 0:re.setBreadcrumbName]);const qe=()=>{c?c():Fe(u||-1)},wt=C.useCallback(()=>{if(a)a(he);else if(m&&X){const ye=b?b(he):void 0,Ce=T?(Ie==null?void 0:Ie.state)||{}:{},at=k?k(he):w,Je=N?N(he):null,on=m.split("?")[0].split("/").filter(Boolean)[0],Wn=at||(Je?{[on]:Je}:void 0);Fe(`${m}/${X}/edit`,{state:{...Ce,...ye&&{breadcrumbName:ye},...Wn&&{customBreadcrumbPaths:Wn},...Je&&{parentPath:Je}}})}},[a,he,m,X,Fe,b,T,Ie==null?void 0:Ie.state,w,k,N]),yt=async()=>{ft(!0);try{f?await f(he):De&&X&&(await De(X),qe()),mt(!1)}catch(ye){console.error("Delete error:",ye)}finally{ft(!1)}},Ue=ye=>!ye||typeof ye!="string"?ye:ye.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),rt=(ye,Ce=80)=>ye.length>Ce?ye.slice(0,Ce).trimEnd()+"…":ye,He=(()=>{const ye=he&&v?v(he):(he==null?void 0:he.name)||(he==null?void 0:he.title)||h;return rt(Ue(ye)||h)})(),Ye=(a||m)&&D,ht=(f||De)&&I,ot=Ye||ht||g.length>0,kt=()=>{if(!ot)return null;const ye=uy([...g,...Ye?[{kind:"edit",label:S,icon:$1,onClick:wt,className:be}]:[],...ht?[{kind:"delete",label:E,icon:Aa,variant:"destructive",separator:!0,iconClassName:"h-4 w-4",onClick:()=>mt(!0)}]:[]]);return p.jsxs(_l,{children:[p.jsx(Sl,{asChild:!0,children:p.jsx(Ke,{variant:"outline",size:"icon",className:"h-8 w-8 cursor-pointer","aria-label":"More actions",children:p.jsx(X5,{className:"h-4 w-4"})})}),p.jsx(So,{align:"end",className:"w-44",children:ye.map((Ce,at)=>p.jsxs(C.Fragment,{children:[Ce.separator&&at>0&&p.jsx(fs,{}),p.jsxs(ds,{onClick:()=>{var Je;return(Je=Ce.onClick)==null?void 0:Je.call(Ce,he)},className:Q("cursor-pointer gap-2",Ce.variant==="destructive"&&"text-destructive focus:text-destructive focus:bg-destructive/10",Ce.className),children:[Ce.icon&&p.jsx(Ce.icon,{className:Ce.iconClassName||"h-4 w-4 text-muted-foreground"}),Ce.label]})]},Ce.label||at))})]})},$n=(ye,Ce)=>{if(ye.render)return he?ye.render(Ce,he):p.jsx("span",{className:"text-muted-foreground",children:"-"});if(Ce==null||Ce==="")return p.jsx("span",{className:"text-muted-foreground",children:"-"});switch(ye.type){case"badge":return p.jsx(Yi,{variant:ye.variant||"default",children:ye.format?ye.format(Ce):String(Ce)});case"status":{const at={active:"success",inactive:"secondary",pending:"warning",error:"destructive",...ye.statusColors};return p.jsx(Yi,{variant:at[Ce==null?void 0:Ce.toLowerCase()]||"default",children:ye.format?ye.format(Ce):String(Ce)})}case"boolean":{const at=!!Ce;return p.jsx(Yi,{variant:at?"success":"secondary",children:at?ye.trueLabel||"Yes":ye.falseLabel||"No"})}case"date":return _0(Ce);case"datetime":return Yo(Ce);case"currency":return new Intl.NumberFormat("en-US",{style:"currency",currency:ye.currency||"USD"}).format(Ce);case"number":return ye.format?ye.format(Ce):new Intl.NumberFormat().format(Ce);case"list":return Array.isArray(Ce)?p.jsx("div",{className:"flex flex-wrap gap-1",children:Ce.map((at,Je)=>p.jsx(Yi,{variant:"outline",children:ye.getItemLabel?ye.getItemLabel(at):String(at)},Je))}):String(Ce);case"link":return p.jsx("a",{href:Ce,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:ye.linkText||Ce});case"email":return p.jsx("a",{href:`mailto:${Ce}`,className:"text-primary hover:underline",children:Ce});case"phone":return p.jsx("a",{href:`tel:${Ce}`,className:"text-primary hover:underline",children:Ce});case"image":return p.jsx("img",{src:Ce,alt:ye.label||"Image",className:Q("rounded-md object-cover",ye.imageClassName||"h-20 w-20")});case"html":return p.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:Ce}});default:return ye.format?ye.format(Ce):String(Ce)}},gn=ye=>{if(he)return ye.accessor?typeof ye.accessor=="function"?ye.accessor(he):he[ye.accessor]:he[ye.name]},vn=Q("grid gap-6",O===1&&"grid-cols-1",O===2&&"grid-cols-1 md:grid-cols-2",O===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),Ae=p.jsxs(p.Fragment,{children:[p.jsx("div",{className:Q(vn,$),children:l.map(ye=>{if(ye.hidden&&(typeof ye.hidden=="function"?he&&ye.hidden(he):ye.hidden))return null;const Ce=gn(ye),at=ye.colSpan||1,Je=Q(at===2&&"md:col-span-2",at===3&&"lg:col-span-3",at==="full"&&"col-span-full");return p.jsxs("div",{className:Q(Je,Z),children:[p.jsxs("dt",{className:Q("text-sm font-medium text-muted-foreground mb-1",ee),children:[ye.icon&&p.jsx(ye.icon,{className:"inline-block mr-2 h-4 w-4"}),ye.label]}),p.jsx("dd",{className:Q("text-sm",te),children:$n(ye,Ce)})]},ye.name||ye.accessor)})}),R&&he&&(he.created_at||he.updated_at||he.createdAt||he.updatedAt)&&p.jsxs(p.Fragment,{children:[p.jsx(Js,{className:"my-6"}),p.jsxs("div",{className:Q("flex flex-wrap gap-6 text-sm text-muted-foreground",se),children:[(he.created_at||he.createdAt)&&(he.created_at||he.createdAt)!==""&&p.jsxs("div",{className:Q("flex items-center gap-2",ie),children:[p.jsx(ea,{className:"h-4 w-4"}),p.jsxs("span",{children:["Created:"," ",Yo(he.created_at||he.createdAt)]})]}),(he.updated_at||he.updatedAt)&&(he.updated_at||he.updatedAt)!==""&&p.jsxs("div",{className:Q("flex items-center gap-2",ie),children:[p.jsx(ea,{className:"h-4 w-4"}),p.jsxs("span",{children:["Updated:"," ",Yo(he.updated_at||he.updatedAt)]})]}),(he.uuid||he.id||he._id)&&p.jsxs("div",{className:Q("flex items-center gap-2",ie),children:[p.jsx(J5,{className:"h-4 w-4"}),p.jsxs("span",{children:["ID: ",he.uuid||he.id||he._id]})]})]})]})]});return Ve?p.jsx("div",{className:Q("space-y-6",H),children:p.jsx(e1,{error:Ve,onBack:xt?qe:void 0,onRetry:()=>fe==null?void 0:fe(X),backLabel:d})}):t&&n&&typeof n=="function"?Oe?p.jsx("div",{className:Q("space-y-6",H),children:p.jsx(yn,{className:Q(ce),children:p.jsx(xn,{className:"py-12",children:p.jsx(Ml,{text:`Loading ${h}...`})})})}):Ve?p.jsx("div",{className:Q("space-y-6",H),children:p.jsx(yn,{className:Q(H,pe),children:p.jsxs(xn,{className:"py-12 text-center",children:[p.jsx("p",{className:"text-destructive",children:(Ve==null?void 0:Ve.message)||"An error occurred"}),p.jsxs(Ke,{variant:"outline",onClick:qe,className:"mt-4 cursor-pointer",children:[p.jsx(cr,{className:"mr-2 h-4 w-4"}),d]})]})})}):he?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:Q("space-y-6",H),...Re,children:[L&&p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:Q("flex items-center gap-3",Y),children:[xt&&p.jsx(Ke,{variant:"ghost",size:"icon",onClick:qe,className:Q("h-8 w-8 cursor-pointer",ae),children:p.jsx(cr,{className:"h-4 w-4"})}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:he&&b&&`${b(he)}`}),_&&p.jsx("p",{className:"text-muted-foreground text-sm",children:_})]})]}),p.jsx(kt,{})]}),n(he)]}),p.jsx(ms,{open:We,onOpenChange:mt,onConfirm:yt,itemName:He,loading:nt})]}):p.jsx("div",{className:Q("space-y-6",H),children:p.jsx(yn,{children:p.jsxs(xn,{className:"py-12 text-center",children:[p.jsxs("p",{className:"text-muted-foreground",children:["No ",h," found"]}),p.jsxs(Ke,{variant:"outline",onClick:qe,className:"mt-4 cursor-pointer",children:[p.jsx(cr,{className:"mr-2 h-4 w-4"}),d]})]})})}):Ve?p.jsx(yn,{className:Q(H,B),children:p.jsx(xn,{className:"py-4",children:p.jsx(e1,{error:Ve,onBack:xt?qe:void 0,onRetry:()=>fe==null?void 0:fe(X),backLabel:d})})}):Oe?p.jsx(yn,{className:H,children:p.jsx(xn,{className:"py-12",children:p.jsx(_d,{text:`Loading ${h}...`})})}):Ve?p.jsx(yn,{className:H,children:p.jsxs(xn,{className:"py-12 text-center",children:[p.jsx("p",{className:"text-destructive",children:(Ve==null?void 0:Ve.message)||"An error occurred"}),p.jsxs(Ke,{variant:"outline",onClick:qe,className:"mt-4 cursor-pointer",children:[p.jsx(cr,{className:"mr-2 h-4 w-4"}),d]})]})}):he?p.jsxs(p.Fragment,{children:[p.jsxs(yn,{className:H,...Re,children:[L&&p.jsxs(ns,{className:Q("flex flex-row items-center justify-between space-y-0 pb-4",j),children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(Ke,{variant:"ghost",size:"icon",onClick:qe,className:Q("h-8 w-8 cursor-pointer",de),children:p.jsx(cr,{className:"h-4 w-4"})}),p.jsxs("div",{children:[y&&p.jsx(rs,{className:Q("text-xl font-semibold tracking-tight",q),children:y}),_&&p.jsx(is,{className:Q(G),children:_})]})]}),p.jsx(kt,{})]}),p.jsx(xn,{children:Ae})]}),p.jsx(ms,{open:We,onOpenChange:mt,onConfirm:yt,itemName:He,loading:nt})]}):p.jsx(yn,{className:H,children:p.jsxs(xn,{className:"py-12 text-center",children:[p.jsxs("p",{className:"text-muted-foreground",children:["No ",h," found"]}),p.jsxs(Ke,{variant:"outline",onClick:qe,className:"mt-4 cursor-pointer",children:[p.jsx(cr,{className:"mr-2 h-4 w-4"}),d]})]})})};function UR(){try{return Pl()}catch{return null}}By.displayName="CrudDetail";const zy=t=>{const{name:n="crud",apiClient:r,endpoint:i,transformResponse:s=m=>m,transformRequest:o=m=>m,initialState:l={},extraActions:c={},idField:a="id",listKey:f="results",countKey:u="count"}=t;if(!r)throw new Error("createCrudStore: apiClient is required");if(!i)throw new Error("createCrudStore: endpoint is required");return m=>m((y,_)=>({items:[],item:null,loading:!1,submitting:!1,error:null,page:1,pageSize:15,totalItems:0,totalPages:0,sortColumn:null,sortDirection:null,search:"",filters:{},selectedIds:[],...l,pageMemory:{},setPage:S=>y(E=>({page:S,pageMemory:{...E.pageMemory,[JSON.stringify(Object.entries(E.filters||{}).sort())]:S}})),setPageSize:S=>y({pageSize:S,page:1}),setSearch:S=>y({search:S,page:1}),setFilters:S=>y(E=>({filters:S,page:E.pageMemory[JSON.stringify(Object.entries(S||{}).sort())]||1})),setSort:(S,E)=>y({sortColumn:S,sortDirection:E}),setSelectedIds:S=>y({selectedIds:S}),clearSelection:()=>y({selectedIds:[]}),clearError:()=>y({error:null}),reset:()=>y({items:[],item:null,loading:!1,submitting:!1,error:null,page:1,pageMemory:{},search:"",filters:{},selectedIds:[],sortColumn:null,sortDirection:null}),fetchList:async(S={})=>{var d,h,v,x;const E=_();if(!E.loading){y({loading:!0,error:null});try{const g={page:E.page,page_size:E.pageSize,search:E.search||void 0,ordering:E.sortColumn?`${E.sortDirection==="desc"?"-":""}${E.sortColumn}`:void 0,...E.filters,...S};Object.keys(g).forEach(D=>{(g[D]===void 0||g[D]==="")&&delete g[D]});const w=(await r.get(i,{params:g})).data,k=w[f]||w.data||(Array.isArray(w)?w:[]),N=w[u]||w.total||k.length,T=Math.ceil(N/E.pageSize);return y({items:k.map(s),totalItems:N,totalPages:T,loading:!1}),{items:k,totalItems:N,totalPages:T}}catch(g){const b=((h=(d=g.response)==null?void 0:d.data)==null?void 0:h.message)||((x=(v=g.response)==null?void 0:v.data)==null?void 0:x.detail)||g.message||"Failed to fetch items";throw y({error:{message:b,original:g},loading:!1}),g}}},fetchOne:async S=>{var E,d,h,v;if(!_().loading){y({loading:!0,error:null,item:null});try{const x=await r.get(`${i}/${S}/`),g=s(x.data);return y({item:g,loading:!1}),g}catch(x){const g=((d=(E=x.response)==null?void 0:E.data)==null?void 0:d.message)||((v=(h=x.response)==null?void 0:h.data)==null?void 0:v.detail)||x.message||"Failed to fetch item";throw y({error:{message:g,original:x},loading:!1}),x}}},create:async S=>{var E,d,h,v,x;if(!_().submitting){y({submitting:!0,error:null});try{const g=o(S),b=await r.post(`${i}/`,g),w=s(b.data);return y(k=>({items:[w,...k.items],totalItems:k.totalItems+1,submitting:!1})),w}catch(g){const b=((d=(E=g.response)==null?void 0:E.data)==null?void 0:d.message)||((v=(h=g.response)==null?void 0:h.data)==null?void 0:v.detail)||g.message||"Failed to create item",w=((x=g.response)==null?void 0:x.data)||{};throw y({error:{message:b,fieldErrors:w,original:g},submitting:!1}),g}}},update:async(S,E)=>{var d,h,v,x,g;if(!_().submitting){y({submitting:!0,error:null});try{const b=o(E),w=await r.patch(`${i}/${S}/`,b),k=s(w.data);return y(N=>{var T;return{items:N.items.map(D=>D[a]===S?k:D),item:((T=N.item)==null?void 0:T[a])===S?k:N.item,submitting:!1}}),k}catch(b){const w=((h=(d=b.response)==null?void 0:d.data)==null?void 0:h.message)||((x=(v=b.response)==null?void 0:v.data)==null?void 0:x.detail)||b.message||"Failed to update item",k=((g=b.response)==null?void 0:g.data)||{};throw y({error:{message:w,fieldErrors:k,original:b},submitting:!1}),b}}},delete:async S=>{var E,d,h,v;if(!_().submitting){y({submitting:!0,error:null});try{return await r.delete(`${i}/${S}/`),y(x=>{var g;return{items:x.items.filter(b=>b[a]!==S),totalItems:x.totalItems-1,item:((g=x.item)==null?void 0:g[a])===S?null:x.item,selectedIds:x.selectedIds.filter(b=>b!==S),submitting:!1}}),!0}catch(x){const g=((d=(E=x.response)==null?void 0:E.data)==null?void 0:d.message)||((v=(h=x.response)==null?void 0:h.data)==null?void 0:v.detail)||x.message||"Failed to delete item";throw y({error:{message:g,original:x},submitting:!1}),x}}},bulkDelete:async S=>{var E,d,h,v;y({submitting:!0,error:null});try{return await Promise.all(S.map(x=>r.delete(`${i}/${x}/`))),y(x=>({items:x.items.filter(g=>!S.includes(g[a])),totalItems:x.totalItems-S.length,selectedIds:[],submitting:!1})),!0}catch(x){const g=((d=(E=x.response)==null?void 0:E.data)==null?void 0:d.message)||((v=(h=x.response)==null?void 0:h.data)==null?void 0:v.detail)||x.message||"Failed to delete items";throw y({error:{message:g,original:x},submitting:!1}),x}},replace:async(S,E)=>{var d,h,v,x,g;y({submitting:!0,error:null});try{const b=o(E),w=await r.put(`${i}/${S}/`,b),k=s(w.data);return y(N=>{var T;return{items:N.items.map(D=>D[a]===S?k:D),item:((T=N.item)==null?void 0:T[a])===S?k:N.item,submitting:!1}}),k}catch(b){const w=((h=(d=b.response)==null?void 0:d.data)==null?void 0:h.message)||((x=(v=b.response)==null?void 0:v.data)==null?void 0:x.detail)||b.message||"Failed to update item",k=((g=b.response)==null?void 0:g.data)||{};throw y({error:{message:w,fieldErrors:k,original:b},submitting:!1}),b}},...c}))},qR=t=>{const{create:n}=require("zustand");return n(zy(t))},YR=ps("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",success:"bg-success text-success-foreground shadow-sm hover:bg-success/90"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),bn=C.forwardRef(({className:t,variant:n,size:r,asChild:i=!1,...s},o)=>{const l=i?k1:"button";return p.jsx(l,{className:Q(YR({variant:n,size:r,className:t})),ref:o,...s})});bn.displayName="Button";function Bd({label:t}){return p.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-15",children:[p.jsx("style",{children:"@keyframes csp{to{transform:rotate(360deg)}}"}),p.jsxs("div",{className:"relative w-11 h-11",children:[p.jsx("div",{className:"w-11 h-11 rounded-full border-2 border-[#e8dcc8] dark:border-[#3a352c] border-t-[#8b5e3c] dark:border-t-[#d9a86c]",style:{animation:"csp 1s linear infinite"}}),p.jsx(Na,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-4 w-4 text-[#8b5e3c] dark:text-[#d9a86c]"})]}),p.jsx("p",{className:"font-serif text-[13px] text-[#9e8870] dark:text-[#a99a86] m-0",children:t})]})}function GR(){return p.jsxs(p.Fragment,{children:[p.jsx("style",{children:"@keyframes psp{to{transform:rotate(360deg)}}"}),p.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-[#e8dcc8] dark:border-[#3a352c] border-t-[#8b5e3c] dark:border-t-[#d9a86c]",style:{animation:"psp 1s linear infinite"}})]})}function zd({message:t,downloadUrl:n}){return p.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-15 text-slate-500 dark:text-slate-400",children:[p.jsx(I1,{className:"h-9 w-9"}),p.jsx("p",{className:"text-sm",children:t}),n&&p.jsx("a",{href:n,download:!0,children:p.jsxs(bn,{variant:"outline",size:"sm",children:[p.jsx(Ks,{size:13,style:{marginRight:4}})," Download instead"]})})]})}const t1="http://www.idpf.org/2008/embedding",n1="http://ns.adobe.com/pdf/enc#RC",p0=t=>new DOMParser().parseFromString(t,"application/xml");async function g0(t,n){const r=t.file(n);return r?r.async("string"):null}async function ZR(t){var a;const n=await g0(t,"META-INF/container.xml"),r=n&&((a=p0(n).querySelector("rootfile"))==null?void 0:a.getAttribute("full-path")),i=r&&await g0(t,r);if(!i)return null;const s=p0(i).documentElement,o=s.getAttribute("unique-identifier"),l=Array.from(s.getElementsByTagNameNS("*","identifier")),c=l.find(f=>f.getAttribute("id")===o)??l[0];return(c==null?void 0:c.textContent)??null}async function XR(t){var i;if(!((i=globalThis.crypto)!=null&&i.subtle))return null;const n=t.replace(/[ \t\r\n]/g,""),r=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(n));return new Uint8Array(r)}function KR(t){const n=t.replace(/^urn:uuid:/i,"").replace(/[^0-9a-f]/gi,"");return n.length!==32?null:Uint8Array.from(n.match(/../g),r=>parseInt(r,16))}function QR(t,n,r){const i=t.slice(),s=Math.min(r,i.length);for(let o=0;o<s;o++)i[o]^=n[o%n.length];return i}async function JR(t){try{const n=await g0(t,"META-INF/encryption.xml");if(!n)return;const r=Array.from(p0(n).getElementsByTagNameNS("*","EncryptedData")).map(o=>{var l,c;return{algorithm:(l=o.getElementsByTagNameNS("*","EncryptionMethod")[0])==null?void 0:l.getAttribute("Algorithm"),path:(c=o.getElementsByTagNameNS("*","CipherReference")[0])==null?void 0:c.getAttribute("URI")}}).filter(o=>o.path&&(o.algorithm===t1||o.algorithm===n1));if(!r.length)return;const i=await ZR(t);if(!i)return;const s={[t1]:{key:await XR(i),length:1040},[n1]:{key:KR(i),length:1024}};await Promise.all(r.map(async({algorithm:o,path:l})=>{const{key:c,length:a}=s[o],f=decodeURIComponent(l).replace(/^\//,""),u=t.file(f);if(!c||!u)return;const m=await u.async("uint8array");t.file(f,QR(m,c,a))}))}catch(n){console.warn("Could not unscramble this book's fonts:",n)}}const v0=/preeti|kantipur|pcs\s*nepali|shreenath/i,jy=[["k|m","फ्र"],["p“m","ऊँ"],["km","फ"],["Km","फ्"],["qm","क्र"],["Qm","क्त"],["pm","ऊ"],["/m","रु"]];new RegExp(jy.map(([t])=>t.replace(/[|/]/g,"\\$&")).join("|"),"g");Object.fromEntries(jy);const Fy=t=>{var n;return((n=t==null?void 0:t.split(",")[0])==null?void 0:n.replace(/["']/g,"").trim().toLowerCase())??""};function r1(t,n=[]){const r=Fy(t);return!!r&&(v0.test(r)||n.includes(r))}async function eP(t){const n=new Set,r=t.file(/\.css$/i);return await Promise.all(r.map(async i=>{var o,l;const s=await i.async("string");for(const[c]of s.matchAll(/@font-face\s*\{[^}]*\}/gi)){const a=(o=c.match(/font-family\s*:\s*([^;}]+)/i))==null?void 0:o[1],f=((l=c.match(/src\s*:\s*([^;}]+)/i))==null?void 0:l[1])??"";a&&(v0.test(f)||v0.test(a))&&n.add(Fy(a))}})),[...n]}const tP="data-legacy-font-families";function nP(t,n){var r;(r=t==null?void 0:t.documentElement)==null||r.setAttribute(tP,n.join("|"))}const rP=1600,Hy="epub-locations:v1:",iP=800,i1=400,sP=600,oP="reader-base",aP=`
|
|
622
622
|
:where(html) { background: #fefdf8; }
|
|
623
623
|
:where(body) {
|
|
624
624
|
font-family: Georgia, 'Times New Roman', serif;
|
|
@@ -627,8 +627,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
627
627
|
}
|
|
628
628
|
:where(img, svg, video) { max-width: 100%; }
|
|
629
629
|
:where(img) { height: auto; }
|
|
630
|
-
`;function oP(t){if(!t)return null;try{return localStorage.getItem(Hy+t)}catch{return null}}function aP(t,n){if(!(!t||!n))try{localStorage.setItem(Hy+t,n)}catch{}}const $y=(t,n)=>Promise.race([t,new Promise(r=>setTimeout(r,n))]);function s1(t,n){const r=t?Array.from(t.images||[]):[];return r.length?$y(Promise.all(r.map(i=>{var s;return(s=i.decode)==null?void 0:s.call(i).catch(()=>{})})),n):Promise.resolve()}function lP(t){return new Promise(n=>{t.addEventListener("load",()=>{var i;const r=(i=t.contentDocument)==null?void 0:i.fonts;((r==null?void 0:r.ready)??Promise.resolve()).then(n,n)},{once:!0})})}function cP({blobUrl:t,allowSpread:n=!1,cacheKey:r}){let i=!1,s=null,o=null,l=null,c=100,a=!1,f=null,u=[],m=!1;const y={relocated:[],locationsReady:[],layout:[],keydown:[],error:[]};function _(R,P){var O;return(O=y[R])==null||O.push(P),()=>{y[R]=y[R].filter(U=>U!==P)}}function S(R,P){var O;(O=y[R])==null||O.forEach(U=>{try{U(P)}catch(H){console.error(`epubEngine listener for "${R}" threw:`,H)}})}const E=()=>{var R;return m&&!!((R=s==null?void 0:s.locations)!=null&&R.length())};function d(R){return!E()||!R?null:s.locations.locationFromCfi(R)+1}function h(R){var O;const P=R==null?void 0:R.start;return P!=null&&P.cfi?{index:P.index??null,cfi:P.cfi,page:d(P.cfi),endPage:d((O=R.end)==null?void 0:O.cfi),totalPages:E()?s.locations.length():null,percentage:E()?s.locations.percentageFromCfi(P.cfi):P.percentage??null,atStart:!!R.atStart,atEnd:!!R.atEnd}:null}function v(){const R=h(l);R&&S("relocated",R)}const x=()=>{var R,P;return(((P=(R=o==null?void 0:o.manager)==null?void 0:R.layout)==null?void 0:P.divisor)??1)>1},g=()=>{var P,O,U;const R=(P=o==null?void 0:o.manager)==null?void 0:P.views;return((U=(O=R==null?void 0:R.last)==null?void 0:O.call(R))==null?void 0:U.contents)??null};function b(){var U,H;const R=(H=(U=g())==null?void 0:U.viewport)==null?void 0:H.call(U),P=parseInt(R==null?void 0:R.width,10),O=parseInt(R==null?void 0:R.height,10);return P>0&&O>0?{width:P,height:O}:null}function w(){S("layout",{spread:x(),fixedLayout:a,pageSize:f})}async function k(){const R=oP(r);if(R)try{s.locations.load(R)}catch{}if(!s.locations.length()){if(await s.locations.generate(tP),i)return;aP(r,s.locations.save())}i||(m=!0,S("locationsReady",s.locations.length()),v())}async function N({el:R}){var P,O,U;try{const{default:H}=await Promise.resolve().then(()=>require("./index-gZlYD4yT.cjs"));if(s=H(t,{openAs:"epub"}),typeof s.unarchive=="function"){const F=s.unarchive.bind(s);s.unarchive=(...Y)=>F(...Y).then(async q=>{var $;const G=($=s.archive)==null?void 0:$.zip;return G&&(await KR(G),u=await QR(G)),q})}if(await s.ready,i)return null;let B=!1;if(s.spine.each(()=>{B=!0}),!B)throw new Error("No readable sections found in EPUB.");const j=await s.loaded.displayOptions.catch(()=>null);return a=((O=(P=s.packaging)==null?void 0:P.metadata)==null?void 0:O.layout)==="pre-paginated"||(j==null?void 0:j.fixedLayout)==="true",i||(o=s.renderTo(R,{width:"100%",height:"100%",flow:"paginated",manager:"default",spread:a||!n?"none":"auto",minSpreadWidth:nP}),o.hooks.content.register(F=>{F.addStylesheetCss(sP,iP),u.length&&eP(F.document,u)}),c!==100&&o.themes.fontSize(`${c}%`),o.on("relocated",F=>{l=F,v()}),o.on("keydown",F=>S("keydown",F)),o.on("layout",()=>w()),await o.display(),i)?null:(a&&(f=b()),w(),k().catch(()=>{}),{toc:((U=s.navigation)==null?void 0:U.toc)??[]})}catch(H){throw S("error",H),H}}async function T(R){var O;if(!o||i)return!1;const P=o.location??l;return(R>0?P!=null&&P.atEnd:P!=null&&P.atStart)||(await(R>0?o.next():o.prev()),i)?!1:(await s1((O=g())==null?void 0:O.document,rP),!i)}function D(R){return!o||i?Promise.resolve():o.display(R).catch(()=>{})}function I(){var P,O,U;if(!(o!=null&&o.manager)||i)return;const R=((O=(P=o.location)==null?void 0:P.start)==null?void 0:O.cfi)??((U=l==null?void 0:l.start)==null?void 0:U.cfi);try{o.resize(void 0,void 0,R)}catch{}}async function L(R){var F;const P=(F=o==null?void 0:o.manager)==null?void 0:F.container;if(!P||!R||i)return!1;const O=P.cloneNode(!0);O.setAttribute("aria-hidden","true"),O.style.pointerEvents="none";const U=P.querySelectorAll("iframe"),H=[];O.querySelectorAll("iframe").forEach((Y,q)=>{var $;const G=($=U[q])==null?void 0:$.contentDocument;Y.removeAttribute("src"),Y.removeAttribute("id"),Y.setAttribute("tabindex","-1"),Y.setAttribute("sandbox","allow-same-origin"),H.push(lP(Y).then(()=>s1(Y.contentDocument,i1))),Y.srcdoc=G?`<!DOCTYPE html>${G.documentElement.outerHTML}`:""}),R.replaceChildren(O);const{scrollLeft:B,scrollTop:j}=P;return O.scrollLeft=B,O.scrollTop=j,await $y(Promise.all(H),i1),O.scrollLeft=B,O.scrollTop=j,!0}return{on:_,init:N,turn:T,display:D,next:()=>T(1),prev:()=>T(-1),resize:I,snapshotInto:L,isSpread:x,isFixedLayout:()=>a,getSpineLength:()=>{var R,P,O;return((P=(R=s==null?void 0:s.spine)==null?void 0:R.spineItems)==null?void 0:P.length)??((O=s==null?void 0:s.spine)==null?void 0:O.length)??0},getPageSize:()=>f,getCurrentCfi:()=>{var R,P,O;return((P=(R=o==null?void 0:o.location)==null?void 0:R.start)==null?void 0:P.cfi)??((O=l==null?void 0:l.start)==null?void 0:O.cfi)??null},setFontScale:R=>{c=R,o==null||o.themes.fontSize(`${R}%`)},getToc:()=>{var R;return((R=s==null?void 0:s.navigation)==null?void 0:R.toc)??[]},hasLocations:E,virtualPageFromCfi:d,spineIndexFromCfi:R=>{var P,O;try{return((O=(P=s==null?void 0:s.spine)==null?void 0:P.get(R))==null?void 0:O.index)??null}catch{return null}},cfiFromVirtualPage:R=>E()?s.locations.cfiFromLocation(Math.max(0,R-1)):null,destroy:()=>{i=!0;try{o==null||o.destroy()}catch{}try{s==null||s.destroy()}catch{}o=null,s=null}}}const uP="4.0.379",o1=`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${uP}`;let Nc=null;function a1(){return Nc||(Nc=import(`${o1}/pdf.min.mjs`).then(t=>(t.GlobalWorkerOptions.workerSrc=`${o1}/pdf.worker.min.mjs`,t))),Nc}const l1=12e6,dP=12,fP=3,hP=15e5;function mP(t){const n=t.toDataURL("image/png");return n.length<=hP?n:t.toDataURL(pP(),.92)}let Wo=null;function pP(){if(!Wo)try{const t=document.createElement("canvas");t.width=1,t.height=1,Wo=t.toDataURL("image/webp").startsWith("data:image/webp")?"image/webp":"image/jpeg"}catch{Wo="image/jpeg"}return Wo}function gP({blobUrl:t}){let n=null,r=!1,i=1;const s=new Map,o=new Map;function l(_,S){for(s.delete(_),s.set(_,S);s.size>dP;)s.delete(s.keys().next().value)}const c={error:[]};function a(_,S){var E;return(E=c[_])==null||E.push(S),()=>{c[_]=c[_].filter(d=>d!==S)}}function f(_,S){var E;(E=c[_])==null||E.forEach(d=>{try{d(S)}catch(h){console.error(`pdfEngine listener for "${_}" threw:`,h)}})}async function u(){try{if(n=await(await a1()).getDocument({url:t,withCredentials:!1}).promise,r)return null;const S=(await n.getPage(1)).getViewport({scale:1});return r?null:{numPages:n.numPages,pageWidth:S.width,pageHeight:S.height}}catch(_){throw f("error",_),_}}async function m(_,S,E,d=1){if(!n||r||_<1)return null;const h=Math.min(fP,Math.max(1,d||1)),v=`${_}:${i}:${S}x${E}@${h.toFixed(2)}`;if(s.has(v)){const g=s.get(v);return l(v,g),g}if(o.has(v))return o.get(v);const x=(async()=>{try{const g=await n.getPage(_),b=g.getViewport({scale:1}),w=Math.min(S/b.width,E/b.height)*i;let k=Math.max(w,.1)*h;const N=b.width*k*(b.height*k);N>l1&&(k*=Math.sqrt(l1/N));const T=g.getViewport({scale:k}),D=document.createElement("canvas");if(D.width=T.width,D.height=T.height,await g.render({canvasContext:D.getContext("2d"),viewport:T}).promise,r)return null;const I=mP(D);return l(v,I),I}catch(g){return console.warn("PDF page render failed:",g),null}finally{o.delete(v)}})();return o.set(v,x),x}async function y(_,S,E,d){if(!(!n||r||!S||!E))try{const h=await a1(),v=await n.getPage(_),x=await v.getTextContent();if(r||d!=null&&d.aborted)return;const g=v.getViewport({scale:1}),b=v.getViewport({scale:E/g.width});S.replaceChildren(),S.style.setProperty("--scale-factor",String(b.scale));const w=[],k=h.renderTextLayer({textContentSource:x,container:S,viewport:b,textDivs:w});if(d==null||d.addEventListener("abort",()=>{var T;return(T=k.cancel)==null?void 0:T.call(k)},{once:!0}),await k.promise,d!=null&&d.aborted)return;x.items.filter(T=>T.str!==void 0).forEach((T,D)=>{var R,P;const I=w[D];if(!I)return;const L=O=>{r1(O==null?void 0:O.name)&&(I.dataset.legacyFont="")};try{v.commonObjs.get(T.fontName,L)}catch{}r1((P=(R=x.styles)==null?void 0:R[T.fontName])==null?void 0:P.fontFamily)&&(I.dataset.legacyFont="")})}catch(h){(h==null?void 0:h.name)!=="AbortException"&&console.warn("PDF text layer failed:",h)}}return{on:a,init:u,get numPages(){return(n==null?void 0:n.numPages)??0},renderPage:m,renderTextLayer:y,setZoom:_=>{i=_},getZoom:()=>i,getOutline:async()=>{if(!n)return[];try{return await n.getOutline()||[]}catch{return[]}},pageIndexForDest:async _=>{if(!n||!_)return null;try{const S=typeof _=="string"?await n.getDestination(_):_;return S?await n.getPageIndex(S[0])+1:null}catch{return null}},destroy:()=>{r=!0,s.clear(),o.clear()}}}function vP(t){const[n,r]=V.useState({width:0,height:0});return V.useEffect(()=>{const i=t.current;if(!i)return;const s=()=>{const l=i.getBoundingClientRect();r(c=>{const a=Math.round(l.width),f=Math.round(l.height);return c.width===a&&c.height===f?c:{width:a,height:f}})},o=new ResizeObserver(s);return o.observe(i),s(),()=>o.disconnect()},[t]),n}const b0=2,bP=4e3,yP=150,c1=10,xP=70,wP=200,CP={width:1e3,height:680},_P={width:420,height:680},u1=1.25,d1=600,SP=8;function kP(t,n){if(!(t!=null&&t.length))return Promise.resolve([]);const r=async i=>{var o;const s=[];for(const l of i){const c=await n(l.dest);s.push({label:l.title,target:c,children:(o=l.items)!=null&&o.length?await r(l.items):void 0})}return s};return r(t)}function Vy(t){return(t||[]).map(n=>{var r,i;return{label:((r=n.label)==null?void 0:r.trim())||n.href,target:n.href,children:(i=n.subitems)!=null&&i.length?Vy(n.subitems):void 0}})}const Ds=()=>new Promise(t=>requestAnimationFrame(()=>t())),EP=b0+3;function f1(t,n,r){let i=t;for(const[s,o]of n)o&&i[s]!==o&&(i===t&&(i={...t}),i[s]=o);for(const s of Object.keys(i))Math.abs(Number(s)-r)>EP&&(i===t&&(i={...t}),delete i[s]);return i}function Wy({type:t,blobUrl:n,title:r,allowSpread:i=!1,cacheKey:s,storage:o=null,visiblePages:l=null,backendTotalPages:c=null,subscribeMessage:a=null,onSubscribe:f=null,hasFullAccess:u=null}){const m=V.useRef(null),y=V.useRef(null),_=V.useRef(null),S=V.useRef(null),{width:E,height:d}=vP(m),[h,v]=V.useState(!1),[x,g]=V.useState(null),[b,w]=V.useState(!1),[k,N]=V.useState(null),[T,D]=V.useState(0),[I,L]=V.useState(!1),R=V.useRef(null),P=V.useRef(!1);P.current=I;const O=V.useRef(!1),U=t==="epub"?h:i,H=t==="pdf"&&i,B=U?2:1,j=V.useRef(1);j.current=B;const[F,Y]=V.useState("loading"),[q,G]=V.useState(null),[$,Z]=V.useState([]),[ee,te]=V.useState({cfi:null,page:null,endPage:null,totalPages:null,percentage:null,atStart:!0,atEnd:!1}),[se,ie]=V.useState(100),[ae,de]=V.useState([]),[be,ce]=V.useState(1),pe=V.useRef(1);pe.current=be;const[Se,Re]=V.useState({}),Fe=V.useRef(null),Ie=V.useRef(!1),Xe=V.useRef(!1),X=V.useRef(null),re=V.useRef(null),oe=V.useRef(null),xe=V.useMemo(()=>!b||!T||!c?0:Math.max(0,T-c),[b,T,c]),ve=V.useCallback(me=>{if(!b||(me==null?void 0:me.index)==null)return me;const ge=Math.max(1,me.index-xe+1),ke=c||Math.max(1,T-xe);return{...me,page:ge,endPage:ge,totalPages:ke}},[b,xe,c,T]),ue=V.useCallback(()=>{const me=S.current,ge=Fe.current;if(!(!me||!ge||Ie.current)){if(Xe.current){Ie.current=!0;return}if(t==="epub")if(b)me.display(Math.max(0,ge-1+xe));else{if(!me.hasLocations())return;const ke=me.cfiFromVirtualPage(ge);ke&&me.display(ke)}else ce(Math.max(1,ge));Ie.current=!0}},[t,b,xe]),fe=V.useRef(o);fe.current=o;const De=!!o;V.useEffect(()=>{var ke;const me=fe.current;if(!me)return;let ge=!1;return Promise.resolve((ke=me.load)==null?void 0:ke.call(me)).then(Le=>{ge||!Le||(Fe.current=Le.lastPage??null,de(Array.isArray(Le.bookmarks)?Le.bookmarks:[]),ue())}).catch(()=>{}),()=>{ge=!0}},[De,t,ue]);const he=V.useCallback(me=>{var ge;(ge=fe.current)!=null&&ge.saveProgress&&(!me||me===re.current||(clearTimeout(oe.current),oe.current=setTimeout(()=>{var ke,Le;re.current=me,Promise.resolve((Le=(ke=fe.current)==null?void 0:ke.saveProgress)==null?void 0:Le.call(ke,me)).catch(()=>{})},bP)))},[]);V.useEffect(()=>()=>clearTimeout(oe.current),[]);const Oe=V.useCallback(me=>{const ge=ve(me);te(ge),ge.page&&he(ge.page)},[he,ve]),Ve=E>0&&d>0;V.useEffect(()=>{if(!n||!Ve||t==="epub"&&!y.current)return;let me=!1;Y("loading"),G(null),Ie.current=!1;const ge=t==="pdf"?gP({blobUrl:n}):cP({blobUrl:n,allowSpread:i,cacheKey:s});S.current=ge;const ke=[ge.on("error",Le=>{me||(Y("error"),G((Le==null?void 0:Le.message)||"Failed to open this document."))})];return t==="epub"&&ke.push(ge.on("relocated",Le=>{me||Oe(Le)}),ge.on("layout",({spread:Le,fixedLayout:it,pageSize:Rt})=>{me||(v(Le),w(!!it),g(en=>(en==null?void 0:en.width)===(Rt==null?void 0:Rt.width)&&(en==null?void 0:en.height)===(Rt==null?void 0:Rt.height)?en:Rt??null))}),ge.on("keydown",Le=>{me||!(Le!=null&&Le.key)||window.dispatchEvent(new KeyboardEvent("keydown",{key:Le.key}))}),ge.on("locationsReady",()=>{if(me)return;ue();const Le=X.current;if(Le!=null){X.current=null;const it=ge.cfiFromVirtualPage(Le);it&&ge.display(it)}})),ge.init(t==="epub"?{el:y.current}:void 0).then(Le=>{var it;me||!Le||(Y("ready"),t==="epub"?(Z(Vy(ge.getToc())),D(((it=ge.getSpineLength)==null?void 0:it.call(ge))??0)):(Le.pageWidth&&Le.pageHeight&&N(Le.pageHeight/Le.pageWidth),te({cfi:null,page:1,endPage:1,totalPages:Le.numPages,percentage:0,atStart:!0,atEnd:Le.numPages<=1}),ue(),ge.getOutline().then(Rt=>kP(Rt,ge.pageIndexForDest).then(Z))))}).catch(()=>{}),()=>{me=!0,ke.forEach(Le=>Le==null?void 0:Le()),ge.destroy(),S.current=null}},[t,n,Ve]);const We=V.useMemo(()=>H?{width:d1*2,height:Math.round(d1*(k??Math.SQRT2))}:x??(i?CP:_P),[H,k,x,i]),mt=V.useMemo(()=>!E||!d?1:H?Math.min((E-SP)/We.width,u1):Math.min(E/We.width,d/We.height,u1),[We,E,d,H]),nt=V.useMemo(()=>{const me=typeof window>"u"?1:Math.max(1,window.devicePixelRatio||1),ge=Math.ceil(mt*me*4)/4;return{width:U?Math.max(1,Math.floor(We.width/2)):We.width,height:We.height,density:Math.max(1,ge)}},[We,mt,U]),ft=V.useRef(nt);ft.current=nt,V.useEffect(()=>{if(t!=="epub"||F!=="ready")return;const me=setTimeout(()=>{var ge;return(ge=S.current)==null?void 0:ge.resize()},yP);return()=>clearTimeout(me)},[t,F,We.width,We.height]),V.useEffect(()=>{if(t!=="pdf"||F!=="ready")return;const me=S.current;if(!me||!E||!d)return;const ge=ee.totalPages||me.numPages;if(!ge)return;const ke=Math.min(Math.max(1,be),ge);if(ke!==be){ce(ke);return}const Le=U?Math.min(ke+1,ge):ke;Oe({cfi:null,page:ke,endPage:Le,totalPages:ge,percentage:ge>1?(ke-1)/(ge-1):0,atStart:ke<=1,atEnd:Le>=ge});const{width:it,height:Rt,density:en}=nt,Oi=new Set;for(const Un of U?[ke,ke+1]:[ke])for(let Ht=-b0;Ht<=b0;Ht++){const Nr=Un+Ht;Nr>=1&&Nr<=ge&&Oi.add(Nr)}const or=new Set(U?[ke,ke+1]:[ke]);[...Oi].sort((Un,Ht)=>Number(or.has(Ht))-Number(or.has(Un))).forEach(Un=>{me.renderPage(Un,it,Rt,en).then(Ht=>{Ht&&Re(Nr=>f1(Nr,[[Un,Ht]],pe.current))})})},[t,F,be,E,d,se,U,nt]);const bt=u===!1?l!=null:u===!0?!1:!!l&&!!c&&l<c,xt=V.useMemo(()=>{const me={atBoundary:!1,past:!1};if(!bt)return me;const ge=(ke,Le)=>({atBoundary:ke>=Le,past:ke>Le});return t==="pdf"?ge(U?be+1:be,l):b?ee.index==null?me:ge(ee.index,xe+l-1):!ee.totalPages||!ee.page?me:ge(ee.page,c?Math.max(1,Math.ceil(ee.totalPages*l/c)):Math.max(1,l))},[bt,t,be,U,l,c,b,xe,ee.index,ee.page,ee.totalPages]),qe=xt.atBoundary;O.current=qe;const wt=V.useRef(null);V.useEffect(()=>{var ge;if(!bt)return;if(!xt.past){ee.cfi&&(wt.current=ee.cfi);return}if(t==="pdf"){const ke=U?Math.max(1,l-1):l;ce(Le=>Math.min(Le,ke));return}const me=wt.current;me&&((ge=S.current)==null||ge.display(me)),L(!0)},[bt,xt.past,ee.cfi,t,l,U]);const yt=V.useCallback(()=>{var me;if(!I){if(Xe.current=!0,qe){L(!0);return}t==="epub"?(me=S.current)==null||me.next():ce(ge=>Math.min(ge+B,ee.totalPages||ge))}},[t,ee.totalPages,I,qe,B]),Ue=V.useCallback(()=>{var me;if(Xe.current=!0,I){L(!1);return}t==="epub"?(me=S.current)==null||me.prev():ce(ge=>Math.max(ge-B,1))},[t,I,B]),rt=V.useCallback(async me=>{var Le;if(t==="epub")return!!await((Le=S.current)==null?void 0:Le.snapshotInto(me));const ge=_.current;if(!ge)return!1;const ke=ge.cloneNode(!0);return ke.setAttribute("aria-hidden","true"),ke.style.pointerEvents="none",me.replaceChildren(ke),await Promise.all([...ke.querySelectorAll("img")].map(it=>it.decode().catch(()=>{}))),!0},[t]),He=V.useCallback(async me=>{if(!me)return!1;if(P.current){const ge=R.current;if(!ge)return!1;const ke=ge.cloneNode(!0);return ke.setAttribute("aria-hidden","true"),ke.style.pointerEvents="none",me.replaceChildren(ke),!0}return rt(me)},[rt]),Ye=V.useRef(!1);Ye.current=xt.past;const ht=V.useCallback(async me=>!me||Ye.current?!1:rt(me),[rt]),ot=V.useCallback(async me=>{var Un;if(Xe.current=!0,P.current)return me>0?!1:(Lr.flushSync(()=>L(!1)),await Ds(),!0);if(me>0&&O.current)return Lr.flushSync(()=>L(!0)),await Ds(),await Ds(),!0;if(t==="epub")return!!await((Un=S.current)==null?void 0:Un.turn(me));const ge=S.current,ke=ee.totalPages||0,Le=j.current,it=pe.current+me*Le;if(!ge||it<1||it>ke)return!1;const{width:Rt,height:en,density:Oi}=ft.current,or=await Promise.all((Le>1?[it,it+1]:[it]).filter(Ht=>Ht>=1&&Ht<=ke).map(async Ht=>[Ht,await ge.renderPage(Ht,Rt,en,Oi)]));return Lr.flushSync(()=>{Re(Ht=>f1(Ht,or,it)),ce(it)}),await Ds(),await Ds(),!0},[t,ee.totalPages]),kt=V.useCallback(me=>{if(!me)return;if(Xe.current=!0,t==="pdf"){ce(Math.min(Math.max(1,me),ee.totalPages||me));return}const ge=S.current;if(b){ge==null||ge.display(Math.max(0,me-1+xe));return}if(!(ge!=null&&ge.hasLocations())){X.current=me;return}const ke=ge.cfiFromVirtualPage(me);ke&&ge.display(ke)},[t,ee.totalPages,b,xe]),$n=V.useCallback(me=>{var ge;t!=="epub"||!me||(Xe.current=!0,(ge=S.current)==null||ge.display(me))},[t]),gn=V.useCallback(me=>{var ke;if(!me)return;const ge=(ke=me.value)==null?void 0:ke.cfi;t==="epub"&&ge?$n(ge):kt(me.page_no)},[t,$n,kt]),vn=V.useCallback(me=>{var ge;me&&(Xe.current=!0,t==="epub"?(ge=S.current)==null||ge.display(me.target):me.target&&ce(me.target))},[t]),Ae=V.useCallback(()=>kt(1),[kt]),ye=V.useCallback(()=>{ee.totalPages&&kt(ee.totalPages)},[kt,ee.totalPages]),Ce=V.useCallback(me=>{var ke;const ge=Math.min(wP,Math.max(xP,me));if(ie(ge),t==="epub"){const Le=S.current,it=Le==null?void 0:Le.getCurrentCfi();Le==null||Le.setFontScale(ge),it&&Le.display(it)}else(ke=S.current)==null||ke.setZoom(ge/100),Re({})},[t]),at=V.useCallback(()=>Ce(se+c1),[Ce,se]),Je=V.useCallback(()=>Ce(se-c1),[Ce,se]),Vn=V.useCallback(()=>Ce(100),[Ce]),on=V.useMemo(()=>ae.find(me=>me.page_no===ee.page)||null,[ae,ee.page]),Wn=V.useCallback(()=>{var Le;if(!ee.page)return;const me=fe.current;if(on){const it=on.id;de(Rt=>Rt.filter(en=>en.id!==it)),Promise.resolve((Le=me==null?void 0:me.removeBookmark)==null?void 0:Le.call(me,it)).catch(()=>{});return}const ge=ee.cfi?{cfi:ee.cfi}:void 0,ke={id:`pending-${Date.now()}`,page_no:ee.page,value:ge,created_at:new Date().toISOString()};de(it=>[ke,...it]),me!=null&&me.addBookmark&&Promise.resolve(me.addBookmark({page_no:ee.page,value:ge})).then(it=>{it!=null&&it.id&&de(Rt=>Rt.map(en=>en.id===ke.id?it:en))}).catch(()=>{de(it=>it.filter(Rt=>Rt.id!==ke.id))})},[ee.page,ee.cfi,on]),ks=V.useCallback(me=>{var ge,ke;de(Le=>Le.filter(it=>it.id!==me)),Promise.resolve((ke=(ge=fe.current)==null?void 0:ge.removeBookmark)==null?void 0:ke.call(ge,me)).catch(()=>{})},[]),To=V.useCallback((me,ge,ke,Le)=>{var it,Rt;return(Rt=(it=S.current)==null?void 0:it.renderTextLayer)==null?void 0:Rt.call(it,me,ge,ke,Le)},[]),Ii=V.useRef(null),[sr,Il]=V.useState(!1);V.useEffect(()=>{const me=()=>Il(document.fullscreenElement===Ii.current);return document.addEventListener("fullscreenchange",me),()=>document.removeEventListener("fullscreenchange",me)},[]);const Tr=V.useCallback(()=>{var me,ge,ke;document.fullscreenElement?(me=document.exitFullscreen)==null||me.call(document):(ke=(ge=Ii.current)==null?void 0:ge.requestFullscreen)==null||ke.call(ge)},[]);return V.useEffect(()=>{const me=ge=>{var ke,Le;((ke=ge.target)==null?void 0:ke.tagName)==="INPUT"||((Le=ge.target)==null?void 0:Le.tagName)==="TEXTAREA"||(ge.key==="Home"?Ae():ge.key==="End"?ye():ge.key==="Escape"&&sr&&Tr())};return window.addEventListener("keydown",me),()=>window.removeEventListener("keydown",me)},[Ae,ye,sr,Tr]),{type:t,status:F,error:q,containerRef:m,epubMountRef:y,pdfSurfaceRef:_,isSpread:U,pdfFitWidth:H,stageSize:We,stageScale:mt,fullscreenRef:Ii,title:r,toc:$,location:ee,canGoNext:I?!1:qe||!ee.atEnd,canGoPrev:I?!0:!ee.atStart,isGated:bt,isLocked:I,subscribeMessage:a,onSubscribe:f,subscribeWallRef:R,snapshotBackdrop:ht,visiblePages:l,backendTotalPages:c,goNext:yt,goPrev:Ue,snapshotInto:He,turnPage:ot,goToToc:vn,goToPageNo:kt,goToCfi:$n,goToBookmark:gn,zoomPercent:se,zoomIn:at,zoomOut:Je,resetZoom:Vn,isFullscreen:sr,toggleFullscreen:Tr,bookmarks:ae,isCurrentBookmarked:!!on,toggleBookmark:Wn,removeBookmark:ks,renderedPages:Se,renderPdfTextLayer:To}}const h1="(max-width: 768px), (pointer: coarse) and (max-width: 1024px)";function TP(){const[t,n]=V.useState(()=>typeof window<"u"&&window.matchMedia(h1).matches);return V.useEffect(()=>{const r=window.matchMedia(h1),i=s=>n(s.matches);return r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[]),t}function m1(t,n){if(t.totalPages){const{page:r,endPage:i,totalPages:s}=t;return n&&r&&i&&i>r?`Pages ${r}–${i} of ${s}`:`Page ${r??"…"} of ${s}`}return t.percentage!=null?`${Math.round(t.percentage*100)}%`:"Loading…"}function NP({visiblePages:t,totalPages:n}){return!t||!n?null:p.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-warning/20 bg-warning/10 px-1.5 py-0.5 text-[10px] font-medium text-warning whitespace-nowrap",title:"Subscribe to read the rest of this book",children:[p.jsx(H1,{className:"h-2.5 w-2.5"}),t," of ",n," pages free"]})}function Uy({reader:t,compact:n=!1,onPrev:r,onNext:i,onOpenToc:s,onOpenBookmarks:o,canDownload:l,downloadUrl:c}){const{title:a,location:f,isSpread:u,canGoPrev:m,canGoNext:y,goPrev:_,goNext:S,zoomPercent:E,zoomIn:d,zoomOut:h,isFullscreen:v,toggleFullscreen:x,isGated:g,visiblePages:b,backendTotalPages:w,isCurrentBookmarked:k,toggleBookmark:N,toc:T}=t;return p.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border bg-background px-3 py-2 flex-wrap",children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx(Na,{className:"h-4 w-4 text-amber-700 shrink-0"}),p.jsx("span",{className:"truncate font-serif italic text-sm text-foreground",title:a,children:a}),!n&&p.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:["— ",m1(f,u)]}),g&&p.jsx(NP,{visiblePages:b,totalPages:w})]}),p.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[n&&p.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap mr-1",children:m1(f,u)}),T.length>0&&p.jsx(bn,{variant:"ghost",size:"icon",onClick:s,title:"Contents",children:p.jsx(F1,{className:"h-4 w-4"})}),p.jsxs(bn,{variant:"ghost",size:"icon",onClick:N,title:k?"Remove mark":"Mark this page","aria-pressed":k,children:[p.jsx(Pc,{className:k?"h-4 w-4 fill-current text-amber-700":"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:k?"Remove mark":"Mark this page"})]}),p.jsxs(bn,{variant:"ghost",size:"icon",onClick:o,title:"Marks",children:[p.jsx(ex,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Marks"})]}),!n&&p.jsxs(p.Fragment,{children:[p.jsx(bn,{variant:"ghost",size:"icon",onClick:h,title:"Zoom out",children:p.jsx(cx,{className:"h-4 w-4"})}),p.jsxs("span",{className:"text-xs text-muted-foreground w-10 text-center tabular-nums",children:[E,"%"]}),p.jsx(bn,{variant:"ghost",size:"icon",onClick:d,title:"Zoom in",children:p.jsx(lx,{className:"h-4 w-4"})})]}),p.jsx(bn,{variant:"ghost",size:"icon",onClick:x,title:"Fullscreen",children:v?p.jsx(rx,{className:"h-4 w-4"}):p.jsx(tx,{className:"h-4 w-4"})}),!n&&p.jsxs(p.Fragment,{children:[p.jsx(bn,{variant:"ghost",size:"icon",onClick:r??_,disabled:!m,title:"Previous",children:p.jsx(Ai,{className:"h-4 w-4"})}),p.jsx(bn,{variant:"ghost",size:"icon",onClick:i??S,disabled:!y,title:"Next",children:p.jsx(In,{className:"h-4 w-4"})})]}),l&&c&&p.jsx("a",{href:c,download:!0,children:p.jsxs(bn,{variant:"default",size:"sm",children:[p.jsx(Ks,{className:"h-3.5 w-3.5"})," Download"]})})]})]})}function qy({...t}){return p.jsx(Z0,{"data-slot":"sheet",...t})}function MP({...t}){return p.jsx(X0,{"data-slot":"sheet-portal",...t})}function AP({className:t,...n}){return p.jsx(Za,{"data-slot":"sheet-overlay",className:Q("fixed inset-0 z-50 bg-black/50 backdrop-blur-[2px]","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=open]:duration-300 data-[state=closed]:duration-200",t),...n})}function Yy({className:t,children:n,side:r="right",...i}){return p.jsxs(MP,{children:[p.jsx(AP,{}),p.jsxs(Xa,{"data-slot":"sheet-content",className:Q("bg-white fixed z-50 flex flex-col shadow-xl","will-change-transform","transition-transform","[transition-timing-function:cubic-bezier(0.32,0.72,0,1)]","data-[state=open]:duration-500 data-[state=closed]:duration-300","data-[state=open]:animate-in data-[state=closed]:animate-out",r==="right"&&["inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-md","data-[state=closed]:slide-out-to-right","data-[state=open]:slide-in-from-right"],r==="left"&&["inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-md","data-[state=closed]:slide-out-to-left","data-[state=open]:slide-in-from-left"],r==="top"&&["inset-x-0 top-0 h-auto border-b","data-[state=closed]:slide-out-to-top","data-[state=open]:slide-in-from-top"],r==="bottom"&&["inset-x-0 bottom-0 h-auto border-t","data-[state=closed]:slide-out-to-bottom","data-[state=open]:slide-in-from-bottom"],t),...i,children:[n,p.jsxs(lo,{className:"absolute top-4 right-4 rounded-sm opacity-70 transition-opacity duration-200 hover:opacity-100 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none z-10",children:[p.jsx(er,{className:"w-4 h-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Gy({className:t,...n}){return p.jsx("div",{"data-slot":"sheet-header",className:Q("flex flex-col gap-1.5 px-6 pt-6",t),...n})}function Zy({className:t,...n}){return p.jsx(Ka,{"data-slot":"sheet-title",className:Q("text-gray-900 text-lg font-semibold",t),...n})}function Xy({items:t,onSelect:n,depth:r=0}){return p.jsx("ul",{className:r===0?"space-y-0.5":"space-y-0.5 border-l pl-3",children:t.map((i,s)=>{var o;return p.jsxs("li",{children:[p.jsx("button",{type:"button",onClick:()=>n(i),disabled:i.target==null,className:"w-full text-left text-sm py-1.5 px-2 rounded-md hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed text-foreground truncate",title:i.label,children:i.label}),((o=i.children)==null?void 0:o.length)>0&&p.jsx(Xy,{items:i.children,onSelect:n,depth:r+1})]},`${r}-${s}-${i.label}`)})})}function Ky({open:t,onOpenChange:n,toc:r,onSelect:i}){return p.jsx(qy,{open:t,onOpenChange:n,children:p.jsxs(Yy,{side:"left",className:"w-80 dark:bg-neutral-900 dark:border-neutral-800",children:[p.jsx(Gy,{children:p.jsxs(Zy,{className:"flex items-center gap-2 dark:text-neutral-100",children:[p.jsx(F1,{className:"h-4 w-4"})," Contents"]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:r.length===0?p.jsx("p",{className:"text-sm text-muted-foreground",children:"No table of contents available."}):p.jsx(Xy,{items:r,onSelect:s=>{i(s),n(!1)}})})]})})}function Qy({open:t,onOpenChange:n,bookmarks:r,onSelect:i,onRemove:s}){return p.jsx(qy,{open:t,onOpenChange:n,children:p.jsxs(Yy,{side:"right",className:"w-80 dark:bg-neutral-900 dark:border-neutral-800",children:[p.jsx(Gy,{children:p.jsxs(Zy,{className:"flex items-center gap-2 dark:text-neutral-100",children:[p.jsx(Pc,{className:"h-4 w-4"})," Marks"]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-4 space-y-1",children:r.length===0?p.jsx("p",{className:"text-sm text-muted-foreground",children:"No marks yet — use the mark icon in the toolbar to mark a page and come back to it later."}):r.map(o=>p.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md px-2 py-1.5 hover:bg-muted group",children:[p.jsxs("button",{type:"button",onClick:()=>{i(o),n(!1)},className:"flex flex-1 items-center gap-2 text-left text-sm text-foreground",children:[p.jsx(Pc,{className:"h-3.5 w-3.5 shrink-0 fill-current text-amber-700"}),"Page ",o.page_no]}),p.jsx(bn,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100",onClick:()=>s(o.id),title:"Remove mark",children:p.jsx(Aa,{className:"h-3.5 w-3.5 text-destructive"})})]},o.id))})]})})}function DP(t,n){const r=Math.min(1,n.width/t.width,n.height/t.height);return{width:t.width*r,height:t.height*r}}function RP({page:t,width:n,renderTextLayer:r}){const i=V.useRef(null);return V.useEffect(()=>{const s=i.current;if(!s||!r||!n)return;const o=new AbortController;return r(t,s,n,o.signal),()=>o.abort()},[t,n,r]),p.jsx("div",{ref:i,className:"textLayer"})}function Mc({page:t,renderedPages:n,half:r=!1,renderTextLayer:i}){const s=V.useRef(null),[o,l]=V.useState(null),[c,a]=V.useState(null);V.useEffect(()=>{const y=s.current;if(!y)return;const _=()=>l(E=>(E==null?void 0:E.width)===y.offsetWidth&&(E==null?void 0:E.height)===y.offsetHeight?E:{width:y.offsetWidth,height:y.offsetHeight});_();const S=new ResizeObserver(_);return S.observe(y),()=>S.disconnect()},[]);const f=t==null,u=t?n[t]:null,m=c&&(o!=null&&o.width)?DP(c,o):null;return p.jsx("div",{ref:s,className:`relative ${r?"w-1/2":"w-full"} h-full flex items-center justify-center bg-[#fefdf8]`,children:f?null:u?p.jsxs(p.Fragment,{children:[p.jsx("img",{src:u,alt:`Page ${t}`,"data-pdf-img":t,onLoad:y=>{const{naturalWidth:_,naturalHeight:S}=y.currentTarget;a(E=>(E==null?void 0:E.width)===_&&(E==null?void 0:E.height)===S?E:{width:_,height:S})},className:"max-w-full max-h-full object-contain"}),m&&p.jsx("div",{"data-pdf-page":t,className:"absolute inset-0 m-auto",style:{width:m.width,height:m.height},children:p.jsx(RP,{page:t,width:Math.round(m.width),renderTextLayer:i})})]}):p.jsx(qR,{})})}function Jy({page:t,rightPage:n,renderedPages:r,isSpread:i,renderTextLayer:s}){const o={renderedPages:r,renderTextLayer:s};return i?p.jsxs("div",{className:"w-full h-full flex bg-[#fefdf8]",children:[p.jsx(Mc,{page:t,half:!0,...o}),p.jsx(Mc,{page:n,half:!0,...o})]}):p.jsx(Mc,{page:t,...o})}const Ac=650,PP=.28,LP=6,IP=3,OP=320,BP=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,Ea=(t,n,r)=>Math.min(r,Math.max(n,t)),Uo="bg-[#fefdf8] rounded-md shadow-xl overflow-hidden",p1="inset(0 50% 0 0)",g1="inset(0 0 0 50%)";function Rs(t,n){if(!t)return;const r=Ea(n,0,1);t.style.setProperty("--flip-p",r.toFixed(4)),t.style.setProperty("--flip-shade",(.5*Math.min(1,r*2)).toFixed(3)),t.style.setProperty("--flip-back-shade",Ea((1-r)*1.4,0,.7).toFixed(3))}function qo(){return p.jsxs(p.Fragment,{children:[p.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 right-1/2 w-[7%]",style:{background:"linear-gradient(to left, rgba(0,0,0,.2), rgba(0,0,0,.06) 45%, rgba(0,0,0,0))"}}),p.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-1/2 w-[7%]",style:{background:"linear-gradient(to right, rgba(0,0,0,.2), rgba(0,0,0,.06) 45%, rgba(0,0,0,0))"}})]})}function v1({hinge:t,variable:n,half:r}){const i=r==="left"?{left:0,width:"50%"}:r==="right"?{left:"50%",width:"50%"}:{left:0,width:"100%"};return p.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0",style:{...i,opacity:`var(${n}, 0)`,background:`linear-gradient(to ${t==="left"?"right":"left"},
|
|
631
|
-
rgba(0,0,0,.5), rgba(0,0,0,.16) 35%, rgba(0,0,0,0) 70%)`}})}function b1(t){if(!t)return{};const{direction:n,spread:r}=t;if(r){const i=n>0?g1:p1,s=n>0?p1:g1,o=-180*n;return{under:{clipPath:s},front:{clipPath:i,transformOrigin:"50% 50%",transform:`rotateY(calc(var(--flip-p, 0) * ${o}deg))`},back:{clipPath:s,transformOrigin:"50% 50%",transform:`rotateY(calc(${-o}deg + var(--flip-p, 0) * ${o}deg))`},frontHalf:n>0?"right":"left",backHalf:n>0?"left":"right",frontHinge:n>0?"left":"right",backHinge:n>0?"right":"left"}}return n>0?{under:null,front:{transformOrigin:"0 50%",transform:"rotateY(calc(var(--flip-p, 0) * -90deg))"},back:null,frontHinge:"left"}:{under:{},front:null,back:{transformOrigin:"0 50%",transform:"rotateY(calc((1 - var(--flip-p, 0)) * -90deg))"},backHinge:"left"}}const e3=V.forwardRef(function({isSpread:n,snapshotInto:r,turnPage:i,canGoNext:s,canGoPrev:o,grabWidth:l=64,className:c="",style:a,hidden:f=!1,overlay:u=null,children:m},y){const _=V.useRef(null),S=V.useRef(null),E=V.useRef(null),d=V.useRef(null),h=V.useRef(0),v=V.useRef(!1),x=V.useRef(null),g=V.useRef([]),[b,w]=V.useState(null);V.useEffect(()=>()=>cancelAnimationFrame(h.current),[]);const k=V.useCallback((G,$,Z)=>(cancelAnimationFrame(h.current),new Promise(ee=>{const te=performance.now(),se=ie=>{const ae=Z<=0?1:Ea((ie-te)/Z,0,1);Rs(_.current,G+($-G)*BP(ae)),ae<1?h.current=requestAnimationFrame(se):ee()};h.current=requestAnimationFrame(se)})),[]),N=V.useCallback(()=>{Lr.flushSync(()=>w(null)),[S,E,d].forEach(G=>{var $;return($=G.current)==null?void 0:$.replaceChildren()}),Rs(_.current,0),x.current=null,v.current=!1},[]),T=V.useCallback(async G=>{if(G>0?!s:!o)return!1;const $=!!n,Z=b1({direction:G,spread:$});Rs(_.current,0),Lr.flushSync(()=>w({direction:G,spread:$,shown:!1}));const ee=[];return Z.under&&ee.push(r(S.current)),Z.front&&ee.push(r(E.current)),!(await Promise.all(ee)).every(Boolean)||(Lr.flushSync(()=>w({direction:G,spread:$,shown:!0})),!await i(G))?(N(),!1):(Z.back&&(await r(d.current),Lr.flushSync(()=>w({direction:G,spread:$,shown:!0,backReady:!0}))),!0)},[s,o,n,r,i,N]),D=V.useCallback(async(G,$=Ac)=>{await k(G,1,$*(1-G)),N()},[k,N]),I=V.useCallback(async(G,$)=>{await k($,0,Ac*$);try{await i(-G)}finally{N()}},[k,i,N]),L=V.useCallback(async G=>{if(v.current){!x.current&&g.current.length<IP&&g.current.push(G);return}let $=G,Z=!1;for(;$!=null;){v.current=!0;try{if(!await T($)){v.current=!1,g.current=[];return}await D(0,Z?OP:Ac)}catch{N(),g.current=[];return}$=g.current.shift(),Z=!0}},[T,D,N]);V.useImperativeHandle(y,()=>({flipNext:()=>L(1),flipPrev:()=>L(-1),get isFlipping(){return v.current}}),[L]);const R=V.useCallback(()=>{var $;const G=(($=_.current)==null?void 0:$.getBoundingClientRect().width)||1;return n?G/2:G},[n]),P=V.useCallback(G=>{const{direction:$,progress:Z=0,moved:ee}=G;!ee||Z>=PP?D(Z):I($,Z)},[D,I]),O=V.useCallback(G=>$=>{if($.button!=null&&$.button!==0||v.current||(G>0?!s:!o))return;v.current=!0;const Z={direction:G,startX:$.clientX,width:R(),armed:!1,released:!1,moved:!1,progress:0};x.current=Z;try{$.currentTarget.setPointerCapture($.pointerId)}catch{}T(G).then(ee=>{if(!ee){x.current=null,v.current=!1;return}Z.armed=!0,Z.released?P(Z):Rs(_.current,Z.progress)}).catch(()=>N())},[T,P,N,s,o,R]),U=V.useCallback(G=>{const $=x.current;if(!$||$.released)return;const Z=G.clientX-$.startX;Math.abs(Z)>LP&&($.moved=!0),$.progress=Ea(Z*-$.direction/$.width,0,1),$.armed&&Rs(_.current,$.progress)},[]),H=V.useCallback(()=>{const G=x.current;!G||G.released||(G.released=!0,G.armed&&P(G))},[P]),B=b1(b),j=b!=null&&b.shown?"visible":"hidden",F={backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden",visibility:j},Y=b!=null&&b.shown&&(b!=null&&b.backReady)?"visible":"hidden",q=G=>({onPointerDown:O(G),onPointerMove:U,onPointerUp:H,onPointerCancel:H});return p.jsxs("div",{ref:_,className:`select-none ${c}`,style:{width:"100%",height:"100%",...a,perspective:3200,visibility:f?"hidden":"visible"},children:[p.jsxs("div",{className:`absolute inset-0 ${Uo}`,children:[m,n&&p.jsx(qo,{})]}),p.jsxs("div",{className:`absolute inset-0 ${Uo}`,style:{zIndex:10,visibility:B.under?j:"hidden",...B.under},children:[p.jsx("div",{ref:S,className:"absolute inset-0"}),(b==null?void 0:b.spread)&&p.jsx(qo,{})]}),p.jsxs("div",{className:`absolute inset-0 ${Uo}`,style:{zIndex:30,...F,...B.front??{visibility:"hidden"}},children:[p.jsx("div",{ref:E,className:"absolute inset-0"}),(b==null?void 0:b.spread)&&p.jsx(qo,{}),B.front&&p.jsx(v1,{hinge:B.frontHinge,half:B.frontHalf,variable:"--flip-shade"})]}),p.jsxs("div",{className:`absolute inset-0 ${Uo}`,style:{zIndex:40,...F,...B.back??{},visibility:B.back?Y:"hidden"},children:[p.jsx("div",{ref:d,className:"absolute inset-0"}),(b==null?void 0:b.spread)&&p.jsx(qo,{}),B.back&&p.jsx(v1,{hinge:B.backHinge,half:B.backHalf,variable:"--flip-back-shade"})]}),p.jsx("div",{...q(-1),className:"absolute inset-y-0 left-0 z-50",style:{width:l,cursor:o?"grab":"default",touchAction:"pan-y"}}),p.jsx("div",{...q(1),className:"absolute inset-y-0 right-0 z-50",style:{width:l,cursor:s?"grab":"default",touchAction:"pan-y"}}),u&&p.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{zIndex:60,visibility:b||f?"hidden":"visible"},children:u})]})}),zP="Subscribe to continue reading this book.";function t3({message:t,visiblePages:n,totalPages:r,snapshotBackdrop:i,backdropKey:s,onSubscribe:o}){const[l,c]=V.useState(!1),a=V.useRef(null),[f,u]=V.useState(!1);V.useEffect(()=>{if(!i)return;let y=!1;return Promise.resolve(i(a.current)).then(_=>{var S;y||(_||(S=a.current)==null||S.replaceChildren(),u(!!_))}).catch(()=>{y||u(!1)}),()=>{y=!0}},[i,s]);const m=async()=>{if(!(!o||l))try{c(!0),await o()}catch{}finally{c(!1)}};return p.jsxs("div",{className:"absolute inset-0 z-20 flex flex-col items-center justify-center overflow-hidden bg-[#fefdf8] px-8 text-center dark:bg-[#1b1b1b]",children:[p.jsx("div",{ref:a,"aria-hidden":!0,className:"pointer-events-none absolute inset-0 select-none overflow-hidden",style:{filter:"blur(7px)",transform:"scale(1.04)",opacity:f?1:0}}),p.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-[#fefdf8]/55 dark:bg-[#1b1b1b]/60"}),p.jsxs("div",{className:"relative flex max-w-xs flex-col items-center gap-4 rounded-2xl border border-[#e8dcc8] bg-[#fefdf8]/95 px-7 py-6 shadow-xl dark:border-[#3a352c] dark:bg-[#242321]/95",children:[p.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-[#f3e9d7] dark:bg-[#3a352c]",children:p.jsx(H1,{className:"h-6 w-6 text-[#8b5e3c] dark:text-[#d9a86c]"})}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"font-serif text-base font-semibold text-[#1e1409] dark:text-[#f1ebe0]",children:t||zP}),n&&p.jsx("p",{className:"text-xs text-[#9e8870] dark:text-[#a99a86]",children:r?`You have read all ${n} free ${n===1?"page":"pages"} of ${r}.`:`The free preview is ${n} ${n===1?"page":"pages"}.`})]}),o&&p.jsxs(bn,{size:"sm",disabled:l,onClick:m,children:[l?p.jsx(Jn,{className:"mr-1 h-4 w-4 animate-spin"}):p.jsx(ox,{className:"mr-1 h-4 w-4"}),l?"Processing…":"Subscribe"]})]})]})}function jP({reader:t,canDownload:n,downloadUrl:r}){const{type:i,status:s,error:o,containerRef:l,epubMountRef:c,pdfSurfaceRef:a,isSpread:f,pdfFitWidth:u,stageSize:m,stageScale:y,isLocked:_,subscribeMessage:S,subscribeWallRef:E,snapshotBackdrop:d,visiblePages:h,backendTotalPages:v,fullscreenRef:x,location:g,snapshotInto:b,turnPage:w,canGoNext:k,canGoPrev:N,renderedPages:T,goToToc:D,goToBookmark:I,renderPdfTextLayer:L,bookmarks:R,removeBookmark:P,toc:O}=t,[U,H]=V.useState(!1),[B,j]=V.useState(!1),F=V.useRef(null),Y=V.useRef(null),q=s==="ready";V.useEffect(()=>{var Z;u&&((Z=Y.current)==null||Z.scrollTo({top:0}))},[u,g.page]);const G=V.useCallback(()=>{var Z;return(Z=F.current)==null?void 0:Z.flipNext()},[]),$=V.useCallback(()=>{var Z;return(Z=F.current)==null?void 0:Z.flipPrev()},[]);return V.useEffect(()=>{const Z=ee=>{var te,se;((te=ee.target)==null?void 0:te.tagName)==="INPUT"||((se=ee.target)==null?void 0:se.tagName)==="TEXTAREA"||(ee.key==="ArrowRight"?G():ee.key==="ArrowLeft"&&$())};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[G,$]),p.jsxs("div",{ref:x,className:"flex flex-col w-full h-full bg-background",children:[p.jsx(Uy,{reader:t,onPrev:$,onNext:G,onOpenToc:()=>H(!0),onOpenBookmarks:()=>j(!0),canDownload:n,downloadUrl:r}),p.jsxs("div",{className:"relative flex-1 min-h-0 flex items-center justify-center gap-3 px-4 py-4",children:[p.jsx("button",{type:"button",onClick:$,disabled:!N,className:"shrink-0 inline-flex items-center justify-center h-10 w-10 rounded-full border bg-background shadow-sm disabled:opacity-20 hover:bg-muted","aria-label":"Previous page",children:p.jsx(Ai,{className:"h-5 w-5"})}),p.jsxs("div",{ref:l,className:`relative flex-1 h-full ${u?"":"max-w-7xl"}`,children:[s==="loading"&&p.jsx(Bd,{label:i==="pdf"?"Loading PDF…":"Opening book…"}),s==="error"&&p.jsx(zd,{message:o,downloadUrl:n?r:null}),p.jsx("div",{ref:Y,className:u?"pdf-scroll absolute inset-0 overflow-y-auto overflow-x-hidden":"absolute inset-0 flex items-center justify-center overflow-hidden",children:p.jsx("div",{style:u?{width:m.width*y,height:m.height*y,margin:"0 auto"}:void 0,children:p.jsx("div",{style:{transform:`scale(${y})`,transformOrigin:u?"top left":"center center"},children:p.jsxs(e3,{ref:F,className:"relative",style:{width:m.width,height:m.height},isSpread:f,snapshotInto:b,turnPage:w,canGoNext:k,canGoPrev:N,hidden:!q,children:[i==="epub"?p.jsx("div",{ref:c,className:"w-full h-full"}):p.jsx("div",{ref:a,className:"w-full h-full",children:p.jsx(Jy,{page:g.page,rightPage:g.endPage>g.page?g.endPage:null,renderedPages:T,renderTextLayer:L,isSpread:f})}),_&&p.jsx("div",{ref:E,className:"absolute inset-0",children:p.jsx(t3,{message:S,onSubscribe:t.onSubscribe,visiblePages:h,totalPages:v??(i==="pdf"?g.totalPages:null),snapshotBackdrop:d,backdropKey:g.page})})]})})})})]}),p.jsx("button",{type:"button",onClick:G,disabled:!k,className:"shrink-0 inline-flex items-center justify-center h-10 w-10 rounded-full border bg-background shadow-sm disabled:opacity-20 hover:bg-muted","aria-label":"Next page",children:p.jsx(In,{className:"h-5 w-5"})})]}),p.jsx(Ky,{open:U,onOpenChange:H,toc:O,onSelect:D}),p.jsx(Qy,{open:B,onOpenChange:j,bookmarks:R,onSelect:I,onRemove:P})]})}const FP=.3,y1=72;function HP({reader:t,canDownload:n,downloadUrl:r}){const{type:i,status:s,error:o,containerRef:l,epubMountRef:c,pdfSurfaceRef:a,stageSize:f,stageScale:u,isLocked:m,subscribeMessage:y,subscribeWallRef:_,snapshotBackdrop:S,visiblePages:E,backendTotalPages:d,fullscreenRef:h,location:v,snapshotInto:x,turnPage:g,canGoNext:b,canGoPrev:w,renderedPages:k,goToToc:N,goToBookmark:T,renderPdfTextLayer:D,bookmarks:I,removeBookmark:L,toc:R}=t,[P,O]=V.useState(!1),[U,H]=V.useState(!1),B=V.useRef(null),[j,F]=V.useState(y1);V.useEffect(()=>{const $=()=>{var ee;const Z=((ee=l.current)==null?void 0:ee.clientWidth)||0;F(Math.max(y1,Math.round(Z*FP)))};return $(),window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[l]);const Y=V.useCallback(()=>{var $;return($=B.current)==null?void 0:$.flipNext()},[]),q=V.useCallback(()=>{var $;return($=B.current)==null?void 0:$.flipPrev()},[]);V.useEffect(()=>{const $=Z=>{var ee,te;((ee=Z.target)==null?void 0:ee.tagName)==="INPUT"||((te=Z.target)==null?void 0:te.tagName)==="TEXTAREA"||(Z.key==="ArrowRight"?Y():Z.key==="ArrowLeft"&&q())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[Y,q]);const G=s==="ready";return p.jsxs("div",{ref:h,className:"flex flex-col w-full h-full bg-background",children:[p.jsx(Uy,{reader:t,compact:!0,onPrev:q,onNext:Y,onOpenToc:()=>O(!0),onOpenBookmarks:()=>H(!0),canDownload:n,downloadUrl:r}),p.jsxs("div",{ref:l,className:"relative flex-1 min-h-0 overflow-hidden",children:[s==="loading"&&p.jsx(Bd,{label:i==="pdf"?"Loading PDF…":"Opening book…"}),s==="error"&&p.jsx(zd,{message:o,downloadUrl:n?r:null}),p.jsx("div",{className:"absolute inset-0 flex items-center justify-center overflow-hidden",children:p.jsx("div",{style:{transform:`scale(${u})`,transformOrigin:"center center"},children:p.jsxs(e3,{ref:B,className:"relative",style:{width:f.width,height:f.height},isSpread:!1,grabWidth:j,hidden:!G,snapshotInto:x,turnPage:g,canGoNext:b,canGoPrev:w,children:[i==="epub"?p.jsx("div",{ref:c,className:"w-full h-full"}):p.jsx("div",{ref:a,className:"w-full h-full",children:p.jsx(Jy,{page:v.page,renderedPages:k,renderTextLayer:D,isSpread:!1})}),m&&p.jsx("div",{ref:_,className:"absolute inset-0",children:p.jsx(t3,{message:y,onSubscribe:t.onSubscribe,visiblePages:E,totalPages:d??(i==="pdf"?v.totalPages:null),snapshotBackdrop:S,backdropKey:v.page})})]})})})]}),p.jsx(Ky,{open:P,onOpenChange:O,toc:R,onSelect:N}),p.jsx(Qy,{open:U,onOpenChange:H,bookmarks:I,onSelect:T,onRemove:L})]})}function $P({isMobile:t,type:n,blobUrl:r,cacheKey:i,storage:s,title:o,canDownload:l,downloadUrl:c,hasFullAccess:a,visiblePages:f,backendTotalPages:u,subscribeMessage:m,onSubscribe:y}){const _=Wy({type:n,blobUrl:r,cacheKey:i,storage:s,title:o,allowSpread:!t,hasFullAccess:a,visiblePages:f,backendTotalPages:u,subscribeMessage:m,onSubscribe:y}),S=t?HP:jP,E=l&&!_.isGated;return p.jsx(S,{reader:_,canDownload:E,downloadUrl:E?c:null})}function n3(t){const n=TP();return p.jsx($P,{isMobile:n,...t},n?"mobile":"desktop")}const x1=1.414,w1=2,r3=600,i3=52,y0=40,VP=32,x0=24,Dc=3e3,Ta={display:"inline-flex",alignItems:"center",justifyContent:"center",width:y0,height:y0,borderRadius:"50%",border:"1px solid #e2e8f0",background:"#fff",color:"#334155",cursor:"pointer",flexShrink:0,boxShadow:"0 1px 4px rgba(0,0,0,.08)",transition:"opacity .2s"};function WP(t,n){let r=0,i=t;for(;i&&i!==n;)r+=i.offsetTop,i=i.offsetParent;return r}function UP(t,n,r,i){if(!t)return[0];const s=Array.from(t.querySelectorAll("p, h1, h2, h3, h4, h5, h6, blockquote, pre, figure, table, dt, dd")).map(c=>{const a=WP(c,t);return{top:a,bottom:a+c.offsetHeight}}).filter(c=>c.bottom>c.top).sort((c,a)=>c.top-a.top),o=[];let l=0;for(;l<r&&o.length<i;){o.push(l);let c=l+n;if(c>=r)break;for(const a of s){if(a.top>=c)break;if(!(a.bottom<=c)&&a.top>l&&a.bottom-a.top<=n){c=a.top;break}}c<=l&&(c=l+n),l=c}return o}async function qP(t,n,r,i=0,s=null){var u;const{default:o}=await Promise.resolve().then(()=>require("./html2canvas.esm-BA_v9SIU.cjs")),l=s!==null?s:r-x0*2,c=t.querySelector("iframe");if((u=c==null?void 0:c.contentDocument)!=null&&u.body)try{const m=await o(c.contentDocument.body,{x:0,y:i,width:n,height:l,backgroundColor:"#fefdf8",scale:1,useCORS:!0,allowTaint:!0,logging:!1,foreignObjectRendering:!1}),y=document.createElement("canvas");y.width=n,y.height=r;const _=y.getContext("2d");return _.fillStyle="#fefdf8",_.fillRect(0,0,n,r),_.drawImage(m,0,x0),y.toDataURL("image/jpeg",.88)}catch{}const a=document.createElement("canvas");a.width=n,a.height=r;const f=a.getContext("2d");f.fillStyle="#fefdf8",f.fillRect(0,0,n,r),f.strokeStyle="rgba(180,160,130,0.15)",f.lineWidth=1;for(let m=40;m<r;m+=28)f.beginPath(),f.moveTo(24,m),f.lineTo(n-24,m),f.stroke();return a.toDataURL("image/jpeg",.88)}function YP(t,n){if(n){if(n==="application/pdf")return"pdf";if(n==="application/epub+zip")return"epub"}if(t){const r=t.toLowerCase().split("?")[0];if(r.endsWith(".pdf"))return"pdf";if(r.endsWith(".epub"))return"epub"}return"epub"}var w0={exports:{}};(function(t,n){(function(r,i){i(n)})(At,function(r){class i{constructor(g,b){this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0},this.createdDensity=b,this.nowDrawingDensity=this.createdDensity,this.render=g}setDensity(g){this.createdDensity=g,this.nowDrawingDensity=g}setDrawingDensity(g){this.nowDrawingDensity=g}setPosition(g){this.state.position=g}setAngle(g){this.state.angle=g}setArea(g){this.state.area=g}setHardDrawingAngle(g){this.state.hardDrawingAngle=g}setHardAngle(g){this.state.hardAngle=g,this.state.hardDrawingAngle=g}setOrientation(g){this.orientation=g}getDrawingDensity(){return this.nowDrawingDensity}getDensity(){return this.createdDensity}getHardAngle(){return this.state.hardAngle}}class s extends i{constructor(g,b,w){super(g,w),this.image=null,this.isLoad=!1,this.loadingAngle=0,this.image=new Image,this.image.src=b}draw(g){const b=this.render.getContext(),w=this.render.convertToGlobal(this.state.position),k=this.render.getRect().pageWidth,N=this.render.getRect().height;b.save(),b.translate(w.x,w.y),b.beginPath();for(let T of this.state.area)T!==null&&(T=this.render.convertToGlobal(T),b.lineTo(T.x-w.x,T.y-w.y));b.rotate(this.state.angle),b.clip(),this.isLoad?b.drawImage(this.image,0,0,k,N):this.drawLoader(b,{x:0,y:0},k,N),b.restore()}simpleDraw(g){const b=this.render.getRect(),w=this.render.getContext(),k=b.pageWidth,N=b.height,T=g===1?b.left+b.pageWidth:b.left,D=b.top;this.isLoad?w.drawImage(this.image,T,D,k,N):this.drawLoader(w,{x:T,y:D},k,N)}drawLoader(g,b,w,k){g.beginPath(),g.strokeStyle="rgb(200, 200, 200)",g.fillStyle="rgb(255, 255, 255)",g.lineWidth=1,g.rect(b.x+1,b.y+1,w-1,k-1),g.stroke(),g.fill();const N={x:b.x+w/2,y:b.y+k/2};g.beginPath(),g.lineWidth=10,g.arc(N.x,N.y,20,this.loadingAngle,3*Math.PI/2+this.loadingAngle),g.stroke(),g.closePath(),this.loadingAngle+=.07,this.loadingAngle>=2*Math.PI&&(this.loadingAngle=0)}load(){this.isLoad||(this.image.onload=()=>{this.isLoad=!0})}newTemporaryCopy(){return this}getTemporaryCopy(){return this}hideTemporaryCopy(){}}class o{constructor(g,b){this.pages=[],this.currentPageIndex=0,this.currentSpreadIndex=0,this.landscapeSpread=[],this.portraitSpread=[],this.render=b,this.app=g,this.currentPageIndex=0,this.isShowCover=this.app.getSettings().showCover}destroy(){this.pages=[]}createSpread(){this.landscapeSpread=[],this.portraitSpread=[];for(let b=0;b<this.pages.length;b++)this.portraitSpread.push([b]);let g=0;this.isShowCover&&(this.pages[0].setDensity("hard"),this.landscapeSpread.push([g]),g++);for(let b=g;b<this.pages.length;b+=2)b<this.pages.length-1?this.landscapeSpread.push([b,b+1]):(this.landscapeSpread.push([b]),this.pages[b].setDensity("hard"))}getSpread(){return this.render.getOrientation()==="landscape"?this.landscapeSpread:this.portraitSpread}getSpreadIndexByPage(g){const b=this.getSpread();for(let w=0;w<b.length;w++)if(g===b[w][0]||g===b[w][1])return w;return null}getPageCount(){return this.pages.length}getPages(){return this.pages}getPage(g){if(g>=0&&g<this.pages.length)return this.pages[g];throw new Error("Invalid page number")}nextBy(g){const b=this.pages.indexOf(g);return b<this.pages.length-1?this.pages[b+1]:null}prevBy(g){const b=this.pages.indexOf(g);return b>0?this.pages[b-1]:null}getFlippingPage(g){const b=this.currentSpreadIndex;if(this.render.getOrientation()==="portrait")return g===0?this.pages[b].newTemporaryCopy():this.pages[b-1];{const w=g===0?this.getSpread()[b+1]:this.getSpread()[b-1];return w.length===1||g===0?this.pages[w[0]]:this.pages[w[1]]}}getBottomPage(g){const b=this.currentSpreadIndex;if(this.render.getOrientation()==="portrait")return g===0?this.pages[b+1]:this.pages[b-1];{const w=g===0?this.getSpread()[b+1]:this.getSpread()[b-1];return w.length===1?this.pages[w[0]]:g===0?this.pages[w[1]]:this.pages[w[0]]}}showNext(){this.currentSpreadIndex<this.getSpread().length&&(this.currentSpreadIndex++,this.showSpread())}showPrev(){this.currentSpreadIndex>0&&(this.currentSpreadIndex--,this.showSpread())}getCurrentPageIndex(){return this.currentPageIndex}show(g=null){if(g===null&&(g=this.currentPageIndex),g<0||g>=this.pages.length)return;const b=this.getSpreadIndexByPage(g);b!==null&&(this.currentSpreadIndex=b,this.showSpread())}getCurrentSpreadIndex(){return this.currentSpreadIndex}setCurrentSpreadIndex(g){if(!(g>=0&&g<this.getSpread().length))throw new Error("Invalid page");this.currentSpreadIndex=g}showSpread(){const g=this.getSpread()[this.currentSpreadIndex];g.length===2?(this.render.setLeftPage(this.pages[g[0]]),this.render.setRightPage(this.pages[g[1]])):this.render.getOrientation()==="landscape"&&g[0]===this.pages.length-1?(this.render.setLeftPage(this.pages[g[0]]),this.render.setRightPage(null)):(this.render.setLeftPage(null),this.render.setRightPage(this.pages[g[0]])),this.currentPageIndex=g[0],this.app.updatePageIndex(this.currentPageIndex)}}class l extends o{constructor(g,b,w){super(g,b),this.imagesHref=w}load(){for(const g of this.imagesHref){const b=new s(this.render,g,"soft");b.load(),this.pages.push(b)}this.createSpread()}}class c{static GetDistanceBetweenTwoPoint(g,b){return g===null||b===null?1/0:Math.sqrt(Math.pow(b.x-g.x,2)+Math.pow(b.y-g.y,2))}static GetSegmentLength(g){return c.GetDistanceBetweenTwoPoint(g[0],g[1])}static GetAngleBetweenTwoLine(g,b){const w=g[0].y-g[1].y,k=b[0].y-b[1].y,N=g[1].x-g[0].x,T=b[1].x-b[0].x;return Math.acos((w*k+N*T)/(Math.sqrt(w*w+N*N)*Math.sqrt(k*k+T*T)))}static PointInRect(g,b){return b===null?null:b.x>=g.left&&b.x<=g.width+g.left&&b.y>=g.top&&b.y<=g.top+g.height?b:null}static GetRotatedPoint(g,b,w){return{x:g.x*Math.cos(w)+g.y*Math.sin(w)+b.x,y:g.y*Math.cos(w)-g.x*Math.sin(w)+b.y}}static LimitPointToCircle(g,b,w){if(c.GetDistanceBetweenTwoPoint(g,w)<=b)return w;const k=g.x,N=g.y,T=w.x,D=w.y;let I=Math.sqrt(Math.pow(b,2)*Math.pow(k-T,2)/(Math.pow(k-T,2)+Math.pow(N-D,2)))+k;w.x<0&&(I*=-1);let L=(I-k)*(N-D)/(k-T)+N;return k-T+N===0&&(L=b),{x:I,y:L}}static GetIntersectBetweenTwoSegment(g,b,w){return c.PointInRect(g,c.GetIntersectBeetwenTwoLine(b,w))}static GetIntersectBeetwenTwoLine(g,b){const w=g[0].y-g[1].y,k=b[0].y-b[1].y,N=g[1].x-g[0].x,T=b[1].x-b[0].x,D=g[0].x*g[1].y-g[1].x*g[0].y,I=b[0].x*b[1].y-b[1].x*b[0].y,L=w*I-k*D,R=N*I-T*D,P=-(D*T-I*N)/(w*T-k*N),O=-(w*I-k*D)/(w*T-k*N);if(isFinite(P)&&isFinite(O))return{x:P,y:O};if(Math.abs(L-R)<.1)throw new Error("Segment included");return null}static GetCordsFromTwoPoint(g,b){const w=Math.abs(g.x-b.x),k=Math.abs(g.y-b.y),N=Math.max(w,k),T=[g];function D(I,L,R,P,O){return L>I?I+O*(R/P):L<I?I-O*(R/P):I}for(let I=1;I<=N;I+=1)T.push({x:D(g.x,b.x,w,N,I),y:D(g.y,b.y,k,N,I)});return T}}class a extends i{constructor(g,b,w){super(g,w),this.copiedElement=null,this.temporaryCopy=null,this.isLoad=!1,this.element=b,this.element.classList.add("stf__item"),this.element.classList.add("--"+w)}newTemporaryCopy(){return this.nowDrawingDensity==="hard"?this:(this.temporaryCopy===null&&(this.copiedElement=this.element.cloneNode(!0),this.element.parentElement.appendChild(this.copiedElement),this.temporaryCopy=new a(this.render,this.copiedElement,this.nowDrawingDensity)),this.getTemporaryCopy())}getTemporaryCopy(){return this.temporaryCopy}hideTemporaryCopy(){this.temporaryCopy!==null&&(this.copiedElement.remove(),this.copiedElement=null,this.temporaryCopy=null)}draw(g){const b=g||this.nowDrawingDensity,w=this.render.convertToGlobal(this.state.position),k=this.render.getRect().pageWidth,N=this.render.getRect().height;this.element.classList.remove("--simple");const T=`
|
|
630
|
+
`;function lP(t){if(!t)return null;try{return localStorage.getItem(Hy+t)}catch{return null}}function cP(t,n){if(!(!t||!n))try{localStorage.setItem(Hy+t,n)}catch{}}const $y=(t,n)=>Promise.race([t,new Promise(r=>setTimeout(r,n))]);function s1(t,n){const r=t?Array.from(t.images||[]):[];return r.length?$y(Promise.all(r.map(i=>{var s;return(s=i.decode)==null?void 0:s.call(i).catch(()=>{})})),n):Promise.resolve()}function uP(t){return new Promise(n=>{t.addEventListener("load",()=>{var i;const r=(i=t.contentDocument)==null?void 0:i.fonts;((r==null?void 0:r.ready)??Promise.resolve()).then(n,n)},{once:!0})})}function dP({blobUrl:t,allowSpread:n=!1,cacheKey:r}){let i=!1,s=null,o=null,l=null,c=100,a=!1,f=null,u=[],m=!1;const y={relocated:[],locationsReady:[],layout:[],keydown:[],error:[]};function _(R,P){var O;return(O=y[R])==null||O.push(P),()=>{y[R]=y[R].filter(U=>U!==P)}}function S(R,P){var O;(O=y[R])==null||O.forEach(U=>{try{U(P)}catch(H){console.error(`epubEngine listener for "${R}" threw:`,H)}})}const E=()=>{var R;return m&&!!((R=s==null?void 0:s.locations)!=null&&R.length())};function d(R){return!E()||!R?null:s.locations.locationFromCfi(R)+1}function h(R){var O;const P=R==null?void 0:R.start;return P!=null&&P.cfi?{index:P.index??null,cfi:P.cfi,page:d(P.cfi),endPage:d((O=R.end)==null?void 0:O.cfi),totalPages:E()?s.locations.length():null,percentage:E()?s.locations.percentageFromCfi(P.cfi):P.percentage??null,atStart:!!R.atStart,atEnd:!!R.atEnd}:null}function v(){const R=h(l);R&&S("relocated",R)}const x=()=>{var R,P;return(((P=(R=o==null?void 0:o.manager)==null?void 0:R.layout)==null?void 0:P.divisor)??1)>1},g=()=>{var P,O,U;const R=(P=o==null?void 0:o.manager)==null?void 0:P.views;return((U=(O=R==null?void 0:R.last)==null?void 0:O.call(R))==null?void 0:U.contents)??null};function b(){var U,H;const R=(H=(U=g())==null?void 0:U.viewport)==null?void 0:H.call(U),P=parseInt(R==null?void 0:R.width,10),O=parseInt(R==null?void 0:R.height,10);return P>0&&O>0?{width:P,height:O}:null}function w(){S("layout",{spread:x(),fixedLayout:a,pageSize:f})}async function k(){const R=lP(r);if(R)try{s.locations.load(R)}catch{}if(!s.locations.length()){if(await s.locations.generate(rP),i)return;cP(r,s.locations.save())}i||(m=!0,S("locationsReady",s.locations.length()),v())}async function N({el:R}){var P,O,U;try{const{default:H}=await Promise.resolve().then(()=>require("./index-uKpclwqW.cjs"));if(s=H(t,{openAs:"epub"}),typeof s.unarchive=="function"){const F=s.unarchive.bind(s);s.unarchive=(...Y)=>F(...Y).then(async q=>{var $;const G=($=s.archive)==null?void 0:$.zip;return G&&(await JR(G),u=await eP(G)),q})}if(await s.ready,i)return null;let B=!1;if(s.spine.each(()=>{B=!0}),!B)throw new Error("No readable sections found in EPUB.");const j=await s.loaded.displayOptions.catch(()=>null);return a=((O=(P=s.packaging)==null?void 0:P.metadata)==null?void 0:O.layout)==="pre-paginated"||(j==null?void 0:j.fixedLayout)==="true",i||(o=s.renderTo(R,{width:"100%",height:"100%",flow:"paginated",manager:"default",spread:a||!n?"none":"auto",minSpreadWidth:iP}),o.hooks.content.register(F=>{F.addStylesheetCss(aP,oP),u.length&&nP(F.document,u)}),c!==100&&o.themes.fontSize(`${c}%`),o.on("relocated",F=>{l=F,v()}),o.on("keydown",F=>S("keydown",F)),o.on("layout",()=>w()),await o.display(),i)?null:(a&&(f=b()),w(),k().catch(()=>{}),{toc:((U=s.navigation)==null?void 0:U.toc)??[]})}catch(H){throw S("error",H),H}}async function T(R){var O;if(!o||i)return!1;const P=o.location??l;return(R>0?P!=null&&P.atEnd:P!=null&&P.atStart)||(await(R>0?o.next():o.prev()),i)?!1:(await s1((O=g())==null?void 0:O.document,sP),!i)}function D(R){return!o||i?Promise.resolve():o.display(R).catch(()=>{})}function I(){var P,O,U;if(!(o!=null&&o.manager)||i)return;const R=((O=(P=o.location)==null?void 0:P.start)==null?void 0:O.cfi)??((U=l==null?void 0:l.start)==null?void 0:U.cfi);try{o.resize(void 0,void 0,R)}catch{}}async function L(R){var F;const P=(F=o==null?void 0:o.manager)==null?void 0:F.container;if(!P||!R||i)return!1;const O=P.cloneNode(!0);O.setAttribute("aria-hidden","true"),O.style.pointerEvents="none";const U=P.querySelectorAll("iframe"),H=[];O.querySelectorAll("iframe").forEach((Y,q)=>{var $;const G=($=U[q])==null?void 0:$.contentDocument;Y.removeAttribute("src"),Y.removeAttribute("id"),Y.setAttribute("tabindex","-1"),Y.setAttribute("sandbox","allow-same-origin"),H.push(uP(Y).then(()=>s1(Y.contentDocument,i1))),Y.srcdoc=G?`<!DOCTYPE html>${G.documentElement.outerHTML}`:""}),R.replaceChildren(O);const{scrollLeft:B,scrollTop:j}=P;return O.scrollLeft=B,O.scrollTop=j,await $y(Promise.all(H),i1),O.scrollLeft=B,O.scrollTop=j,!0}return{on:_,init:N,turn:T,display:D,next:()=>T(1),prev:()=>T(-1),resize:I,snapshotInto:L,isSpread:x,isFixedLayout:()=>a,getSpineLength:()=>{var R,P,O;return((P=(R=s==null?void 0:s.spine)==null?void 0:R.spineItems)==null?void 0:P.length)??((O=s==null?void 0:s.spine)==null?void 0:O.length)??0},getPageSize:()=>f,getCurrentCfi:()=>{var R,P,O;return((P=(R=o==null?void 0:o.location)==null?void 0:R.start)==null?void 0:P.cfi)??((O=l==null?void 0:l.start)==null?void 0:O.cfi)??null},setFontScale:R=>{c=R,o==null||o.themes.fontSize(`${R}%`)},getToc:()=>{var R;return((R=s==null?void 0:s.navigation)==null?void 0:R.toc)??[]},hasLocations:E,virtualPageFromCfi:d,spineIndexFromCfi:R=>{var P,O;try{return((O=(P=s==null?void 0:s.spine)==null?void 0:P.get(R))==null?void 0:O.index)??null}catch{return null}},cfiFromVirtualPage:R=>E()?s.locations.cfiFromLocation(Math.max(0,R-1)):null,destroy:()=>{i=!0;try{o==null||o.destroy()}catch{}try{s==null||s.destroy()}catch{}o=null,s=null}}}const fP="4.0.379",o1=`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${fP}`;let Nc=null;function a1(){return Nc||(Nc=import(`${o1}/pdf.min.mjs`).then(t=>(t.GlobalWorkerOptions.workerSrc=`${o1}/pdf.worker.min.mjs`,t))),Nc}const l1=12e6,hP=12,mP=3,pP=15e5;function gP(t){const n=t.toDataURL("image/png");return n.length<=pP?n:t.toDataURL(vP(),.92)}let Wo=null;function vP(){if(!Wo)try{const t=document.createElement("canvas");t.width=1,t.height=1,Wo=t.toDataURL("image/webp").startsWith("data:image/webp")?"image/webp":"image/jpeg"}catch{Wo="image/jpeg"}return Wo}function bP({blobUrl:t}){let n=null,r=!1,i=1;const s=new Map,o=new Map;function l(_,S){for(s.delete(_),s.set(_,S);s.size>hP;)s.delete(s.keys().next().value)}const c={error:[]};function a(_,S){var E;return(E=c[_])==null||E.push(S),()=>{c[_]=c[_].filter(d=>d!==S)}}function f(_,S){var E;(E=c[_])==null||E.forEach(d=>{try{d(S)}catch(h){console.error(`pdfEngine listener for "${_}" threw:`,h)}})}async function u(){try{if(n=await(await a1()).getDocument({url:t,withCredentials:!1}).promise,r)return null;const S=(await n.getPage(1)).getViewport({scale:1});return r?null:{numPages:n.numPages,pageWidth:S.width,pageHeight:S.height}}catch(_){throw f("error",_),_}}async function m(_,S,E,d=1){if(!n||r||_<1)return null;const h=Math.min(mP,Math.max(1,d||1)),v=`${_}:${i}:${S}x${E}@${h.toFixed(2)}`;if(s.has(v)){const g=s.get(v);return l(v,g),g}if(o.has(v))return o.get(v);const x=(async()=>{try{const g=await n.getPage(_),b=g.getViewport({scale:1}),w=Math.min(S/b.width,E/b.height)*i;let k=Math.max(w,.1)*h;const N=b.width*k*(b.height*k);N>l1&&(k*=Math.sqrt(l1/N));const T=g.getViewport({scale:k}),D=document.createElement("canvas");if(D.width=T.width,D.height=T.height,await g.render({canvasContext:D.getContext("2d"),viewport:T}).promise,r)return null;const I=gP(D);return l(v,I),I}catch(g){return console.warn("PDF page render failed:",g),null}finally{o.delete(v)}})();return o.set(v,x),x}async function y(_,S,E,d){if(!(!n||r||!S||!E))try{const h=await a1(),v=await n.getPage(_),x=await v.getTextContent();if(r||d!=null&&d.aborted)return;const g=v.getViewport({scale:1}),b=v.getViewport({scale:E/g.width});S.replaceChildren(),S.style.setProperty("--scale-factor",String(b.scale));const w=[],k=h.renderTextLayer({textContentSource:x,container:S,viewport:b,textDivs:w});if(d==null||d.addEventListener("abort",()=>{var T;return(T=k.cancel)==null?void 0:T.call(k)},{once:!0}),await k.promise,d!=null&&d.aborted)return;x.items.filter(T=>T.str!==void 0).forEach((T,D)=>{var R,P;const I=w[D];if(!I)return;const L=O=>{r1(O==null?void 0:O.name)&&(I.dataset.legacyFont="")};try{v.commonObjs.get(T.fontName,L)}catch{}r1((P=(R=x.styles)==null?void 0:R[T.fontName])==null?void 0:P.fontFamily)&&(I.dataset.legacyFont="")})}catch(h){(h==null?void 0:h.name)!=="AbortException"&&console.warn("PDF text layer failed:",h)}}return{on:a,init:u,get numPages(){return(n==null?void 0:n.numPages)??0},renderPage:m,renderTextLayer:y,setZoom:_=>{i=_},getZoom:()=>i,getOutline:async()=>{if(!n)return[];try{return await n.getOutline()||[]}catch{return[]}},pageIndexForDest:async _=>{if(!n||!_)return null;try{const S=typeof _=="string"?await n.getDestination(_):_;return S?await n.getPageIndex(S[0])+1:null}catch{return null}},destroy:()=>{r=!0,s.clear(),o.clear()}}}function yP(t){const[n,r]=V.useState({width:0,height:0});return V.useEffect(()=>{const i=t.current;if(!i)return;const s=()=>{const l=i.getBoundingClientRect();r(c=>{const a=Math.round(l.width),f=Math.round(l.height);return c.width===a&&c.height===f?c:{width:a,height:f}})},o=new ResizeObserver(s);return o.observe(i),s(),()=>o.disconnect()},[t]),n}const b0=2,xP=4e3,wP=150,c1=10,CP=70,_P=200,SP={width:1e3,height:680},kP={width:420,height:680},u1=1.25,d1=600,EP=8;function TP(t,n){if(!(t!=null&&t.length))return Promise.resolve([]);const r=async i=>{var o;const s=[];for(const l of i){const c=await n(l.dest);s.push({label:l.title,target:c,children:(o=l.items)!=null&&o.length?await r(l.items):void 0})}return s};return r(t)}function Vy(t){return(t||[]).map(n=>{var r,i;return{label:((r=n.label)==null?void 0:r.trim())||n.href,target:n.href,children:(i=n.subitems)!=null&&i.length?Vy(n.subitems):void 0}})}const Ds=()=>new Promise(t=>requestAnimationFrame(()=>t())),NP=b0+3;function f1(t,n,r){let i=t;for(const[s,o]of n)o&&i[s]!==o&&(i===t&&(i={...t}),i[s]=o);for(const s of Object.keys(i))Math.abs(Number(s)-r)>NP&&(i===t&&(i={...t}),delete i[s]);return i}function Wy({type:t,blobUrl:n,title:r,allowSpread:i=!1,cacheKey:s,storage:o=null,visiblePages:l=null,backendTotalPages:c=null,subscribeMessage:a=null,onSubscribe:f=null,hasFullAccess:u=null}){const m=V.useRef(null),y=V.useRef(null),_=V.useRef(null),S=V.useRef(null),{width:E,height:d}=yP(m),[h,v]=V.useState(!1),[x,g]=V.useState(null),[b,w]=V.useState(!1),[k,N]=V.useState(null),[T,D]=V.useState(0),[I,L]=V.useState(!1),R=V.useRef(null),P=V.useRef(!1);P.current=I;const O=V.useRef(!1),U=t==="epub"?h:i,H=t==="pdf"&&i,B=U?2:1,j=V.useRef(1);j.current=B;const[F,Y]=V.useState("loading"),[q,G]=V.useState(null),[$,Z]=V.useState([]),[ee,te]=V.useState({cfi:null,page:null,endPage:null,totalPages:null,percentage:null,atStart:!0,atEnd:!1}),[se,ie]=V.useState(100),[ae,de]=V.useState([]),[be,ce]=V.useState(1),pe=V.useRef(1);pe.current=be;const[Se,Re]=V.useState({}),Fe=V.useRef(null),Ie=V.useRef(!1),Xe=V.useRef(!1),X=V.useRef(null),re=V.useRef(null),oe=V.useRef(null),xe=V.useMemo(()=>!b||!T||!c?0:Math.max(0,T-c),[b,T,c]),ve=V.useCallback(me=>{if(!b||(me==null?void 0:me.index)==null)return me;const ge=Math.max(1,me.index-xe+1),ke=c||Math.max(1,T-xe);return{...me,page:ge,endPage:ge,totalPages:ke}},[b,xe,c,T]),ue=V.useCallback(()=>{const me=S.current,ge=Fe.current;if(!(!me||!ge||Ie.current)){if(Xe.current){Ie.current=!0;return}if(t==="epub")if(b)me.display(Math.max(0,ge-1+xe));else{if(!me.hasLocations())return;const ke=me.cfiFromVirtualPage(ge);ke&&me.display(ke)}else ce(Math.max(1,ge));Ie.current=!0}},[t,b,xe]),fe=V.useRef(o);fe.current=o;const De=!!o;V.useEffect(()=>{var ke;const me=fe.current;if(!me)return;let ge=!1;return Promise.resolve((ke=me.load)==null?void 0:ke.call(me)).then(Le=>{ge||!Le||(Fe.current=Le.lastPage??null,de(Array.isArray(Le.bookmarks)?Le.bookmarks:[]),ue())}).catch(()=>{}),()=>{ge=!0}},[De,t,ue]);const he=V.useCallback(me=>{var ge;(ge=fe.current)!=null&&ge.saveProgress&&(!me||me===re.current||(clearTimeout(oe.current),oe.current=setTimeout(()=>{var ke,Le;re.current=me,Promise.resolve((Le=(ke=fe.current)==null?void 0:ke.saveProgress)==null?void 0:Le.call(ke,me)).catch(()=>{})},xP)))},[]);V.useEffect(()=>()=>clearTimeout(oe.current),[]);const Oe=V.useCallback(me=>{const ge=ve(me);te(ge),ge.page&&he(ge.page)},[he,ve]),Ve=E>0&&d>0;V.useEffect(()=>{if(!n||!Ve||t==="epub"&&!y.current)return;let me=!1;Y("loading"),G(null),Ie.current=!1;const ge=t==="pdf"?bP({blobUrl:n}):dP({blobUrl:n,allowSpread:i,cacheKey:s});S.current=ge;const ke=[ge.on("error",Le=>{me||(Y("error"),G((Le==null?void 0:Le.message)||"Failed to open this document."))})];return t==="epub"&&ke.push(ge.on("relocated",Le=>{me||Oe(Le)}),ge.on("layout",({spread:Le,fixedLayout:it,pageSize:Rt})=>{me||(v(Le),w(!!it),g(en=>(en==null?void 0:en.width)===(Rt==null?void 0:Rt.width)&&(en==null?void 0:en.height)===(Rt==null?void 0:Rt.height)?en:Rt??null))}),ge.on("keydown",Le=>{me||!(Le!=null&&Le.key)||window.dispatchEvent(new KeyboardEvent("keydown",{key:Le.key}))}),ge.on("locationsReady",()=>{if(me)return;ue();const Le=X.current;if(Le!=null){X.current=null;const it=ge.cfiFromVirtualPage(Le);it&&ge.display(it)}})),ge.init(t==="epub"?{el:y.current}:void 0).then(Le=>{var it;me||!Le||(Y("ready"),t==="epub"?(Z(Vy(ge.getToc())),D(((it=ge.getSpineLength)==null?void 0:it.call(ge))??0)):(Le.pageWidth&&Le.pageHeight&&N(Le.pageHeight/Le.pageWidth),te({cfi:null,page:1,endPage:1,totalPages:Le.numPages,percentage:0,atStart:!0,atEnd:Le.numPages<=1}),ue(),ge.getOutline().then(Rt=>TP(Rt,ge.pageIndexForDest).then(Z))))}).catch(()=>{}),()=>{me=!0,ke.forEach(Le=>Le==null?void 0:Le()),ge.destroy(),S.current=null}},[t,n,Ve]);const We=V.useMemo(()=>H?{width:d1*2,height:Math.round(d1*(k??Math.SQRT2))}:x??(i?SP:kP),[H,k,x,i]),mt=V.useMemo(()=>!E||!d?1:H?Math.min((E-EP)/We.width,u1):Math.min(E/We.width,d/We.height,u1),[We,E,d,H]),nt=V.useMemo(()=>{const me=typeof window>"u"?1:Math.max(1,window.devicePixelRatio||1),ge=Math.ceil(mt*me*4)/4;return{width:U?Math.max(1,Math.floor(We.width/2)):We.width,height:We.height,density:Math.max(1,ge)}},[We,mt,U]),ft=V.useRef(nt);ft.current=nt,V.useEffect(()=>{if(t!=="epub"||F!=="ready")return;const me=setTimeout(()=>{var ge;return(ge=S.current)==null?void 0:ge.resize()},wP);return()=>clearTimeout(me)},[t,F,We.width,We.height]),V.useEffect(()=>{if(t!=="pdf"||F!=="ready")return;const me=S.current;if(!me||!E||!d)return;const ge=ee.totalPages||me.numPages;if(!ge)return;const ke=Math.min(Math.max(1,be),ge);if(ke!==be){ce(ke);return}const Le=U?Math.min(ke+1,ge):ke;Oe({cfi:null,page:ke,endPage:Le,totalPages:ge,percentage:ge>1?(ke-1)/(ge-1):0,atStart:ke<=1,atEnd:Le>=ge});const{width:it,height:Rt,density:en}=nt,Oi=new Set;for(const Un of U?[ke,ke+1]:[ke])for(let Ht=-b0;Ht<=b0;Ht++){const Nr=Un+Ht;Nr>=1&&Nr<=ge&&Oi.add(Nr)}const or=new Set(U?[ke,ke+1]:[ke]);[...Oi].sort((Un,Ht)=>Number(or.has(Ht))-Number(or.has(Un))).forEach(Un=>{me.renderPage(Un,it,Rt,en).then(Ht=>{Ht&&Re(Nr=>f1(Nr,[[Un,Ht]],pe.current))})})},[t,F,be,E,d,se,U,nt]);const bt=u===!1?l!=null:u===!0?!1:!!l&&!!c&&l<c,xt=V.useMemo(()=>{const me={atBoundary:!1,past:!1};if(!bt)return me;const ge=(ke,Le)=>({atBoundary:ke>=Le,past:ke>Le});return t==="pdf"?ge(U?be+1:be,l):b?ee.index==null?me:ge(ee.index,xe+l-1):!ee.totalPages||!ee.page?me:ge(ee.page,c?Math.max(1,Math.ceil(ee.totalPages*l/c)):Math.max(1,l))},[bt,t,be,U,l,c,b,xe,ee.index,ee.page,ee.totalPages]),qe=xt.atBoundary;O.current=qe;const wt=V.useRef(null);V.useEffect(()=>{var ge;if(!bt)return;if(!xt.past){ee.cfi&&(wt.current=ee.cfi);return}if(t==="pdf"){const ke=U?Math.max(1,l-1):l;ce(Le=>Math.min(Le,ke));return}const me=wt.current;me&&((ge=S.current)==null||ge.display(me)),L(!0)},[bt,xt.past,ee.cfi,t,l,U]);const yt=V.useCallback(()=>{var me;if(!I){if(Xe.current=!0,qe){L(!0);return}t==="epub"?(me=S.current)==null||me.next():ce(ge=>Math.min(ge+B,ee.totalPages||ge))}},[t,ee.totalPages,I,qe,B]),Ue=V.useCallback(()=>{var me;if(Xe.current=!0,I){L(!1);return}t==="epub"?(me=S.current)==null||me.prev():ce(ge=>Math.max(ge-B,1))},[t,I,B]),rt=V.useCallback(async me=>{var Le;if(t==="epub")return!!await((Le=S.current)==null?void 0:Le.snapshotInto(me));const ge=_.current;if(!ge)return!1;const ke=ge.cloneNode(!0);return ke.setAttribute("aria-hidden","true"),ke.style.pointerEvents="none",me.replaceChildren(ke),await Promise.all([...ke.querySelectorAll("img")].map(it=>it.decode().catch(()=>{}))),!0},[t]),He=V.useCallback(async me=>{if(!me)return!1;if(P.current){const ge=R.current;if(!ge)return!1;const ke=ge.cloneNode(!0);return ke.setAttribute("aria-hidden","true"),ke.style.pointerEvents="none",me.replaceChildren(ke),!0}return rt(me)},[rt]),Ye=V.useRef(!1);Ye.current=xt.past;const ht=V.useCallback(async me=>!me||Ye.current?!1:rt(me),[rt]),ot=V.useCallback(async me=>{var Un;if(Xe.current=!0,P.current)return me>0?!1:(Lr.flushSync(()=>L(!1)),await Ds(),!0);if(me>0&&O.current)return Lr.flushSync(()=>L(!0)),await Ds(),await Ds(),!0;if(t==="epub")return!!await((Un=S.current)==null?void 0:Un.turn(me));const ge=S.current,ke=ee.totalPages||0,Le=j.current,it=pe.current+me*Le;if(!ge||it<1||it>ke)return!1;const{width:Rt,height:en,density:Oi}=ft.current,or=await Promise.all((Le>1?[it,it+1]:[it]).filter(Ht=>Ht>=1&&Ht<=ke).map(async Ht=>[Ht,await ge.renderPage(Ht,Rt,en,Oi)]));return Lr.flushSync(()=>{Re(Ht=>f1(Ht,or,it)),ce(it)}),await Ds(),await Ds(),!0},[t,ee.totalPages]),kt=V.useCallback(me=>{if(!me)return;if(Xe.current=!0,t==="pdf"){ce(Math.min(Math.max(1,me),ee.totalPages||me));return}const ge=S.current;if(b){ge==null||ge.display(Math.max(0,me-1+xe));return}if(!(ge!=null&&ge.hasLocations())){X.current=me;return}const ke=ge.cfiFromVirtualPage(me);ke&&ge.display(ke)},[t,ee.totalPages,b,xe]),$n=V.useCallback(me=>{var ge;t!=="epub"||!me||(Xe.current=!0,(ge=S.current)==null||ge.display(me))},[t]),gn=V.useCallback(me=>{var ke;if(!me)return;const ge=(ke=me.value)==null?void 0:ke.cfi;t==="epub"&&ge?$n(ge):kt(me.page_no)},[t,$n,kt]),vn=V.useCallback(me=>{var ge;me&&(Xe.current=!0,t==="epub"?(ge=S.current)==null||ge.display(me.target):me.target&&ce(me.target))},[t]),Ae=V.useCallback(()=>kt(1),[kt]),ye=V.useCallback(()=>{ee.totalPages&&kt(ee.totalPages)},[kt,ee.totalPages]),Ce=V.useCallback(me=>{var ke;const ge=Math.min(_P,Math.max(CP,me));if(ie(ge),t==="epub"){const Le=S.current,it=Le==null?void 0:Le.getCurrentCfi();Le==null||Le.setFontScale(ge),it&&Le.display(it)}else(ke=S.current)==null||ke.setZoom(ge/100),Re({})},[t]),at=V.useCallback(()=>Ce(se+c1),[Ce,se]),Je=V.useCallback(()=>Ce(se-c1),[Ce,se]),Vn=V.useCallback(()=>Ce(100),[Ce]),on=V.useMemo(()=>ae.find(me=>me.page_no===ee.page)||null,[ae,ee.page]),Wn=V.useCallback(()=>{var Le;if(!ee.page)return;const me=fe.current;if(on){const it=on.id;de(Rt=>Rt.filter(en=>en.id!==it)),Promise.resolve((Le=me==null?void 0:me.removeBookmark)==null?void 0:Le.call(me,it)).catch(()=>{});return}const ge=ee.cfi?{cfi:ee.cfi}:void 0,ke={id:`pending-${Date.now()}`,page_no:ee.page,value:ge,created_at:new Date().toISOString()};de(it=>[ke,...it]),me!=null&&me.addBookmark&&Promise.resolve(me.addBookmark({page_no:ee.page,value:ge})).then(it=>{it!=null&&it.id&&de(Rt=>Rt.map(en=>en.id===ke.id?it:en))}).catch(()=>{de(it=>it.filter(Rt=>Rt.id!==ke.id))})},[ee.page,ee.cfi,on]),ks=V.useCallback(me=>{var ge,ke;de(Le=>Le.filter(it=>it.id!==me)),Promise.resolve((ke=(ge=fe.current)==null?void 0:ge.removeBookmark)==null?void 0:ke.call(ge,me)).catch(()=>{})},[]),To=V.useCallback((me,ge,ke,Le)=>{var it,Rt;return(Rt=(it=S.current)==null?void 0:it.renderTextLayer)==null?void 0:Rt.call(it,me,ge,ke,Le)},[]),Ii=V.useRef(null),[sr,Il]=V.useState(!1);V.useEffect(()=>{const me=()=>Il(document.fullscreenElement===Ii.current);return document.addEventListener("fullscreenchange",me),()=>document.removeEventListener("fullscreenchange",me)},[]);const Tr=V.useCallback(()=>{var me,ge,ke;document.fullscreenElement?(me=document.exitFullscreen)==null||me.call(document):(ke=(ge=Ii.current)==null?void 0:ge.requestFullscreen)==null||ke.call(ge)},[]);return V.useEffect(()=>{const me=ge=>{var ke,Le;((ke=ge.target)==null?void 0:ke.tagName)==="INPUT"||((Le=ge.target)==null?void 0:Le.tagName)==="TEXTAREA"||(ge.key==="Home"?Ae():ge.key==="End"?ye():ge.key==="Escape"&&sr&&Tr())};return window.addEventListener("keydown",me),()=>window.removeEventListener("keydown",me)},[Ae,ye,sr,Tr]),{type:t,status:F,error:q,containerRef:m,epubMountRef:y,pdfSurfaceRef:_,isSpread:U,pdfFitWidth:H,stageSize:We,stageScale:mt,fullscreenRef:Ii,title:r,toc:$,location:ee,canGoNext:I?!1:qe||!ee.atEnd,canGoPrev:I?!0:!ee.atStart,isGated:bt,isLocked:I,subscribeMessage:a,onSubscribe:f,subscribeWallRef:R,snapshotBackdrop:ht,visiblePages:l,backendTotalPages:c,goNext:yt,goPrev:Ue,snapshotInto:He,turnPage:ot,goToToc:vn,goToPageNo:kt,goToCfi:$n,goToBookmark:gn,zoomPercent:se,zoomIn:at,zoomOut:Je,resetZoom:Vn,isFullscreen:sr,toggleFullscreen:Tr,bookmarks:ae,isCurrentBookmarked:!!on,toggleBookmark:Wn,removeBookmark:ks,renderedPages:Se,renderPdfTextLayer:To}}const h1="(max-width: 768px), (pointer: coarse) and (max-width: 1024px)";function MP(){const[t,n]=V.useState(()=>typeof window<"u"&&window.matchMedia(h1).matches);return V.useEffect(()=>{const r=window.matchMedia(h1),i=s=>n(s.matches);return r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[]),t}function m1(t,n){if(t.totalPages){const{page:r,endPage:i,totalPages:s}=t;return n&&r&&i&&i>r?`Pages ${r}–${i} of ${s}`:`Page ${r??"…"} of ${s}`}return t.percentage!=null?`${Math.round(t.percentage*100)}%`:"Loading…"}function AP({visiblePages:t,totalPages:n}){return!t||!n?null:p.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-warning/20 bg-warning/10 px-1.5 py-0.5 text-[10px] font-medium text-warning whitespace-nowrap",title:"Subscribe to read the rest of this book",children:[p.jsx(H1,{className:"h-2.5 w-2.5"}),t," of ",n," pages free"]})}function Uy({reader:t,compact:n=!1,onPrev:r,onNext:i,onOpenToc:s,onOpenBookmarks:o,canDownload:l,downloadUrl:c}){const{title:a,location:f,isSpread:u,canGoPrev:m,canGoNext:y,goPrev:_,goNext:S,zoomPercent:E,zoomIn:d,zoomOut:h,isFullscreen:v,toggleFullscreen:x,isGated:g,visiblePages:b,backendTotalPages:w,isCurrentBookmarked:k,toggleBookmark:N,toc:T}=t;return p.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border bg-background px-3 py-2 flex-wrap",children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx(Na,{className:"h-4 w-4 text-amber-700 shrink-0"}),p.jsx("span",{className:"truncate font-serif italic text-sm text-foreground",title:a,children:a}),!n&&p.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:["— ",m1(f,u)]}),g&&p.jsx(AP,{visiblePages:b,totalPages:w})]}),p.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[n&&p.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap mr-1",children:m1(f,u)}),T.length>0&&p.jsx(bn,{variant:"ghost",size:"icon",onClick:s,title:"Contents",children:p.jsx(F1,{className:"h-4 w-4"})}),p.jsxs(bn,{variant:"ghost",size:"icon",onClick:N,title:k?"Remove mark":"Mark this page","aria-pressed":k,children:[p.jsx(Pc,{className:k?"h-4 w-4 fill-current text-amber-700":"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:k?"Remove mark":"Mark this page"})]}),p.jsxs(bn,{variant:"ghost",size:"icon",onClick:o,title:"Marks",children:[p.jsx(ex,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Marks"})]}),!n&&p.jsxs(p.Fragment,{children:[p.jsx(bn,{variant:"ghost",size:"icon",onClick:h,title:"Zoom out",children:p.jsx(cx,{className:"h-4 w-4"})}),p.jsxs("span",{className:"text-xs text-muted-foreground w-10 text-center tabular-nums",children:[E,"%"]}),p.jsx(bn,{variant:"ghost",size:"icon",onClick:d,title:"Zoom in",children:p.jsx(lx,{className:"h-4 w-4"})})]}),p.jsx(bn,{variant:"ghost",size:"icon",onClick:x,title:"Fullscreen",children:v?p.jsx(rx,{className:"h-4 w-4"}):p.jsx(tx,{className:"h-4 w-4"})}),!n&&p.jsxs(p.Fragment,{children:[p.jsx(bn,{variant:"ghost",size:"icon",onClick:r??_,disabled:!m,title:"Previous",children:p.jsx(Ai,{className:"h-4 w-4"})}),p.jsx(bn,{variant:"ghost",size:"icon",onClick:i??S,disabled:!y,title:"Next",children:p.jsx(In,{className:"h-4 w-4"})})]}),l&&c&&p.jsx("a",{href:c,download:!0,children:p.jsxs(bn,{variant:"default",size:"sm",children:[p.jsx(Ks,{className:"h-3.5 w-3.5"})," Download"]})})]})]})}function qy({...t}){return p.jsx(Z0,{"data-slot":"sheet",...t})}function DP({...t}){return p.jsx(X0,{"data-slot":"sheet-portal",...t})}function RP({className:t,...n}){return p.jsx(Za,{"data-slot":"sheet-overlay",className:Q("fixed inset-0 z-50 bg-black/50 backdrop-blur-[2px]","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=open]:duration-300 data-[state=closed]:duration-200",t),...n})}function Yy({className:t,children:n,side:r="right",...i}){return p.jsxs(DP,{children:[p.jsx(RP,{}),p.jsxs(Xa,{"data-slot":"sheet-content",className:Q("bg-white fixed z-50 flex flex-col shadow-xl","will-change-transform","transition-transform","[transition-timing-function:cubic-bezier(0.32,0.72,0,1)]","data-[state=open]:duration-500 data-[state=closed]:duration-300","data-[state=open]:animate-in data-[state=closed]:animate-out",r==="right"&&["inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-md","data-[state=closed]:slide-out-to-right","data-[state=open]:slide-in-from-right"],r==="left"&&["inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-md","data-[state=closed]:slide-out-to-left","data-[state=open]:slide-in-from-left"],r==="top"&&["inset-x-0 top-0 h-auto border-b","data-[state=closed]:slide-out-to-top","data-[state=open]:slide-in-from-top"],r==="bottom"&&["inset-x-0 bottom-0 h-auto border-t","data-[state=closed]:slide-out-to-bottom","data-[state=open]:slide-in-from-bottom"],t),...i,children:[n,p.jsxs(lo,{className:"absolute top-4 right-4 rounded-sm opacity-70 transition-opacity duration-200 hover:opacity-100 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none z-10",children:[p.jsx(er,{className:"w-4 h-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Gy({className:t,...n}){return p.jsx("div",{"data-slot":"sheet-header",className:Q("flex flex-col gap-1.5 px-6 pt-6",t),...n})}function Zy({className:t,...n}){return p.jsx(Ka,{"data-slot":"sheet-title",className:Q("text-gray-900 text-lg font-semibold",t),...n})}function Xy({items:t,onSelect:n,depth:r=0}){return p.jsx("ul",{className:r===0?"space-y-0.5":"space-y-0.5 border-l pl-3",children:t.map((i,s)=>{var o;return p.jsxs("li",{children:[p.jsx("button",{type:"button",onClick:()=>n(i),disabled:i.target==null,className:"w-full text-left text-sm py-1.5 px-2 rounded-md hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed text-foreground truncate",title:i.label,children:i.label}),((o=i.children)==null?void 0:o.length)>0&&p.jsx(Xy,{items:i.children,onSelect:n,depth:r+1})]},`${r}-${s}-${i.label}`)})})}function Ky({open:t,onOpenChange:n,toc:r,onSelect:i}){return p.jsx(qy,{open:t,onOpenChange:n,children:p.jsxs(Yy,{side:"left",className:"w-80 dark:bg-neutral-900 dark:border-neutral-800",children:[p.jsx(Gy,{children:p.jsxs(Zy,{className:"flex items-center gap-2 dark:text-neutral-100",children:[p.jsx(F1,{className:"h-4 w-4"})," Contents"]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:r.length===0?p.jsx("p",{className:"text-sm text-muted-foreground",children:"No table of contents available."}):p.jsx(Xy,{items:r,onSelect:s=>{i(s),n(!1)}})})]})})}function Qy({open:t,onOpenChange:n,bookmarks:r,onSelect:i,onRemove:s}){return p.jsx(qy,{open:t,onOpenChange:n,children:p.jsxs(Yy,{side:"right",className:"w-80 dark:bg-neutral-900 dark:border-neutral-800",children:[p.jsx(Gy,{children:p.jsxs(Zy,{className:"flex items-center gap-2 dark:text-neutral-100",children:[p.jsx(Pc,{className:"h-4 w-4"})," Marks"]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-4 space-y-1",children:r.length===0?p.jsx("p",{className:"text-sm text-muted-foreground",children:"No marks yet — use the mark icon in the toolbar to mark a page and come back to it later."}):r.map(o=>p.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md px-2 py-1.5 hover:bg-muted group",children:[p.jsxs("button",{type:"button",onClick:()=>{i(o),n(!1)},className:"flex flex-1 items-center gap-2 text-left text-sm text-foreground",children:[p.jsx(Pc,{className:"h-3.5 w-3.5 shrink-0 fill-current text-amber-700"}),"Page ",o.page_no]}),p.jsx(bn,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100",onClick:()=>s(o.id),title:"Remove mark",children:p.jsx(Aa,{className:"h-3.5 w-3.5 text-destructive"})})]},o.id))})]})})}function PP(t,n){const r=Math.min(1,n.width/t.width,n.height/t.height);return{width:t.width*r,height:t.height*r}}function LP({page:t,width:n,renderTextLayer:r}){const i=V.useRef(null);return V.useEffect(()=>{const s=i.current;if(!s||!r||!n)return;const o=new AbortController;return r(t,s,n,o.signal),()=>o.abort()},[t,n,r]),p.jsx("div",{ref:i,className:"textLayer"})}function Mc({page:t,renderedPages:n,half:r=!1,renderTextLayer:i}){const s=V.useRef(null),[o,l]=V.useState(null),[c,a]=V.useState(null);V.useEffect(()=>{const y=s.current;if(!y)return;const _=()=>l(E=>(E==null?void 0:E.width)===y.offsetWidth&&(E==null?void 0:E.height)===y.offsetHeight?E:{width:y.offsetWidth,height:y.offsetHeight});_();const S=new ResizeObserver(_);return S.observe(y),()=>S.disconnect()},[]);const f=t==null,u=t?n[t]:null,m=c&&(o!=null&&o.width)?PP(c,o):null;return p.jsx("div",{ref:s,className:`relative ${r?"w-1/2":"w-full"} h-full flex items-center justify-center bg-[#fefdf8]`,children:f?null:u?p.jsxs(p.Fragment,{children:[p.jsx("img",{src:u,alt:`Page ${t}`,"data-pdf-img":t,onLoad:y=>{const{naturalWidth:_,naturalHeight:S}=y.currentTarget;a(E=>(E==null?void 0:E.width)===_&&(E==null?void 0:E.height)===S?E:{width:_,height:S})},className:"max-w-full max-h-full object-contain"}),m&&p.jsx("div",{"data-pdf-page":t,className:"absolute inset-0 m-auto",style:{width:m.width,height:m.height},children:p.jsx(LP,{page:t,width:Math.round(m.width),renderTextLayer:i})})]}):p.jsx(GR,{})})}function Jy({page:t,rightPage:n,renderedPages:r,isSpread:i,renderTextLayer:s}){const o={renderedPages:r,renderTextLayer:s};return i?p.jsxs("div",{className:"w-full h-full flex bg-[#fefdf8]",children:[p.jsx(Mc,{page:t,half:!0,...o}),p.jsx(Mc,{page:n,half:!0,...o})]}):p.jsx(Mc,{page:t,...o})}const Ac=650,IP=.28,OP=6,BP=3,zP=320,jP=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,Ea=(t,n,r)=>Math.min(r,Math.max(n,t)),Uo="bg-[#fefdf8] rounded-md shadow-xl overflow-hidden",p1="inset(0 50% 0 0)",g1="inset(0 0 0 50%)";function Rs(t,n){if(!t)return;const r=Ea(n,0,1);t.style.setProperty("--flip-p",r.toFixed(4)),t.style.setProperty("--flip-shade",(.5*Math.min(1,r*2)).toFixed(3)),t.style.setProperty("--flip-back-shade",Ea((1-r)*1.4,0,.7).toFixed(3))}function qo(){return p.jsxs(p.Fragment,{children:[p.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 right-1/2 w-[7%]",style:{background:"linear-gradient(to left, rgba(0,0,0,.2), rgba(0,0,0,.06) 45%, rgba(0,0,0,0))"}}),p.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-1/2 w-[7%]",style:{background:"linear-gradient(to right, rgba(0,0,0,.2), rgba(0,0,0,.06) 45%, rgba(0,0,0,0))"}})]})}function v1({hinge:t,variable:n,half:r}){const i=r==="left"?{left:0,width:"50%"}:r==="right"?{left:"50%",width:"50%"}:{left:0,width:"100%"};return p.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0",style:{...i,opacity:`var(${n}, 0)`,background:`linear-gradient(to ${t==="left"?"right":"left"},
|
|
631
|
+
rgba(0,0,0,.5), rgba(0,0,0,.16) 35%, rgba(0,0,0,0) 70%)`}})}function b1(t){if(!t)return{};const{direction:n,spread:r}=t;if(r){const i=n>0?g1:p1,s=n>0?p1:g1,o=-180*n;return{under:{clipPath:s},front:{clipPath:i,transformOrigin:"50% 50%",transform:`rotateY(calc(var(--flip-p, 0) * ${o}deg))`},back:{clipPath:s,transformOrigin:"50% 50%",transform:`rotateY(calc(${-o}deg + var(--flip-p, 0) * ${o}deg))`},frontHalf:n>0?"right":"left",backHalf:n>0?"left":"right",frontHinge:n>0?"left":"right",backHinge:n>0?"right":"left"}}return n>0?{under:null,front:{transformOrigin:"0 50%",transform:"rotateY(calc(var(--flip-p, 0) * -90deg))"},back:null,frontHinge:"left"}:{under:{},front:null,back:{transformOrigin:"0 50%",transform:"rotateY(calc((1 - var(--flip-p, 0)) * -90deg))"},backHinge:"left"}}const e3=V.forwardRef(function({isSpread:n,snapshotInto:r,turnPage:i,canGoNext:s,canGoPrev:o,grabWidth:l=64,className:c="",style:a,hidden:f=!1,overlay:u=null,children:m},y){const _=V.useRef(null),S=V.useRef(null),E=V.useRef(null),d=V.useRef(null),h=V.useRef(0),v=V.useRef(!1),x=V.useRef(null),g=V.useRef([]),[b,w]=V.useState(null);V.useEffect(()=>()=>cancelAnimationFrame(h.current),[]);const k=V.useCallback((G,$,Z)=>(cancelAnimationFrame(h.current),new Promise(ee=>{const te=performance.now(),se=ie=>{const ae=Z<=0?1:Ea((ie-te)/Z,0,1);Rs(_.current,G+($-G)*jP(ae)),ae<1?h.current=requestAnimationFrame(se):ee()};h.current=requestAnimationFrame(se)})),[]),N=V.useCallback(()=>{Lr.flushSync(()=>w(null)),[S,E,d].forEach(G=>{var $;return($=G.current)==null?void 0:$.replaceChildren()}),Rs(_.current,0),x.current=null,v.current=!1},[]),T=V.useCallback(async G=>{if(G>0?!s:!o)return!1;const $=!!n,Z=b1({direction:G,spread:$});Rs(_.current,0),Lr.flushSync(()=>w({direction:G,spread:$,shown:!1}));const ee=[];return Z.under&&ee.push(r(S.current)),Z.front&&ee.push(r(E.current)),!(await Promise.all(ee)).every(Boolean)||(Lr.flushSync(()=>w({direction:G,spread:$,shown:!0})),!await i(G))?(N(),!1):(Z.back&&(await r(d.current),Lr.flushSync(()=>w({direction:G,spread:$,shown:!0,backReady:!0}))),!0)},[s,o,n,r,i,N]),D=V.useCallback(async(G,$=Ac)=>{await k(G,1,$*(1-G)),N()},[k,N]),I=V.useCallback(async(G,$)=>{await k($,0,Ac*$);try{await i(-G)}finally{N()}},[k,i,N]),L=V.useCallback(async G=>{if(v.current){!x.current&&g.current.length<BP&&g.current.push(G);return}let $=G,Z=!1;for(;$!=null;){v.current=!0;try{if(!await T($)){v.current=!1,g.current=[];return}await D(0,Z?zP:Ac)}catch{N(),g.current=[];return}$=g.current.shift(),Z=!0}},[T,D,N]);V.useImperativeHandle(y,()=>({flipNext:()=>L(1),flipPrev:()=>L(-1),get isFlipping(){return v.current}}),[L]);const R=V.useCallback(()=>{var $;const G=(($=_.current)==null?void 0:$.getBoundingClientRect().width)||1;return n?G/2:G},[n]),P=V.useCallback(G=>{const{direction:$,progress:Z=0,moved:ee}=G;!ee||Z>=IP?D(Z):I($,Z)},[D,I]),O=V.useCallback(G=>$=>{if($.button!=null&&$.button!==0||v.current||(G>0?!s:!o))return;v.current=!0;const Z={direction:G,startX:$.clientX,width:R(),armed:!1,released:!1,moved:!1,progress:0};x.current=Z;try{$.currentTarget.setPointerCapture($.pointerId)}catch{}T(G).then(ee=>{if(!ee){x.current=null,v.current=!1;return}Z.armed=!0,Z.released?P(Z):Rs(_.current,Z.progress)}).catch(()=>N())},[T,P,N,s,o,R]),U=V.useCallback(G=>{const $=x.current;if(!$||$.released)return;const Z=G.clientX-$.startX;Math.abs(Z)>OP&&($.moved=!0),$.progress=Ea(Z*-$.direction/$.width,0,1),$.armed&&Rs(_.current,$.progress)},[]),H=V.useCallback(()=>{const G=x.current;!G||G.released||(G.released=!0,G.armed&&P(G))},[P]),B=b1(b),j=b!=null&&b.shown?"visible":"hidden",F={backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden",visibility:j},Y=b!=null&&b.shown&&(b!=null&&b.backReady)?"visible":"hidden",q=G=>({onPointerDown:O(G),onPointerMove:U,onPointerUp:H,onPointerCancel:H});return p.jsxs("div",{ref:_,className:`select-none ${c}`,style:{width:"100%",height:"100%",...a,perspective:3200,visibility:f?"hidden":"visible"},children:[p.jsxs("div",{className:`absolute inset-0 ${Uo}`,children:[m,n&&p.jsx(qo,{})]}),p.jsxs("div",{className:`absolute inset-0 ${Uo}`,style:{zIndex:10,visibility:B.under?j:"hidden",...B.under},children:[p.jsx("div",{ref:S,className:"absolute inset-0"}),(b==null?void 0:b.spread)&&p.jsx(qo,{})]}),p.jsxs("div",{className:`absolute inset-0 ${Uo}`,style:{zIndex:30,...F,...B.front??{visibility:"hidden"}},children:[p.jsx("div",{ref:E,className:"absolute inset-0"}),(b==null?void 0:b.spread)&&p.jsx(qo,{}),B.front&&p.jsx(v1,{hinge:B.frontHinge,half:B.frontHalf,variable:"--flip-shade"})]}),p.jsxs("div",{className:`absolute inset-0 ${Uo}`,style:{zIndex:40,...F,...B.back??{},visibility:B.back?Y:"hidden"},children:[p.jsx("div",{ref:d,className:"absolute inset-0"}),(b==null?void 0:b.spread)&&p.jsx(qo,{}),B.back&&p.jsx(v1,{hinge:B.backHinge,half:B.backHalf,variable:"--flip-back-shade"})]}),p.jsx("div",{...q(-1),className:"absolute inset-y-0 left-0 z-50",style:{width:l,cursor:o?"grab":"default",touchAction:"pan-y"}}),p.jsx("div",{...q(1),className:"absolute inset-y-0 right-0 z-50",style:{width:l,cursor:s?"grab":"default",touchAction:"pan-y"}}),u&&p.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{zIndex:60,visibility:b||f?"hidden":"visible"},children:u})]})}),FP="Subscribe to continue reading this book.";function t3({message:t,visiblePages:n,totalPages:r,snapshotBackdrop:i,backdropKey:s,onSubscribe:o}){const[l,c]=V.useState(!1),a=V.useRef(null),[f,u]=V.useState(!1);V.useEffect(()=>{if(!i)return;let y=!1;return Promise.resolve(i(a.current)).then(_=>{var S;y||(_||(S=a.current)==null||S.replaceChildren(),u(!!_))}).catch(()=>{y||u(!1)}),()=>{y=!0}},[i,s]);const m=async()=>{if(!(!o||l))try{c(!0),await o()}catch{}finally{c(!1)}};return p.jsxs("div",{className:"absolute inset-0 z-20 flex flex-col items-center justify-center overflow-hidden bg-[#fefdf8] px-8 text-center dark:bg-[#1b1b1b]",children:[p.jsx("div",{ref:a,"aria-hidden":!0,className:"pointer-events-none absolute inset-0 select-none overflow-hidden",style:{filter:"blur(7px)",transform:"scale(1.04)",opacity:f?1:0}}),p.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-[#fefdf8]/55 dark:bg-[#1b1b1b]/60"}),p.jsxs("div",{className:"relative flex max-w-xs flex-col items-center gap-4 rounded-2xl border border-[#e8dcc8] bg-[#fefdf8]/95 px-7 py-6 shadow-xl dark:border-[#3a352c] dark:bg-[#242321]/95",children:[p.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-[#f3e9d7] dark:bg-[#3a352c]",children:p.jsx(H1,{className:"h-6 w-6 text-[#8b5e3c] dark:text-[#d9a86c]"})}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"font-serif text-base font-semibold text-[#1e1409] dark:text-[#f1ebe0]",children:t||FP}),n&&p.jsx("p",{className:"text-xs text-[#9e8870] dark:text-[#a99a86]",children:r?`You have read all ${n} free ${n===1?"page":"pages"} of ${r}.`:`The free preview is ${n} ${n===1?"page":"pages"}.`})]}),o&&p.jsxs(bn,{size:"sm",disabled:l,onClick:m,children:[l?p.jsx(Jn,{className:"mr-1 h-4 w-4 animate-spin"}):p.jsx(ox,{className:"mr-1 h-4 w-4"}),l?"Processing…":"Subscribe"]})]})]})}function HP({reader:t,canDownload:n,downloadUrl:r}){const{type:i,status:s,error:o,containerRef:l,epubMountRef:c,pdfSurfaceRef:a,isSpread:f,pdfFitWidth:u,stageSize:m,stageScale:y,isLocked:_,subscribeMessage:S,subscribeWallRef:E,snapshotBackdrop:d,visiblePages:h,backendTotalPages:v,fullscreenRef:x,location:g,snapshotInto:b,turnPage:w,canGoNext:k,canGoPrev:N,renderedPages:T,goToToc:D,goToBookmark:I,renderPdfTextLayer:L,bookmarks:R,removeBookmark:P,toc:O}=t,[U,H]=V.useState(!1),[B,j]=V.useState(!1),F=V.useRef(null),Y=V.useRef(null),q=s==="ready";V.useEffect(()=>{var Z;u&&((Z=Y.current)==null||Z.scrollTo({top:0}))},[u,g.page]);const G=V.useCallback(()=>{var Z;return(Z=F.current)==null?void 0:Z.flipNext()},[]),$=V.useCallback(()=>{var Z;return(Z=F.current)==null?void 0:Z.flipPrev()},[]);return V.useEffect(()=>{const Z=ee=>{var te,se;((te=ee.target)==null?void 0:te.tagName)==="INPUT"||((se=ee.target)==null?void 0:se.tagName)==="TEXTAREA"||(ee.key==="ArrowRight"?G():ee.key==="ArrowLeft"&&$())};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[G,$]),p.jsxs("div",{ref:x,className:"flex flex-col w-full h-full bg-background",children:[p.jsx(Uy,{reader:t,onPrev:$,onNext:G,onOpenToc:()=>H(!0),onOpenBookmarks:()=>j(!0),canDownload:n,downloadUrl:r}),p.jsxs("div",{className:"relative flex-1 min-h-0 flex items-center justify-center gap-3 px-4 py-4",children:[p.jsx("button",{type:"button",onClick:$,disabled:!N,className:"shrink-0 inline-flex items-center justify-center h-10 w-10 rounded-full border bg-background shadow-sm disabled:opacity-20 hover:bg-muted","aria-label":"Previous page",children:p.jsx(Ai,{className:"h-5 w-5"})}),p.jsxs("div",{ref:l,className:`relative flex-1 h-full ${u?"":"max-w-7xl"}`,children:[s==="loading"&&p.jsx(Bd,{label:i==="pdf"?"Loading PDF…":"Opening book…"}),s==="error"&&p.jsx(zd,{message:o,downloadUrl:n?r:null}),p.jsx("div",{ref:Y,className:u?"pdf-scroll absolute inset-0 overflow-y-auto overflow-x-hidden":"absolute inset-0 flex items-center justify-center overflow-hidden",children:p.jsx("div",{style:u?{width:m.width*y,height:m.height*y,margin:"0 auto"}:void 0,children:p.jsx("div",{style:{transform:`scale(${y})`,transformOrigin:u?"top left":"center center"},children:p.jsxs(e3,{ref:F,className:"relative",style:{width:m.width,height:m.height},isSpread:f,snapshotInto:b,turnPage:w,canGoNext:k,canGoPrev:N,hidden:!q,children:[i==="epub"?p.jsx("div",{ref:c,className:"w-full h-full"}):p.jsx("div",{ref:a,className:"w-full h-full",children:p.jsx(Jy,{page:g.page,rightPage:g.endPage>g.page?g.endPage:null,renderedPages:T,renderTextLayer:L,isSpread:f})}),_&&p.jsx("div",{ref:E,className:"absolute inset-0",children:p.jsx(t3,{message:S,onSubscribe:t.onSubscribe,visiblePages:h,totalPages:v??(i==="pdf"?g.totalPages:null),snapshotBackdrop:d,backdropKey:g.page})})]})})})})]}),p.jsx("button",{type:"button",onClick:G,disabled:!k,className:"shrink-0 inline-flex items-center justify-center h-10 w-10 rounded-full border bg-background shadow-sm disabled:opacity-20 hover:bg-muted","aria-label":"Next page",children:p.jsx(In,{className:"h-5 w-5"})})]}),p.jsx(Ky,{open:U,onOpenChange:H,toc:O,onSelect:D}),p.jsx(Qy,{open:B,onOpenChange:j,bookmarks:R,onSelect:I,onRemove:P})]})}const $P=.3,y1=72;function VP({reader:t,canDownload:n,downloadUrl:r}){const{type:i,status:s,error:o,containerRef:l,epubMountRef:c,pdfSurfaceRef:a,stageSize:f,stageScale:u,isLocked:m,subscribeMessage:y,subscribeWallRef:_,snapshotBackdrop:S,visiblePages:E,backendTotalPages:d,fullscreenRef:h,location:v,snapshotInto:x,turnPage:g,canGoNext:b,canGoPrev:w,renderedPages:k,goToToc:N,goToBookmark:T,renderPdfTextLayer:D,bookmarks:I,removeBookmark:L,toc:R}=t,[P,O]=V.useState(!1),[U,H]=V.useState(!1),B=V.useRef(null),[j,F]=V.useState(y1);V.useEffect(()=>{const $=()=>{var ee;const Z=((ee=l.current)==null?void 0:ee.clientWidth)||0;F(Math.max(y1,Math.round(Z*$P)))};return $(),window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[l]);const Y=V.useCallback(()=>{var $;return($=B.current)==null?void 0:$.flipNext()},[]),q=V.useCallback(()=>{var $;return($=B.current)==null?void 0:$.flipPrev()},[]);V.useEffect(()=>{const $=Z=>{var ee,te;((ee=Z.target)==null?void 0:ee.tagName)==="INPUT"||((te=Z.target)==null?void 0:te.tagName)==="TEXTAREA"||(Z.key==="ArrowRight"?Y():Z.key==="ArrowLeft"&&q())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[Y,q]);const G=s==="ready";return p.jsxs("div",{ref:h,className:"flex flex-col w-full h-full bg-background",children:[p.jsx(Uy,{reader:t,compact:!0,onPrev:q,onNext:Y,onOpenToc:()=>O(!0),onOpenBookmarks:()=>H(!0),canDownload:n,downloadUrl:r}),p.jsxs("div",{ref:l,className:"relative flex-1 min-h-0 overflow-hidden",children:[s==="loading"&&p.jsx(Bd,{label:i==="pdf"?"Loading PDF…":"Opening book…"}),s==="error"&&p.jsx(zd,{message:o,downloadUrl:n?r:null}),p.jsx("div",{className:"absolute inset-0 flex items-center justify-center overflow-hidden",children:p.jsx("div",{style:{transform:`scale(${u})`,transformOrigin:"center center"},children:p.jsxs(e3,{ref:B,className:"relative",style:{width:f.width,height:f.height},isSpread:!1,grabWidth:j,hidden:!G,snapshotInto:x,turnPage:g,canGoNext:b,canGoPrev:w,children:[i==="epub"?p.jsx("div",{ref:c,className:"w-full h-full"}):p.jsx("div",{ref:a,className:"w-full h-full",children:p.jsx(Jy,{page:v.page,renderedPages:k,renderTextLayer:D,isSpread:!1})}),m&&p.jsx("div",{ref:_,className:"absolute inset-0",children:p.jsx(t3,{message:y,onSubscribe:t.onSubscribe,visiblePages:E,totalPages:d??(i==="pdf"?v.totalPages:null),snapshotBackdrop:S,backdropKey:v.page})})]})})})]}),p.jsx(Ky,{open:P,onOpenChange:O,toc:R,onSelect:N}),p.jsx(Qy,{open:U,onOpenChange:H,bookmarks:I,onSelect:T,onRemove:L})]})}function WP({isMobile:t,type:n,blobUrl:r,cacheKey:i,storage:s,title:o,canDownload:l,downloadUrl:c,hasFullAccess:a,visiblePages:f,backendTotalPages:u,subscribeMessage:m,onSubscribe:y}){const _=Wy({type:n,blobUrl:r,cacheKey:i,storage:s,title:o,allowSpread:!t,hasFullAccess:a,visiblePages:f,backendTotalPages:u,subscribeMessage:m,onSubscribe:y}),S=t?VP:HP,E=l&&!_.isGated;return p.jsx(S,{reader:_,canDownload:E,downloadUrl:E?c:null})}function n3(t){const n=MP();return p.jsx(WP,{isMobile:n,...t},n?"mobile":"desktop")}const x1=1.414,w1=2,r3=600,i3=52,y0=40,UP=32,x0=24,Dc=3e3,Ta={display:"inline-flex",alignItems:"center",justifyContent:"center",width:y0,height:y0,borderRadius:"50%",border:"1px solid #e2e8f0",background:"#fff",color:"#334155",cursor:"pointer",flexShrink:0,boxShadow:"0 1px 4px rgba(0,0,0,.08)",transition:"opacity .2s"};function qP(t,n){let r=0,i=t;for(;i&&i!==n;)r+=i.offsetTop,i=i.offsetParent;return r}function YP(t,n,r,i){if(!t)return[0];const s=Array.from(t.querySelectorAll("p, h1, h2, h3, h4, h5, h6, blockquote, pre, figure, table, dt, dd")).map(c=>{const a=qP(c,t);return{top:a,bottom:a+c.offsetHeight}}).filter(c=>c.bottom>c.top).sort((c,a)=>c.top-a.top),o=[];let l=0;for(;l<r&&o.length<i;){o.push(l);let c=l+n;if(c>=r)break;for(const a of s){if(a.top>=c)break;if(!(a.bottom<=c)&&a.top>l&&a.bottom-a.top<=n){c=a.top;break}}c<=l&&(c=l+n),l=c}return o}async function GP(t,n,r,i=0,s=null){var u;const{default:o}=await Promise.resolve().then(()=>require("./html2canvas.esm-BA_v9SIU.cjs")),l=s!==null?s:r-x0*2,c=t.querySelector("iframe");if((u=c==null?void 0:c.contentDocument)!=null&&u.body)try{const m=await o(c.contentDocument.body,{x:0,y:i,width:n,height:l,backgroundColor:"#fefdf8",scale:1,useCORS:!0,allowTaint:!0,logging:!1,foreignObjectRendering:!1}),y=document.createElement("canvas");y.width=n,y.height=r;const _=y.getContext("2d");return _.fillStyle="#fefdf8",_.fillRect(0,0,n,r),_.drawImage(m,0,x0),y.toDataURL("image/jpeg",.88)}catch{}const a=document.createElement("canvas");a.width=n,a.height=r;const f=a.getContext("2d");f.fillStyle="#fefdf8",f.fillRect(0,0,n,r),f.strokeStyle="rgba(180,160,130,0.15)",f.lineWidth=1;for(let m=40;m<r;m+=28)f.beginPath(),f.moveTo(24,m),f.lineTo(n-24,m),f.stroke();return a.toDataURL("image/jpeg",.88)}function ZP(t,n){if(n){if(n==="application/pdf")return"pdf";if(n==="application/epub+zip")return"epub"}if(t){const r=t.toLowerCase().split("?")[0];if(r.endsWith(".pdf"))return"pdf";if(r.endsWith(".epub"))return"epub"}return"epub"}var w0={exports:{}};(function(t,n){(function(r,i){i(n)})(At,function(r){class i{constructor(g,b){this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0},this.createdDensity=b,this.nowDrawingDensity=this.createdDensity,this.render=g}setDensity(g){this.createdDensity=g,this.nowDrawingDensity=g}setDrawingDensity(g){this.nowDrawingDensity=g}setPosition(g){this.state.position=g}setAngle(g){this.state.angle=g}setArea(g){this.state.area=g}setHardDrawingAngle(g){this.state.hardDrawingAngle=g}setHardAngle(g){this.state.hardAngle=g,this.state.hardDrawingAngle=g}setOrientation(g){this.orientation=g}getDrawingDensity(){return this.nowDrawingDensity}getDensity(){return this.createdDensity}getHardAngle(){return this.state.hardAngle}}class s extends i{constructor(g,b,w){super(g,w),this.image=null,this.isLoad=!1,this.loadingAngle=0,this.image=new Image,this.image.src=b}draw(g){const b=this.render.getContext(),w=this.render.convertToGlobal(this.state.position),k=this.render.getRect().pageWidth,N=this.render.getRect().height;b.save(),b.translate(w.x,w.y),b.beginPath();for(let T of this.state.area)T!==null&&(T=this.render.convertToGlobal(T),b.lineTo(T.x-w.x,T.y-w.y));b.rotate(this.state.angle),b.clip(),this.isLoad?b.drawImage(this.image,0,0,k,N):this.drawLoader(b,{x:0,y:0},k,N),b.restore()}simpleDraw(g){const b=this.render.getRect(),w=this.render.getContext(),k=b.pageWidth,N=b.height,T=g===1?b.left+b.pageWidth:b.left,D=b.top;this.isLoad?w.drawImage(this.image,T,D,k,N):this.drawLoader(w,{x:T,y:D},k,N)}drawLoader(g,b,w,k){g.beginPath(),g.strokeStyle="rgb(200, 200, 200)",g.fillStyle="rgb(255, 255, 255)",g.lineWidth=1,g.rect(b.x+1,b.y+1,w-1,k-1),g.stroke(),g.fill();const N={x:b.x+w/2,y:b.y+k/2};g.beginPath(),g.lineWidth=10,g.arc(N.x,N.y,20,this.loadingAngle,3*Math.PI/2+this.loadingAngle),g.stroke(),g.closePath(),this.loadingAngle+=.07,this.loadingAngle>=2*Math.PI&&(this.loadingAngle=0)}load(){this.isLoad||(this.image.onload=()=>{this.isLoad=!0})}newTemporaryCopy(){return this}getTemporaryCopy(){return this}hideTemporaryCopy(){}}class o{constructor(g,b){this.pages=[],this.currentPageIndex=0,this.currentSpreadIndex=0,this.landscapeSpread=[],this.portraitSpread=[],this.render=b,this.app=g,this.currentPageIndex=0,this.isShowCover=this.app.getSettings().showCover}destroy(){this.pages=[]}createSpread(){this.landscapeSpread=[],this.portraitSpread=[];for(let b=0;b<this.pages.length;b++)this.portraitSpread.push([b]);let g=0;this.isShowCover&&(this.pages[0].setDensity("hard"),this.landscapeSpread.push([g]),g++);for(let b=g;b<this.pages.length;b+=2)b<this.pages.length-1?this.landscapeSpread.push([b,b+1]):(this.landscapeSpread.push([b]),this.pages[b].setDensity("hard"))}getSpread(){return this.render.getOrientation()==="landscape"?this.landscapeSpread:this.portraitSpread}getSpreadIndexByPage(g){const b=this.getSpread();for(let w=0;w<b.length;w++)if(g===b[w][0]||g===b[w][1])return w;return null}getPageCount(){return this.pages.length}getPages(){return this.pages}getPage(g){if(g>=0&&g<this.pages.length)return this.pages[g];throw new Error("Invalid page number")}nextBy(g){const b=this.pages.indexOf(g);return b<this.pages.length-1?this.pages[b+1]:null}prevBy(g){const b=this.pages.indexOf(g);return b>0?this.pages[b-1]:null}getFlippingPage(g){const b=this.currentSpreadIndex;if(this.render.getOrientation()==="portrait")return g===0?this.pages[b].newTemporaryCopy():this.pages[b-1];{const w=g===0?this.getSpread()[b+1]:this.getSpread()[b-1];return w.length===1||g===0?this.pages[w[0]]:this.pages[w[1]]}}getBottomPage(g){const b=this.currentSpreadIndex;if(this.render.getOrientation()==="portrait")return g===0?this.pages[b+1]:this.pages[b-1];{const w=g===0?this.getSpread()[b+1]:this.getSpread()[b-1];return w.length===1?this.pages[w[0]]:g===0?this.pages[w[1]]:this.pages[w[0]]}}showNext(){this.currentSpreadIndex<this.getSpread().length&&(this.currentSpreadIndex++,this.showSpread())}showPrev(){this.currentSpreadIndex>0&&(this.currentSpreadIndex--,this.showSpread())}getCurrentPageIndex(){return this.currentPageIndex}show(g=null){if(g===null&&(g=this.currentPageIndex),g<0||g>=this.pages.length)return;const b=this.getSpreadIndexByPage(g);b!==null&&(this.currentSpreadIndex=b,this.showSpread())}getCurrentSpreadIndex(){return this.currentSpreadIndex}setCurrentSpreadIndex(g){if(!(g>=0&&g<this.getSpread().length))throw new Error("Invalid page");this.currentSpreadIndex=g}showSpread(){const g=this.getSpread()[this.currentSpreadIndex];g.length===2?(this.render.setLeftPage(this.pages[g[0]]),this.render.setRightPage(this.pages[g[1]])):this.render.getOrientation()==="landscape"&&g[0]===this.pages.length-1?(this.render.setLeftPage(this.pages[g[0]]),this.render.setRightPage(null)):(this.render.setLeftPage(null),this.render.setRightPage(this.pages[g[0]])),this.currentPageIndex=g[0],this.app.updatePageIndex(this.currentPageIndex)}}class l extends o{constructor(g,b,w){super(g,b),this.imagesHref=w}load(){for(const g of this.imagesHref){const b=new s(this.render,g,"soft");b.load(),this.pages.push(b)}this.createSpread()}}class c{static GetDistanceBetweenTwoPoint(g,b){return g===null||b===null?1/0:Math.sqrt(Math.pow(b.x-g.x,2)+Math.pow(b.y-g.y,2))}static GetSegmentLength(g){return c.GetDistanceBetweenTwoPoint(g[0],g[1])}static GetAngleBetweenTwoLine(g,b){const w=g[0].y-g[1].y,k=b[0].y-b[1].y,N=g[1].x-g[0].x,T=b[1].x-b[0].x;return Math.acos((w*k+N*T)/(Math.sqrt(w*w+N*N)*Math.sqrt(k*k+T*T)))}static PointInRect(g,b){return b===null?null:b.x>=g.left&&b.x<=g.width+g.left&&b.y>=g.top&&b.y<=g.top+g.height?b:null}static GetRotatedPoint(g,b,w){return{x:g.x*Math.cos(w)+g.y*Math.sin(w)+b.x,y:g.y*Math.cos(w)-g.x*Math.sin(w)+b.y}}static LimitPointToCircle(g,b,w){if(c.GetDistanceBetweenTwoPoint(g,w)<=b)return w;const k=g.x,N=g.y,T=w.x,D=w.y;let I=Math.sqrt(Math.pow(b,2)*Math.pow(k-T,2)/(Math.pow(k-T,2)+Math.pow(N-D,2)))+k;w.x<0&&(I*=-1);let L=(I-k)*(N-D)/(k-T)+N;return k-T+N===0&&(L=b),{x:I,y:L}}static GetIntersectBetweenTwoSegment(g,b,w){return c.PointInRect(g,c.GetIntersectBeetwenTwoLine(b,w))}static GetIntersectBeetwenTwoLine(g,b){const w=g[0].y-g[1].y,k=b[0].y-b[1].y,N=g[1].x-g[0].x,T=b[1].x-b[0].x,D=g[0].x*g[1].y-g[1].x*g[0].y,I=b[0].x*b[1].y-b[1].x*b[0].y,L=w*I-k*D,R=N*I-T*D,P=-(D*T-I*N)/(w*T-k*N),O=-(w*I-k*D)/(w*T-k*N);if(isFinite(P)&&isFinite(O))return{x:P,y:O};if(Math.abs(L-R)<.1)throw new Error("Segment included");return null}static GetCordsFromTwoPoint(g,b){const w=Math.abs(g.x-b.x),k=Math.abs(g.y-b.y),N=Math.max(w,k),T=[g];function D(I,L,R,P,O){return L>I?I+O*(R/P):L<I?I-O*(R/P):I}for(let I=1;I<=N;I+=1)T.push({x:D(g.x,b.x,w,N,I),y:D(g.y,b.y,k,N,I)});return T}}class a extends i{constructor(g,b,w){super(g,w),this.copiedElement=null,this.temporaryCopy=null,this.isLoad=!1,this.element=b,this.element.classList.add("stf__item"),this.element.classList.add("--"+w)}newTemporaryCopy(){return this.nowDrawingDensity==="hard"?this:(this.temporaryCopy===null&&(this.copiedElement=this.element.cloneNode(!0),this.element.parentElement.appendChild(this.copiedElement),this.temporaryCopy=new a(this.render,this.copiedElement,this.nowDrawingDensity)),this.getTemporaryCopy())}getTemporaryCopy(){return this.temporaryCopy}hideTemporaryCopy(){this.temporaryCopy!==null&&(this.copiedElement.remove(),this.copiedElement=null,this.temporaryCopy=null)}draw(g){const b=g||this.nowDrawingDensity,w=this.render.convertToGlobal(this.state.position),k=this.render.getRect().pageWidth,N=this.render.getRect().height;this.element.classList.remove("--simple");const T=`
|
|
632
632
|
display: block;
|
|
633
633
|
z-index: ${this.element.style.zIndex};
|
|
634
634
|
left: 0;
|
|
@@ -754,7 +754,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
754
754
|
position: absolute;
|
|
755
755
|
left: 0;
|
|
756
756
|
top: 0;
|
|
757
|
-
}`),r.PageFlip=class extends class{constructor(){this.events=new Map}on(x,g){return this.events.has(x)?this.events.get(x).push(g):this.events.set(x,[g]),this}off(x){this.events.delete(x)}trigger(x,g,b=null){if(this.events.has(x))for(const w of this.events.get(x))w({data:b,object:g})}}{constructor(x,g){super(),this.isUserTouch=!1,this.isUserMove=!1,this.setting=null,this.pages=null,this.setting=new v().getSettings(g),this.block=x}destroy(){this.ui.destroy(),this.block.remove()}update(){this.render.update(),this.pages.show()}loadFromImages(x){this.ui=new d(this.block,this,this.setting);const g=this.ui.getCanvas();this.render=new _(this,this.setting,g),this.flipController=new m(this.render,this),this.pages=new l(this,this.render,x),this.pages.load(),this.render.start(),this.pages.show(this.setting.startPage),setTimeout(()=>{this.ui.update(),this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})},1)}loadFromHTML(x){this.ui=new E(this.block,this,this.setting,x),this.render=new h(this,this.setting,this.ui.getDistElement()),this.flipController=new m(this.render,this),this.pages=new f(this,this.render,this.ui.getDistElement(),x),this.pages.load(),this.render.start(),this.pages.show(this.setting.startPage),setTimeout(()=>{this.ui.update(),this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})},1)}updateFromImages(x){const g=this.pages.getCurrentPageIndex();this.pages.destroy(),this.pages=new l(this,this.render,x),this.pages.load(),this.pages.show(g),this.trigger("update",this,{page:g,mode:this.render.getOrientation()})}updateFromHtml(x){const g=this.pages.getCurrentPageIndex();this.pages.destroy(),this.pages=new f(this,this.render,this.ui.getDistElement(),x),this.pages.load(),this.ui.updateItems(x),this.render.reload(),this.pages.show(g),this.trigger("update",this,{page:g,mode:this.render.getOrientation()})}clear(){this.pages.destroy(),this.ui.clear()}turnToPrevPage(){this.pages.showPrev()}turnToNextPage(){this.pages.showNext()}turnToPage(x){this.pages.show(x)}flipNext(x="top"){this.flipController.flipNext(x)}flipPrev(x="top"){this.flipController.flipPrev(x)}flip(x,g="top"){this.flipController.flipToPage(x,g)}updateState(x){this.trigger("changeState",this,x)}updatePageIndex(x){this.trigger("flip",this,x)}updateOrientation(x){this.ui.setOrientationStyle(x),this.update(),this.trigger("changeOrientation",this,x)}getPageCount(){return this.pages.getPageCount()}getCurrentPageIndex(){return this.pages.getCurrentPageIndex()}getPage(x){return this.pages.getPage(x)}getRender(){return this.render}getFlipController(){return this.flipController}getOrientation(){return this.render.getOrientation()}getBoundsRect(){return this.render.getRect()}getSettings(){return this.setting}getUI(){return this.ui}getState(){return this.flipController.getState()}getPageCollection(){return this.pages}startUserTouch(x){this.mousePosition=x,this.isUserTouch=!0,this.isUserMove=!1}userMove(x,g){this.isUserTouch||g||!this.setting.showPageCorners?this.isUserTouch&&c.GetDistanceBetweenTwoPoint(this.mousePosition,x)>5&&(this.isUserMove=!0,this.flipController.fold(x)):this.flipController.showCorner(x)}userStop(x,g=!1){this.isUserTouch&&(this.isUserTouch=!1,g||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(x)))}},Object.defineProperty(r,"__esModule",{value:!0})})})(w0,w0.exports);var
|
|
757
|
+
}`),r.PageFlip=class extends class{constructor(){this.events=new Map}on(x,g){return this.events.has(x)?this.events.get(x).push(g):this.events.set(x,[g]),this}off(x){this.events.delete(x)}trigger(x,g,b=null){if(this.events.has(x))for(const w of this.events.get(x))w({data:b,object:g})}}{constructor(x,g){super(),this.isUserTouch=!1,this.isUserMove=!1,this.setting=null,this.pages=null,this.setting=new v().getSettings(g),this.block=x}destroy(){this.ui.destroy(),this.block.remove()}update(){this.render.update(),this.pages.show()}loadFromImages(x){this.ui=new d(this.block,this,this.setting);const g=this.ui.getCanvas();this.render=new _(this,this.setting,g),this.flipController=new m(this.render,this),this.pages=new l(this,this.render,x),this.pages.load(),this.render.start(),this.pages.show(this.setting.startPage),setTimeout(()=>{this.ui.update(),this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})},1)}loadFromHTML(x){this.ui=new E(this.block,this,this.setting,x),this.render=new h(this,this.setting,this.ui.getDistElement()),this.flipController=new m(this.render,this),this.pages=new f(this,this.render,this.ui.getDistElement(),x),this.pages.load(),this.render.start(),this.pages.show(this.setting.startPage),setTimeout(()=>{this.ui.update(),this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})},1)}updateFromImages(x){const g=this.pages.getCurrentPageIndex();this.pages.destroy(),this.pages=new l(this,this.render,x),this.pages.load(),this.pages.show(g),this.trigger("update",this,{page:g,mode:this.render.getOrientation()})}updateFromHtml(x){const g=this.pages.getCurrentPageIndex();this.pages.destroy(),this.pages=new f(this,this.render,this.ui.getDistElement(),x),this.pages.load(),this.ui.updateItems(x),this.render.reload(),this.pages.show(g),this.trigger("update",this,{page:g,mode:this.render.getOrientation()})}clear(){this.pages.destroy(),this.ui.clear()}turnToPrevPage(){this.pages.showPrev()}turnToNextPage(){this.pages.showNext()}turnToPage(x){this.pages.show(x)}flipNext(x="top"){this.flipController.flipNext(x)}flipPrev(x="top"){this.flipController.flipPrev(x)}flip(x,g="top"){this.flipController.flipToPage(x,g)}updateState(x){this.trigger("changeState",this,x)}updatePageIndex(x){this.trigger("flip",this,x)}updateOrientation(x){this.ui.setOrientationStyle(x),this.update(),this.trigger("changeOrientation",this,x)}getPageCount(){return this.pages.getPageCount()}getCurrentPageIndex(){return this.pages.getCurrentPageIndex()}getPage(x){return this.pages.getPage(x)}getRender(){return this.render}getFlipController(){return this.flipController}getOrientation(){return this.render.getOrientation()}getBoundsRect(){return this.render.getRect()}getSettings(){return this.setting}getUI(){return this.ui}getState(){return this.flipController.getState()}getPageCollection(){return this.pages}startUserTouch(x){this.mousePosition=x,this.isUserTouch=!0,this.isUserMove=!1}userMove(x,g){this.isUserTouch||g||!this.setting.showPageCorners?this.isUserTouch&&c.GetDistanceBetweenTwoPoint(this.mousePosition,x)>5&&(this.isUserMove=!0,this.flipController.fold(x)):this.flipController.showCorner(x)}userStop(x,g=!1){this.isUserTouch&&(this.isUserTouch=!1,g||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(x)))}},Object.defineProperty(r,"__esModule",{value:!0})})})(w0,w0.exports);var XP=w0.exports;const KP=V.forwardRef((t,n)=>{const r=V.useRef(null),i=V.useRef([]),s=V.useRef(),[o,l]=V.useState([]);V.useImperativeHandle(n,()=>({pageFlip:()=>s.current}));const c=V.useCallback(()=>{s.current&&s.current.clear()},[]),a=V.useCallback(()=>{const f=s.current;f&&(f.off("flip"),f.off("changeOrientation"),f.off("changeState"),f.off("init"),f.off("update"))},[]);return V.useEffect(()=>{if(i.current=[],t.children){const f=V.Children.map(t.children,u=>V.cloneElement(u,{ref:m=>{m&&i.current.push(m)}}));(!t.renderOnlyPageLengthChange||o.length!==f.length)&&(f.length<o.length&&c(),l(f))}},[t.children]),V.useEffect(()=>{const f=()=>{const u=s.current;u&&(t.onFlip&&u.on("flip",m=>t.onFlip(m)),t.onChangeOrientation&&u.on("changeOrientation",m=>t.onChangeOrientation(m)),t.onChangeState&&u.on("changeState",m=>t.onChangeState(m)),t.onInit&&u.on("init",m=>t.onInit(m)),t.onUpdate&&u.on("update",m=>t.onUpdate(m)))};o.length>0&&i.current.length>0&&(a(),r.current&&!s.current&&(s.current=new XP.PageFlip(r.current,t)),s.current.getFlipController()?s.current.updateFromHtml(i.current):s.current.loadFromHTML(i.current),f())},[o]),V.createElement("div",{ref:r,className:t.className,style:t.style},o)}),s3=V.memo(KP);function o3({title:t,pageLabel:n,canDownload:r,downloadUrl:i,isCapturing:s,captureProgress:o}){return p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",padding:"8px 0 10px",borderBottom:"1px solid #f1f5f9",minHeight:i3},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[p.jsx(Na,{size:15,style:{color:"#8b5e3c",flexShrink:0}}),p.jsx("span",{style:{fontSize:13,color:"#5a4632",fontFamily:"Georgia,serif",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),n&&p.jsxs("span",{style:{fontSize:12,color:"#b09878",fontFamily:"Georgia,serif",whiteSpace:"nowrap"},children:["— ",n]}),s&&p.jsxs("span",{style:{fontSize:11,color:"#8b5e3c",background:"#fdf3e7",padding:"2px 8px",borderRadius:10,display:"inline-flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[p.jsx(Jn,{size:10,style:{animation:"tbspin 1s linear infinite"}}),p.jsx("style",{children:"@keyframes tbspin{to{transform:rotate(360deg)}}"}),o<100?`${o}%`:"Finishing…"]})]}),r&&i&&p.jsx("a",{href:i,download:!0,style:{textDecoration:"none"},children:p.jsxs(Ke,{variant:"default",size:"sm",children:[p.jsx(Ks,{size:13})," Download"]})})]})}function a3({label:t}){return p.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"60px 0"},children:[p.jsx("style",{children:"@keyframes csp{to{transform:rotate(360deg)}}"}),p.jsxs("div",{style:{position:"relative",width:44,height:44},children:[p.jsx("div",{style:{width:44,height:44,borderRadius:"50%",border:"2px solid #e8dcc8",borderTopColor:"#8b5e3c",animation:"csp 1s linear infinite"}}),p.jsx(Na,{size:16,style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%,-50%)",color:"#8b5e3c"}})]}),p.jsx("p",{style:{fontFamily:"Georgia,serif",fontSize:13,color:"#9e8870",margin:0},children:t})]})}function l3(){return p.jsxs(p.Fragment,{children:[p.jsx("style",{children:"@keyframes psp{to{transform:rotate(360deg)}}"}),p.jsx("div",{style:{width:24,height:24,borderRadius:"50%",border:"2px solid #e8dcc8",borderTopColor:"#8b5e3c",animation:"psp 1s linear infinite"}})]})}function c3({message:t,downloadUrl:n}){return p.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,padding:"60px 0",color:"#64748b"},children:[p.jsx(I1,{size:36}),p.jsx("p",{style:{fontSize:14},children:t}),n&&p.jsx("a",{href:n,download:!0,children:p.jsxs(Ke,{variant:"outline",size:"sm",children:[p.jsx(Ks,{size:13,style:{marginRight:4}})," Download instead"]})})]})}const QP=`
|
|
758
758
|
* { box-sizing: border-box; }
|
|
759
759
|
body {
|
|
760
760
|
font-family: Georgia,'Times New Roman',serif !important;
|
|
@@ -768,5 +768,5 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
768
768
|
h1,h2,h3,h4 { color:#1a1208 !important; line-height:1.3 !important; }
|
|
769
769
|
a { color:#8b5e3c !important; }
|
|
770
770
|
img{ max-width:100% !important; height:auto !important; }
|
|
771
|
-
`,u3=V.memo(V.forwardRef(({dataUrl:t,pageNum:n,width:r,height:i},s)=>p.jsx("div",{ref:s,style:{width:r,height:i,background:"#fefdf8",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative",flexShrink:0},children:t?p.jsx("img",{src:t,alt:`Page ${n}`,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block"}}):p.jsx(l3,{})})));u3.displayName="EpubPage";function KP({blobUrl:t,pageWidth:n,pageHeight:r,canDownload:i,downloadUrl:s,title:o}){const[l,c]=V.useState(0),[a,f]=V.useState({}),[u,m]=V.useState(!0),[y,_]=V.useState(!1),[S,E]=V.useState(0),[d,h]=V.useState(null),[v,x]=V.useState(0),g=V.useRef(null),b=V.useRef(!1);V.useEffect(()=>{if(!t||n<10||r<10)return;b.current=!1,m(!0),h(null),c(0),f({}),E(0),_(!1),x(0);let I=null;return(async()=>{var R,P,O,U;try{const{default:H}=await Promise.resolve().then(()=>require("./index-gZlYD4yT.cjs"));I=H(t,{openAs:"epub"}),await I.ready;const B=[];if(I.spine.each(ee=>B.push(ee)),B.length===0){h("No readable sections found in EPUB."),m(!1);return}const j=document.createElement("div");Object.assign(j.style,{position:"fixed",top:"-9999px",left:"-9999px",width:`${n}px`,height:`${r}px`,overflow:"hidden",pointerEvents:"none",zIndex:-1}),document.body.appendChild(j);const F=I.renderTo(j,{width:n,height:r,spread:"none",flow:"scrolled",manager:"default"});F.hooks.content.register(ee=>{ee.addStylesheet(XP)});const Y=()=>new Promise(ee=>{let te=!1;const se=()=>{te||(te=!0,clearTimeout(ie),ee())},ie=setTimeout(se,3e3);F.once("rendered",se),F.once("relocated",se)}),q=r-x0*2,G=[];for(let ee=0;ee<B.length&&!(b.current||G.length>=Dc);ee++){const te=Y();try{await F.display(B[ee].href)}catch{G.push({si:ee,sy:0});continue}await te,await new Promise(be=>setTimeout(be,80));const se=j.querySelector("iframe"),ie=(R=se==null?void 0:se.contentDocument)==null?void 0:R.body,ae=Math.max(r,(ie==null?void 0:ie.scrollHeight)??r,((O=(P=se==null?void 0:se.contentDocument)==null?void 0:P.documentElement)==null?void 0:O.scrollHeight)??0);UP(ie,q,ae,Dc-G.length).forEach(be=>G.push({si:ee,sy:be}))}if(b.current){document.body.removeChild(j);return}const $=Math.min(G.length,Dc);if($===0){h("Could not capture EPUB pages."),m(!1),document.body.removeChild(j);return}c($),m(!1),_(!0);let Z=-1;for(let ee=0;ee<$&&!b.current;ee++){const{si:te,sy:se}=G[ee];if(te!==Z){const ce=Y();await F.display(B[te].href),await ce,await new Promise(pe=>setTimeout(pe,150)),Z=te}const ie=G[ee+1],ae=ie&&ie.si===te?Math.min(ie.sy-se,q):q,de=j.querySelector("iframe");(U=de==null?void 0:de.contentWindow)==null||U.scrollTo(0,se),await new Promise(ce=>setTimeout(ce,40));const be=await qP(j,n,r,se,ae);f(ce=>({...ce,[ee]:be})),E(Math.min(99,Math.round((ee+1)/$*100)))}document.body.removeChild(j);try{F.destroy()}catch{}b.current||E(100)}catch(H){b.current||(console.error("EPUB render error:",H),h("Failed to render EPUB pages."),m(!1))}finally{if(_(!1),I)try{I.destroy()}catch{}}})(),()=>{b.current=!0}},[t,n,r]);const w=V.useCallback(()=>{var I,L;return(L=(I=g.current)==null?void 0:I.pageFlip())==null?void 0:L.flipPrev("top")},[]),k=V.useCallback(()=>{var I,L;v<l-2&&((L=(I=g.current)==null?void 0:I.pageFlip())==null||L.flipNext("top"))},[v,l]),N=V.useCallback(I=>x(I.data),[]);if(V.useEffect(()=>{const I=L=>{L.key==="ArrowRight"&&k(),L.key==="ArrowLeft"&&w()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[k,w]),u)return p.jsx(a3,{label:"Opening book…"});if(d)return p.jsx(c3,{message:d,downloadUrl:i?s:null});const T=v+1,D=Math.min(v+2,l);return p.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column"},children:[p.jsx(o3,{title:o,pageLabel:`${T}–${D} of ${l}`,canDownload:i,downloadUrl:s,isCapturing:y,captureProgress:S}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",paddingTop:12,gap:8},children:[p.jsx("button",{onClick:w,disabled:v===0,style:{...Ta,opacity:v===0?.2:1},"aria-label":"Previous",children:p.jsx(Ai,{size:20})}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6},children:[p.jsx("div",{style:{width:n*2,height:r,overflow:"hidden",borderRadius:4,boxShadow:"0 8px 32px rgba(50,30,10,.15), 0 2px 8px rgba(50,30,10,.08)",flexShrink:0},children:p.jsx(s3,{ref:g,width:n,height:r,size:"fixed",minWidth:n,maxWidth:n,minHeight:r,maxHeight:r,maxShadowOpacity:.3,showCover:!1,mobileScrollSupport:!1,onFlip:N,flippingTime:r3,usePortrait:!1,startZIndex:10,autoSize:!1,clickEventForward:!1,useMouseEvents:!0,swipeDistance:30,showPageCorners:!0,style:{background:"transparent"},children:Array.from({length:l},(I,L)=>p.jsx(u3,{dataUrl:a[L]??null,pageNum:L+1,width:n,height:r},`epub-${L}`))})}),y&&p.jsx("div",{style:{width:n*2,height:3,background:"#f1ece3",borderRadius:2,overflow:"hidden"},children:p.jsx("div",{style:{width:`${S}%`,height:"100%",background:"#8b5e3c",borderRadius:2,transition:"width .4s"}})})]}),p.jsx("button",{onClick:k,disabled:v>=l-2,style:{...Ta,opacity:v>=l-2?.2:1},"aria-label":"Next",children:p.jsx(In,{size:20})})]})]})}const d3=V.forwardRef(({dataUrl:t,pageNum:n,width:r,height:i},s)=>p.jsx("div",{ref:s,style:{width:r,height:i,background:"#fefdf8",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative",flexShrink:0},children:t?p.jsx("img",{src:t,alt:`Page ${n}`,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block"}}):p.jsx(l3,{})}));d3.displayName="PdfPage";function QP({blobUrl:t,pageWidth:n,pageHeight:r,canDownload:i,downloadUrl:s,title:o,totalPagesHint:l}){const[c,a]=V.useState(null),[f,u]=V.useState(l||0),[m,y]=V.useState(0),[_,S]=V.useState({}),[E,d]=V.useState(!0),[h,v]=V.useState(null),x=V.useRef(null),g=V.useRef(new Set),b=V.useRef(!1),w=V.useCallback(async P=>{try{const O=await import("https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.0.379/pdf.min.mjs");O.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.0.379/pdf.worker.min.mjs";const U=await O.getDocument({url:P,withCredentials:!1}).promise;if(b.current)return;a({doc:U,pdfjs:O}),u(U.numPages),d(!1)}catch(O){console.error("PDF load:",O),b.current||v("Failed to load PDF.")}},[]);V.useEffect(()=>(b.current=!1,d(!0),v(null),S({}),y(0),w(t),()=>{b.current=!0}),[t,w]);const k=V.useCallback(async(P,O,U,H)=>{if(!(!P||g.current.has(O))){g.current.add(O);try{const B=await P.doc.getPage(O),j=B.getViewport({scale:1}),F=Math.min(U/j.width,H/j.height),Y=B.getViewport({scale:F}),q=document.createElement("canvas");if(q.width=Y.width,q.height=Y.height,await B.render({canvasContext:q.getContext("2d"),viewport:Y}).promise,b.current)return;S(G=>({...G,[O]:q.toDataURL("image/jpeg",.92)}))}catch(B){console.warn("PDF page render:",B)}finally{g.current.delete(O)}}},[]);V.useEffect(()=>{if(!c||f===0)return;const P=new Set;for(const O of[m+1,m+2])for(let U=-w1;U<=w1;U++){const H=O+U;H>=1&&H<=f&&!_[H]&&P.add(H)}P.forEach(O=>k(c,O,n,r))},[c,m,f,n,r,k,_]);const N=V.useCallback(()=>{var P,O;return(O=(P=x.current)==null?void 0:P.pageFlip())==null?void 0:O.flipPrev("top")},[]),T=V.useCallback(()=>{var P,O;m<f-2&&((O=(P=x.current)==null?void 0:P.pageFlip())==null||O.flipNext("top"))},[m,f]),D=V.useCallback(P=>y(P.data),[]),I=V.useMemo(()=>Array.from({length:f},(P,O)=>O),[f]);if(E)return p.jsx(a3,{label:"Loading PDF…"});if(h)return p.jsx(c3,{message:h,downloadUrl:i?s:null});const L=m+1,R=Math.min(m+2,f);return p.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column"},children:[p.jsx(o3,{title:o,pageLabel:`${L}–${R} of ${f}`,canDownload:i,downloadUrl:s}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",paddingTop:12,gap:8},children:[p.jsx("button",{onClick:N,disabled:m===0,style:{...Ta,opacity:m===0?.2:1},"aria-label":"Previous",children:p.jsx(Ai,{size:20})}),p.jsx("div",{style:{width:n*2,height:r,overflow:"hidden",borderRadius:4,boxShadow:"0 8px 32px rgba(50,30,10,.15), 0 2px 8px rgba(50,30,10,.08)",flexShrink:0},children:p.jsx(s3,{ref:x,width:n,height:r,size:"fixed",minWidth:n,maxWidth:n,minHeight:r,maxHeight:r,maxShadowOpacity:.3,showCover:!1,mobileScrollSupport:!1,onFlip:D,flippingTime:r3,usePortrait:!1,startZIndex:10,autoSize:!1,clickEventForward:!1,useMouseEvents:!0,swipeDistance:30,showPageCorners:!0,style:{background:"transparent"},children:I.map(P=>p.jsx(d3,{dataUrl:_[P+1],pageNum:P+1,width:n,height:r},`pdf-${P}-${n}`))})}),p.jsx("button",{onClick:T,disabled:m>=f-2,style:{...Ta,opacity:m>=f-2?.2:1},"aria-label":"Next",children:p.jsx(In,{size:20})})]})]})}function JP(t){const[n,r]=V.useState({containerWidth:0,spreadWidth:0,pageWidth:0,pageHeight:0});return V.useEffect(()=>{if(!t.current)return;const i=()=>{const o=t.current;if(!o)return;const c=o.getBoundingClientRect().width,a=window.innerHeight-i3-VP-16,u=Math.max(300,Math.min(a,720)),m=Math.floor(u/x1),y=(y0+12)*2,_=Math.max(200,c-y),S=Math.floor(_/2),E=Math.round(S*x1);let d,h;E<=u?(d=S,h=E):(d=m,h=u),d=Math.max(150,d),h=Math.max(200,h),r({containerWidth:c,spreadWidth:d*2,pageWidth:d,pageHeight:h})},s=new ResizeObserver(i);return s.observe(t.current),window.addEventListener("resize",i),i(),()=>{s.disconnect(),window.removeEventListener("resize",i)}},[t]),n}async function eL(t,n){const r=await fetch(t,n);if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.arrayBuffer()}function tL({src:t,file:n,blobUrl:r,type:i,mimeType:s,title:o="Untitled",canDownload:l=!1,downloadUrl:c,totalPages:a,totalPagesHint:f,onFetch:u,fetchOptions:m,height:y="calc(100vh - 180px)",cacheKey:_,storage:S,hasFullAccess:E=null,visiblePages:d=null,subscribeMessage:h=null,onSubscribe:v}){const[x,g]=V.useState("idle"),[b,w]=V.useState(null),[k,N]=V.useState(null),T=V.useRef(null),D=V.useRef(null),I=i??YP(t??r??"",s),L=I==="pdf"?"application/pdf":"application/epub+zip";return V.useEffect(()=>{if(r){w(r),g("ready");return}if(n){T.current&&URL.revokeObjectURL(T.current);const O=URL.createObjectURL(n);T.current=O,w(O),g("ready");return}if(!t||D.current===t&&T.current)return;D.current=t,g("fetching"),N(null),T.current&&(URL.revokeObjectURL(T.current),T.current=null);let R=!1;return(u?()=>u(t):()=>eL(t,m))().then(O=>{if(R)return;const U=O instanceof Blob?O:new Blob([O],{type:L}),H=URL.createObjectURL(U);T.current=H,w(H),g("ready")}).catch(O=>{R||(console.error("BookViewer fetch error:",O),N((O==null?void 0:O.message)??"Failed to load file."),g("error"),D.current=null)}),()=>{R=!0}},[t,n,r,u,m,L]),V.useEffect(()=>()=>{T.current&&URL.revokeObjectURL(T.current)},[]),p.jsxs("div",{style:{width:"100%",height:y,minHeight:480,display:"flex",flexDirection:"column"},children:[(x==="idle"||x==="fetching")&&p.jsx(Bd,{label:"Downloading file…"}),x==="error"&&p.jsx(zd,{message:k,downloadUrl:l?c:null}),x==="ready"&&b&&p.jsx(n3,{type:I,blobUrl:b,cacheKey:_??t,storage:S,title:o,canDownload:l,downloadUrl:c,hasFullAccess:E,visiblePages:d,backendTotalPages:a??f??null,subscribeMessage:h,onSubscribe:v})]})}exports.Alert=dd;exports.AlertDescription=hd;exports.AlertDialog=$D;exports.AlertDialogAction=Xb;exports.AlertDialogCancel=Kb;exports.AlertDialogContent=Ub;exports.AlertDialogDescription=Zb;exports.AlertDialogFooter=Yb;exports.AlertDialogHeader=qb;exports.AlertDialogOverlay=md;exports.AlertDialogPortal=Wb;exports.AlertDialogTitle=Gb;exports.AlertDialogTrigger=VD;exports.AlertTitle=fd;exports.AlertWithIcon=Sb;exports.AuthLayout=CR;exports.Avatar=su;exports.AvatarFallback=au;exports.AvatarImage=ou;exports.Badge=Yi;exports.BookViewer=tL;exports.BreadcrumbProvider=Cy;exports.Button=Ke;exports.Calendar=ha;exports.Card=yn;exports.CardContent=xn;exports.CardDescription=is;exports.CardFooter=V1;exports.CardHeader=ns;exports.CardTitle=rs;exports.Checkbox=ss;exports.ConfirmModal=kd;exports.CreateEmptyState=ay;exports.CrudDetail=By;exports.CrudForm=Sy;exports.CrudList=dy;exports.DashboardLayout=HR;exports.DataTable=Ed;exports.DatePicker=_u;exports.DateRangePicker=Su;exports.DeleteConfirmModal=ms;exports.Dialog=Zp;exports.DialogClose=S9;exports.DialogContent=J0;exports.DialogDescription=nu;exports.DialogFooter=Qa;exports.DialogHeader=eu;exports.DialogOverlay=Q0;exports.DialogPortal=Xp;exports.DialogTitle=tu;exports.DialogTrigger=_9;exports.DocumentReader=n3;exports.DropdownMenu=_l;exports.DropdownMenuCheckboxItem=ob;exports.DropdownMenuContent=So;exports.DropdownMenuGroup=eD;exports.DropdownMenuItem=ds;exports.DropdownMenuLabel=kl;exports.DropdownMenuPortal=tD;exports.DropdownMenuRadioGroup=rD;exports.DropdownMenuRadioItem=ab;exports.DropdownMenuSeparator=fs;exports.DropdownMenuShortcut=lb;exports.DropdownMenuSub=nD;exports.DropdownMenuSubContent=sb;exports.DropdownMenuSubTrigger=ib;exports.DropdownMenuTrigger=Sl;exports.EmptyState=Ss;exports.EpubViewer=KP;exports.ErrorState=ly;exports.FormField=mi;exports.FormModal=cy;exports.Header=Ry;exports.HeaderSlotProvider=Iy;exports.Input=ni;exports.Label=br;exports.Loading=Ml;exports.LoadingButton=oy;exports.LoadingOverlay=_d;exports.LoginPage=_R;exports.Modal=Al;exports.Pagination=Cd;exports.PdfViewer=QP;exports.Popover=du;exports.PopoverContent=ll;exports.PopoverTrigger=fu;exports.QCheckbox=ty;exports.QDatePicker=ry;exports.QDateRangePicker=iy;exports.QForm=ny;exports.QInput=_a;exports.QRichTextEditor=sy;exports.QSearchSelect=ey;exports.QSelect=xd;exports.QSwitch=wd;exports.QTabs=wg;exports.QTextarea=yd;exports.RichTextEditor=Xu;exports.ScrollArea=Cb;exports.ScrollBar=ud;exports.SearchEmptyState=Sd;exports.SearchSelect=bd;exports.Select=$0;exports.SelectContent=qa;exports.SelectGroup=r9;exports.SelectItem=Ya;exports.SelectLabel=Np;exports.SelectScrollDownButton=U0;exports.SelectScrollUpButton=W0;exports.SelectSeparator=Mp;exports.SelectTrigger=Ua;exports.SelectValue=V0;exports.Separator=Js;exports.Sidebar=Dy;exports.SidebarProvider=Ey;exports.Skeleton=Ps;exports.Switch=D0;exports.Table=pd;exports.TableBody=vd;exports.TableCaption=Jb;exports.TableCell=Gn;exports.TableFooter=Qb;exports.TableHead=Zi;exports.TableHeader=gd;exports.TableRow=Gi;exports.Tabs=nC;exports.TabsContent=xg;exports.TabsList=bg;exports.TabsTrigger=yg;exports.Textarea=k0;exports.TimeStampFormat=T5;exports.ToastContainer=Py;exports.Tooltip=sl;exports.TooltipContent=uo;exports.TooltipProvider=cu;exports.TooltipTrigger=ol;exports.alertVariants=_b;exports.badgeVariants=W1;exports.buildQueryString=B5;exports.buttonVariants=ts;exports.capitalize=A5;exports.cn=Q;exports.commonjsGlobal=At;exports.commonjsRequire=cv;exports.createCrudStore=zy;exports.createStore=WR;exports.debounce=P1;exports.deepClone=R5;exports.formatCurrency=E5;exports.formatDate=_0;exports.formatDateTime=Yo;exports.formatRelativeTime=N5;exports.generateId=I5;exports.getDefaultExportFromCjs=Di;exports.getInitials=L5;exports.isEmpty=P5;exports.parseQueryString=O5;exports.slugify=D5;exports.truncate=M5;exports.useBookDimensions=JP;exports.useBreadcrumb=Pl;exports.useDocumentReader=Wy;exports.useHeaderSlot=Oy;exports.useSidebarContext=Rd;exports.useToast=Dl;
|
|
772
|
-
//# sourceMappingURL=index-
|
|
771
|
+
`,u3=V.memo(V.forwardRef(({dataUrl:t,pageNum:n,width:r,height:i},s)=>p.jsx("div",{ref:s,style:{width:r,height:i,background:"#fefdf8",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative",flexShrink:0},children:t?p.jsx("img",{src:t,alt:`Page ${n}`,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block"}}):p.jsx(l3,{})})));u3.displayName="EpubPage";function JP({blobUrl:t,pageWidth:n,pageHeight:r,canDownload:i,downloadUrl:s,title:o}){const[l,c]=V.useState(0),[a,f]=V.useState({}),[u,m]=V.useState(!0),[y,_]=V.useState(!1),[S,E]=V.useState(0),[d,h]=V.useState(null),[v,x]=V.useState(0),g=V.useRef(null),b=V.useRef(!1);V.useEffect(()=>{if(!t||n<10||r<10)return;b.current=!1,m(!0),h(null),c(0),f({}),E(0),_(!1),x(0);let I=null;return(async()=>{var R,P,O,U;try{const{default:H}=await Promise.resolve().then(()=>require("./index-uKpclwqW.cjs"));I=H(t,{openAs:"epub"}),await I.ready;const B=[];if(I.spine.each(ee=>B.push(ee)),B.length===0){h("No readable sections found in EPUB."),m(!1);return}const j=document.createElement("div");Object.assign(j.style,{position:"fixed",top:"-9999px",left:"-9999px",width:`${n}px`,height:`${r}px`,overflow:"hidden",pointerEvents:"none",zIndex:-1}),document.body.appendChild(j);const F=I.renderTo(j,{width:n,height:r,spread:"none",flow:"scrolled",manager:"default"});F.hooks.content.register(ee=>{ee.addStylesheet(QP)});const Y=()=>new Promise(ee=>{let te=!1;const se=()=>{te||(te=!0,clearTimeout(ie),ee())},ie=setTimeout(se,3e3);F.once("rendered",se),F.once("relocated",se)}),q=r-x0*2,G=[];for(let ee=0;ee<B.length&&!(b.current||G.length>=Dc);ee++){const te=Y();try{await F.display(B[ee].href)}catch{G.push({si:ee,sy:0});continue}await te,await new Promise(be=>setTimeout(be,80));const se=j.querySelector("iframe"),ie=(R=se==null?void 0:se.contentDocument)==null?void 0:R.body,ae=Math.max(r,(ie==null?void 0:ie.scrollHeight)??r,((O=(P=se==null?void 0:se.contentDocument)==null?void 0:P.documentElement)==null?void 0:O.scrollHeight)??0);YP(ie,q,ae,Dc-G.length).forEach(be=>G.push({si:ee,sy:be}))}if(b.current){document.body.removeChild(j);return}const $=Math.min(G.length,Dc);if($===0){h("Could not capture EPUB pages."),m(!1),document.body.removeChild(j);return}c($),m(!1),_(!0);let Z=-1;for(let ee=0;ee<$&&!b.current;ee++){const{si:te,sy:se}=G[ee];if(te!==Z){const ce=Y();await F.display(B[te].href),await ce,await new Promise(pe=>setTimeout(pe,150)),Z=te}const ie=G[ee+1],ae=ie&&ie.si===te?Math.min(ie.sy-se,q):q,de=j.querySelector("iframe");(U=de==null?void 0:de.contentWindow)==null||U.scrollTo(0,se),await new Promise(ce=>setTimeout(ce,40));const be=await GP(j,n,r,se,ae);f(ce=>({...ce,[ee]:be})),E(Math.min(99,Math.round((ee+1)/$*100)))}document.body.removeChild(j);try{F.destroy()}catch{}b.current||E(100)}catch(H){b.current||(console.error("EPUB render error:",H),h("Failed to render EPUB pages."),m(!1))}finally{if(_(!1),I)try{I.destroy()}catch{}}})(),()=>{b.current=!0}},[t,n,r]);const w=V.useCallback(()=>{var I,L;return(L=(I=g.current)==null?void 0:I.pageFlip())==null?void 0:L.flipPrev("top")},[]),k=V.useCallback(()=>{var I,L;v<l-2&&((L=(I=g.current)==null?void 0:I.pageFlip())==null||L.flipNext("top"))},[v,l]),N=V.useCallback(I=>x(I.data),[]);if(V.useEffect(()=>{const I=L=>{L.key==="ArrowRight"&&k(),L.key==="ArrowLeft"&&w()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[k,w]),u)return p.jsx(a3,{label:"Opening book…"});if(d)return p.jsx(c3,{message:d,downloadUrl:i?s:null});const T=v+1,D=Math.min(v+2,l);return p.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column"},children:[p.jsx(o3,{title:o,pageLabel:`${T}–${D} of ${l}`,canDownload:i,downloadUrl:s,isCapturing:y,captureProgress:S}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",paddingTop:12,gap:8},children:[p.jsx("button",{onClick:w,disabled:v===0,style:{...Ta,opacity:v===0?.2:1},"aria-label":"Previous",children:p.jsx(Ai,{size:20})}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6},children:[p.jsx("div",{style:{width:n*2,height:r,overflow:"hidden",borderRadius:4,boxShadow:"0 8px 32px rgba(50,30,10,.15), 0 2px 8px rgba(50,30,10,.08)",flexShrink:0},children:p.jsx(s3,{ref:g,width:n,height:r,size:"fixed",minWidth:n,maxWidth:n,minHeight:r,maxHeight:r,maxShadowOpacity:.3,showCover:!1,mobileScrollSupport:!1,onFlip:N,flippingTime:r3,usePortrait:!1,startZIndex:10,autoSize:!1,clickEventForward:!1,useMouseEvents:!0,swipeDistance:30,showPageCorners:!0,style:{background:"transparent"},children:Array.from({length:l},(I,L)=>p.jsx(u3,{dataUrl:a[L]??null,pageNum:L+1,width:n,height:r},`epub-${L}`))})}),y&&p.jsx("div",{style:{width:n*2,height:3,background:"#f1ece3",borderRadius:2,overflow:"hidden"},children:p.jsx("div",{style:{width:`${S}%`,height:"100%",background:"#8b5e3c",borderRadius:2,transition:"width .4s"}})})]}),p.jsx("button",{onClick:k,disabled:v>=l-2,style:{...Ta,opacity:v>=l-2?.2:1},"aria-label":"Next",children:p.jsx(In,{size:20})})]})]})}const d3=V.forwardRef(({dataUrl:t,pageNum:n,width:r,height:i},s)=>p.jsx("div",{ref:s,style:{width:r,height:i,background:"#fefdf8",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative",flexShrink:0},children:t?p.jsx("img",{src:t,alt:`Page ${n}`,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block"}}):p.jsx(l3,{})}));d3.displayName="PdfPage";function eL({blobUrl:t,pageWidth:n,pageHeight:r,canDownload:i,downloadUrl:s,title:o,totalPagesHint:l}){const[c,a]=V.useState(null),[f,u]=V.useState(l||0),[m,y]=V.useState(0),[_,S]=V.useState({}),[E,d]=V.useState(!0),[h,v]=V.useState(null),x=V.useRef(null),g=V.useRef(new Set),b=V.useRef(!1),w=V.useCallback(async P=>{try{const O=await import("https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.0.379/pdf.min.mjs");O.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.0.379/pdf.worker.min.mjs";const U=await O.getDocument({url:P,withCredentials:!1}).promise;if(b.current)return;a({doc:U,pdfjs:O}),u(U.numPages),d(!1)}catch(O){console.error("PDF load:",O),b.current||v("Failed to load PDF.")}},[]);V.useEffect(()=>(b.current=!1,d(!0),v(null),S({}),y(0),w(t),()=>{b.current=!0}),[t,w]);const k=V.useCallback(async(P,O,U,H)=>{if(!(!P||g.current.has(O))){g.current.add(O);try{const B=await P.doc.getPage(O),j=B.getViewport({scale:1}),F=Math.min(U/j.width,H/j.height),Y=B.getViewport({scale:F}),q=document.createElement("canvas");if(q.width=Y.width,q.height=Y.height,await B.render({canvasContext:q.getContext("2d"),viewport:Y}).promise,b.current)return;S(G=>({...G,[O]:q.toDataURL("image/jpeg",.92)}))}catch(B){console.warn("PDF page render:",B)}finally{g.current.delete(O)}}},[]);V.useEffect(()=>{if(!c||f===0)return;const P=new Set;for(const O of[m+1,m+2])for(let U=-w1;U<=w1;U++){const H=O+U;H>=1&&H<=f&&!_[H]&&P.add(H)}P.forEach(O=>k(c,O,n,r))},[c,m,f,n,r,k,_]);const N=V.useCallback(()=>{var P,O;return(O=(P=x.current)==null?void 0:P.pageFlip())==null?void 0:O.flipPrev("top")},[]),T=V.useCallback(()=>{var P,O;m<f-2&&((O=(P=x.current)==null?void 0:P.pageFlip())==null||O.flipNext("top"))},[m,f]),D=V.useCallback(P=>y(P.data),[]),I=V.useMemo(()=>Array.from({length:f},(P,O)=>O),[f]);if(E)return p.jsx(a3,{label:"Loading PDF…"});if(h)return p.jsx(c3,{message:h,downloadUrl:i?s:null});const L=m+1,R=Math.min(m+2,f);return p.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column"},children:[p.jsx(o3,{title:o,pageLabel:`${L}–${R} of ${f}`,canDownload:i,downloadUrl:s}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",paddingTop:12,gap:8},children:[p.jsx("button",{onClick:N,disabled:m===0,style:{...Ta,opacity:m===0?.2:1},"aria-label":"Previous",children:p.jsx(Ai,{size:20})}),p.jsx("div",{style:{width:n*2,height:r,overflow:"hidden",borderRadius:4,boxShadow:"0 8px 32px rgba(50,30,10,.15), 0 2px 8px rgba(50,30,10,.08)",flexShrink:0},children:p.jsx(s3,{ref:x,width:n,height:r,size:"fixed",minWidth:n,maxWidth:n,minHeight:r,maxHeight:r,maxShadowOpacity:.3,showCover:!1,mobileScrollSupport:!1,onFlip:D,flippingTime:r3,usePortrait:!1,startZIndex:10,autoSize:!1,clickEventForward:!1,useMouseEvents:!0,swipeDistance:30,showPageCorners:!0,style:{background:"transparent"},children:I.map(P=>p.jsx(d3,{dataUrl:_[P+1],pageNum:P+1,width:n,height:r},`pdf-${P}-${n}`))})}),p.jsx("button",{onClick:T,disabled:m>=f-2,style:{...Ta,opacity:m>=f-2?.2:1},"aria-label":"Next",children:p.jsx(In,{size:20})})]})]})}function tL(t){const[n,r]=V.useState({containerWidth:0,spreadWidth:0,pageWidth:0,pageHeight:0});return V.useEffect(()=>{if(!t.current)return;const i=()=>{const o=t.current;if(!o)return;const c=o.getBoundingClientRect().width,a=window.innerHeight-i3-UP-16,u=Math.max(300,Math.min(a,720)),m=Math.floor(u/x1),y=(y0+12)*2,_=Math.max(200,c-y),S=Math.floor(_/2),E=Math.round(S*x1);let d,h;E<=u?(d=S,h=E):(d=m,h=u),d=Math.max(150,d),h=Math.max(200,h),r({containerWidth:c,spreadWidth:d*2,pageWidth:d,pageHeight:h})},s=new ResizeObserver(i);return s.observe(t.current),window.addEventListener("resize",i),i(),()=>{s.disconnect(),window.removeEventListener("resize",i)}},[t]),n}async function nL(t,n){const r=await fetch(t,n);if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.arrayBuffer()}function rL({src:t,file:n,blobUrl:r,type:i,mimeType:s,title:o="Untitled",canDownload:l=!1,downloadUrl:c,totalPages:a,totalPagesHint:f,onFetch:u,fetchOptions:m,height:y="calc(100vh - 180px)",cacheKey:_,storage:S,hasFullAccess:E=null,visiblePages:d=null,subscribeMessage:h=null,onSubscribe:v}){const[x,g]=V.useState("idle"),[b,w]=V.useState(null),[k,N]=V.useState(null),T=V.useRef(null),D=V.useRef(null),I=i??ZP(t??r??"",s),L=I==="pdf"?"application/pdf":"application/epub+zip";return V.useEffect(()=>{if(r){w(r),g("ready");return}if(n){T.current&&URL.revokeObjectURL(T.current);const O=URL.createObjectURL(n);T.current=O,w(O),g("ready");return}if(!t||D.current===t&&T.current)return;D.current=t,g("fetching"),N(null),T.current&&(URL.revokeObjectURL(T.current),T.current=null);let R=!1;return(u?()=>u(t):()=>nL(t,m))().then(O=>{if(R)return;const U=O instanceof Blob?O:new Blob([O],{type:L}),H=URL.createObjectURL(U);T.current=H,w(H),g("ready")}).catch(O=>{R||(console.error("BookViewer fetch error:",O),N((O==null?void 0:O.message)??"Failed to load file."),g("error"),D.current=null)}),()=>{R=!0}},[t,n,r,u,m,L]),V.useEffect(()=>()=>{T.current&&URL.revokeObjectURL(T.current)},[]),p.jsxs("div",{style:{width:"100%",height:y,minHeight:480,display:"flex",flexDirection:"column"},children:[(x==="idle"||x==="fetching")&&p.jsx(Bd,{label:"Downloading file…"}),x==="error"&&p.jsx(zd,{message:k,downloadUrl:l?c:null}),x==="ready"&&b&&p.jsx(n3,{type:I,blobUrl:b,cacheKey:_??t,storage:S,title:o,canDownload:l,downloadUrl:c,hasFullAccess:E,visiblePages:d,backendTotalPages:a??f??null,subscribeMessage:h,onSubscribe:v})]})}exports.Alert=dd;exports.AlertDescription=hd;exports.AlertDialog=$D;exports.AlertDialogAction=Xb;exports.AlertDialogCancel=Kb;exports.AlertDialogContent=Ub;exports.AlertDialogDescription=Zb;exports.AlertDialogFooter=Yb;exports.AlertDialogHeader=qb;exports.AlertDialogOverlay=md;exports.AlertDialogPortal=Wb;exports.AlertDialogTitle=Gb;exports.AlertDialogTrigger=VD;exports.AlertTitle=fd;exports.AlertWithIcon=Sb;exports.AuthLayout=SR;exports.Avatar=su;exports.AvatarFallback=au;exports.AvatarImage=ou;exports.Badge=Yi;exports.BookViewer=rL;exports.BreadcrumbProvider=Cy;exports.Button=Ke;exports.Calendar=ha;exports.Card=yn;exports.CardContent=xn;exports.CardDescription=is;exports.CardFooter=V1;exports.CardHeader=ns;exports.CardTitle=rs;exports.Checkbox=ss;exports.ConfirmModal=kd;exports.CreateEmptyState=ay;exports.CrudDetail=By;exports.CrudForm=Sy;exports.CrudList=dy;exports.DashboardLayout=VR;exports.DataTable=Ed;exports.DatePicker=_u;exports.DateRangePicker=Su;exports.DeleteConfirmModal=ms;exports.Dialog=Zp;exports.DialogClose=S9;exports.DialogContent=J0;exports.DialogDescription=nu;exports.DialogFooter=Qa;exports.DialogHeader=eu;exports.DialogOverlay=Q0;exports.DialogPortal=Xp;exports.DialogTitle=tu;exports.DialogTrigger=_9;exports.DocumentReader=n3;exports.DropdownMenu=_l;exports.DropdownMenuCheckboxItem=ob;exports.DropdownMenuContent=So;exports.DropdownMenuGroup=eD;exports.DropdownMenuItem=ds;exports.DropdownMenuLabel=kl;exports.DropdownMenuPortal=tD;exports.DropdownMenuRadioGroup=rD;exports.DropdownMenuRadioItem=ab;exports.DropdownMenuSeparator=fs;exports.DropdownMenuShortcut=lb;exports.DropdownMenuSub=nD;exports.DropdownMenuSubContent=sb;exports.DropdownMenuSubTrigger=ib;exports.DropdownMenuTrigger=Sl;exports.EmptyState=Ss;exports.EpubViewer=JP;exports.ErrorState=ly;exports.FormField=mi;exports.FormModal=cy;exports.Header=Ry;exports.HeaderSlotProvider=Iy;exports.Input=ni;exports.Label=br;exports.Loading=Ml;exports.LoadingButton=oy;exports.LoadingOverlay=_d;exports.LoginPage=kR;exports.Modal=Al;exports.Pagination=Cd;exports.PdfViewer=eL;exports.Popover=du;exports.PopoverContent=ll;exports.PopoverTrigger=fu;exports.QCheckbox=ty;exports.QDatePicker=ry;exports.QDateRangePicker=iy;exports.QForm=ny;exports.QInput=_a;exports.QRichTextEditor=sy;exports.QSearchSelect=ey;exports.QSelect=xd;exports.QSwitch=wd;exports.QTabs=wg;exports.QTextarea=yd;exports.RichTextEditor=Xu;exports.ScrollArea=Cb;exports.ScrollBar=ud;exports.SearchEmptyState=Sd;exports.SearchSelect=bd;exports.Select=$0;exports.SelectContent=qa;exports.SelectGroup=r9;exports.SelectItem=Ya;exports.SelectLabel=Np;exports.SelectScrollDownButton=U0;exports.SelectScrollUpButton=W0;exports.SelectSeparator=Mp;exports.SelectTrigger=Ua;exports.SelectValue=V0;exports.Separator=Js;exports.Sidebar=Dy;exports.SidebarProvider=Ey;exports.Skeleton=Ps;exports.Switch=D0;exports.Table=pd;exports.TableBody=vd;exports.TableCaption=Jb;exports.TableCell=Gn;exports.TableFooter=Qb;exports.TableHead=Zi;exports.TableHeader=gd;exports.TableRow=Gi;exports.Tabs=nC;exports.TabsContent=xg;exports.TabsList=bg;exports.TabsTrigger=yg;exports.Textarea=k0;exports.TimeStampFormat=T5;exports.ToastContainer=Py;exports.Tooltip=sl;exports.TooltipContent=uo;exports.TooltipProvider=cu;exports.TooltipTrigger=ol;exports.alertVariants=_b;exports.badgeVariants=W1;exports.buildQueryString=B5;exports.buttonVariants=ts;exports.capitalize=A5;exports.cn=Q;exports.commonjsGlobal=At;exports.commonjsRequire=cv;exports.createCrudStore=zy;exports.createStore=qR;exports.debounce=P1;exports.deepClone=R5;exports.formatCurrency=E5;exports.formatDate=_0;exports.formatDateTime=Yo;exports.formatRelativeTime=N5;exports.generateId=I5;exports.getDefaultExportFromCjs=Di;exports.getInitials=L5;exports.isEmpty=P5;exports.parseQueryString=O5;exports.slugify=D5;exports.truncate=M5;exports.useBookDimensions=tL;exports.useBreadcrumb=Pl;exports.useDocumentReader=Wy;exports.useHeaderSlot=Oy;exports.useSidebarContext=Rd;exports.useToast=Dl;
|
|
772
|
+
//# sourceMappingURL=index-CYvgvnp2.cjs.map
|