@wazobiatech/wazui 1.0.28 → 1.0.29
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/{PictureBlot-B-um6LWG.js → PictureBlot-CX-e979g.js} +2 -2
- package/dist/{PictureBlot-B-um6LWG.js.map → PictureBlot-CX-e979g.js.map} +1 -1
- package/dist/{PictureBlot-BRQyAryr.cjs → PictureBlot-DyTkCWww.cjs} +2 -2
- package/dist/{PictureBlot-BRQyAryr.cjs.map → PictureBlot-DyTkCWww.cjs.map} +1 -1
- package/dist/components/wazui/BlogPostsComponent/columns.d.ts.map +1 -1
- package/dist/components/wazui/WazUiPostCard/WazUiPostCard.d.ts.map +1 -1
- package/dist/{index-CPaCRsdW.js → index-D_rNa2hx.js} +18 -18
- package/dist/index-D_rNa2hx.js.map +4 -0
- package/dist/{index-BUTSH4-8.cjs → index-g3cHKL0U.cjs} +5 -5
- package/dist/index-g3cHKL0U.cjs.map +4 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{quill-CHSiUZ4y.cjs → quill-B8jLsVN2.cjs} +2 -2
- package/dist/{quill-CHSiUZ4y.cjs.map → quill-B8jLsVN2.cjs.map} +1 -1
- package/dist/{quill-CHOTIP6r.js → quill-BwREFauP.js} +2 -2
- package/dist/{quill-CHOTIP6r.js.map → quill-BwREFauP.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BUTSH4-8.cjs.map +0 -4
- package/dist/index-CPaCRsdW.js.map +0 -4
|
@@ -439,7 +439,7 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var U=W(R,_,J,K,nA+"."+_
|
|
|
439
439
|
*/var AP;function ftA(){return AP||(AP=1,(function(A){(function(){var e={}.hasOwnProperty;function t(){for(var s="",a=0;a<arguments.length;a++){var o=arguments[a];o&&(s=r(s,n(o)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return t.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var a="";for(var o in s)e.call(s,o)&&s[o]&&(a=r(a,o));return a}function r(s,a){return a?s?s+" "+a:s+a:s}A.exports?(t.default=t,A.exports=t):window.classNames=t})()})(Qm)),Qm.exports}var dtA=ftA();const QA=Zc(dtA);function gtA(A,e){var t=u4({},e);return{stencilSize:function(n,r){var s=Pe(A.stencilSize)?A.stencilSize(n,r):A.stencilSize;return qn(aA(aA({},s),{aspectRatio:ieA(t.aspectRatio,co(_A(s)))}))}}}function O0(A,e){var t=A.boundary,n=Pe(e.stencilSize)?e.stencilSize(A,e):e.stencilSize;return(n.width>t.width||n.height>t.height)&&(n=qn({sizeRestrictions:{maxWidth:t.width,maxHeight:t.height,minWidth:0,minHeight:0},width:n.width,height:n.height,aspectRatio:{minimum:_A(n),maximum:_A(n)}})),n}function vtA(A,e){var t=O0(A,aA(aA({},e),{stencilSize:e.stencilSize})),n=Kn(A,e);return{maxWidth:n.maxWidth*t.width/A.boundary.width,maxHeight:n.maxHeight*t.height/A.boundary.height,minWidth:0,minHeight:0}}function mtA(A,e){var t=A.imageSize,n=A.visibleArea,r=A.boundary,s=Un(A,e),a=pa(A,e),o=Pe(e.stencilSize)?e.stencilSize(A,e):e.stencilSize,i=n||t,c,u;return _A(i)>_A(r)?(c=o.height*i.height/r.height,u=c*_A(o)):(u=o.width*i.width/r.width,c=u/_A(o)),qn({width:u,height:c,aspectRatio:a,sizeRestrictions:s})}function ptA(A,e){var t=_A(O0(A,e));return{minimum:t,maximum:t}}function htA(A,e){if(Bn(A)){var t=Vt(A),n=O0(A,e);t.visibleArea=hr(t.visibleArea,t.coordinates.width*t.boundary.width/(t.visibleArea.width*n.width));var r=B0(t.visibleArea,Kn(t,e));return r!==1&&(t.visibleArea=hr(t.visibleArea,r),t.coordinates=hr(t.coordinates,r)),t.visibleArea=Pt(t.visibleArea,Ln(He(t.coordinates),He(t.visibleArea))),t.visibleArea=qe(t.visibleArea,Jn(t,e)),t.coordinates=qe(t.coordinates,ma(cn(t.visibleArea),Jn(t,e))),t}return A}function wtA(A,e,t){return t&&t.immediately?htA(A,e):A}function ytA(A,e){if(Bn(A)){var t=Vt(A),n={width:0,height:0};_A(t.boundary)>_A(t.coordinates)?(n.height=t.boundary.height*.8,n.width=n.height*_A(t.coordinates)):(n.width=t.boundary.width*.8,n.height=n.width*_A(t.coordinates)),t.visibleArea=hr(t.visibleArea,t.coordinates.width*t.boundary.width/(t.visibleArea.width*n.width));var r=B0(t.visibleArea,Kn(t,e));return t.visibleArea=hr(t.visibleArea,r),r!==1&&(n.height/=r,n.width/=r),t.visibleArea=Pt(t.visibleArea,Ln(He(t.coordinates),He(t.visibleArea))),t.visibleArea=qe(t.visibleArea,Jn(t,e)),t.coordinates=qe(t.coordinates,ma(cn(t.visibleArea),un(t,e))),t}return A}function PtA(A,e,t){return t.immediately?ytA(A,e):A}function btA(A){process.env.NODE_ENV==="development"&&console.warn("Deprecation warning: ".concat(A))}function xtA(){var A=P.useRef([]);return function(e){A.current.indexOf(e)===-1&&(btA(e),A.current.push(e))}}function ztA(A){return P.forwardRef(A)}function DtA(){var A=P.useRef(!0);return A.current?(A.current=!1,!0):A.current}var Ql=function(A,e){var t=DtA();P.useEffect(function(){if(!t)return A()},e)};function d4(A){var e=Ne(P.useState(A),2),t=e[0],n=e[1],r=Ne(P.useState(null),2),s=r[0],a=r[1],o=P.useRef(A);return Ql(function(){s&&s(t,o.current)},[s]),[t,function(i,c){o.current=t,n(i),a(function(){return c})}]}var BtA=(function(A){jr(e,A);function e(t,n){var r=A.call(this)||this;return r.props=t,r.notify=n,r.data={state:null,transitions:!1,interactions:NeA()},r}return e.prototype.getProps=function(){return this.props()},e.prototype.setData=function(t){this.data=t,this.notify()},e.prototype.getData=function(){return this.data},e})(JeA);function g4(){var A=Ne(P.useState({}),2);A[0];var e=A[1];return function(){e({})}}function MtA(A){var e=P.useRef(A);return e.current=A,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.current.apply(e,Pr([],Ne(t),!1))}}function CtA(A){var e=g4(),t=MtA(function(){var r=A(),s=r.settings,a=na(r,["settings"]),o=aA({imageRestriction:ao.fitArea,transformImage:{adjustStencil:!0}},s),i=aA({transitions:!0},a);return aA({settings:aA(aA({},o),LeA(o))},i)}),n=P.useRef(new BtA(t,e));return n.current}function jtA(A){var e=A.src,t=A.onLoadingStart,n=A.onLoadingEnd,r=A.onError,s=A.onLoad,a=A.crossOrigin,o=A.checkOrientation,i=A.canvas,c=A.unloadTime,u=Ne(P.useState(null),2),f=u[0],d=u[1],g=Ne(P.useState(!1),2),v=g[0],m=g[1],p=Ne(d4(!1),2),h=p[0],w=p[1],b=P.useRef(null);return P.useEffect(function(){if(b.current!==e)if(b.current=e||null,w(!1),e){m(!0),t==null||t();var x=[ltA(e,{crossOrigin:At(a)?i:a,checkOrientation:o})];h&&c&&x.push(Qy(c)),Promise.all(x).then(function(z){var D=Ne(z,1),B=D[0];b.current===e&&d(B)}).catch(function(){b.current===e&&(r==null||r())}).finally(function(){b.current===e&&(n==null||n(),m(!1))})}else c?Qy(c).then(function(){b.current===e&&d(null)}):d(null)},[e,f]),P.useEffect(function(){f&&w(!0,function(){s==null||s(f)})},[f]),{isLoading:function(){return v},isLoaded:function(){return h},getImage:function(){return f},setImage:d}}var v4=function(A){var e=P.useRef(A),t=function(){e.current&&e.current()};P.useEffect(function(){e.current=A},[A]),P.useEffect(function(){return window.addEventListener("resize",t),window.addEventListener("orientationchange",t),function(){window.removeEventListener("resize",t),window.removeEventListener("orientationchange",t)}},[])};function OtA(A,e){e===void 0&&(e=!0);var t=Ne(P.useState(e),2),n=t[0],r=t[1];return P.useLayoutEffect(function(){n&&!A.hasInteractions()&&A.reconcileState()}),{pause:function(){r(!1)},resume:function(){r(!0)}}}function TtA(A){var e=this,t=A(),n=t.src,r=t.onReady,s=t.onError,a=t.onUpdate,o=t.canvas,i=o===void 0?!0:o,c=t.unloadTime,u=c===void 0?500:c,f=t.crossOrigin,d=f===void 0?!0:f,g=t.checkOrientation,v=g===void 0?!0:g,m=t.autoReconcileState,p=m===void 0?!0:m,h=P.useRef(null),w=P.useRef(null),b=P.useRef(null),x=P.useRef(null),z=Ne(d4(null),2),D=z[0],B=z[1],M=CtA(function(){return aA(aA({},A()),{getInstance:function(){return x.current}})}),I=jtA({src:n,crossOrigin:d,checkOrientation:v,unloadTime:u,canvas:i,onError:function(){x.current&&(s==null||s(x.current))}}),X=OtA(M,p),V=function(){return bp(e,void 0,void 0,function(){var Z,C,Q;return Ff(this,function(Y){switch(Y.label){case 0:return w.current?(X.pause(),Z=I.getImage(),[4,(Q=w.current)===null||Q===void 0?void 0:Q.stretchTo(Z)]):[3,2];case 1:C=Y.sent(),B(Z,function(){C&&Z?M.reset(C,Z):M.clear()}),X.resume(),Y.label=2;case 2:return[2]}})})},E=function(){return bp(e,void 0,void 0,function(){var Z,C,Q,Y;return Ff(this,function(T){switch(T.label){case 0:return w.current?(X.pause(),Z=I.getImage(),[4,(Y=w.current)===null||Y===void 0?void 0:Y.stretchTo(Z)]):[3,2];case 1:C=T.sent(),C&&Z?(Q=M.getState(),Q?(C.width!==Q.boundary.width||C.height!==Q.boundary.height)&&(M.setBoundary(C),M.reconcileState()):M.reset(C,Z)):M.clear(),X.resume(),T.label=2;case 2:return[2]}})})},k={reset:function(){return V()},refresh:function(){return E()},setImage:function(Z){return B(Z)},reconcileState:M.reconcileState,moveCoordinates:M.moveCoordinates,moveCoordinatesEnd:M.moveCoordinatesEnd,resizeCoordinates:M.resizeCoordinates,clear:M.clear,resizeCoordinatesEnd:M.resizeCoordinatesEnd,moveImage:M.moveImage,flipImage:M.flipImage,zoomImage:M.zoomImage,rotateImage:M.rotateImage,transformImage:M.transformImage,transformImageEnd:M.transformImageEnd,setCoordinates:M.setCoordinates,setVisibleArea:M.setVisibleArea,startTransitions:M.startTransitions,setState:M.setState,hasInteractions:M.hasInteractions,getStencilCoordinates:M.getStencilCoordinates,getCoordinates:M.getCoordinates,getVisibleArea:M.getVisibleArea,getTransforms:M.getTransforms,getTransitions:M.getTransitions,getInteractions:M.getInteractions,getSettings:M.getSettings,getState:M.getState,getDefaultState:function(){var Z=M.getState(),C=I.getImage();return Z&&C?M.createDefaultState(Z.boundary,C):null},getCanvas:function(Z){var C=M.getState();return h.current&&b.current&&C?b.current.draw(C,h.current,Z):null},getImage:function(){return D?aA({},D):null},isLoading:I.isLoading,isLoaded:I.isLoaded};return v4(function(){E()}),Ql(function(){V()},[I.getImage()]),Ql(function(){x.current&&D&&(r==null||r(x.current))},[D]),Ql(function(){x.current&&(a==null||a(x.current))},[I.isLoaded(),I.isLoading()]),P.useImperativeHandle(x,function(){return k}),{cropper:k,refs:{image:h,boundary:w,canvas:b},image:D}}var T0=P.forwardRef(function(A,e){var t=A.className,n=A.style,r=A.stretcherClassName,s=A.contentClassName,a=A.stretchAlgorithm,o=a===void 0?KeA:a,i=A.sizeAlgorithm,c=i===void 0?IeA:i,u=A.children,f=P.useRef(null),d=P.useRef(null);return P.useImperativeHandle(e,function(){return{reset:function(){var g=f.current;g&&(g.style.height="",g.style.width="")},stretchTo:function(g){var v=f.current,m=d.current;if(g!=null&&g.width&&(g!=null&&g.height)&&v&&m){o(m,v,g);var p=c(m,g);return Promise.resolve(p.width&&p.height?p:null)}else return v&&(v.style.height="",v.style.width=""),Promise.resolve(null)}}}),P.createElement("div",{ref:d,style:n,className:QA("advanced-cropper-boundary",t)},P.createElement("div",{ref:f,className:QA(["advanced-cropper-boundary__stretcher",r])}),P.createElement("div",{className:QA(["advanced-cropper-boundary__content",s])},u))});T0.displayName="StretchableBoundary";var m4=function(A){var e=A.visible,t=A.className,n=A.style,r=A.children;return P.createElement("div",{style:n,className:QA(t,"advanced-cropper-fade",!!e&&"advanced-cropper-fade--visible")},r)},EtA=function(A){var e=A.cropper,t=A.children,n=A.className,r=A.style,s=e?e.getState():null,a=e?e.isLoaded():!1;return P.createElement("div",{className:QA(n,"advanced-cropper-wrapper"),style:r},P.createElement(m4,{visible:s&&a,className:"advanced-cropper-wrapper__fade"},t))};function p4(A){A.preventDefault()}var h4=P.forwardRef(function(A,e){var t=A.className,n=A.style,r=A.cropper,s=A.crossOrigin,a=s===void 0?!0:s,o=r.getState(),i=r.getTransitions(),c=r.getImage(),u=c&&o?ctA(c,o,i):{},f=c?c.src:void 0;return f?P.createElement("img",{key:f,ref:e,className:QA("advanced-cropper-background-image",t),src:f,crossOrigin:a===!0?"anonymous":a||void 0,style:aA(aA({},u),n),onMouseDown:p4}):null});h4.displayName="CropperBackgroundImage";var w4=P.forwardRef(function(A,e){var t=P.useRef(null),n=P.useRef(null);return P.useImperativeHandle(e,function(){return{draw:function(r,s,a){return a===void 0&&(a={}),s&&t.current&&n.current?FeA(r,s,t.current,n.current,a):null}}}),P.createElement(P.Fragment,null,P.createElement("canvas",{className:"advanced-cropper-canvas",ref:t}),P.createElement("canvas",{className:"advanced-cropper-canvas",ref:n}))});w4.displayName="CropperCanvas";var vv=(function(A){jr(e,A);function e(t){var n=A.call(this,t)||this;return n.processMove=function(r,s){var a,o=n.container.current;if(o&&n.touches.length){var i=o.getBoundingClientRect(),c=i.left,u=i.top;if(n.touches.length===1&&s.length===1&&n.props.onMove){var f={left:Math.abs(s[0].clientX-n.anchor.left-c)<Math.abs(n.touches[0].clientX-n.anchor.left-c),top:Math.abs(s[0].clientY-n.anchor.top-u)<Math.abs(n.touches[0].clientY-n.anchor.top-u)},d={left:0,top:0};(!n.props.useAnchor||!f.left)&&(d.left=s[0].clientX-n.touches[0].clientX),(!n.props.useAnchor||!f.top)&&(d.top=s[0].clientY-n.touches[0].clientY),(a=n.props)===null||a===void 0||a.onMove(d,r),n.touches=Pr([],Ne(s),!1)}}},n.processEnd=function(){var r=n.props,s=r.onMoveEnd,a=r.onLeave;!n.props.disabled&&n.touches.length&&(s==null||s()),n.hovered&&(a==null||a(),n.hovered=!1),n.touches=[]},n.initAnchor=function(r){var s=n.container.current;if(s){var a=s.getBoundingClientRect(),o=a.left,i=a.top;n.anchor={left:r.clientX-o,top:r.clientY-i}}},n.onMouseOver=function(){var r=n.props,s=r.onEnter,a=r.disabled;!n.hovered&&!a&&(n.hovered=!0,s==null||s())},n.onMouseLeave=function(){var r=n.props.onLeave;n.hovered&&!n.touches.length&&(n.hovered=!1,r==null||r())},n.onTouchStart=function(r){var s=n.props,a=s.onEnter,o=s.onMoveStart,i=s.disabled;if(r.cancelable){n.touches=Array.from(r.touches);var c=!i&&r.touches.length===1;c&&(n.touches=Array.from(r.touches),o==null||o()),!n.hovered&&!i&&(n.hovered=!0,a==null||a()),(n.started||c)&&(r.preventDefault(),r.stopPropagation())}},n.onTouchEnd=function(){n.started=!1,n.processEnd()},n.onTouchMove=function(r){n.touches.length>=1&&(n.started?(n.processMove(r,Array.from(r.touches)),r.preventDefault(),r.stopPropagation()):A4({left:n.touches[0].clientX,top:n.touches[0].clientY},{left:r.touches[0].clientX,top:r.touches[0].clientY})>(n.props.activationDistance||0)&&(n.initAnchor({clientX:r.touches[0].clientX,clientY:r.touches[0].clientY}),n.started=!0))},n.onMouseDown=function(r){var s=n.props,a=s.onMoveStart,o=s.disabled;if(!o&&r.button===0){var i={clientX:r.clientX,clientY:r.clientY};n.touches=[i],n.initAnchor(i),r.stopPropagation(),a==null||a()}},n.onMouseMove=function(r){!n.props.disabled&&n.touches.length&&(n.processMove(r,[{clientX:r.clientX,clientY:r.clientY}]),r.preventDefault&&r.cancelable&&r.preventDefault(),r.stopPropagation())},n.onMouseUp=function(){n.processEnd()},n.touches=[],n.hovered=!1,n.started=!1,n.anchor={left:0,top:0},n.container=P.createRef(),n}return e.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var t=this.container.current;t&&(t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("mousedown",this.onMouseDown))},e.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var t=this.container.current;t&&(t.addEventListener("touchstart",this.onTouchStart,{passive:!1}),t.addEventListener("mousedown",this.onMouseDown,{passive:!1}))},e.prototype.componentDidUpdate=function(t){this.props.disabled&&!t.disabled&&(this.touches=[])},e.prototype.render=function(){var t=this.props,n=t.children,r=t.className;return P.createElement("div",{className:QA("advanced-cropper-draggable-element",r),ref:this.container,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},n)},e.defaultProps={disabled:!1,activationDistance:30,useAnchor:!0,rerender:!0},e})(P.Component),HtA=function(A){var e=A.position,t=A.className,n=A.disabled,r=A.onDrag,s=A.onDragEnd,a=A.onLeave,o=A.onEnter,i=A.children;return P.createElement(vv,{className:QA(["advanced-cropper-line-wrapper",e&&"advanced-cropper-line-wrapper--".concat(e),n&&"advanced-cropper-line-wrapper--disabled",t]),disabled:n,onMove:r,onMoveEnd:s,onLeave:a,onEnter:o,activationDistance:0},P.createElement("div",{className:QA(["advanced-cropper-line-wrapper__content",e&&"advanced-cropper-line-wrapper__content--".concat(e)])},i))},E0=function(A){var e,t,n=A.position,r=A.hoverClassName,s=A.wrapperClassName,a=A.defaultClassName,o=A.disabled,i=A.onMove,c=A.onMoveEnd,u=Ne(P.useState(!1),2),f=u[0],d=u[1],g=function(){d(!0)},v=function(){d(!1)};return P.createElement(HtA,{className:QA("advanced-cropper-simple-line-wrapper",s,(e={},e["advanced-cropper-simple-line-wrapper--".concat(n)]=!!n,e)),position:n,disabled:o,onDrag:i,onDragEnd:c,onLeave:v,onEnter:g},P.createElement("div",{className:QA("advanced-cropper-simple-line",f&&"advanced-cropper-simple-line--hover",a,f&&r,(t={},t["advanced-cropper-simple-line--".concat(n)]=!!n,t))}))},NtA=function(A){var e=A.horizontalPosition,t=A.verticalPosition,n=A.className,r=A.disabled,s=A.onDrag,a=A.onDragEnd,o=A.onLeave,i=A.onEnter,c=A.children,u=A.style,f=e||t?G2(e,t).snakeCase:null;return P.createElement("div",{style:u,className:QA(n,"advanced-cropper-handler-wrapper",f&&"advanced-cropper-handler-wrapper--".concat(f),r&&"advanced-cropper-handler-wrapper--disabled")},P.createElement(vv,{className:"advanced-cropper-handler-wrapper__draggable",disabled:r,onMove:s,onMoveEnd:a,onLeave:o,onEnter:i,activationDistance:0},c))},H0=function(A){var e,t=A.verticalPosition,n=A.horizontalPosition,r=A.hoverClassName,s=A.wrapperClassName,a=A.defaultClassName,o=A.wrapperStyle,i=A.disabled,c=A.onMove,u=A.onMoveEnd,f=Ne(P.useState(!1),2),d=f[0],g=f[1],v=function(){g(!0)},m=function(){g(!1)};return P.createElement(NtA,{style:o,className:QA("advanced-cropper-simple-handler-wrapper",s,t&&"advanced-cropper-simple-handler-wrapper--".concat(t),n&&"advanced-cropper-simple-handler-wrapper--".concat(n),n&&t&&"advanced-cropper-simple-handler-wrapper--".concat(n,"-").concat(t),d&&"advanced-cropper-simple-handler-wrapper--hover"),verticalPosition:t,horizontalPosition:n,disabled:i,onDrag:c,onDragEnd:u,onLeave:m,onEnter:v},P.createElement("div",{className:QA("advanced-cropper-simple-handler",d&&"advanced-cropper-simple-handler--hover",a,d&&r,(e={},e["advanced-cropper-simple-handler--".concat(t)]=!!t,e["advanced-cropper-simple-handler--".concat(n)]=!!n,e["advanced-cropper-simple-handler--".concat(n,"-").concat(t)]=n&&t,e))}))},ktA=["east","west",null],ZtA=["south","north",null],y4=function(A){var e=A.style,t=A.className,n=A.children,r=A.onResize,s=A.onResizeEnd,a=A.handlerComponent,o=a===void 0?H0:a,i=A.handlers,c=i===void 0?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:i,u=A.handlerClassNames,f=u===void 0?{}:u,d=A.handlerWrapperClassNames,g=d===void 0?{}:d,v=A.lines,m=v===void 0?{west:!0,north:!0,east:!0,south:!0}:v,p=A.lineComponent,h=p===void 0?E0:p,w=A.lineClassNames,b=w===void 0?{}:w,x=A.lineWrapperClassNames,z=x===void 0?{}:x,D=A.disabled,B=D===void 0?!1:D,M=A.reference,I=M===void 0?null:M,X=Ne(P.useState(null),2),V=X[0],E=X[1],k=P.useMemo(function(){var T=[];return ktA.forEach(function(H){ZtA.forEach(function(N){if(H!==N){var j=G2(H,N),O=j.snakeCase,G=j.camelCase;O&&G&&T.push({name:G,className:O,verticalPosition:N,horizontalPosition:H})}})}),T},[]),Z=P.useMemo(function(){var T=[];return k.forEach(function(H){neA(H.name)&&(Ia(m)?m[H.name]:m)&&T.push({name:H.name,component:h,className:QA(b.default,b[H.name],B&&b.disabled),wrapperClassName:QA("advanced-cropper-bounding-box__line","advanced-cropper-bounding-box__line--".concat(H.name),z.default,z[H.name],B&&z.disabled),hoverClassName:b.hover,verticalPosition:H.verticalPosition,horizontalPosition:H.horizontalPosition,disabled:B})}),T},[k,m,h,b,z,B]),C=P.useMemo(function(){var T=[];return k.forEach(function(H){(Ia(c)?c[H.name]:c)&&T.push({name:H.name,component:o,className:QA(f.default,f[H.name]),containerClassName:QA("advanced-cropper-bounding-box__handler-wrapper","advanced-cropper-bounding-box__handler-wrapper--".concat(H.className)),wrapperClassName:QA("advanced-cropper-bounding-box__handler","advanced-cropper-bounding-box__handler--".concat(H.className),g.default,g[H.name]),hoverClassName:f.hover,verticalPosition:H.verticalPosition,horizontalPosition:H.horizontalPosition,disabled:B})}),T},[k,c,o,f,g,B]),Q=function(T,H){return function(N,j){var O=N.left,G=N.top,J={left:O,top:G},K;if(!H&&T?K="width":H&&!T&&(K="height"),!B){if(r){var nA=G2(T,H).camelCase;nA&&r(nA,J,{reference:V||I,preserveAspectRatio:j&&j.shiftKey,respectDirection:K,compensate:!0})}V||E(I)}}},Y=function(){s==null||s(),E(null)};return P.createElement("div",{className:QA("advanced-cropper-bounding-box",t),style:e},n,P.createElement("div",null,Z.map(function(T){return P.createElement(T.component,{key:T.name,defaultClassName:T.className,hoverClassName:T.hoverClassName,wrapperClassName:T.wrapperClassName,position:T.name,disabled:T.disabled,onMove:Q(T.horizontalPosition,T.verticalPosition),onMoveEnd:Y})})),P.createElement("div",null,C.map(function(T){var H=P.createElement(T.component,{defaultClassName:T.className,hoverClassName:T.hoverClassName,wrapperClassName:T.wrapperClassName,horizontalPosition:T.horizontalPosition,verticalPosition:T.verticalPosition,disabled:T.disabled,onMove:Q(T.horizontalPosition,T.verticalPosition),onMoveEnd:Y});return P.createElement("div",{key:T.name,className:T.containerClassName},H)})))},P4=function(A){var e=A.className,t=A.children;return P.createElement("div",{className:QA("advanced-cropper-stencil-overlay",e)},t)};function StA(A){A===void 0&&(A=null);var e=P.useRef(new qeA),t=Ne(P.useState(!1),2),n=t[0],r=t[1];return[function(s){A&&A.active?e.current.start(aA(aA({},A),{onStart:function(){r(!0)},onProgress:function(a){s(a)},onStop:function(){r(!1)}})):e.current.active||s(1)},n]}var VtA=function(A){var e=A.className,t=A.transitions,n=A.children,r=na(A,["className","transitions","children"]),s=P.useRef(null),a=P.useRef(r),o=Ne(P.useState(r),2),i=o[0],c=o[1],u=Ne(StA(t),2),f=u[0],d=u[1];P.useLayoutEffect(function(){if(!Fo(i,r)){c(r);var m=d?aA({},a.current):i;f(function(p){var h=["left","top","height","width"];h.forEach(function(w){var b=r[w],x=m[w];a.current[w]=Oe(x)&&Oe(b)?x+(b-x)*p:b}),s.current&&(s.current.style.width="".concat(a.current.width,"px"),s.current.style.height="".concat(a.current.height,"px"),s.current.style.transform="translate3d(".concat(a.current.left,"px, ").concat(a.current.top,"px, 0px)"))})}},[i,d,r.width,r.height,r.top,r.left]);var g=d?a.current:r,v={left:0,top:0,width:"".concat(g.width,"px"),height:"".concat(g.height,"px"),transform:"translate3d(".concat(g.left,"px, ").concat(g.top,"px, 0px)")};return P.createElement("div",{ref:s,className:QA("advanced-cropper-artificial-transition",e),style:v},n)},b4=function(A){var e=A.className,t=A.transitions,n=A.width,r=A.height,s=A.left,a=A.top,o=A.children;return P.createElement(VtA,{className:QA("advanced-cropper-stencil-wrapper",e),transitions:t,width:n,height:r,top:a,left:s},o)},x4=function(A){var e=A.columns,t=e===void 0?3:e,n=A.rows,r=n===void 0?3:n,s=A.visible,a=s===void 0?!1:s,o=A.className,i=[],c=Ne(P.useState(t),2),u=c[0],f=c[1],d=Ne(P.useState(r),2),g=d[0],v=d[1];Ql(function(){a&&(v(r),f(t))},[a,t,r]);for(var m=0;m<g;m++){for(var p=[],h=0;h<u;h++)p.push(P.createElement("div",{key:h,className:QA("advanced-cropper-stencil-grid__cell",m===0&&"advanced-cropper-stencil-grid__cell--top",m===g-1&&"advanced-cropper-stencil-grid__cell--bottom",h===0&&"advanced-cropper-stencil-grid__cell--left",h===u-1&&"advanced-cropper-stencil-grid__cell--right")}));i.push(P.createElement("div",{key:m,className:"advanced-cropper-stencil-grid__row"},p))}return P.createElement("div",{className:QA("advanced-cropper-stencil-grid",a&&"advanced-cropper-stencil-grid--visible",o)},i)},z4=P.forwardRef(function(A,e){var t=A.cropper,n=A.coordinates,r=A.aspectRatio,s=A.minAspectRatio,a=A.maxAspectRatio,o=A.handlerComponent,i=o===void 0?H0:o,c=A.handlers,u=c===void 0?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:c,f=A.handlerClassNames,d=f===void 0?{}:f,g=A.handlerWrapperClassNames,v=g===void 0?{}:g,m=A.lines,p=m===void 0?{west:!0,north:!0,east:!0,south:!0}:m,h=A.lineComponent,w=h===void 0?E0:h,b=A.lineClassNames,x=b===void 0?{}:b,z=A.lineWrapperClassNames,D=z===void 0?{}:z,B=A.resizable,M=B===void 0?!0:B,I=A.movable,X=I===void 0?!0:I,V=A.grid,E=A.gridClassName,k=A.className,Z=A.movingClassName,C=A.resizingClassName,Q=A.previewClassName,Y=A.boundingBoxClassName,T=A.overlayClassName,H=A.draggableAreaClassName,N=A.disabled,j=t.getState(),O=t.getTransitions(),G=t.getInteractions(),J=M&&!N,K=X&&!N;P.useImperativeHandle(e,function(){return{aspectRatio:co(r||{minimum:s,maximum:a})}});var nA=function(YA){t&&K&&t.moveCoordinates(YA)},R=function(){t&&t.moveCoordinatesEnd()},eA=function(YA,ee,hA){t&&J&&t.resizeCoordinates(YA,ee,hA)},AA=function(){t&&t.resizeCoordinatesEnd()},_=n?Pe(n)?n(j):n:M0(j),W=_.width,U=_.height,PA=_.left,TA=_.top;return j&&P.createElement(b4,{className:QA("advanced-cropper-rectangle-stencil",k,G.moveCoordinates&&Z,G.resizeCoordinates&&C,{"advanced-cropper-rectangle-stencil--movable":K,"advanced-cropper-rectangle-stencil--moving":G.moveCoordinates,"advanced-cropper-rectangle-stencil--resizable":J,"advanced-cropper-rectangle-stencil--resizing":G.resizeCoordinates,"advanced-cropper-rectangle-stencil--disabled":N}),width:W,height:U,left:PA,top:TA,transitions:O},P.createElement(y4,{reference:j.coordinates,className:QA(Y,"advanced-cropper-rectangle-stencil__bounding-box"),handlers:u,handlerComponent:i,handlerClassNames:d,handlerWrapperClassNames:v,lines:p,lineComponent:w,lineClassNames:x,lineWrapperClassNames:D,onResize:eA,onResizeEnd:AA,disabled:!J},P.createElement(vv,{disabled:!K,onMove:nA,onMoveEnd:R,className:QA("advanced-cropper-rectangle-stencil__draggable-area",H)},P.createElement(P4,{className:QA("advanced-cropper-rectangle-stencil__overlay",T)},V&&P.createElement(x4,{visible:t.hasInteractions(),columns:G.transformImage.rotate?9:3,rows:G.transformImage.rotate?9:3,className:QA("advanced-cropper-rectangle-stencil__grid",E)}),P.createElement("div",{className:QA("advanced-cropper-rectangle-stencil__preview",Q)})))))});z4.displayName="RectangleStencil";function XtA(A){return P.useMemo(function(){return yu(A,{touch:!0},{touch:!1})},[A])}function YtA(A){return P.useMemo(function(){return yu(A,{touch:!0,wheel:{ratio:.1}},{touch:!1,wheel:!1})},[A])}function GtA(A){return P.useMemo(function(){return yu(A,{touch:!0,mouse:!0},{touch:!1,mouse:!1})},[A])}var ItA=(function(){function A(e){var t=e.active;this.active=t,this.defaultPrevented=!1}return A.prototype.preventDefault=function(){this.defaultPrevented=!0},A})(),QtA=(function(A){jr(e,A);function e(t){var n=A.call(this,t)||this;return n.processMove=function(r){var s=n.props,a=s.onTransform,o=s.touchScale,i=s.touchMove,c=s.touchRotate,u=n.container.current;u&&a&&(a(EeA(r,n.touches,u,{scale:o,rotate:c,move:i})),n.touches=r)},n.processEnd=function(){var r=n.props.onTransformEnd;n.transforming&&(n.transforming=!1,r&&r())},n.processStart=function(){n.transforming=!0,n.debouncedProcessEnd.clear()},n.processEvent=function(r){var s=n.props,a=s.onEvent,o=s.disabled,i=s.preventDefault,c=i===void 0?!0:i,u=new ItA({active:n.transforming});return a?a(u,r):c&&(r.preventDefault(),r.stopPropagation()),!o&&!u.defaultPrevented},n.onWheel=function(r){var s=n.props,a=s.onTransform,o=s.wheelScale,i=n.container.current;o&&n.processEvent(r)&&(n.processStart(),a&&i&&a(HeA(r,i,o===!0?.1:o.ratio)),n.touches.length||n.debouncedProcessEnd())},n.onTouchStart=function(r){var s=n.props,a=s.touchMove,o=s.touchScale,i=s.touchRotate;if(r.cancelable&&(a||(o||i)&&r.touches.length>1)&&n.processEvent(r)){var c=n.container.current;if(c){var u=c.getBoundingClientRect(),f=u.left,d=u.top,g=u.bottom,v=u.right;n.touches=Array.from(r.touches).filter(function(m){return m.clientX>f&&m.clientX<v&&m.clientY>d&&m.clientY<g})}}},n.onTouchEnd=function(r){r.touches.length===0&&(n.touches=[],n.processEnd())},n.onTouchMove=function(r){if(n.touches.length){var s=Pr([],Ne(r.touches),!1).filter(function(a){return!a.identifier||n.touches.find(function(o){return o.identifier===a.identifier})});n.processEvent(r)&&(n.processMove(s),n.processStart())}},n.onMouseDown=function(r){var s=n.props.mouseMove;if(s&&"buttons"in r&&r.buttons===1&&n.processEvent(r)){var a={clientX:r.clientX,clientY:r.clientY};n.touches=[a],n.processStart()}},n.onMouseMove=function(r){n.touches.length&&n.processEvent(r)&&n.processMove([{clientX:r.clientX,clientY:r.clientY}])},n.onMouseUp=function(){n.touches=[],n.processEnd()},n.transforming=!1,n.touches=[],n.anchor={left:0,top:0},n.container=P.createRef(),n.debouncedProcessEnd=t4(n.processEnd,t.timeout),n}return e.prototype.shouldComponentUpdate=function(){return!0},e.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var t=this.container.current;t&&(t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("wheel",this.onWheel))},e.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var t=this.container.current;t&&(t.addEventListener("touchstart",this.onTouchStart,{passive:!1}),t.addEventListener("mousedown",this.onMouseDown,{passive:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}))},e.prototype.render=function(){var t=this.props,n=t.className,r=t.children,s=t.style;return P.createElement("div",{className:n,style:s,ref:this.container},r)},e.defaultProps={touchMove:!0,mouseMove:!0,touchScale:!0,touchRotate:!1,wheelScale:!0,timeout:500},e})(P.Component),LtA=function(A){var e=A.scaleImage,t=e===void 0?!0:e,n=A.moveImage,r=n===void 0?!0:n,s=A.rotateImage,a=s===void 0?!1:s,o=A.children,i=A.className,c=A.style,u=A.cropper,f=A.timeout,d=A.disabled,g=u.getTransitions(),v=XtA(a),m=YtA(t),p=GtA(r);return P.createElement(QtA,{className:i,style:c,onTransform:u.transformImage,onTransformEnd:u.transformImageEnd,touchMove:p.touch,mouseMove:p.mouse,touchScale:m.touch,wheelScale:m.wheel,touchRotate:v.touch,disabled:g.active||d,preventDefault:!d,timeout:f},o)},JtA=function(A,e){var t=A.style,n=A.className,r=A.stencilComponent,s=r===void 0?z4:r,a=A.stencilConstraints,o=a===void 0?u4:a,i=A.stencilProps,c=i===void 0?{}:i,u=A.wrapperComponent,f=u===void 0?EtA:u,d=A.wrapperProps,g=d===void 0?{}:d,v=A.backgroundComponent,m=v===void 0?h4:v,p=A.backgroundProps,h=p===void 0?{}:p,w=A.backgroundClassName,b=A.backgroundWrapperComponent,x=b===void 0?LtA:b,z=A.backgroundWrapperProps,D=z===void 0?{}:z,B=A.boundaryComponent,M=B===void 0?T0:B,I=A.boundaryProps,X=A.boundaryClassName,V=A.canvas,E=V===void 0?!0:V,k=A.crossOrigin,Z=k===void 0?!0:k,C=A.disabled,Q=A.settings,Y=na(A,["style","className","stencilComponent","stencilConstraints","stencilProps","wrapperComponent","wrapperProps","backgroundComponent","backgroundProps","backgroundClassName","backgroundWrapperComponent","backgroundWrapperProps","boundaryComponent","boundaryProps","boundaryClassName","canvas","crossOrigin","disabled","settings"]),T=P.useRef(null),H=TtA(function(){return aA(aA({},Y),{crossOrigin:Z,stencilProps:c,canvas:E,settings:aA(aA({},Q),o(Q,aA(aA({},c),T.current)))})}),N=H.cropper,j=H.image,O=H.refs,G=s,J=f,K=x,nA=m,R=M;P.useImperativeHandle(e,function(){return N});var eA={loading:N.isLoading(),loaded:N.isLoaded()};return P.createElement(J,aA({},g,{disabled:C,className:QA("advanced-cropper",n),cropper:N,style:t},eA),P.createElement(R,aA({},I,{ref:O.boundary,className:QA("advanced-cropper__boundary",X)}),P.createElement(K,aA({},D,{disabled:C,cropper:N,className:"advanced-cropper__background-wrapper"}),N.getState()&&P.createElement(nA,aA({},h,{ref:O.image,crossOrigin:Z,cropper:N,className:QA("advanced-cropper__background",w)})),P.createElement(G,aA({},c,{disabled:C,ref:T,cropper:N,image:j}))),E&&P.createElement(w4,{ref:O.canvas})))},D4=ztA(JtA),B4=["transformImage","moveCoordinates","resizeCoordinates","defaultCoordinates","defaultVisibleArea","areaPositionRestrictions","areaSizeRestrictions","sizeRestrictions","positionRestrictions","aspectRatio","minWidth","minHeight","maxWidth","maxHeight","defaultSize","defaultPosition","defaultTransforms","imageRestriction","priority"];function M4(A,e){e===void 0&&(e=B4);var t={settings:{},props:{}};return Object.keys(A).forEach(function(n){e.some(function(r){return r===n})?t.settings[n]=A[n]:t.props[n]=A[n]}),t}var C4=P.forwardRef(function(A,e){var t=M4(A,Pr(Pr([],Ne(B4),!1),["stencilSize"],!1));return P.createElement(D4,aA({postProcess:wtA,stencilConstraints:gtA},t.props,{settings:aA(aA({defaultSize:mtA,aspectRatio:ptA,sizeRestrictions:QeA(vtA)},t.settings),{transformImage:aA(aA({},t.settings.transformImage),{adjustStencil:!1})}),ref:e}))});C4.displayName="FixedCropper";var j4=P.forwardRef(function(A,e){var t=M4(A),n=t.props,r=t.settings,s=r.stencilSize,a=r.autoZoom,o=na(r,["stencilSize","autoZoom"]),i=xtA();return At(a)||(n.postProcess||s?i("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function."):(i("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function. The 'postProcess' automatically set to 'hybridAutoZoom'"),n.postProcess=PtA)),At(s)?P.createElement(D4,aA({},n,{ref:e,settings:o})):(i("prop 'stencilSize' is deprecated for <Cropper/> component now and will be removed, use <FixedCropper/> component instead."),P.createElement(C4,aA({ref:e,stencilSize:s},o,n)))});j4.displayName="CropperComponent";var qtA=P.forwardRef(function(A,e){var t=A.cropper,n=A.coordinates,r=A.handlerComponent,s=r===void 0?H0:r,a=A.handlers,o=a===void 0?{eastNorth:!0,westNorth:!0,westSouth:!0,eastSouth:!0}:a,i=A.handlerClassNames,c=i===void 0?{}:i,u=A.handlerWrapperClassNames,f=u===void 0?{}:u,d=A.lines,g=d===void 0?{west:!0,north:!0,east:!0,south:!0}:d,v=A.lineComponent,m=v===void 0?E0:v,p=A.lineClassNames,h=p===void 0?{}:p,w=A.lineWrapperClassNames,b=w===void 0?{}:w,x=A.resizable,z=x===void 0?!0:x,D=A.movable,B=D===void 0?!0:D,M=A.grid,I=A.gridClassName,X=A.className,V=A.movingClassName,E=A.resizingClassName,k=A.previewClassName,Z=A.boundingBoxClassName,C=A.overlayClassName,Q=A.draggableAreaClassName,Y=A.disabled,T=t.getState(),H=t.getTransitions(),N=t.getInteractions(),j=z&&!Y,O=B&&!Y;P.useImperativeHandle(e,function(){return{aspectRatio:1,boundingBox:"circle"}});var G=function(U){t&&O&&t.moveCoordinates(U)},J=function(){t&&t.moveCoordinatesEnd()},K=function(U,PA,TA){t&&j&&t.resizeCoordinates(U,PA,TA)},nA=function(){t&&t.resizeCoordinatesEnd()},R=n?Pe(n)?n(T):n:M0(T),eA=R.width,AA=R.height,_=R.left,W=R.top;return T&&P.createElement(b4,{className:QA("advanced-cropper-circle-stencil",X,N.moveCoordinates&&V,N.resizeCoordinates&&E,{"advanced-cropper-circle-stencil--movable":O,"advanced-cropper-circle-stencil--moving":N.moveCoordinates,"advanced-cropper-circle-stencil--resizable":j,"advanced-cropper-circle-stencil--resizing":N.resizeCoordinates,"advanced-cropper-circle-stencil--disabled":Y}),width:eA,height:AA,left:_,top:W,transitions:H},P.createElement(y4,{reference:T.coordinates,className:QA(Z,"advanced-cropper-circle-stencil__bounding-box"),handlers:o,handlerComponent:s,handlerClassNames:c,handlerWrapperClassNames:f,lines:g,lineComponent:m,lineClassNames:h,lineWrapperClassNames:b,onResize:K,onResizeEnd:nA,disabled:!j},P.createElement(vv,{disabled:!O,onMove:G,onMoveEnd:J,className:QA("advanced-cropper-circle-stencil__draggable-area",Q)},P.createElement(P4,{className:QA("advanced-cropper-circle-stencil__overlay",C)},M&&P.createElement(x4,{visible:t.hasInteractions(),columns:N.transformImage.rotate?9:3,rows:N.transformImage.rotate?9:3,className:QA("advanced-cropper-circle-stencil__grid",I)}),P.createElement("div",{className:QA("advanced-cropper-circle-stencil__preview",k)})))))});qtA.displayName="CircleStencil";var RtA=P.forwardRef(function(A,e){var t=A.src,n=A.crossOrigin,r=n===void 0?!0:n,s=na(A,["src","crossOrigin"]);return t?P.createElement("img",aA({key:t,ref:e,src:t,className:QA("advanced-cropper-source"),crossOrigin:r===!0?"anonymous":r||void 0},s)):null});RtA.displayName="CropperSource";var WtA=function(A){var e=A.children,t=A.cropper,n=A.className,r=A.style;return P.createElement("div",{className:QA(n,"cropper-preview-wrapper"),style:r},P.createElement(m4,{visible:t==null?void 0:t.isLoaded(),className:"cropper-preview-wrapper__fade"},e))},FtA=function(A){var e=A.className,t=A.cropper,n=A.crossOrigin,r=n===void 0?!0:n,s=A.size,a=A.style,o=t.getState(),i=t.getTransitions(),c=t.getImage(),u=s&&c&&(o!=null&&o.coordinates)?utA(c,o,s,i):{},f=c?c.src:void 0;return f?P.createElement("img",{key:f,className:QA("advanced-cropper-background-image",e),src:f,crossOrigin:r===!0?"anonymous":r||void 0,style:aA(aA({},u),a),onMouseDown:p4}):null};P.forwardRef(function(A,e){var t,n,r,s,a=A.className,o=A.contentClassName,i=A.state,c=i===void 0?null:i,u=A.image,f=u===void 0?null:u,d=A.transitions,g=d===void 0?null:d,v=A.backgroundComponent,m=v===void 0?FtA:v,p=A.backgroundProps,h=A.backgroundClassName,w=A.boundaryComponent,b=w===void 0?T0:w,x=A.boundaryProps,z=A.boundaryClassName,D=A.wrapperComponent,B=D===void 0?WtA:D,M=A.wrapperProps,I=A.loaded,X=I===void 0?!0:I,V=A.loading,E=V===void 0?!1:V,k=A.style,Z=A.cropper,C=g4(),Q=P.useRef(null),Y=P.useRef(null),T=Z||(Y.current?Y:{current:{getState:function(){return c},getTransitions:function(){return g},getImage:function(){return f},isLoaded:function(){return X},isLoading:function(){return E}}}),H=Ne(P.useState(null),2),N=H[0],j=H[1],O=(n=(t=T.current)===null||t===void 0?void 0:t.getState())===null||n===void 0?void 0:n.coordinates,G=(s=(r=T.current)===null||r===void 0?void 0:r.getImage())===null||s===void 0?void 0:s.src,J=N?{width:"".concat(N.width,"px"),height:"".concat(N.height,"px")}:{},K=function(){var AA,_,W=(_=(AA=T.current)===null||AA===void 0?void 0:AA.getState())===null||_===void 0?void 0:_.coordinates;Q.current&&W&&Q.current.stretchTo(W).then(function(U){U&&W?_s(_A(W),_A(U))?j({width:U.width,height:U.width/_A(W)}):j({width:U.height*_A(W),height:U.height}):j(null)}),C()};v4(K),P.useLayoutEffect(K,[O==null?void 0:O.height,O==null?void 0:O.width]),P.useImperativeHandle(e,function(){return{refresh:K,update:function(AA){AA?Y.current=AA:Y.current=null,K()}}});var nA=B,R=m,eA=b;return P.createElement(nA,aA({},M,{className:QA(a,"advanced-cropper-preview"),cropper:T.current,style:k}),P.createElement(eA,aA({ref:Q,stretchAlgorithm:UeA},x,{className:QA("advanced-cropper-preview__boundary",z)}),P.createElement("div",{className:QA(o,"advanced-cropper-preview__content"),style:J},T.current&&P.createElement(R,aA({},p,{cropper:T.current,size:N,className:QA(h,"advanced-cropper-preview__image",G&&"advanced-cropper-preview__image--visible")})))))});const Lm={custom:null,"1:1":{width:800,height:800},"16:9":{width:1920,height:1080},"3:2":{width:1200,height:800},"4:3":{width:1024,height:768}},KtA=()=>{const{state:{activeMedia:A},cropperRef:e,transformations:t,setTransformations:n,config:{cropperAspectRatio:r,viewOnly:s}}=Tr(),[a,o]=P.useState(null),[i,c]=P.useState(""),[u,f]=P.useState("desktop"),[d,g]=P.useState(r||"custom"),v=!((A==null?void 0:A.media)instanceof File)&&s,m=()=>{if(!r)return null;const[E,k]=r.split(":"),Z=parseInt(E,10),C=parseInt(k,10);return isNaN(Z)||isNaN(C)?null:{width:Z,height:C}},p=()=>{if(r){const k=m();return k?k.width/k.height:void 0}if(d==="custom")return;const E=Lm[d];return E?E.width/E.height:void 0};P.useEffect(()=>{var k,Z;if(!(A!=null&&A.media)||!e.current)return;if(!((A==null?void 0:A.media)instanceof File)){c(((k=A.media)==null?void 0:k.url)||((Z=A.media)==null?void 0:Z.src)),I(!0);return}const E=new FileReader;E.onload=C=>{var Q;e.current&&((Q=C.target)!=null&&Q.result)&&c(C.target.result.toString())},E.readAsDataURL(A==null?void 0:A.media),I(!0)},[A]),P.useEffect(()=>{r&&g(r)},[r]);const h=[{icon:lS,label:"desktop",size:"1920x1080"},{icon:SS,label:"tablet",size:"1024x768"},{icon:OS,label:"mobile",size:"414x896"}],w=()=>r?[]:Object.keys(Lm).map(E=>{let k=m7;return(E==="16:9"||E==="3:2"||E==="4:3")&&(k=v7),{icon:k,label:E}}),b=E=>{const k=E.getImage(),Z=E.getCoordinates();let C;Z&&(C=jy(Z,(k==null?void 0:k.width)||0,(k==null?void 0:k.height)||0)),n(Q=>({...Q,[u]:{...Q[u],coordinates:Z,pillowCropBox:C||void 0,aspectRatio:r||d||"custom",originalImageWidth:(k==null?void 0:k.width)||0,originalImageHeight:(k==null?void 0:k.height)||0}}))},x=E=>{E&&(e.current&&e.current.reset(),f(E),setTimeout(()=>{z(E)},100))},z=E=>{const k=t[E];if(!(!e.current||!k)){if(k.rotation)for(let Z=0;Z<k.rotation/90;Z++)e.current.rotateImage(90);if((k.flipHorizontal||k.flipVertical)&&e.current.flipImage(k.flipHorizontal||!1,k.flipVertical||!1),k.coordinates)e.current.setCoordinates(k.coordinates);else{const Z=e.current.getImage();e.current.setCoordinates({height:Z==null?void 0:Z.height,left:0,top:0,width:Z==null?void 0:Z.width})}k.aspectRatio&&g(k.aspectRatio)}},D=(E,k)=>{if(e.current){e.current.flipImage(E,k);const Z=e.current.getCoordinates(),C=e.current.getImage();n(Q=>{var Y,T,H,N;return{...Q,[u]:{...Q[u],coordinates:Z,flipHorizontal:E?!((Y=Q[u])!=null&&Y.flipHorizontal):(T=Q[u])==null?void 0:T.flipHorizontal,flipVertical:k?!((H=Q[u])!=null&&H.flipVertical):(N=Q[u])==null?void 0:N.flipVertical,originalImageWidth:(C==null?void 0:C.width)||0,originalImageHeight:(C==null?void 0:C.height)||0}}})}},B=()=>{if(!d||!a||!e.current)return;let E;if(r){const J=m();if(!J)return;E=J}else{const J=Lm[d];if(!J)return;E=J}const k=a.width,Z=a.height,C=E.width,Q=E.height,Y=k/C,T=Z/Q,H=Math.min(Y,T),N=C*H,j=Q*H,O={width:N,height:j,left:(k-N)/2,top:(Z-j)/2};e.current.setCoordinates(O);const G=jy(O,k,Z);n(J=>({...J,[u]:{...J[u],coordinates:O,pillowCropBox:G,aspectRatio:r||d,originalImageWidth:k,originalImageHeight:Z}}))},M=()=>{if(e.current){e.current.rotateImage(-90);const E=e.current.getCoordinates(),k=e.current.getImage();n(Z=>{var C;return{...Z,[u]:{...Z[u],coordinates:E,rotation:(((C=Z[u])==null?void 0:C.rotation)||0)+90,originalImageWidth:(k==null?void 0:k.width)||0,originalImageHeight:(k==null?void 0:k.height)||0}}})}},I=(E=!1)=>{if(e.current){const k={rotation:0,flipHorizontal:!1,flipVertical:!1,aspectRatio:r||"custom",coordinates:void 0,pillowCropBox:void 0,originalImageWidth:0,originalImageHeight:0};n(E?{desktop:k,tablet:k,mobile:k}:C=>({...C,[u]:k})),e.current.reset();const Z=e.current.getImage();Z&&e.current.setCoordinates({height:Z==null?void 0:Z.height,left:0,top:0,width:Z==null?void 0:Z.width}),r||g("custom")}};P.useEffect(()=>{B()},[d]);const X=w(),V=!r&&X.length>0;return l.jsxs("div",{className:"flex flex-col items-center space-y-4 h-full bg-muted p-4 px-6 ",children:[l.jsxs("div",{className:S("w-full flex justify-between items-center",{hidden:!v}),children:[l.jsx(cd,{type:"single",value:u,onValueChange:x,className:"flex-1",children:h.map(E=>l.jsx(ud,{value:E.label,className:"text-muted-foreground text-xs p-2 rounded-none gap-1 md:px-4 capitalize flex-col bg-transparent data-[state=on]:bg-transparent data-[state=on]:border-b-2 data-[state=on]:border-primary data-[state=on]:text-[#434343]",children:l.jsx(E.icon,{className:S("h-[16px] w-[20px]",{"text-[#434343]":E.label==u}),strokeWidth:2})},E.label))}),l.jsx(ve,{size:"sm",variant:"outline",onClick:()=>I(),children:"Reset"})]}),l.jsxs("div",{className:"bg-background overflow-hidden rounded border w-md 3xl:w-160 flex flex-col flex-1",children:[l.jsx(j4,{ref:e,src:i,onChange:v?b:void 0,onReady:E=>{const k=E.getImage();o(k),E.setCoordinates({height:k==null?void 0:k.height,left:0,top:0,width:k==null?void 0:k.width})},stencilProps:v?{movable:!0,resizable:!0,lines:!0,handlers:!0,overlayClassName:"bg-[#3338533D]",aspectRatio:p()}:{movable:!1,resizable:!1,lines:!1,handlers:!1},crossOrigin:!1,backgroundWrapperProps:{scaleImage:v,moveImage:v},resizeCoordinates:v,canvas:!0,className:"!max-h-[25rem] flex-1 w-md 3xl:w-160 relative bg-[red]",disabled:!v}),l.jsxs("div",{className:"flex gap-2 justify-center items-center text-muted-foreground text-xs p-4 border-t",children:[v&&V&&l.jsxs(l.Fragment,{children:[l.jsx(cd,{type:"single",value:d,onValueChange:E=>g(E||"custom"),className:"gap-2",children:X.map(E=>l.jsxs(ud,{value:E.label,className:"group text-muted-foreground text-xs h-fit p-2 rounded gap-1 capitalize flex-col bg-transparent data-[state=on]:bg-primary/40 data-[state=on]:text-[#434343]",children:[l.jsx(E.icon,{className:"h-[16px] w-[20px]",strokeWidth:2}),E.label]},E.label))}),l.jsx("div",{className:"w-px h-8 bg-border mx-2"})]}),r&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium ",children:[l.jsx(m7,{className:"h-4 w-4"}),r]}),v&&l.jsx("div",{className:"w-px h-8 bg-border mx-2"})]}),v&&l.jsxs(l.Fragment,{children:[l.jsxs(ve,{variant:"ghost",className:"flex-col gap-1 !p-2 h-fit",onClick:M,children:[l.jsx(zS,{className:"h-4 w-4"}),"Rotate"]}),l.jsxs(ve,{variant:"ghost",className:"flex-col gap-1 !p-2 h-fit",onClick:()=>D(!0,!1),children:[l.jsx(UZ,{className:"h-4 w-4"}),"Flip H"]}),l.jsxs(ve,{variant:"ghost",className:"flex-col gap-1 !p-2 h-fit",onClick:()=>D(!1,!0),children:[l.jsx($Z,{className:"h-4 w-4"}),"Flip V"]})]})]})]})]})},UtA=()=>{const{handleMediaUpdate:A,handleMediaAction:e,state:{activeMedia:t,activeTab:n},handleMediaSelect:r,config:s,mutations:{editMutationPending:a,uploadMutationPending:o}}=Tr(),i=(t==null?void 0:t.type)==="add"||(t==null?void 0:t.type)==="edit",c=a||o,[u,f]=P.useState({title:"",description:"",alternative_text:"",caption:"",url:""});P.useEffect(()=>{var m;if(!(t!=null&&t.media))return;const v={title:(t==null?void 0:t.media)instanceof File?t.media.name:((m=t.media)==null?void 0:m.title)??"",alternative_text:(t==null?void 0:t.media)instanceof File?t.media.name:t.media.alternative_text??"",caption:t.media.caption??"",url:t.media.url??""};f(v)},[t]);const d=P.useCallback((v,m)=>{f(p=>({...p,[v]:m}))},[]),g=P.useCallback(v=>{var m;if(v.preventDefault(),s!=null&&s.viewOnly&&!((t==null?void 0:t.media)instanceof File))r({...t.media,...u});else{const p=u;(t==null?void 0:t.media)instanceof File||(p.uuid=(m=t==null?void 0:t.media)==null?void 0:m.uuid),A(p)}},[s==null?void 0:s.viewOnly,t.media,r,u,A]);return l.jsx(xt,{open:i,onOpenChange:()=>e(""),children:l.jsx(vt,{className:"sm:max-w-[70%] sm:max-h-[50rem] p-6 gap-4 items-start overflow-auto",children:l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs($t,{className:"h-fit w-fit",children:[l.jsx(A9,{children:l.jsx("h1",{className:"text-left text-md",children:"Edit Image"})}),l.jsx(gg,{className:" text-start text-muted-foreground text-base",children:"Modify your image to your preference"})]}),l.jsxs("div",{className:" flex-1 h-0 w-full overflow-auto grid grid-cols-[2fr_1fr] gap-4",children:[l.jsx(KtA,{}),l.jsxs("form",{className:"max-w-full flex flex-col justify-between items-center gap-3",onSubmit:g,children:[l.jsx("div",{className:"w-full justify-start h-fit bg-muted border text-base font-bold p-4 py-2 rounded",children:"Image Properties"}),l.jsxs("div",{className:"space-y-3 w-full overflow-y-auto h-10 flex-1",children:[l.jsx($e,{label:"Title",value:u.title,onChange:v=>d("title",v),inputProps:{placeholder:"Type here"}}),l.jsx($e,{label:l.jsxs("span",{className:"flex justify-between gap-2",children:["Alternative Text",l.jsx(xi,{children:l.jsxs(Es,{children:[l.jsx(Hs,{asChild:!0,children:l.jsx(g7,{className:"h-4 w-4 text-muted-foreground"})}),l.jsx(Ns,{children:l.jsx("p",{children:"Alternative text helps screen-reading tools describe images to visually impaired readers."})})]})})]}),value:u.alternative_text,onChange:v=>d("alternative_text",v),inputProps:{placeholder:"Describe the image",minLength:10,onInvalid:v=>{const m=v.target;m.validity.tooShort&&m.setCustomValidity("Alternative text must be at least 10 characters")},onInput:v=>{v.target.setCustomValidity("")}}}),l.jsx($e,{label:l.jsxs("span",{className:"flex justify-between gap-2",children:["Description",l.jsx(xi,{children:l.jsxs(Es,{children:[l.jsx(Hs,{asChild:!0,children:l.jsx(g7,{className:"h-4 w-4 text-muted-foreground"})}),l.jsx(Ns,{children:l.jsx("p",{className:"max-w-xs",children:"Add a caption to display below the image"})})]})})]}),type:"textarea",value:u.caption,onChange:v=>d("caption",v),textareaProps:{placeholder:"Image caption",rows:4}})]}),l.jsx(fn,{className:"w-full items-center mt-auto mb-4",children:l.jsx(ve,{type:"submit",isLoading:c,disabled:c,className:"w-full rounded capitalize",children:(t==null?void 0:t.media)instanceof File?"Upload Image":s.viewOnly||n!=null&&n.viewOnly?"add image":"Save Changes"})})]})]})]})})})},_tA=()=>{const{state:{activeMedia:A},mutations:{deleteMutationPending:e},handleMediaAction:t,handleMediaDelete:n}=Tr(),r=()=>t("");return l.jsx(xt,{open:A.type=="delete",onOpenChange:r,children:l.jsxs(vt,{className:"max-w-[370px] p-0 overflow-hidden",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{className:"text-md",children:l.jsx("h1",{children:"Remove Image?"})})}),l.jsx(ls,{className:"px-4 text-base",children:"Are you sure you want to delete this image?"}),l.jsxs(fn,{className:"flex flex-row p-4 pt-0 gap-4 justify-end mt-4",children:[l.jsx(ve,{variant:"outline",className:"rounded",onClick:r,children:"No, don't delete"}),l.jsx(ve,{className:"rounded",variant:"destructive",onClick:n,isLoading:e,disabled:e,children:"Delete"})]})]})})},$tA=({className:A})=>{var n;const{dispatch:e,config:t}=Tr();return l.jsxs("div",{className:S("w-full h-[100vh] flex-1 flex flex-col p-6 overflow-hidden gap-4",A),children:[l.jsxs("div",{children:[l.jsx("h1",{"data-testid":"header",className:" text-3xl font-[UniversalFeature]",children:"Media Library"}),l.jsx("p",{className:"text-base text-muted-foreground",children:"Select your preferred image choice"})]}),l.jsxs(Zg,{defaultValue:(n=kl[0])==null?void 0:n.id,onValueChange:r=>e({type:"SET_ACTIVE_TAB",payload:kl.find(s=>s.id==r)}),className:"p-0 w-full flex-1 flex flex-col",children:[l.jsxs("div",{className:"w-full max-w-full overflow-hidden flex items-center justify-between gap-4",children:[l.jsx(su,{className:"h-fit flex-1 p-0 justify-start bg-transparent border-0 overflow-hidden",children:kl.map((r,s)=>l.jsxs(au,{value:r.id,className:"px-4 py-2 rounded-none rounded-t flex items-center justify-center gap-2 data-[state=active]:border-b-3 data-[state=active]:border-[#6FFFF0] data-[state=active]:bg-accent data-[state=active]:text-accent-foreground data-[state=active]:shadow-none border-0",children:[r.icon&&l.jsx("img",{alt:r.label,src:P0(r.icon),className:"h-5 w-5"}),r.label]},r.id+s))}),l.jsx(hAA,{})]}),kl.map(r=>l.jsx(UAA,{tab:r,viewOnly:!!t.viewOnly},r.id))]}),l.jsx(UtA,{}),l.jsx(_tA,{})]})},eP={success:l.jsx(Xa,{className:"w-20 h-20 text-primary-foreground/70"}),error:l.jsx(IZ,{className:"w-20 h-20 text-white"}),warning:l.jsx(YS,{className:"w-20 h-20 text-yellow-500"}),info:l.jsx(Xa,{className:"w-20 h-20 text-primary-foreground"}),action:l.jsx(Xa,{className:"w-20 h-20 text-primary-foreground/90"})},AnA=()=>{const{isVisible:A,currentModal:e,hideModal:t}=cC(),[n,r]=P.useState(!1);if(!e)return null;const{type:s,title:a,message:o,icon:i,confirmText:c="OK",cancelText:u="Cancel",onAction:f,onCancel:d,variant:g="default",size:v="md"}=e,m=async()=>{if(f){r(!0);try{await f()}catch(b){console.error("Modal confirm action failed:",b)}finally{r(!1)}}t()},p=()=>{d&&d(),t()},h={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl"},w=()=>{switch(s){case"error":return"destructive";case"warning":return"outline";case"success":return"default";default:return g}};return l.jsx(xt,{"data-testid":"action-modal",open:A,onOpenChange:t,children:l.jsxs(vt,{className:S("p-8 sm:max-w-[400px] ",h[v]),children:[l.jsxs($t,{className:"flex items-center justify-around text-center space-y-4",children:[(i||eP[s])&&l.jsx("div",{className:S("flex justify-center items-center p-4 text-3xl bg-primary/50 w-20 h-20 rounded-full border border-primary ",{"bg-destructive/90 border-destructive":s=="error"}),children:i||eP[s]}),l.jsx(An,{children:l.jsx("h1",{className:"text-md capitalize text-center",children:a})}),o&&l.jsx(ls,{className:"text-sm lowercase first-letter:uppercase text-center text-muted-foreground px-10",children:o})]}),l.jsxs(fn,{className:"flex justify-center space-x-4 mt-4",children:[(f||s==="action")&&l.jsx(pA,{className:"flex-1 rounded",variant:"outline",onClick:m,disabled:n,children:n?"Processing...":c}),l.jsx(pA,{variant:w(),onClick:p,disabled:n,className:"flex-1 rounded",children:u})]})]})})},Zi=({children:A})=>{const[e,t]=P.useState(!1),[n,r]=P.useState(null),s=P.useRef(null),a=P.useCallback(c=>{s.current&&clearTimeout(s.current),r(c),t(!0),c.autoClose&&c.autoClose>0&&(s.current=setTimeout(()=>{o()},c.autoClose))},[]),o=P.useCallback(()=>{s.current&&clearTimeout(s.current),t(!1),r(null)},[]);P.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const i={showModal:a,hideModal:o,isVisible:e,currentModal:n};return l.jsxs(lC.Provider,{value:i,children:[A,l.jsx(AnA,{})]})},O4=({className:A,config:e,onChange:t,image:n})=>l.jsx(Zi,{children:l.jsx(vAA,{config:e,onChange:t,image:n,children:l.jsx($tA,{className:A})})}),R2=({open:A=!0,config:e,onChange:t,handleToggleOpen:n,className:r,image:s})=>l.jsx(xt,{open:A,onOpenChange:n,children:l.jsx(vt,{className:S("sm:max-w-[70%] h-[90%] shadow-lg p-0",r),children:l.jsx(O4,{config:e,onChange:t,className:"h-full",image:s})})}),enA=()=>{const{state:A,dispatch:e,imageGalleryConfig:t}=zn(),{showImageGallery:n,value:r}=A,s=()=>{e({type:"TOGGLE_IMAGE_GALLERY"})},a=()=>{e({type:"SET_VALUE",payload:""})},o=f=>{f&&e({type:"SELECT_IMAGE",payload:f}),e({type:"TOGGLE_IMAGE_GALLERY",payload:!1})};if(!t)return null;const i=r,c=(i==null?void 0:i.url)||(i==null?void 0:i.src)||"";return(t==null?void 0:t.type)==="inline"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[l.jsx("div",{className:"w-20 h-15 rounded-sm overflow-hidden bg-gray-100 flex items-center justify-center shrink-0",children:c?l.jsx(as,{url:c,alt:i.alternative_text,classname:"w-full h-full object-cover"}):l.jsx(SAA,{className:"w-6 h-6 text-gray-400"})}),l.jsxs("div",{className:"flex items-center gap-2 flex-1 flex-wrap",children:[c?l.jsxs(l.Fragment,{children:[l.jsxs(pA,{size:"sm",onClick:s,className:"h-8 px-3 text-sm",children:[l.jsx(Rs,{className:"w-4 h-4 mr-1"}),"Edit image"]}),l.jsxs(pA,{variant:"outline",size:"sm",onClick:a,className:"h-8 px-3 text-sm ",children:[l.jsx(zi,{className:"w-4 h-4 mr-1 text-red-600"}),"Remove image"]})]}):l.jsxs(pA,{size:"sm",onClick:s,className:"h-8 px-3 text-sm",children:[l.jsx(Yy,{className:"w-4 h-4 mr-1"}),"Upload image"]}),l.jsx("div",{className:"text-xs text-gray-500 shrink-0 w-full",children:"Use JPEG, PNG, or GIF. Best size: 200x200 pixels. Keep it under 2MB"})]})]}),l.jsx(R2,{config:{...t,viewOnly:!0},open:n,onChange:o,image:i,handleToggleOpen:f=>e({type:"TOGGLE_IMAGE_GALLERY",payload:f})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:S("flex-1 overflow-hidden",{"border-2 border-dashed ":!c}),children:[c&&l.jsxs("div",{className:"relative w-full max-h-full overflow-hidden flex-1 flex items-center justify-center",children:[l.jsx(as,{url:c,alt:i.alternative_text,classname:"min-h-20 waz-input-box-content"}),l.jsxs("div",{className:"flex items-center gap-1 absolute top-2 right-2 z-10",children:[l.jsx(pA,{variant:"ghost",size:"icon",className:"rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7",onClick:s,children:l.jsx(Rs,{color:"gray",fontSize:6})}),l.jsx(pA,{variant:"ghost",size:"icon",className:"rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7",onClick:a,children:l.jsx(zi,{color:"red",size:"small"})})]})]}),!c&&l.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 h-50",onClick:s,children:[l.jsx(Yy,{className:"text-muted-forground"}),l.jsxs("p",{className:"text-sm text-center",children:[l.jsx("span",{className:"text-[#EE6F71] cursor-pointer",children:"Click to open media library"})," ",l.jsx("br",{}),"PNG, JPG, JPEG"]})]})]}),l.jsx(R2,{config:{...t,viewOnly:!0},open:n,onChange:o,image:i,handleToggleOpen:f=>e({type:"TOGGLE_IMAGE_GALLERY",payload:f})})]})};function T4(A){return JA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M512 256C512 114.6 397.4 0 256 0S0 114.6 0 256C0 376 82.7 476.8 194.2 504.5V334.2H141.4V256h52.8V222.3c0-87.1 39.4-127.5 125-127.5c16.2 0 44.2 3.2 55.7 6.4V172c-6-.6-16.5-1-29.6-1c-42 0-58.2 15.9-58.2 57.2V256h83.6l-14.4 78.2H287V510.1C413.8 494.8 512 386.9 512 256h0z"},child:[]}]})(A)}function E4(A){return JA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"},child:[]}]})(A)}function H4(A){return JA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M331.5 235.7c2.2 .9 4.2 1.9 6.3 2.8c29.2 14.1 50.6 35.2 61.8 61.4c15.7 36.5 17.2 95.8-30.3 143.2c-36.2 36.2-80.3 52.5-142.6 53h-.3c-70.2-.5-124.1-24.1-160.4-70.2c-32.3-41-48.9-98.1-49.5-169.6V256v-.2C17 184.3 33.6 127.2 65.9 86.2C102.2 40.1 156.2 16.5 226.4 16h.3c70.3 .5 124.9 24 162.3 69.9c18.4 22.7 32 50 40.6 81.7l-40.4 10.8c-7.1-25.8-17.8-47.8-32.2-65.4c-29.2-35.8-73-54.2-130.5-54.6c-57 .5-100.1 18.8-128.2 54.4C72.1 146.1 58.5 194.3 58 256c.5 61.7 14.1 109.9 40.3 143.3c28 35.6 71.2 53.9 128.2 54.4c51.4-.4 85.4-12.6 113.7-40.9c32.3-32.2 31.7-71.8 21.4-95.9c-6.1-14.2-17.1-26-31.9-34.9c-3.7 26.9-11.8 48.3-24.7 64.8c-17.1 21.8-41.4 33.6-72.7 35.3c-23.6 1.3-46.3-4.4-63.9-16c-20.8-13.8-33-34.8-34.3-59.3c-2.5-48.3 35.7-83 95.2-86.4c21.1-1.2 40.9-.3 59.2 2.8c-2.4-14.8-7.3-26.6-14.6-35.2c-10-11.7-25.6-17.7-46.2-17.8H227c-16.6 0-39 4.6-53.3 26.3l-34.4-23.6c19.2-29.1 50.3-45.1 87.8-45.1h.8c62.6 .4 99.9 39.5 103.7 107.7l-.2 .2zm-156 68.8c1.3 25.1 28.4 36.8 54.6 35.3c25.6-1.4 54.6-11.4 59.5-73.2c-13.2-2.9-27.8-4.4-43.4-4.4c-4.8 0-9.6 .1-14.4 .4c-42.9 2.4-57.2 23.2-56.2 41.8l-.1 .1z"},child:[]}]})(A)}function Pu(A){return JA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"},child:[]}]})(A)}function N4(A){return JA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"},child:[]}]})(A)}function W2(A){return JA({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"},child:[]}]})(A)}function k4(A){return JA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512l388.6 0c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304l-91.4 0z"},child:[]}]})(A)}function Z4(A){return JA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M16.1 260.2c-22.6 12.9-20.5 47.3 3.6 57.3L160 376l0 103.3c0 18.1 14.6 32.7 32.7 32.7c9.7 0 18.9-4.3 25.1-11.8l62-74.3 123.9 51.6c18.9 7.9 40.8-4.5 43.9-24.7l64-416c1.9-12.1-3.4-24.3-13.5-31.2s-23.3-7.5-34-1.4l-448 256zm52.1 25.5L409.7 90.6 190.1 336l1.2 1L68.2 285.7zM403.3 425.4L236.7 355.9 450.8 116.6 403.3 425.4z"},child:[]}]})(A)}const tnA=()=>{const{state:{value:A},dispatch:e,optionsQuery:{data:t,isLoading:n,fetchNextPage:r,hasNextPage:s,isFetchingNextPage:a},selectProps:o}=zn(),i=P.useMemo(()=>{const h=(t==null?void 0:t.pages.flatMap(w=>w==null?void 0:w.data))??[];if(Array.isArray(A)){const w=A.filter(b=>typeof b=="object"&&"label"in b&&"value"in b);return[...w.filter(b=>b==null?void 0:b.value),...h.filter(b=>!w.some(x=>x.value==b.value))]}else return typeof A=="object"&&A&&"label"in A&&"value"in A&&(A!=null&&A.value)?[A,...h.filter(w=>w.value!==A.value)]:h},[t,A]),[c,u]=y.useState(!1),{ref:f,inView:d}=fv(),g=P.useCallback(h=>{e({type:"SET_OPTIONS_SEARCH_VALUE",payload:h})},[e]),v=P.useCallback(h=>{if(o!=null&&o.multiple){let w=[];A&&Array.isArray(A)&&A.every(x=>typeof x=="object"&&"label"in x&&"value"in x)&&(w=A);const b=w.find(x=>x.value===h.value)?w.filter(x=>x.value!==h.value):[...w,h];e({type:"SET_VALUE",payload:b})}else e({type:"SET_VALUE",payload:h}),u(!1)},[o==null?void 0:o.multiple,A,e]),m=(o==null?void 0:o.placeholder)||"Select...",p=P.useMemo(()=>{const h={label:m,options:""};if(!A)return h;if(o!=null&&o.multiple){if(!Array.isArray(A))return h;const w=A.filter(B=>typeof B=="object"&&"label"in B&&"value"in B);if(!w.length)return h;const b=o.maximumLabelItems||w.length,z=w.slice(0,b).map(B=>B.label||B.value).join(", ");return{label:w.length>b?`${z} +${w.length-b}`:z,options:w.map(B=>B.label||B.value).join(", ")}}if(typeof A=="object"&&A&&"label"in A&&"value"in A){const w=A.label||A.value||m;return{label:w,options:w}}return h},[o==null?void 0:o.multiple,o==null?void 0:o.maximumLabelItems,A,m]);return y.useEffect(()=>{d&&s&&!a&&r()},[d,s,a,r]),l.jsxs(oa,{open:c,onOpenChange:u,modal:!1,children:[l.jsx(ia,{asChild:!0,children:l.jsxs(pA,{variant:"ghost",role:"combobox","aria-expanded":c,className:"w-full justify-between h-10 bg-background !p-2 rounded-none hover:bg-background",children:[l.jsx("span",{className:S("w-full text-left overflow-x-auto no-scrollbar capitalize",{"opacity-50":p.label==m}),children:p.label}),l.jsx(VZ,{className:"opacity-50"})]})}),l.jsx(cs,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:l.jsxs($c,{children:[l.jsx(i9,{placeholder:(o==null?void 0:o.searchPlaceholder)||"Search options...",className:"h-10",onValueChange:o!=null&&o.queryConfig?g:void 0}),l.jsxs(wg,{children:[l.jsx(yg,{className:"flex items-center justify-center p-3 ",children:n?l.jsx(mi,{className:"h-6 w-6 animate-spin"}):"No Options found."}),l.jsx(Pg,{children:i.map(h=>l.jsxs(bg,{value:h.label,onSelect:()=>v(h),className:"capitalize",children:[h.label,l.jsx(N4,{className:S("ml-auto",p!=null&&p.options.toString().includes(h.label)||p.options.toString().includes(h.value)?"opacity-100":"opacity-0")})]},h.value))}),s&&l.jsx("div",{ref:f,className:"w-full flex justify-center",children:a?l.jsx(mi,{className:"h-6 w-6 animate-spin"}):l.jsx(pA,{variant:"ghost",onClick:()=>r(),children:"Load more"})})]})]})})]})},S4=P.createContext(void 0),fo=()=>{const A=P.useContext(S4);if(A===void 0)throw new Error("useWysiwyg must be used within a WysiwygProvider");return A},nnA=({icon:A,title:e,description:t,handleClick:n,className:r})=>l.jsxs(pA,{onClick:n,variant:"ghost",className:S("w-full h-fit flex items-center justify-start gap-4 p-3 rounded-none m-0 hover:bg-accent",r),children:[A,l.jsxs("div",{className:"flex flex-col justify-start items-start",children:[l.jsx("span",{className:"p-0",children:e}),l.jsx("span",{className:"text-sm text-muted-foreground",children:t})]})]}),rnA=()=>{const{handleInitiateEmbed:A}=fo(),e=n=>{A==null||A(n)},t=[{icon:l.jsx(aS,{className:"w-[40px] text-[#FBBC9A]"}),title:"Picture",description:"jpeg, png",type:"image"},{icon:l.jsx(QS,{size:"10",className:"text-[#FBBC9A]"}),title:"Video",description:"JW player, Youtube, Vimeo",type:"video"},{icon:l.jsx(Nh,{size:"10",className:"text-[#FBBC9A]"}),title:"Social",description:"Instagram, Twitter, Tiktok, Snapchat, Facebook",type:"link"}];return l.jsxs(oa,{children:[l.jsx(ia,{asChild:!0,children:l.jsx(pA,{variant:"ghost",size:"icon",className:"p-1 h-6 w-6 rounded-full bg-gray-200 hover:bg-muted text-muted-foreground",children:l.jsx(As,{})})}),l.jsxs(cs,{className:"w-fit p-0 bg-background",align:"start",sideOffset:5,children:[l.jsx("div",{className:"p-4 border-b leading-[18px]",children:l.jsx("span",{className:"text-md",children:"Embeds"})}),l.jsx("div",{children:t.map(n=>l.jsx(nnA,{icon:n.icon,title:n.title,description:n.description,handleClick:()=>e(n.type),className:""},n.type))})]})]})};function snA(A){return JA({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.82843 6.99955L8.36396 9.53509L6.94975 10.9493L2 5.99955L6.94975 1.0498L8.36396 2.46402L5.82843 4.99955H13C17.4183 4.99955 21 8.58127 21 12.9996C21 17.4178 17.4183 20.9996 13 20.9996H4V18.9996H13C16.3137 18.9996 19 16.3133 19 12.9996C19 9.68584 16.3137 6.99955 13 6.99955H5.82843Z"},child:[]}]})(A)}function anA(A){return JA({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M16 7H11C7.68629 7 5 9.68629 5 13C5 16.3137 7.68629 19 11 19H20V21H11C6.58172 21 3 17.4183 3 13C3 8.58172 6.58172 5 11 5H16V1L22 6L16 11V7Z"},child:[]}]})(A)}function onA(A){return JA({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M19 21H5C4.44772 21 4 20.5523 4 20V11L1 11L11.3273 1.6115C11.7087 1.26475 12.2913 1.26475 12.6727 1.6115L23 11L20 11V20C20 20.5523 19.5523 21 19 21ZM6 19H18V9.15745L12 3.7029L6 9.15745V19ZM8 15H16V17H8V15Z"},child:[]}]})(A)}function inA(A){return JA({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM11 7H13V13H11V7Z"},child:[]}]})(A)}const tP=()=>{const{quillObj:A,state:e}=fo(),t=()=>{A&&A.history&&A.history.undo()},n=()=>{A&&A.history&&A.history.redo()};return l.jsxs("div",{className:"bg-muted order-2 w-full p-2 h-fit flex items-center justify-center gap-4 border-b",children:[l.jsx(rnA,{}),l.jsxs("div",{id:e.toolbarId,className:"!bg-transparent w-full !border-0 !p-0 h-fit flex flex-row gap-2 flex-wrap ql-toolbar",children:[l.jsx("span",{className:S("ql-formats","!rounded-sm !w-[120px] flex justify-between"),children:l.jsxs("select",{className:"ql-header !text-base !font-bold !w-full !m-0","data-tooltip":"Text Format",children:[l.jsx("option",{value:"",children:"Normal Text"}),l.jsx("option",{value:"1",className:"",children:"Heading 1"}),l.jsx("option",{value:"2",className:"",children:"Heading 2"}),l.jsx("option",{value:"3",className:"!",children:"Heading 3"}),l.jsx("option",{value:"4",className:"!",children:"Heading 4"}),l.jsx("option",{value:"5",className:"!",children:"Heading 5"}),l.jsx("option",{value:"6",className:"!",children:"Heading 6"})]})}),l.jsxs("span",{className:"ql-formats",children:[l.jsx("button",{className:"ql-bold","data-tooltip":"Bold (Ctrl+B)"}),l.jsx("button",{className:"ql-italic","data-tooltip":"Italic (Ctrl+I)"}),l.jsx("button",{className:"ql-underline","data-tooltip":"Underline (Ctrl+U)"}),l.jsx("button",{className:"ql-strike","data-tooltip":"Strike through"})]}),l.jsxs("span",{className:"ql-formats",children:[l.jsx("select",{className:"ql-align","data-tooltip":"Text Alignment"}),l.jsx("select",{className:"ql-color","data-tooltip":"Text Color"}),l.jsx("select",{className:"ql-background","data-tooltip":"Background Color"})]}),l.jsxs("span",{className:"ql-formats",children:[l.jsx("button",{className:"ql-blockquote","data-tooltip":"Blockquote"}),l.jsx("button",{className:"ql-code-block","data-tooltip":"Code Block"})]}),l.jsxs("span",{className:"ql-formats",children:[l.jsx("button",{className:"ql-list",value:"ordered","data-tooltip":"Numbered List"}),l.jsx("button",{className:"ql-list",value:"bullet","data-tooltip":"Bullet List"}),l.jsx("button",{className:"ql-indent",value:"-1","data-tooltip":"Decrease Indent"}),l.jsx("button",{className:"ql-indent",value:"+1","data-tooltip":"Increase Indent"})]}),l.jsx("span",{className:"ql-formats",children:l.jsx("button",{className:"ql-link","data-tooltip":"Insert Link (Ctrl+K)"})}),l.jsxs("span",{className:"ql-formats",children:[l.jsx("button",{onClick:t,"data-tooltip":"Undo (Ctrl+Z)",children:l.jsx(snA,{className:"text-xl"})}),l.jsx("button",{className:"ql-redo",onClick:n,"data-tooltip":"Redo (Ctrl+Y)",children:l.jsx(anA,{className:"text-xl"})})]})]})]})};function lnA(A){return JA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10 3H4a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1zM9 9H5V5h4v4zm11 4h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1zm-1 6h-4v-4h4v4zM17 3c-2.206 0-4 1.794-4 4s1.794 4 4 4 4-1.794 4-4-1.794-4-4-4zm0 6c-1.103 0-2-.897-2-2s.897-2 2-2 2 .897 2 2-.897 2-2 2zM7 13c-2.206 0-4 1.794-4 4s1.794 4 4 4 4-1.794 4-4-1.794-4-4-4zm0 6c-1.103 0-2-.897-2-2s.897-2 2-2 2 .897 2 2-.897 2-2 2z"},child:[]}]})(A)}function cnA(A){return JA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z"},child:[]}]})(A)}function unA(A){return JA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M21 15c0-4.625-3.507-8.441-8-8.941V4h-2v2.059c-4.493.5-8 4.316-8 8.941v2h18v-2zM5 15c0-3.859 3.141-7 7-7s7 3.141 7 7H5zm-3 3h20v2H2z"},child:[]}]})(A)}function fnA(A){return JA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z"},child:[]}]})(A)}const dnA=({selectedText:A})=>{const{dispatch:e,handleContentChange:t,handleInitiateEmbed:n,quillObj:r}=fo(),s=[{label:"Cut",action:"cut",disabled:!A,shortcut:"Ctrl+X"},{label:"Copy",action:"copy",disabled:!A,shortcut:"Ctrl+C"},{label:"Paste",action:"paste",disabled:!1,shortcut:"Ctrl+V"},{type:"separator"},{label:"Add Link",action:"link",disabled:!A,shortcut:"Ctrl+K"},{label:"Remove Link",action:"removeLink",disabled:!A,shortcut:""},{type:"separator"},{label:"Insert Image",action:"insertImage",disabled:!1,shortcut:""},{label:"Insert Video",action:"insertVideo",disabled:!1,shortcut:""},{label:"Insert Social Link",action:"insertSocial",disabled:!1,shortcut:""}],a=P.useCallback(()=>{var c;(c=r==null?void 0:r.root)!=null&&c.innerHTML&&t(r.root.innerHTML)},[r,t]),o=()=>{const c=document.querySelector('[data-state="open"]');c&&c.setAttribute("data-state","closed"),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0}))},i=P.useCallback(async c=>{if(!r)return;const u=r.getSelection();try{switch(c){case"cut":if(u&&u.length>0){const f=r.getText(u.index,u.length);await navigator.clipboard.writeText(f),r.deleteText(u.index,u.length),a()}break;case"copy":if(u&&u.length>0){const f=r.getText(u.index,u.length);await navigator.clipboard.writeText(f)}break;case"paste":try{const f=await navigator.clipboard.readText();u&&(r.insertText(u.index,f),a())}catch(f){console.warn("Failed to read clipboard:",f)}break;case"link":if(o(),u&&u.length>0){setTimeout(()=>{r.formatText(u.index,u.length,"link","https://","api"),a()},100);return}break;case"removeLink":u&&u.length>0&&(r.formatText(u.index,u.length,"link",!1),a());break;case"insertImage":o(),n("image");break;case"insertVideo":o(),n("video");break;case"insertSocial":o(),n("link");break}}catch(f){console.error("Context menu action failed:",f)}},[r,a,n]);return l.jsxs(P1,{className:"w-50",children:[s.map((c,u)=>c.type==="separator"?l.jsx(b1,{},u):l.jsxs(Op,{inset:!0,disabled:c.disabled,className:S("w-full text-left text-sm hover:bg-accent flex items-center justify-between !px-2 !py-2"),onClick:()=>!c.disabled&&i(c.action),children:[l.jsx("span",{children:c.label}),c.shortcut&&l.jsx(x1,{className:"text-xs text-gray-400 ml-4",children:c.shortcut})]},u)),l.jsxs(Op,{inset:!0,disabled:!A,className:S("w-full text-left text-sm hover:bg-accent flex items-center justify-start !px-2 !py-2 "),onClick:()=>{o(),e({type:"TOGGLE_EMBED_POST",payload:!0})},children:[l.jsx(fnA,{className:"text-md text-current"}),l.jsx("span",{children:"Insert Article"})]})]})},nP=()=>{const[A,e]=P.useState(""),{dispatch:t,state:{content:n,embedType:r,embedValue:s,quillRef:a},handleContentChange:o,blogPostsConfig:i,quillObj:c,imageGalleryConfig:u}=fo(),f=r&&s?{type:r,value:s}:void 0,d=((u==null?void 0:u.apolloUri)||"").replaceAll("/graphql",""),g=P.useCallback(m=>{var p,h,w,b;if(!c){console.warn("Quill editor not available for embed");return}try{const x=c.getSelection(!0)||{index:c.getLength(),length:0},z=document.getElementById("editorParent"),D=(z==null?void 0:z.scrollTop)||0,{type:B,value:M}=m;switch(B){case"link":{const[X,V]=M.split("||>>");X&&V&&(c.insertText(x.index,X,"user"),c.setSelection(x.index,X.length),c.formatText(x.index,X.length,"link",V));break}case"post":{const X=s;if(i!=null&&i.postBaseURL&&(X!=null&&X.slug)){const V=c.getSelection();V&&V.length>0&&c.formatText(V.index,V.length,"link",i.postBaseURL+X.slug)}break}case"image":{const X=M,{desktop:V,tablet:E,mobile:k,url:Z}=Dc({url:X.url,transformationsUrl:d}),C=(h=(p=X==null?void 0:X.src)==null?void 0:p.includes)!=null&&h.call(p,"unsplash")?"Unsplash":"Pexels",Q=`${X!=null&&X.photographer?`Photo by
|
|
440
440
|
<a href=${(w=X==null?void 0:X.photographer)==null?void 0:w.url} style="color: inherit;">${(b=X==null?void 0:X.photographer)==null?void 0:b.name}</a> on
|
|
441
441
|
<a href=${X==null?void 0:X.src} style="color: inherit;">${C}</a>`:(X==null?void 0:X.caption)??""}`,T={sources:[{srcset:rf(k),media:"(max-width: 640px)",type:"image/webp"},{srcset:rf(V),media:"(min-width: 1025px)",type:"image/webp"},{srcset:rf(E),media:"(max-width: 1024px)",type:"image/webp"}],fallbackSrc:rf(Z),alt:(X==null?void 0:X.caption)||(X==null?void 0:X.alternate_text)||"",caption:Q};c.insertEmbed(x.index,"picture",T,"user"),setTimeout(()=>{const H=c.getLength(),N=x.index+1;N>=H-1&&(c.insertText(N,`
|
|
442
|
-
`,"user"),c.setSelection(N+1,0))},100);break}case"htmlembed":c.clipboard.dangerouslyPasteHTML(x.index,M,"user");break;default:c.insertEmbed(x.index,B,M);break}z&&(z.scrollTop=D);const I=c.root.innerHTML;o(I),t({type:"RESET_EMBED"})}catch(x){console.error("Failed to handle embed:",x),t({type:"RESET_EMBED"})}},[c,t,o,i,s]);P.useEffect(()=>{f&&g(f)},[f,g]),P.useEffect(()=>{var p;if(!c)return;const m=h=>{const w=h&&h.length>0?c.getText(h.index,h.length):"";e(w.trim())};return(p=c==null?void 0:c.on)==null||p.call(c,"selection-change",m),()=>{var h;(h=c==null?void 0:c.off)==null||h.call(c,"selection-change",m)}},[c]);const v=P.useCallback(()=>{if(!n||n.trim().length===0)return 0;const m=n.replace(/<[^>]*>/g,"").trim();return m.length===0?0:m.split(/\s+/).filter(p=>p.length>0).length},[n]);return l.jsx(w1,{children:l.jsxs("div",{className:"flex order-3 h-full flex-col w-full relative bg-background",children:[l.jsx(y1,{className:"w-full h-10 grow flex flex-col items-center justify-center overflow-auto",children:l.jsx("div",{id:"editorParent",className:"flex w-full h-10 flex-1 items-center justify-center overflow-auto pb-10",children:l.jsx("div",{ref:a,id:"editor",className:"quill-editor text-md flex-1"})})}),l.jsx(dnA,{selectedText:A}),l.jsxs("div",{className:"flex justify-end text-sm text-muted-foreground border p-2 absolute bottom-0 right-0 w-full bg-muted",children:[v()," word count"]})]})})},mv=A=>new Promise(e=>{const t=setTimeout(()=>mv(A),10);typeof A<"u"&&(clearTimeout(t),e(null))}),So=({src:A=null,innerHTML:e=null,tag:t="head",async:n=!1,id:r=null})=>new Promise((s,a)=>{const o=document.createElement("script");A&&(o.src=A),e&&(o.innerHTML=e),r&&(o.id=r),n&&(o.async=!0),o.defer=!0,o.onload=()=>{s()},o.onerror=a;const i=document.getElementsByTagName(t)[0];i?i.appendChild(o):a(new Error(`Target element "${t}" not found`))}),gnA=(A="")=>{const e=document.createElement("div");e.innerHTML=A;const t=e.querySelector("iframe"),n=e.querySelector("span"),r=(n==null?void 0:n.style.width.replace("px",""))??"560",s=(n==null?void 0:n.style.height.replace("px",""))??"600";t.setAttribute("width",r),t.setAttribute("height",s);const a=t.getAttribute("src"),o=new URL(a);return o.searchParams.append("width",r),o.searchParams.append("height",s),t.setAttribute("src",o.toString()),t.outerHTML},vnA=(A="")=>{const e=document.createElement("div");e.innerHTML=A;const t=e.querySelector("iframe"),n="560",r="720",s=t.getAttribute("src"),a=new URL(s);return a.searchParams.append("width",n),a.searchParams.append("height",r),t.setAttribute("src",a.toString()),t.setAttribute("width",n),t.setAttribute("height",r),t.outerHTML},mnA=(A="")=>{var o,i;const e=document.createElement("div");e.innerHTML=A;const t=e.querySelector("iframe"),n=((o=t==null?void 0:t.getAttribute("height"))==null?void 0:o.replace("px",""))??"",r=((i=t==null?void 0:t.getAttribute("width"))==null?void 0:i.replace("px",""))??"",s=(t==null?void 0:t.getAttribute("src"))||"",a=new URL(s);return a.searchParams.append("height",n),a.searchParams.append("width",r),t==null||t.setAttribute("src",a.toString()),t.outerHTML},pnA=async()=>{await So({src:"https://www.instagram.com/embed.js"}),await So({src:"https://platform.twitter.com/widgets.js"}),await So({src:"https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v14.0",tag:"body"}),await So({src:"//embed.redditmedia.com/widgets/platform.js"})},hnA=A=>A.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||A.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/)||A.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/)||A.match(/^.*(youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#&?]*).*/),wnA=A=>A.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/),Vo=A=>{var n;const e=hnA(A);if(e&&((n=e[2])==null?void 0:n.length)===11)return{embed:!0,url:"https://www.youtube.com/embed/"+e[2]+"?showinfo=0"};const t=wnA(A);return t?{embed:!0,url:(t[1]||"https")+"://player.vimeo.com/video/"+t[2]+"/"}:{url:A,embed:!1}},rP=(A,e,t)=>{if(A&&"reportValidity"in A){const n=yA(t,e);A.setCustomValidity(n&&n.message||""),A.reportValidity()}},F2=(A,e)=>{for(const t in e.fields){const n=e.fields[t];n&&n.ref&&"reportValidity"in n.ref?rP(n.ref,t,A):n&&n.refs&&n.refs.forEach(r=>rP(r,t,A))}},sP=(A,e)=>{e.shouldUseNativeValidation&&F2(A,e);const t={};for(const n in A){const r=yA(e.fields,n),s=Object.assign(A[n]||{},{ref:r&&r.ref});if(ynA(e.names||Object.keys(A),n)){const a=Object.assign({},yA(t,n));Be(a,"root",s),Be(t,n,a)}else Be(t,n,s)}return t},ynA=(A,e)=>{const t=aP(e);return A.some(n=>aP(n).match(`^${t}\\.\\d+`))};function aP(A){return A.replace(/\]|\[/g,"")}function V4(A,e,t){function n(o,i){if(o._zod||Object.defineProperty(o,"_zod",{value:{def:i,constr:a,traits:new Set},enumerable:!1}),o._zod.traits.has(A))return;o._zod.traits.add(A),e(o,i);const c=a.prototype,u=Object.keys(c);for(let f=0;f<u.length;f++){const d=u[f];d in o||(o[d]=c[d].bind(o))}}const r=(t==null?void 0:t.Parent)??Object;class s extends r{}Object.defineProperty(s,"name",{value:A});function a(o){var i;const c=t!=null&&t.Parent?new s:this;n(c,o),(i=c._zod).deferred??(i.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var i,c;return t!=null&&t.Parent&&o instanceof t.Parent?!0:(c=(i=o==null?void 0:o._zod)==null?void 0:i.traits)==null?void 0:c.has(A)}}),Object.defineProperty(a,"name",{value:A}),a}class PnA extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const bnA={};function X4(A){return bnA}function xnA(A,e){return typeof e=="bigint"?e.toString():e}const Y4="captureStackTrace"in Error?Error.captureStackTrace:(...A)=>{};function lf(A){return typeof A=="string"?A:A==null?void 0:A.message}function G4(A,e,t){var r,s,a,o,i,c;const n={...A,path:A.path??[]};if(!A.message){const u=lf((a=(s=(r=A.inst)==null?void 0:r._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,A))??lf((o=e==null?void 0:e.error)==null?void 0:o.call(e,A))??lf((i=t.customError)==null?void 0:i.call(t,A))??lf((c=t.localeError)==null?void 0:c.call(t,A))??"Invalid input";n.message=u}return delete n.inst,delete n.continue,e!=null&&e.reportInput||delete n.input,n}const I4=(A,e)=>{A.name="$ZodError",Object.defineProperty(A,"_zod",{value:A._zod,enumerable:!1}),Object.defineProperty(A,"issues",{value:e,enumerable:!1}),A.message=JSON.stringify(e,xnA,2),Object.defineProperty(A,"toString",{value:()=>A.message,enumerable:!1})},znA=V4("$ZodError",I4),Q4=V4("$ZodError",I4,{Parent:Error}),DnA=A=>(e,t,n,r)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:t,issues:[]},s);if(a instanceof Promise)throw new PnA;if(a.issues.length){const o=new((r==null?void 0:r.Err)??A)(a.issues.map(i=>G4(i,s,X4())));throw Y4(o,r==null?void 0:r.callee),o}return a.value},BnA=DnA(Q4),MnA=A=>async(e,t,n,r)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let a=e._zod.run({value:t,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((r==null?void 0:r.Err)??A)(a.issues.map(i=>G4(i,s,X4())));throw Y4(o,r==null?void 0:r.callee),o}return a.value},CnA=MnA(Q4);function oP(A,e){try{var t=A()}catch(n){return e(n)}return t&&t.then?t.then(void 0,e):t}function jnA(A,e){for(var t={};A.length;){var n=A[0],r=n.code,s=n.message,a=n.path.join(".");if(!t[a])if("unionErrors"in n){var o=n.unionErrors[0].errors[0];t[a]={message:o.message,type:o.code}}else t[a]={message:s,type:r};if("unionErrors"in n&&n.unionErrors.forEach(function(u){return u.errors.forEach(function(f){return A.push(f)})}),e){var i=t[a].types,c=i&&i[n.code];t[a]=v9(a,e,t,r,c?[].concat(c,n.message):n.message)}A.shift()}return t}function OnA(A,e){for(var t={};A.length;){var n=A[0],r=n.code,s=n.message,a=n.path.join(".");if(!t[a])if(n.code==="invalid_union"&&n.errors.length>0){var o=n.errors[0][0];t[a]={message:o.message,type:o.code}}else t[a]={message:s,type:r};if(n.code==="invalid_union"&&n.errors.forEach(function(u){return u.forEach(function(f){return A.push(f)})}),e){var i=t[a].types,c=i&&i[n.code];t[a]=v9(a,e,t,r,c?[].concat(c,n.message):n.message)}A.shift()}return t}function pv(A,e,t){if(t===void 0&&(t={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(A))return function(n,r,s){try{return Promise.resolve(oP(function(){return Promise.resolve(A[t.mode==="sync"?"parse":"parseAsync"](n,e)).then(function(a){return s.shouldUseNativeValidation&&F2({},s),{errors:{},values:t.raw?Object.assign({},n):a}})},function(a){if((function(o){return Array.isArray(o==null?void 0:o.issues)})(a))return{values:{},errors:sP(jnA(a.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(A))return function(n,r,s){try{return Promise.resolve(oP(function(){return Promise.resolve((t.mode==="sync"?BnA:CnA)(A,n,e)).then(function(a){return s.shouldUseNativeValidation&&F2({},s),{errors:{},values:t.raw?Object.assign({},n):a}})},function(a){if((function(o){return o instanceof znA})(a))return{values:{},errors:sP(OnA(a.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}};throw new Error("Invalid input: not a Zod schema")}const TnA=["background","color","size","font"],EnA=(A,e)=>(e.ops=e.ops.map(t=>{const n=t.attributes;if(!n)return t;const r={...n};return TnA.forEach(s=>delete r[s]),Object.keys(r).length>0?{...t,attributes:r}:{insert:t.insert}}),e),HnA={history:{delay:500,maxStack:100,userOnly:!0},clipboard:{matchers:[["*",EnA]]}},NnA=["header","size","bold","italic","underline","align","list","indent","link","strike","image","video","color","blockquote","background","code-block","picture"],L4=Ee({url:dA().url("Invalid URL, enter valid URL")}),knA=()=>{const{state:{showEmbedVideo:A},dispatch:e,handleAddEmbed:t}=fo(),[n,r]=P.useState(Vo("")),s=()=>{e({type:"TOGGLE_EMBED_VIDEO",payload:!1})},a=()=>{t("video",n.url),r(Vo("")),s()},o=Dg({resolver:pv(L4),defaultValues:{url:""},reValidateMode:"onChange",mode:"onChange"}),i=async()=>{if(!c)throw new Error("Validation failed");a(),o.reset()},c=o.formState.isValid;return P.useEffect(()=>{const u=o.watch(async(f,{name:d,values:g})=>{d=="url"&&r(Vo(g.url??""))});return()=>u.unsubscribe()},[o]),l.jsx(xt,{open:A,onOpenChange:s,children:l.jsxs(vt,{className:"p-0 overflow-hidden rounded-xl border-0",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{children:l.jsx("h1",{className:"text-md",children:"Embed Video"})})}),l.jsxs("div",{className:"px-4 space-y-4 flex items-center justify-center flex-wrap",children:[c&&l.jsx("div",{className:"w-full [&_video]:max-h-50 [&_video]:lg:max-h-80",children:l.jsx($e,{label:"Video Preview",type:"video",value:n.url,linkProps:{className:"min-h-70 ![&_video]:lg:max-h-50"},onChange:u=>r(Vo(u))})}),l.jsx(io,{control:o.control,name:"url",render:({field:u,fieldState:f})=>l.jsx($e,{label:"Video Url",onChange:u.onChange,error:f.error,inputProps:{name:u.name,value:u.value,className:"underline",placeholder:"Video URL"}})},"url")]}),l.jsx(fn,{className:"flex flex-row p-4 pt-0 gap-4 justify-end mt-4",children:l.jsx(ve,{className:"rounded",variant:"primary",onClick:i,disabled:!c,children:"Embed"})})]})})};function ZnA(A){return JA({attr:{version:"1.1",viewBox:"0 0 20 16"},child:[{tag:"path",attr:{d:"M13 11.5l1.5 1.5 5-5-5-5-1.5 1.5 3.5 3.5z"},child:[]},{tag:"path",attr:{d:"M7 4.5l-1.5-1.5-5 5 5 5 1.5-1.5-3.5-3.5z"},child:[]},{tag:"path",attr:{d:"M10.958 2.352l1.085 0.296-3 11-1.085-0.296 3-11z"},child:[]}]})(A)}const SnA={title:"",content:"",showEmbedVideo:!1,showEmbedLink:!1,showEmbedImage:!1,showEmbedPost:!1,embedType:null,embedValue:"",error:!1,isLoading:!1,toolbarId:"",editorContainerId:""},VnA=(A,e)=>{switch(e.type){case"SET_TITLE":return{...A,title:e.payload};case"SET_CONTENT":return{...A,content:e.payload};case"TOGGLE_EMBED_VIDEO":return{...A,showEmbedVideo:e.payload};case"TOGGLE_EMBED_LINK":return{...A,showEmbedLink:e.payload};case"TOGGLE_EMBED_IMAGE":return{...A,showEmbedImage:e.payload};case"TOGGLE_EMBED_POST":return{...A,showEmbedPost:e.payload};case"SET_EMBED":return{...A,embedType:e.payload.type,embedValue:e.payload.value};case"INITIATE_EMBED":return{...A,embedType:e.payload,showEmbedVideo:e.payload==="video",showEmbedLink:e.payload==="link",showEmbedImage:e.payload==="image"};case"RESET_EMBED":return{...A,embedType:"",embedValue:"",showEmbedVideo:!1,showEmbedLink:!1,showEmbedImage:!1};case"SET_ERROR":return{...A,error:e.payload};case"SET_LOADING":return{...A,isLoading:e.payload};default:return A}};function XnA({url:A}){const e=sv(A||"",300),t=P.useCallback(async()=>{if(de.NEXT_PUBLIC_TWITTER_EMBED_ENDPOINT)return(await Ge.post(de.NEXT_PUBLIC_TWITTER_EMBED_ENDPOINT||"",{url:e})).data;throw console.error("Invalid Twitter Embed Configuration"),Error("Invalid Twitter Embed Configuration")},[e]);return nv({queryKey:[e],queryFn:t,staleTime:300*1e3,gcTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1})}const YnA=({value:A,label:e,removeCaption:t})=>{const n={text:s=>l.jsx("iframe",{className:"",allowFullScreen:!0,src:Vo(s).url}),tiktok:s=>l.jsx(GnA,{url:s,className:"custom__embed tiktok__embed"}),twitter:s=>l.jsx(InA,{url:s}),instagram:(s,a)=>l.jsx(LnA,{value:s,removeCaption:a}),facebook:(s,a)=>l.jsx(QnA,{value:s,removeCaption:a}),reddit:()=>l.jsx(JnA,{url:A})};P.useEffect(()=>{pnA()},[]);const r=n[e];if(!["text","facebook","tiktok","instagram","twitter","reddit"].includes(e)||!A)return l.jsx("div",{className:"w-fit max-h-[20vh] overflow-auto flex items-center justify-center border border-[#ccc]",children:l.jsx(ZnA,{size:30})});if(r)return l.jsx(l.Fragment,{children:r(A,t)})},GnA=({url:A="",className:e=""})=>{const[t,n]=P.useState(null);return P.useEffect(()=>{const r=async a=>{try{const o=await fetch(`https://www.tiktok.com/oembed?url=${encodeURIComponent(a)}`),{html:i=""}=await o.json();return i}catch(o){return console.error({summary:`TikTok Embed Fetch Failed For: ${a}`,message:o==null?void 0:o.message}),null}};(async()=>{if(!A)return;const a=await r(A);n(a)})().then(()=>{So({src:"https://www.tiktok.com/embed.js"})})},[A]),l.jsx("div",{className:e,dangerouslySetInnerHTML:{__html:t??""}})},InA=({url:A=""})=>{var s;const[e,t]=P.useState(null),n=P.useRef(null),r=XnA({url:A});return P.useEffect(()=>{const a=r.data;if(r.isError||!(a!=null&&a.embedHtml)||!n.current)return;t(a.embedHtml||null),(async()=>{await new Promise(i=>setTimeout(i,100)),window.twttr&&window.twttr.widgets&&n.current&&window.twttr.widgets.load(n.current)})()},[r.data,r.isError]),P.useEffect(()=>{if(!window.twttr){const a=document.createElement("script");a.src="https://platform.twitter.com/widgets.js",a.async=!0,document.body.appendChild(a)}},[]),l.jsxs("div",{className:"relative w-full max-w-[550px] min-h-20",children:[r.isLoading&&l.jsx("div",{className:"absolute h-full w-full inset-0 bg-secondary/20 animate-pulse rounded"}),r.isFetched&&l.jsx("div",{className:"w-full",ref:n,dangerouslySetInnerHTML:{__html:e}}),r.isError&&l.jsx("div",{className:"p-4 border border-red-200 bg-red-50 rounded text-red-600",children:(s=r.error)==null?void 0:s.message})]})},QnA=({value:A,removeCaption:e})=>(P.useEffect(()=>{(async()=>{var n,r,s;await mv(window.FB),(s=(r=(n=window.FB)==null?void 0:n.XFBML)==null?void 0:r.parse)==null||s.call(r)})()},[A,e]),l.jsx("div",{className:"fb-post custom__embed","data-href":A,"data-show-text":`${!e}`,children:l.jsx("blockquote",{cite:A,className:"fb-xfbml-parse-ignore"})})),LnA=({value:A,removeCaption:e})=>(P.useEffect(()=>{(async()=>{var n,r,s;await mv(window.instgrm),(s=(r=(n=window.instgrm)==null?void 0:n.Embeds)==null?void 0:r.process)==null||s.call(r)})()},[A,e]),l.jsx("div",{dangerouslySetInnerHTML:{__html:`<blockquote class="instagram-media" ${e?"":"data-instgrm-captioned"} data-instgrm-permalink="${A}?utm_source=ig_embed&utm_campaign=loading" data-instgrm-version="13" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:540px; min-width:326px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);"><div style="padding:16px;"> <a href="${A}?utm_source=ig_embed&utm_campaign=loading" style=" background:#FFFFFF; line-height:0; padding:0 0; text-align:center; text-decoration:none; width:100%;" target="_blank"> <div style=" display: flex; flex-direction: row; align-items: center;"> <div style="background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 40px; margin-right: 14px; width: 40px;"></div> <div style="display: flex; flex-direction: column; flex-grow: 1; justify-content: center;"> <div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 100px;"></div> <div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 60px;"></div></div></div><div style="padding: 19% 0;"></div> <div style="display:block; height:50px; margin:0 auto 12px; width:50px;"><svg width="50px" height="50px" viewBox="0 0 60 60" version="1.1" xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-511.000000, -20.000000)" fill="#000000"><g><path d="M556.869,30.41 C554.814,30.41 553.148,32.076 553.148,34.131 C553.148,36.186 554.814,37.852 556.869,37.852 C558.924,37.852 560.59,36.186 560.59,34.131 C560.59,32.076 558.924,30.41 556.869,30.41 M541,60.657 C535.114,60.657 530.342,55.887 530.342,50 C530.342,44.114 535.114,39.342 541,39.342 C546.887,39.342 551.658,44.114 551.658,50 C551.658,55.887 546.887,60.657 541,60.657 M541,33.886 C532.1,33.886 524.886,41.1 524.886,50 C524.886,58.899 532.1,66.113 541,66.113 C549.9,66.113 557.115,58.899 557.115,50 C557.115,41.1 549.9,33.886 541,33.886 M565.378,62.101 C565.244,65.022 564.756,66.606 564.346,67.663 C563.803,69.06 563.154,70.057 562.106,71.106 C561.058,72.155 560.06,72.803 558.662,73.347 C557.607,73.757 556.021,74.244 553.102,74.378 C549.944,74.521 548.997,74.552 541,74.552 C533.003,74.552 532.056,74.521 528.898,74.378 C525.979,74.244 524.393,73.757 523.338,73.347 C521.94,72.803 520.942,72.155 519.894,71.106 C518.846,70.057 518.197,69.06 517.654,67.663 C517.244,66.606 516.755,65.022 516.623,62.101 C516.479,58.943 516.448,57.996 516.448,50 C516.448,42.003 516.479,41.056 516.623,37.899 C516.755,34.978 517.244,33.391 517.654,32.338 C518.197,30.938 518.846,29.942 519.894,28.894 C520.942,27.846 521.94,27.196 523.338,26.654 C524.393,26.244 525.979,25.756 528.898,25.623 C532.057,25.479 533.004,25.448 541,25.448 C548.997,25.448 549.943,25.479 553.102,25.623 C556.021,25.756 557.607,26.244 558.662,26.654 C560.06,27.196 561.058,27.846 562.106,28.894 C563.154,29.942 563.803,30.938 564.346,32.338 C564.756,33.391 565.244,34.978 565.378,37.899 C565.522,41.056 565.552,42.003 565.552,50 C565.552,57.996 565.522,58.943 565.378,62.101 M570.82,37.631 C570.674,34.438 570.167,32.258 569.425,30.349 C568.659,28.377 567.633,26.702 565.965,25.035 C564.297,23.368 562.623,22.342 560.652,21.575 C558.743,20.834 556.562,20.326 553.369,20.18 C550.169,20.033 549.148,20 541,20 C532.853,20 531.831,20.033 528.631,20.18 C525.438,20.326 523.257,20.834 521.349,21.575 C519.376,22.342 517.703,23.368 516.035,25.035 C514.368,26.702 513.342,28.377 512.574,30.349 C511.834,32.258 511.326,34.438 511.181,37.631 C511.035,40.831 511,41.851 511,50 C511,58.147 511.035,59.17 511.181,62.369 C511.326,65.562 511.834,67.743 512.574,69.651 C513.342,71.625 514.368,73.296 516.035,74.965 C517.703,76.634 519.376,77.658 521.349,78.425 C523.257,79.167 525.438,79.673 528.631,79.82 C531.831,79.965 532.853,80.001 541,80.001 C549.148,80.001 550.169,79.965 553.369,79.82 C556.562,79.673 558.743,79.167 560.652,78.425 C562.623,77.658 564.297,76.634 565.965,74.965 C567.633,73.296 568.659,71.625 569.425,69.651 C570.167,67.743 570.674,65.562 570.82,62.369 C570.966,59.17 571,58.147 571,50 C571,41.851 570.966,40.831 570.82,37.631"></path></g></g></g></svg></div><div style="padding-top: 8px;"> <div style=" color:#3897f0; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:550; line-height:18px;"> View this post on Instagram</div></div><div style="padding: 12.5% 0;"></div> <div style="display: flex; flex-direction: row; margin-bottom: 14px; align-items: center;"><div> <div style="background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(0px) translateY(7px);"></div> <div style="background-color: #F4F4F4; height: 12.5px; transform: rotate(-45deg) translateX(3px) translateY(1px); width: 12.5px; flex-grow: 0; margin-right: 14px; margin-left: 2px;"></div> <div style="background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(9px) translateY(-18px);"></div></div><div style="margin-left: 8px;"> <div style=" background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 20px; width: 20px;"></div> <div style=" width: 0; height: 0; border-top: 2px solid transparent; border-left: 6px solid #f4f4f4; border-bottom: 2px solid transparent; transform: translateX(16px) translateY(-4px) rotate(30deg)"></div></div><div style="margin-left: auto;"> <div style=" width: 0px; border-top: 8px solid #F4F4F4; border-right: 8px solid transparent; transform: translateY(16px);"></div> <div style=" background-color: #F4F4F4; flex-grow: 0; height: 12px; width: 16px; transform: translateY(-4px);"></div> <div style=" width: 0; height: 0; border-top: 8px solid #F4F4F4; border-left: 8px solid transparent; transform: translateY(-4px) translateX(8px);"></div></div></div> <div style="display: flex; flex-direction: column; flex-grow: 1; justify-content: center; margin-bottom: 24px;"> <div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 224px;"></div> <div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 144px;"></div></div></a><p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;"><a href="${A}?utm_source=ig_embed&utm_campaign=loading" style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none;" target="_blank">A post shared by </a></p></div></blockquote>`}})),JnA=({url:A=""})=>{const e=P.useRef(null);return P.useEffect(()=>{(async()=>{!A||!e.current||(window.rembeddit||(await So({src:"//embed.redditmedia.com/widgets/platform.js"}),await mv(window.rembeddit)),setTimeout(()=>{if(window.rembeddit&&e.current)try{window.rembeddit.createEmbeds()}catch(n){console.warn("Reddit embed processing failed:",n)}},500))})()},[A]),l.jsx("div",{className:"w-full max-w-[600px] p-2 relative",children:l.jsx("div",{className:"custom__embed p-4",ref:e,children:l.jsx("blockquote",{className:"reddit-embed-bq","data-card-created":Date.now(),children:l.jsx("a",{href:A,children:A})})})})},Jm=[{label:"Text",value:"text"},{label:"Instagram",value:"instagram"},{label:"Facebook",value:"facebook"},{label:"X",value:"twitter"},{label:"Reddit",value:"reddit"},{label:"TikTok",value:"tiktok"}],qnA=()=>{var v;const{state:{showEmbedLink:A},dispatch:e,handleAddEmbed:t}=fo(),[n,r]=P.useState(((v=Jm[0])==null?void 0:v.value)||"text"),[s,a]=P.useState(""),o=P.useRef(null),i=Dg({resolver:pv(L4),defaultValues:{url:""},reValidateMode:"onChange",mode:"onChange"}),c=i.formState.isValid,u=m=>{t("htmlembed",m),d(),a("")},f=async()=>{var m,p,h,w,b;try{if(!c)throw new Error("Validation failed");switch(n){case"text":u((m=o.current)==null?void 0:m.innerHTML);break;case"tiktok":case"twitter":u(vnA((p=o.current)==null?void 0:p.innerHTML));break;case"facebook":u(gnA((h=o.current)==null?void 0:h.innerHTML));break;case"instagram":case"reddit":u(mnA((w=o.current)==null?void 0:w.innerHTML));break;default:break}r(((b=Jm[0])==null?void 0:b.value)||"text"),a("")}catch(x){console.log(x)}},d=()=>{e({type:"TOGGLE_EMBED_LINK",payload:!1})},g=m=>{const p=m;p!=null&&p.value&&r(p.value)};return P.useEffect(()=>{const m=i.watch((p,{name:h,values:w})=>{h=="url"&&a(w.url??"")});return()=>m.unsubscribe()},[i]),l.jsx(xt,{open:A,onOpenChange:d,children:l.jsxs(vt,{className:"sm:max-w-[600px] p-0 overflow-hidden rounded border-0",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{children:l.jsx("h1",{className:"text-md",children:"Embed Link"})})}),l.jsx("div",{className:"mx-auto mb-5 w-fit max-h-90 overflow-auto",id:"postembed",ref:o,children:c&&l.jsx(YnA,{label:n,removeCaption:!1,value:s})}),l.jsxs("div",{className:"px-4 space-y-4",children:[l.jsx($e,{label:"Social Media Platform",type:"select",value:{value:n,label:n},selectProps:{options:Jm,dataKey:"social-media-platforms"},onChange:g}),l.jsx(io,{control:i.control,name:"url",render:({field:m,fieldState:p})=>l.jsx(mr,{className:"flex-1",children:l.jsx(lo,{className:"w-full",children:l.jsx($e,{label:"URL",inputProps:{name:m.name,value:m.value,className:"underline",placeholder:"URL"},error:p.error,onChange:m.onChange})})})},"url")]}),l.jsxs(fn,{className:"flex flex-row p-4 pt-0 gap-4 justify-end mt-4",children:[l.jsx(ve,{className:"rounded",variant:"primary",onClick:f,disabled:!c,children:"Embed"}),l.jsx(ve,{variant:"outline",className:"rounded",onClick:d,children:"Cancel"})]})]})})},J4=({open:A=!0,onSave:e,handleToggleOpen:t,className:n,selectedPosts:r,columns:s,queryConfig:a,defaultState:o,gridCard:i,postType:c,filterFields:u,postBaseURL:f,apolloUri:d,...g})=>{const v=m=>{e==null||e(m),t==null||t(!1)};return l.jsx(xt,{open:A,onOpenChange:t,children:l.jsx(vt,{className:S("sm:max-w-[80%] md:max-w-[80%] h-[90%] shadow-lg p-0 overflow-hidden",n),children:l.jsx(dn,{columns:s,selectedPosts:r,queryConfig:a,defaultState:o,gridCard:i,postType:c,postBaseURL:f,filterFields:u,isSelect:!0,rootClassName:"h-full",gridColumnStyle:"repeat(auto-fit, minmax(210px, 1fr))",onSave:v,apolloUri:d,...g})})})},RnA=({className:A})=>{const{state:e,imageGalleryConfig:t,dispatch:n,handleAddEmbed:r,asChild:s,blogPostsConfig:a}=fo(),{showEmbedImage:o,showEmbedPost:i}=e,c=d=>{n({type:"TOGGLE_EMBED_IMAGE",payload:d})},u=d=>{r("image",d),c(!1)},f=d=>{d[0]&&r("post",d[0]),n({type:"TOGGLE_EMBED_POST",payload:!1})};return l.jsxs(l.Fragment,{children:[!s&&l.jsxs("div",{className:S("w-full h-full flex-1 flex flex-col no-scrollbar gap-2 border-1",A),"data-testid":"editor",children:[l.jsx(tP,{}),l.jsx(nP,{})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx(tP,{}),l.jsx(nP,{})]}),l.jsx(knA,{}),l.jsx(qnA,{}),t&&l.jsx(R2,{config:{...t,viewOnly:!0},open:o,onChange:d=>d&&u(d),handleToggleOpen:c}),a&&l.jsx(J4,{...a,open:i,selectedPosts:[],onSave:f,handleToggleOpen:d=>n({type:"TOGGLE_EMBED_POST",payload:d})})]})},WnA=({children:A,onChange:e,imageGalleryConfig:t,content:n,asChild:r,blogPostsConfig:s,twitterEmbedConfig:a})=>{const o=P.useRef(null),[i,c]=P.useState(null),u=P.useMemo(()=>({toolbarId:`toolbar-${Date.now()}`,editorContainerId:`editorParent-${Date.now()}`}),[]),[f,d]=P.useReducer(VnA,{...SnA,toolbarId:u.toolbarId,editorContainerId:u.editorContainerId,content:n||"",quillRef:o}),g=P.useCallback(h=>{const w=h.replace(/<div class="ql-picture-caption"([^>]*?)>Click to edit caption\.\.\.<\/div>/g,'<div class="ql-picture-caption"$1></div>');d({type:"SET_CONTENT",payload:w}),e==null||e(w)},[e]),v=h=>{setTimeout(()=>{d({type:"INITIATE_EMBED",payload:h})},100)},m=(h,w)=>{d({type:"SET_EMBED",payload:{type:h,value:w}})};P.useEffect(()=>{let h=null;return(async()=>{if(!(typeof window>"u"))try{const x=(await Promise.resolve().then(()=>require("./quill-CHSiUZ4y.cjs"))).default,D=await(await Promise.resolve().then(()=>require("./PictureBlot-BRQyAryr.cjs"))).default();D&&x.register("formats/picture",D,!0),o.current&&(h=new x(o.current,{theme:"snow",modules:{...HnA,toolbar:{container:`#${u.toolbarId}`}},formats:NnA,placeholder:"Add content"}),n&&n.trim()!==""&&(h==null||h.clipboard.dangerouslyPasteHTML(n,"silent")),h.on("text-change",()=>{if(h){const B=h.root.innerHTML;g(B)}}),h.root.addEventListener("keydown",B=>{var M,I;if(B.key==="Enter"&&h){const X=h.getSelection();if(X){const V=h.getLength();if(X.index>=V-1){const Z=h.root.lastElementChild;if(Z!=null&&Z.classList.contains("ql-picture-container")){B.preventDefault(),h.insertText(V,`
|
|
442
|
+
`,"user"),c.setSelection(N+1,0))},100);break}case"htmlembed":c.clipboard.dangerouslyPasteHTML(x.index,M,"user");break;default:c.insertEmbed(x.index,B,M);break}z&&(z.scrollTop=D);const I=c.root.innerHTML;o(I),t({type:"RESET_EMBED"})}catch(x){console.error("Failed to handle embed:",x),t({type:"RESET_EMBED"})}},[c,t,o,i,s]);P.useEffect(()=>{f&&g(f)},[f,g]),P.useEffect(()=>{var p;if(!c)return;const m=h=>{const w=h&&h.length>0?c.getText(h.index,h.length):"";e(w.trim())};return(p=c==null?void 0:c.on)==null||p.call(c,"selection-change",m),()=>{var h;(h=c==null?void 0:c.off)==null||h.call(c,"selection-change",m)}},[c]);const v=P.useCallback(()=>{if(!n||n.trim().length===0)return 0;const m=n.replace(/<[^>]*>/g,"").trim();return m.length===0?0:m.split(/\s+/).filter(p=>p.length>0).length},[n]);return l.jsx(w1,{children:l.jsxs("div",{className:"flex order-3 h-full flex-col w-full relative bg-background",children:[l.jsx(y1,{className:"w-full h-10 grow flex flex-col items-center justify-center overflow-auto",children:l.jsx("div",{id:"editorParent",className:"flex w-full h-10 flex-1 items-center justify-center overflow-auto pb-10",children:l.jsx("div",{ref:a,id:"editor",className:"quill-editor text-md flex-1"})})}),l.jsx(dnA,{selectedText:A}),l.jsxs("div",{className:"flex justify-end text-sm text-muted-foreground border p-2 absolute bottom-0 right-0 w-full bg-muted",children:[v()," word count"]})]})})},mv=A=>new Promise(e=>{const t=setTimeout(()=>mv(A),10);typeof A<"u"&&(clearTimeout(t),e(null))}),So=({src:A=null,innerHTML:e=null,tag:t="head",async:n=!1,id:r=null})=>new Promise((s,a)=>{const o=document.createElement("script");A&&(o.src=A),e&&(o.innerHTML=e),r&&(o.id=r),n&&(o.async=!0),o.defer=!0,o.onload=()=>{s()},o.onerror=a;const i=document.getElementsByTagName(t)[0];i?i.appendChild(o):a(new Error(`Target element "${t}" not found`))}),gnA=(A="")=>{const e=document.createElement("div");e.innerHTML=A;const t=e.querySelector("iframe"),n=e.querySelector("span"),r=(n==null?void 0:n.style.width.replace("px",""))??"560",s=(n==null?void 0:n.style.height.replace("px",""))??"600";t.setAttribute("width",r),t.setAttribute("height",s);const a=t.getAttribute("src"),o=new URL(a);return o.searchParams.append("width",r),o.searchParams.append("height",s),t.setAttribute("src",o.toString()),t.outerHTML},vnA=(A="")=>{const e=document.createElement("div");e.innerHTML=A;const t=e.querySelector("iframe"),n="560",r="720",s=t.getAttribute("src"),a=new URL(s);return a.searchParams.append("width",n),a.searchParams.append("height",r),t.setAttribute("src",a.toString()),t.setAttribute("width",n),t.setAttribute("height",r),t.outerHTML},mnA=(A="")=>{var o,i;const e=document.createElement("div");e.innerHTML=A;const t=e.querySelector("iframe"),n=((o=t==null?void 0:t.getAttribute("height"))==null?void 0:o.replace("px",""))??"",r=((i=t==null?void 0:t.getAttribute("width"))==null?void 0:i.replace("px",""))??"",s=(t==null?void 0:t.getAttribute("src"))||"",a=new URL(s);return a.searchParams.append("height",n),a.searchParams.append("width",r),t==null||t.setAttribute("src",a.toString()),t.outerHTML},pnA=async()=>{await So({src:"https://www.instagram.com/embed.js"}),await So({src:"https://platform.twitter.com/widgets.js"}),await So({src:"https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v14.0",tag:"body"}),await So({src:"//embed.redditmedia.com/widgets/platform.js"})},hnA=A=>A.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||A.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/)||A.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/)||A.match(/^.*(youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#&?]*).*/),wnA=A=>A.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/),Vo=A=>{var n;const e=hnA(A);if(e&&((n=e[2])==null?void 0:n.length)===11)return{embed:!0,url:"https://www.youtube.com/embed/"+e[2]+"?showinfo=0"};const t=wnA(A);return t?{embed:!0,url:(t[1]||"https")+"://player.vimeo.com/video/"+t[2]+"/"}:{url:A,embed:!1}},rP=(A,e,t)=>{if(A&&"reportValidity"in A){const n=yA(t,e);A.setCustomValidity(n&&n.message||""),A.reportValidity()}},F2=(A,e)=>{for(const t in e.fields){const n=e.fields[t];n&&n.ref&&"reportValidity"in n.ref?rP(n.ref,t,A):n&&n.refs&&n.refs.forEach(r=>rP(r,t,A))}},sP=(A,e)=>{e.shouldUseNativeValidation&&F2(A,e);const t={};for(const n in A){const r=yA(e.fields,n),s=Object.assign(A[n]||{},{ref:r&&r.ref});if(ynA(e.names||Object.keys(A),n)){const a=Object.assign({},yA(t,n));Be(a,"root",s),Be(t,n,a)}else Be(t,n,s)}return t},ynA=(A,e)=>{const t=aP(e);return A.some(n=>aP(n).match(`^${t}\\.\\d+`))};function aP(A){return A.replace(/\]|\[/g,"")}function V4(A,e,t){function n(o,i){if(o._zod||Object.defineProperty(o,"_zod",{value:{def:i,constr:a,traits:new Set},enumerable:!1}),o._zod.traits.has(A))return;o._zod.traits.add(A),e(o,i);const c=a.prototype,u=Object.keys(c);for(let f=0;f<u.length;f++){const d=u[f];d in o||(o[d]=c[d].bind(o))}}const r=(t==null?void 0:t.Parent)??Object;class s extends r{}Object.defineProperty(s,"name",{value:A});function a(o){var i;const c=t!=null&&t.Parent?new s:this;n(c,o),(i=c._zod).deferred??(i.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var i,c;return t!=null&&t.Parent&&o instanceof t.Parent?!0:(c=(i=o==null?void 0:o._zod)==null?void 0:i.traits)==null?void 0:c.has(A)}}),Object.defineProperty(a,"name",{value:A}),a}class PnA extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const bnA={};function X4(A){return bnA}function xnA(A,e){return typeof e=="bigint"?e.toString():e}const Y4="captureStackTrace"in Error?Error.captureStackTrace:(...A)=>{};function lf(A){return typeof A=="string"?A:A==null?void 0:A.message}function G4(A,e,t){var r,s,a,o,i,c;const n={...A,path:A.path??[]};if(!A.message){const u=lf((a=(s=(r=A.inst)==null?void 0:r._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,A))??lf((o=e==null?void 0:e.error)==null?void 0:o.call(e,A))??lf((i=t.customError)==null?void 0:i.call(t,A))??lf((c=t.localeError)==null?void 0:c.call(t,A))??"Invalid input";n.message=u}return delete n.inst,delete n.continue,e!=null&&e.reportInput||delete n.input,n}const I4=(A,e)=>{A.name="$ZodError",Object.defineProperty(A,"_zod",{value:A._zod,enumerable:!1}),Object.defineProperty(A,"issues",{value:e,enumerable:!1}),A.message=JSON.stringify(e,xnA,2),Object.defineProperty(A,"toString",{value:()=>A.message,enumerable:!1})},znA=V4("$ZodError",I4),Q4=V4("$ZodError",I4,{Parent:Error}),DnA=A=>(e,t,n,r)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:t,issues:[]},s);if(a instanceof Promise)throw new PnA;if(a.issues.length){const o=new((r==null?void 0:r.Err)??A)(a.issues.map(i=>G4(i,s,X4())));throw Y4(o,r==null?void 0:r.callee),o}return a.value},BnA=DnA(Q4),MnA=A=>async(e,t,n,r)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let a=e._zod.run({value:t,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((r==null?void 0:r.Err)??A)(a.issues.map(i=>G4(i,s,X4())));throw Y4(o,r==null?void 0:r.callee),o}return a.value},CnA=MnA(Q4);function oP(A,e){try{var t=A()}catch(n){return e(n)}return t&&t.then?t.then(void 0,e):t}function jnA(A,e){for(var t={};A.length;){var n=A[0],r=n.code,s=n.message,a=n.path.join(".");if(!t[a])if("unionErrors"in n){var o=n.unionErrors[0].errors[0];t[a]={message:o.message,type:o.code}}else t[a]={message:s,type:r};if("unionErrors"in n&&n.unionErrors.forEach(function(u){return u.errors.forEach(function(f){return A.push(f)})}),e){var i=t[a].types,c=i&&i[n.code];t[a]=v9(a,e,t,r,c?[].concat(c,n.message):n.message)}A.shift()}return t}function OnA(A,e){for(var t={};A.length;){var n=A[0],r=n.code,s=n.message,a=n.path.join(".");if(!t[a])if(n.code==="invalid_union"&&n.errors.length>0){var o=n.errors[0][0];t[a]={message:o.message,type:o.code}}else t[a]={message:s,type:r};if(n.code==="invalid_union"&&n.errors.forEach(function(u){return u.forEach(function(f){return A.push(f)})}),e){var i=t[a].types,c=i&&i[n.code];t[a]=v9(a,e,t,r,c?[].concat(c,n.message):n.message)}A.shift()}return t}function pv(A,e,t){if(t===void 0&&(t={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(A))return function(n,r,s){try{return Promise.resolve(oP(function(){return Promise.resolve(A[t.mode==="sync"?"parse":"parseAsync"](n,e)).then(function(a){return s.shouldUseNativeValidation&&F2({},s),{errors:{},values:t.raw?Object.assign({},n):a}})},function(a){if((function(o){return Array.isArray(o==null?void 0:o.issues)})(a))return{values:{},errors:sP(jnA(a.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(A))return function(n,r,s){try{return Promise.resolve(oP(function(){return Promise.resolve((t.mode==="sync"?BnA:CnA)(A,n,e)).then(function(a){return s.shouldUseNativeValidation&&F2({},s),{errors:{},values:t.raw?Object.assign({},n):a}})},function(a){if((function(o){return o instanceof znA})(a))return{values:{},errors:sP(OnA(a.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}};throw new Error("Invalid input: not a Zod schema")}const TnA=["background","color","size","font"],EnA=(A,e)=>(e.ops=e.ops.map(t=>{const n=t.attributes;if(!n)return t;const r={...n};return TnA.forEach(s=>delete r[s]),Object.keys(r).length>0?{...t,attributes:r}:{insert:t.insert}}),e),HnA={history:{delay:500,maxStack:100,userOnly:!0},clipboard:{matchers:[["*",EnA]]}},NnA=["header","size","bold","italic","underline","align","list","indent","link","strike","image","video","color","blockquote","background","code-block","picture"],L4=Ee({url:dA().url("Invalid URL, enter valid URL")}),knA=()=>{const{state:{showEmbedVideo:A},dispatch:e,handleAddEmbed:t}=fo(),[n,r]=P.useState(Vo("")),s=()=>{e({type:"TOGGLE_EMBED_VIDEO",payload:!1})},a=()=>{t("video",n.url),r(Vo("")),s()},o=Dg({resolver:pv(L4),defaultValues:{url:""},reValidateMode:"onChange",mode:"onChange"}),i=async()=>{if(!c)throw new Error("Validation failed");a(),o.reset()},c=o.formState.isValid;return P.useEffect(()=>{const u=o.watch(async(f,{name:d,values:g})=>{d=="url"&&r(Vo(g.url??""))});return()=>u.unsubscribe()},[o]),l.jsx(xt,{open:A,onOpenChange:s,children:l.jsxs(vt,{className:"p-0 overflow-hidden rounded-xl border-0",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{children:l.jsx("h1",{className:"text-md",children:"Embed Video"})})}),l.jsxs("div",{className:"px-4 space-y-4 flex items-center justify-center flex-wrap",children:[c&&l.jsx("div",{className:"w-full [&_video]:max-h-50 [&_video]:lg:max-h-80",children:l.jsx($e,{label:"Video Preview",type:"video",value:n.url,linkProps:{className:"min-h-70 ![&_video]:lg:max-h-50"},onChange:u=>r(Vo(u))})}),l.jsx(io,{control:o.control,name:"url",render:({field:u,fieldState:f})=>l.jsx($e,{label:"Video Url",onChange:u.onChange,error:f.error,inputProps:{name:u.name,value:u.value,className:"underline",placeholder:"Video URL"}})},"url")]}),l.jsx(fn,{className:"flex flex-row p-4 pt-0 gap-4 justify-end mt-4",children:l.jsx(ve,{className:"rounded",variant:"primary",onClick:i,disabled:!c,children:"Embed"})})]})})};function ZnA(A){return JA({attr:{version:"1.1",viewBox:"0 0 20 16"},child:[{tag:"path",attr:{d:"M13 11.5l1.5 1.5 5-5-5-5-1.5 1.5 3.5 3.5z"},child:[]},{tag:"path",attr:{d:"M7 4.5l-1.5-1.5-5 5 5 5 1.5-1.5-3.5-3.5z"},child:[]},{tag:"path",attr:{d:"M10.958 2.352l1.085 0.296-3 11-1.085-0.296 3-11z"},child:[]}]})(A)}const SnA={title:"",content:"",showEmbedVideo:!1,showEmbedLink:!1,showEmbedImage:!1,showEmbedPost:!1,embedType:null,embedValue:"",error:!1,isLoading:!1,toolbarId:"",editorContainerId:""},VnA=(A,e)=>{switch(e.type){case"SET_TITLE":return{...A,title:e.payload};case"SET_CONTENT":return{...A,content:e.payload};case"TOGGLE_EMBED_VIDEO":return{...A,showEmbedVideo:e.payload};case"TOGGLE_EMBED_LINK":return{...A,showEmbedLink:e.payload};case"TOGGLE_EMBED_IMAGE":return{...A,showEmbedImage:e.payload};case"TOGGLE_EMBED_POST":return{...A,showEmbedPost:e.payload};case"SET_EMBED":return{...A,embedType:e.payload.type,embedValue:e.payload.value};case"INITIATE_EMBED":return{...A,embedType:e.payload,showEmbedVideo:e.payload==="video",showEmbedLink:e.payload==="link",showEmbedImage:e.payload==="image"};case"RESET_EMBED":return{...A,embedType:"",embedValue:"",showEmbedVideo:!1,showEmbedLink:!1,showEmbedImage:!1};case"SET_ERROR":return{...A,error:e.payload};case"SET_LOADING":return{...A,isLoading:e.payload};default:return A}};function XnA({url:A}){const e=sv(A||"",300),t=P.useCallback(async()=>{if(de.NEXT_PUBLIC_TWITTER_EMBED_ENDPOINT)return(await Ge.post(de.NEXT_PUBLIC_TWITTER_EMBED_ENDPOINT||"",{url:e})).data;throw console.error("Invalid Twitter Embed Configuration"),Error("Invalid Twitter Embed Configuration")},[e]);return nv({queryKey:[e],queryFn:t,staleTime:300*1e3,gcTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1})}const YnA=({value:A,label:e,removeCaption:t})=>{const n={text:s=>l.jsx("iframe",{className:"",allowFullScreen:!0,src:Vo(s).url}),tiktok:s=>l.jsx(GnA,{url:s,className:"custom__embed tiktok__embed"}),twitter:s=>l.jsx(InA,{url:s}),instagram:(s,a)=>l.jsx(LnA,{value:s,removeCaption:a}),facebook:(s,a)=>l.jsx(QnA,{value:s,removeCaption:a}),reddit:()=>l.jsx(JnA,{url:A})};P.useEffect(()=>{pnA()},[]);const r=n[e];if(!["text","facebook","tiktok","instagram","twitter","reddit"].includes(e)||!A)return l.jsx("div",{className:"w-fit max-h-[20vh] overflow-auto flex items-center justify-center border border-[#ccc]",children:l.jsx(ZnA,{size:30})});if(r)return l.jsx(l.Fragment,{children:r(A,t)})},GnA=({url:A="",className:e=""})=>{const[t,n]=P.useState(null);return P.useEffect(()=>{const r=async a=>{try{const o=await fetch(`https://www.tiktok.com/oembed?url=${encodeURIComponent(a)}`),{html:i=""}=await o.json();return i}catch(o){return console.error({summary:`TikTok Embed Fetch Failed For: ${a}`,message:o==null?void 0:o.message}),null}};(async()=>{if(!A)return;const a=await r(A);n(a)})().then(()=>{So({src:"https://www.tiktok.com/embed.js"})})},[A]),l.jsx("div",{className:e,dangerouslySetInnerHTML:{__html:t??""}})},InA=({url:A=""})=>{var s;const[e,t]=P.useState(null),n=P.useRef(null),r=XnA({url:A});return P.useEffect(()=>{const a=r.data;if(r.isError||!(a!=null&&a.embedHtml)||!n.current)return;t(a.embedHtml||null),(async()=>{await new Promise(i=>setTimeout(i,100)),window.twttr&&window.twttr.widgets&&n.current&&window.twttr.widgets.load(n.current)})()},[r.data,r.isError]),P.useEffect(()=>{if(!window.twttr){const a=document.createElement("script");a.src="https://platform.twitter.com/widgets.js",a.async=!0,document.body.appendChild(a)}},[]),l.jsxs("div",{className:"relative w-full max-w-[550px] min-h-20",children:[r.isLoading&&l.jsx("div",{className:"absolute h-full w-full inset-0 bg-secondary/20 animate-pulse rounded"}),r.isFetched&&l.jsx("div",{className:"w-full",ref:n,dangerouslySetInnerHTML:{__html:e}}),r.isError&&l.jsx("div",{className:"p-4 border border-red-200 bg-red-50 rounded text-red-600",children:(s=r.error)==null?void 0:s.message})]})},QnA=({value:A,removeCaption:e})=>(P.useEffect(()=>{(async()=>{var n,r,s;await mv(window.FB),(s=(r=(n=window.FB)==null?void 0:n.XFBML)==null?void 0:r.parse)==null||s.call(r)})()},[A,e]),l.jsx("div",{className:"fb-post custom__embed","data-href":A,"data-show-text":`${!e}`,children:l.jsx("blockquote",{cite:A,className:"fb-xfbml-parse-ignore"})})),LnA=({value:A,removeCaption:e})=>(P.useEffect(()=>{(async()=>{var n,r,s;await mv(window.instgrm),(s=(r=(n=window.instgrm)==null?void 0:n.Embeds)==null?void 0:r.process)==null||s.call(r)})()},[A,e]),l.jsx("div",{dangerouslySetInnerHTML:{__html:`<blockquote class="instagram-media" ${e?"":"data-instgrm-captioned"} data-instgrm-permalink="${A}?utm_source=ig_embed&utm_campaign=loading" data-instgrm-version="13" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:540px; min-width:326px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);"><div style="padding:16px;"> <a href="${A}?utm_source=ig_embed&utm_campaign=loading" style=" background:#FFFFFF; line-height:0; padding:0 0; text-align:center; text-decoration:none; width:100%;" target="_blank"> <div style=" display: flex; flex-direction: row; align-items: center;"> <div style="background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 40px; margin-right: 14px; width: 40px;"></div> <div style="display: flex; flex-direction: column; flex-grow: 1; justify-content: center;"> <div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 100px;"></div> <div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 60px;"></div></div></div><div style="padding: 19% 0;"></div> <div style="display:block; height:50px; margin:0 auto 12px; width:50px;"><svg width="50px" height="50px" viewBox="0 0 60 60" version="1.1" xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-511.000000, -20.000000)" fill="#000000"><g><path d="M556.869,30.41 C554.814,30.41 553.148,32.076 553.148,34.131 C553.148,36.186 554.814,37.852 556.869,37.852 C558.924,37.852 560.59,36.186 560.59,34.131 C560.59,32.076 558.924,30.41 556.869,30.41 M541,60.657 C535.114,60.657 530.342,55.887 530.342,50 C530.342,44.114 535.114,39.342 541,39.342 C546.887,39.342 551.658,44.114 551.658,50 C551.658,55.887 546.887,60.657 541,60.657 M541,33.886 C532.1,33.886 524.886,41.1 524.886,50 C524.886,58.899 532.1,66.113 541,66.113 C549.9,66.113 557.115,58.899 557.115,50 C557.115,41.1 549.9,33.886 541,33.886 M565.378,62.101 C565.244,65.022 564.756,66.606 564.346,67.663 C563.803,69.06 563.154,70.057 562.106,71.106 C561.058,72.155 560.06,72.803 558.662,73.347 C557.607,73.757 556.021,74.244 553.102,74.378 C549.944,74.521 548.997,74.552 541,74.552 C533.003,74.552 532.056,74.521 528.898,74.378 C525.979,74.244 524.393,73.757 523.338,73.347 C521.94,72.803 520.942,72.155 519.894,71.106 C518.846,70.057 518.197,69.06 517.654,67.663 C517.244,66.606 516.755,65.022 516.623,62.101 C516.479,58.943 516.448,57.996 516.448,50 C516.448,42.003 516.479,41.056 516.623,37.899 C516.755,34.978 517.244,33.391 517.654,32.338 C518.197,30.938 518.846,29.942 519.894,28.894 C520.942,27.846 521.94,27.196 523.338,26.654 C524.393,26.244 525.979,25.756 528.898,25.623 C532.057,25.479 533.004,25.448 541,25.448 C548.997,25.448 549.943,25.479 553.102,25.623 C556.021,25.756 557.607,26.244 558.662,26.654 C560.06,27.196 561.058,27.846 562.106,28.894 C563.154,29.942 563.803,30.938 564.346,32.338 C564.756,33.391 565.244,34.978 565.378,37.899 C565.522,41.056 565.552,42.003 565.552,50 C565.552,57.996 565.522,58.943 565.378,62.101 M570.82,37.631 C570.674,34.438 570.167,32.258 569.425,30.349 C568.659,28.377 567.633,26.702 565.965,25.035 C564.297,23.368 562.623,22.342 560.652,21.575 C558.743,20.834 556.562,20.326 553.369,20.18 C550.169,20.033 549.148,20 541,20 C532.853,20 531.831,20.033 528.631,20.18 C525.438,20.326 523.257,20.834 521.349,21.575 C519.376,22.342 517.703,23.368 516.035,25.035 C514.368,26.702 513.342,28.377 512.574,30.349 C511.834,32.258 511.326,34.438 511.181,37.631 C511.035,40.831 511,41.851 511,50 C511,58.147 511.035,59.17 511.181,62.369 C511.326,65.562 511.834,67.743 512.574,69.651 C513.342,71.625 514.368,73.296 516.035,74.965 C517.703,76.634 519.376,77.658 521.349,78.425 C523.257,79.167 525.438,79.673 528.631,79.82 C531.831,79.965 532.853,80.001 541,80.001 C549.148,80.001 550.169,79.965 553.369,79.82 C556.562,79.673 558.743,79.167 560.652,78.425 C562.623,77.658 564.297,76.634 565.965,74.965 C567.633,73.296 568.659,71.625 569.425,69.651 C570.167,67.743 570.674,65.562 570.82,62.369 C570.966,59.17 571,58.147 571,50 C571,41.851 570.966,40.831 570.82,37.631"></path></g></g></g></svg></div><div style="padding-top: 8px;"> <div style=" color:#3897f0; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:550; line-height:18px;"> View this post on Instagram</div></div><div style="padding: 12.5% 0;"></div> <div style="display: flex; flex-direction: row; margin-bottom: 14px; align-items: center;"><div> <div style="background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(0px) translateY(7px);"></div> <div style="background-color: #F4F4F4; height: 12.5px; transform: rotate(-45deg) translateX(3px) translateY(1px); width: 12.5px; flex-grow: 0; margin-right: 14px; margin-left: 2px;"></div> <div style="background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(9px) translateY(-18px);"></div></div><div style="margin-left: 8px;"> <div style=" background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 20px; width: 20px;"></div> <div style=" width: 0; height: 0; border-top: 2px solid transparent; border-left: 6px solid #f4f4f4; border-bottom: 2px solid transparent; transform: translateX(16px) translateY(-4px) rotate(30deg)"></div></div><div style="margin-left: auto;"> <div style=" width: 0px; border-top: 8px solid #F4F4F4; border-right: 8px solid transparent; transform: translateY(16px);"></div> <div style=" background-color: #F4F4F4; flex-grow: 0; height: 12px; width: 16px; transform: translateY(-4px);"></div> <div style=" width: 0; height: 0; border-top: 8px solid #F4F4F4; border-left: 8px solid transparent; transform: translateY(-4px) translateX(8px);"></div></div></div> <div style="display: flex; flex-direction: column; flex-grow: 1; justify-content: center; margin-bottom: 24px;"> <div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 224px;"></div> <div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 144px;"></div></div></a><p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;"><a href="${A}?utm_source=ig_embed&utm_campaign=loading" style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none;" target="_blank">A post shared by </a></p></div></blockquote>`}})),JnA=({url:A=""})=>{const e=P.useRef(null);return P.useEffect(()=>{(async()=>{!A||!e.current||(window.rembeddit||(await So({src:"//embed.redditmedia.com/widgets/platform.js"}),await mv(window.rembeddit)),setTimeout(()=>{if(window.rembeddit&&e.current)try{window.rembeddit.createEmbeds()}catch(n){console.warn("Reddit embed processing failed:",n)}},500))})()},[A]),l.jsx("div",{className:"w-full max-w-[600px] p-2 relative",children:l.jsx("div",{className:"custom__embed p-4",ref:e,children:l.jsx("blockquote",{className:"reddit-embed-bq","data-card-created":Date.now(),children:l.jsx("a",{href:A,children:A})})})})},Jm=[{label:"Text",value:"text"},{label:"Instagram",value:"instagram"},{label:"Facebook",value:"facebook"},{label:"X",value:"twitter"},{label:"Reddit",value:"reddit"},{label:"TikTok",value:"tiktok"}],qnA=()=>{var v;const{state:{showEmbedLink:A},dispatch:e,handleAddEmbed:t}=fo(),[n,r]=P.useState(((v=Jm[0])==null?void 0:v.value)||"text"),[s,a]=P.useState(""),o=P.useRef(null),i=Dg({resolver:pv(L4),defaultValues:{url:""},reValidateMode:"onChange",mode:"onChange"}),c=i.formState.isValid,u=m=>{t("htmlembed",m),d(),a("")},f=async()=>{var m,p,h,w,b;try{if(!c)throw new Error("Validation failed");switch(n){case"text":u((m=o.current)==null?void 0:m.innerHTML);break;case"tiktok":case"twitter":u(vnA((p=o.current)==null?void 0:p.innerHTML));break;case"facebook":u(gnA((h=o.current)==null?void 0:h.innerHTML));break;case"instagram":case"reddit":u(mnA((w=o.current)==null?void 0:w.innerHTML));break;default:break}r(((b=Jm[0])==null?void 0:b.value)||"text"),a("")}catch(x){console.log(x)}},d=()=>{e({type:"TOGGLE_EMBED_LINK",payload:!1})},g=m=>{const p=m;p!=null&&p.value&&r(p.value)};return P.useEffect(()=>{const m=i.watch((p,{name:h,values:w})=>{h=="url"&&a(w.url??"")});return()=>m.unsubscribe()},[i]),l.jsx(xt,{open:A,onOpenChange:d,children:l.jsxs(vt,{className:"sm:max-w-[600px] p-0 overflow-hidden rounded border-0",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{children:l.jsx("h1",{className:"text-md",children:"Embed Link"})})}),l.jsx("div",{className:"mx-auto mb-5 w-fit max-h-90 overflow-auto",id:"postembed",ref:o,children:c&&l.jsx(YnA,{label:n,removeCaption:!1,value:s})}),l.jsxs("div",{className:"px-4 space-y-4",children:[l.jsx($e,{label:"Social Media Platform",type:"select",value:{value:n,label:n},selectProps:{options:Jm,dataKey:"social-media-platforms"},onChange:g}),l.jsx(io,{control:i.control,name:"url",render:({field:m,fieldState:p})=>l.jsx(mr,{className:"flex-1",children:l.jsx(lo,{className:"w-full",children:l.jsx($e,{label:"URL",inputProps:{name:m.name,value:m.value,className:"underline",placeholder:"URL"},error:p.error,onChange:m.onChange})})})},"url")]}),l.jsxs(fn,{className:"flex flex-row p-4 pt-0 gap-4 justify-end mt-4",children:[l.jsx(ve,{className:"rounded",variant:"primary",onClick:f,disabled:!c,children:"Embed"}),l.jsx(ve,{variant:"outline",className:"rounded",onClick:d,children:"Cancel"})]})]})})},J4=({open:A=!0,onSave:e,handleToggleOpen:t,className:n,selectedPosts:r,columns:s,queryConfig:a,defaultState:o,gridCard:i,postType:c,filterFields:u,postBaseURL:f,apolloUri:d,...g})=>{const v=m=>{e==null||e(m),t==null||t(!1)};return l.jsx(xt,{open:A,onOpenChange:t,children:l.jsx(vt,{className:S("sm:max-w-[80%] md:max-w-[80%] h-[90%] shadow-lg p-0 overflow-hidden",n),children:l.jsx(dn,{columns:s,selectedPosts:r,queryConfig:a,defaultState:o,gridCard:i,postType:c,postBaseURL:f,filterFields:u,isSelect:!0,rootClassName:"h-full",gridColumnStyle:"repeat(auto-fit, minmax(210px, 1fr))",onSave:v,apolloUri:d,...g})})})},RnA=({className:A})=>{const{state:e,imageGalleryConfig:t,dispatch:n,handleAddEmbed:r,asChild:s,blogPostsConfig:a}=fo(),{showEmbedImage:o,showEmbedPost:i}=e,c=d=>{n({type:"TOGGLE_EMBED_IMAGE",payload:d})},u=d=>{r("image",d),c(!1)},f=d=>{d[0]&&r("post",d[0]),n({type:"TOGGLE_EMBED_POST",payload:!1})};return l.jsxs(l.Fragment,{children:[!s&&l.jsxs("div",{className:S("w-full h-full flex-1 flex flex-col no-scrollbar gap-2 border-1",A),"data-testid":"editor",children:[l.jsx(tP,{}),l.jsx(nP,{})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx(tP,{}),l.jsx(nP,{})]}),l.jsx(knA,{}),l.jsx(qnA,{}),t&&l.jsx(R2,{config:{...t,viewOnly:!0},open:o,onChange:d=>d&&u(d),handleToggleOpen:c}),a&&l.jsx(J4,{...a,open:i,selectedPosts:[],onSave:f,handleToggleOpen:d=>n({type:"TOGGLE_EMBED_POST",payload:d})})]})},WnA=({children:A,onChange:e,imageGalleryConfig:t,content:n,asChild:r,blogPostsConfig:s,twitterEmbedConfig:a})=>{const o=P.useRef(null),[i,c]=P.useState(null),u=P.useMemo(()=>({toolbarId:`toolbar-${Date.now()}`,editorContainerId:`editorParent-${Date.now()}`}),[]),[f,d]=P.useReducer(VnA,{...SnA,toolbarId:u.toolbarId,editorContainerId:u.editorContainerId,content:n||"",quillRef:o}),g=P.useCallback(h=>{const w=h.replace(/<div class="ql-picture-caption"([^>]*?)>Click to edit caption\.\.\.<\/div>/g,'<div class="ql-picture-caption"$1></div>');d({type:"SET_CONTENT",payload:w}),e==null||e(w)},[e]),v=h=>{setTimeout(()=>{d({type:"INITIATE_EMBED",payload:h})},100)},m=(h,w)=>{d({type:"SET_EMBED",payload:{type:h,value:w}})};P.useEffect(()=>{let h=null;return(async()=>{if(!(typeof window>"u"))try{const x=(await Promise.resolve().then(()=>require("./quill-B8jLsVN2.cjs"))).default,D=await(await Promise.resolve().then(()=>require("./PictureBlot-DyTkCWww.cjs"))).default();D&&x.register("formats/picture",D,!0),o.current&&(h=new x(o.current,{theme:"snow",modules:{...HnA,toolbar:{container:`#${u.toolbarId}`}},formats:NnA,placeholder:"Add content"}),n&&n.trim()!==""&&(h==null||h.clipboard.dangerouslyPasteHTML(n,"silent")),h.on("text-change",()=>{if(h){const B=h.root.innerHTML;g(B)}}),h.root.addEventListener("keydown",B=>{var M,I;if(B.key==="Enter"&&h){const X=h.getSelection();if(X){const V=h.getLength();if(X.index>=V-1){const Z=h.root.lastElementChild;if(Z!=null&&Z.classList.contains("ql-picture-container")){B.preventDefault(),h.insertText(V,`
|
|
443
443
|
`,"user"),h.setSelection(V+1,0);return}}const[E]=h.getLeaf(X.index);if((I=(M=E==null?void 0:E.domNode)==null?void 0:M.closest)==null?void 0:I.call(M,".ql-picture-container")){B.preventDefault();const Z=X.index;h.insertText(Z+1,`
|
|
444
444
|
`,"user"),h.setSelection(Z+2,0)}}}}),h.on("text-change",(B,M,I)=>{if(I==="user"){if(document.querySelector('.ql-picture-caption[data-editing="true"]'))return;setTimeout(()=>{if(!h)return;const V=h.root.innerHTML,E=/<p[^>]*class="[^"]*ql-align-[^"]*"[^>]*><br><\/p>/g,k=V.replace(E,"<p><br></p>");if(/^<p[^>]*class="[^"]*ql-align-[^"]*"[^>]*><br><\/p>$/.test(V.trim()))h.root.innerHTML="<p><br></p>",h.setSelection(0,0);else if(k!==V){h.root.innerHTML=k;const C=h.getSelection();C&&h.setSelection(C.index,C.length)}},100)}}),c(h))}catch(b){console.error("Failed to load Quill editor:",b)}})(),()=>{h&&h.off("text-change"),c(null)}},[o]),P.useEffect(()=>{i&&n&&!f.content&&(i.clipboard.dangerouslyPasteHTML(n,"silent"),d({type:"SET_CONTENT",payload:n}))},[n,i]);const p={state:f,dispatch:d,handleContentChange:g,handleInitiateEmbed:v,handleAddEmbed:m,imageGalleryConfig:t,blogPostsConfig:s,onChange:e,asChild:r,quillObj:i,setQuillObj:c,twitterEmbedConfig:a};return l.jsx(S4.Provider,{value:p,children:A})},FnA=({className:A,onChange:e,initialValue:t,content:n,imageGalleryConfig:r,blogPostsConfig:s,asChild:a,twitterEmbedConfig:o})=>l.jsx(WnA,{content:n||t,onChange:e,imageGalleryConfig:r,asChild:a,blogPostsConfig:s,twitterEmbedConfig:o,children:l.jsx(RnA,{className:A})}),KnA=()=>{const{state:A,dispatch:e,onChange:t,linkProps:n}=zn(),{value:r}=A,[s,a]=y.useState(!0),[o,i]=y.useState(0),[c,u]=y.useState(0),[f,d]=y.useState(0),[g,v]=y.useState(""),[m,p]=y.useState(0),[h,w]=y.useState(!1),[b,x]=y.useState({x:0,y:0}),z=y.useRef(null),D=y.useRef(null),B=y.useRef(null),M=y.useRef(null),I=Vo(r),X=()=>{e({type:"SET_VALUE",payload:""}),t&&t("")},V=y.useCallback(()=>{z.current&&(s?z.current.play():z.current.pause(),a(!s))},[s]),E=y.useCallback(()=>{if(z.current){const H=z.current.currentTime,N=z.current.duration;i(H),d(N>0?H/N*100:0),D.current&&(D.current.currentTime=H)}},[]),k=y.useCallback(()=>{z.current&&(u(z.current.duration),Y(I.url))},[I.url]),Z=y.useCallback(H=>{if(B.current&&z.current&&c>0){const N=B.current.getBoundingClientRect(),j=(H.clientX-N.left)/N.width*c;if(p(j),x({x:H.clientX-N.left,y:N.top-10}),w(!0),M.current&&z.current){const O=M.current,G=O.getContext("2d");if(G){const J=document.createElement("video");J.src=I.url,J.currentTime=j,J.muted=!0,J.addEventListener("seeked",()=>{G.drawImage(J,0,0,O.width,O.height)},{once:!0})}}}},[c,I]),C=y.useCallback(()=>{w(!1)},[]),Q=y.useCallback(H=>{if(B.current&&z.current&&c>0){const N=B.current.getBoundingClientRect(),j=(H.clientX-N.left)/N.width*c;z.current.currentTime=j,i(j),d(j/c*100)}},[c]),Y=y.useCallback(H=>{try{const N=H.split("/"),j=N[N.length-1];if(j&&j.includes(".")){const J=j.split(".").slice(0,-1).join("."),nA=decodeURIComponent(J).replace(/[_-]/g," ").replace(/\s+/g," ").trim();if(nA){v(nA);return}}const O=new URL(H).pathname.split("/").filter(Boolean);if(O.length>0){const J=O[O.length-1],K=decodeURIComponent(J).replace(/[_-]/g," ").replace(/\s+/g," ").trim();if(K&&!K.includes(".")){v(K);return}}const G=new URL(H).hostname;G.includes("youtube")||G.includes("youtu.be")?v("YouTube Video"):G.includes("vimeo")?v("Vimeo Video"):G.includes("twitch")?v("Twitch Video"):v("Video")}catch(N){console.log(N),v("Video")}},[]);y.useEffect(()=>{const H=z.current,N=D.current;return H&&(H.src=I.url,H.addEventListener("timeupdate",E),H.addEventListener("loadedmetadata",k),H.addEventListener("pause",()=>a(!0)),H.addEventListener("play",()=>a(!1))),N&&(N.src=I.url,N.muted=!0),()=>{H&&(H.removeEventListener("timeupdate",E),H.removeEventListener("loadedmetadata",k),H.removeEventListener("pause",()=>a(!0)),H.removeEventListener("play",()=>a(!1)))}},[r,E,k]),y.useEffect(()=>{setTimeout(()=>{s||V()},2e3)},[r]);const T=H=>{const N=Math.floor(H/60),j=Math.floor(H%60);return`${N}:${j.toString().padStart(2,"0")}`};return l.jsxs("div",{className:"flex-1 overflow-hidden h-full flex flex-col items-center justify-center gap-2 bg-background",children:[r&&!(I!=null&&I.embed)&&l.jsxs("div",{className:"group relative w-full h-full flex-1 flex items-center justify-center overflow-hidden ",children:[l.jsx("video",{className:"w-full h-100 flex-1",src:I.url,ref:z,children:"Your browser does not support the video tag."}),l.jsxs("div",{className:"hidden group-hover:flex absolute w-full h-full flex-col justify-between p-4 bg-gradient-to-b from-transparent via-transparent via-60% to-black/50 ",children:[l.jsxs("div",{className:"flex-1 flex gap-1 justify-end",children:[l.jsx(pA,{variant:"ghost",size:"icon",className:"bg-background rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] h-7 w-7",onClick:V,children:s?l.jsx(yS,{}):l.jsx(mS,{})}),l.jsx(pA,{variant:"ghost",size:"icon",onClick:X,className:"bg-background shadow-[0px_4.29px_12.86px_0px_#00000012] rounded-md h-7 w-7",children:l.jsx(zi,{className:"text-destructive",size:"small"})})]}),l.jsxs("div",{className:"h-fit flex flex-col gap-2",children:[l.jsx("p",{className:"text-background capitalize text-xl",children:g||"Loading..."}),l.jsxs("div",{className:"flex w-full justify-between items-center",children:[l.jsx("p",{className:"text-background",children:"Video Player"}),l.jsxs("span",{className:"text-sm text-background",children:[T(o)," / ",T(c)]})]}),l.jsx("div",{className:"relative",children:l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs("div",{className:"flex-1 relative",children:[l.jsxs("div",{ref:B,className:"h-[2px] bg-background/50 rounded-full cursor-pointer relative overflow-hidden",onMouseMove:Z,onMouseLeave:C,onClick:Q,children:[l.jsx("div",{className:"h-full bg-background rounded-full transition-all duration-[1000]",style:{width:`${f}%`}}),h&&l.jsx("div",{className:"absolute top-0 w-0.5 h-full bg-white/80 pointer-events-none",style:{left:`${m/c*100}%`,transform:"translateX(-50%)"}})]}),h&&l.jsx("div",{className:"absolute z-50 pointer-events-none",style:{left:`${b.x}px`,bottom:"100%",transform:"translateX(-50%)",marginBottom:"4px"},children:l.jsx("canvas",{ref:M,width:120,height:68,className:"rounded border border-background mb-1"})})]})})})]})]})]}),r&&(I==null?void 0:I.embed)&&l.jsx("iframe",{className:S("w-full h-full",n==null?void 0:n.className),allowFullScreen:!0,src:I.url}),!r&&l.jsxs("div",{"data-testid":"no-video",className:"flex flex-col w-full h-80 items-center justify-center gap-2 text-muted-foreground",children:[l.jsx(JC,{className:"text-xl"}),l.jsx("p",{className:"text-xs text-center",children:"No video to display"})]})]})},UnA=()=>{const{state:A,dispatch:e,blogPostsConfig:t,label:n}=zn(),{showPostsModal:r,value:s}=A,a=()=>{e({type:"TOGGLE_POSTS_MODAL"})},o=u=>{const f=c.filter(d=>d.uuid!==u.uuid);e({type:"SET_VALUE",payload:f})},i=u=>{e({type:"SET_VALUE",payload:u})};if(!t)return null;const c=s;return l.jsxs("div",{className:S("flex-1 bg-background space-y-2"),children:[l.jsxs("div",{className:"w-full flex items-center justify-between gap-2",children:[l.jsx(ve,{size:"icon",variant:"primary",className:"bg-muted rounded-full",onClick:a,children:l.jsx(As,{})}),l.jsx("div",{className:"flex-1 text-sm ",children:n}),!!c.length&&l.jsxs("p",{className:"text-sm p-2 bg-muted text-muted-foreground rounded",children:[c.length," selected articles"]})]}),l.jsx("div",{className:"space-y-1 max-h-60 overflow-y-auto",children:c.map(u=>{const f=u.featured_image?JSON.parse(u.featured_image):null;return l.jsxs("div",{className:"gap-2 flex flex-row items-center justify-between w-full waz_shadow py-2","data-testid":"post-row",children:[f!=null&&f.src?l.jsx("img",{src:Dc({url:f==null?void 0:f.src,width:80,height:64}).url,alt:"Post Image",className:"w-[3rem] h-10 rounded-sm object-cover flex-shrink-0"}):l.jsx("div",{className:"w-[3rem] h-10 bg-muted rounded-sm flex items-center justify-center","data-testid":"post-no-image",children:l.jsxs("div",{className:"flex flex-col items-center text-muted-foreground",children:[l.jsx(rS,{className:"h-3 w-3"}),l.jsx("span",{className:"text-[9px]",children:"No image"})]})}),l.jsx("a",{className:" flex-1 hover:underline cursor-pointer text-sm line-clamp-1",href:u.slug,target:"_blank",rel:"noopener noreferrer",children:Ur(u.title)}),l.jsx(ve,{size:"icon",variant:"ghost",onClick:()=>o(u),"data-testid":"remove-post",children:l.jsx(Ls,{})})]},u.uuid)})}),l.jsx(J4,{...t,selectedPosts:c,open:r,onSave:i,handleToggleOpen:u=>e({type:"TOGGLE_POSTS_MODAL",payload:u})})]})};function _nA(A){return JA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"},child:[]}]})(A)}function $nA(A){return JA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z"},child:[]}]})(A)}function ArA(A){return JA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"},child:[]}]})(A)}function N0(A){return JA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"},child:[]}]})(A)}const erA=()=>{const{state:{value:A,showEditLinkModal:e},dispatch:t,onChange:n,label:r,linkProps:s,error:a}=zn(),[o,i]=P.useState(A),c=()=>{t({type:"SET_VALUE",payload:o}),n&&n(o),u()},u=()=>{t({type:"TOGGLE_EDIT_LINK_MODAL"})};return P.useEffect(()=>{i(A)},[A]),l.jsx(l.Fragment,{children:l.jsx(xt,{open:e,onOpenChange:u,children:l.jsxs(vt,{className:"p-0 border-none overflow-hidden rounded-xl",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{children:l.jsxs("h1",{className:"text-md capitalize",children:["Edit ",r]})})}),l.jsx("div",{className:"p-4 py-2",children:l.jsx($e,{label:l.jsxs("span",{className:"flex gap-2 items-center text-sm ",children:[r,a&&l.jsxs("span",{className:"flex items-center justify-center gap-1",children:[l.jsx(N0,{className:"text-destructive text-xl"}),l.jsx("span",{className:" capitalize text-xs text-muted-foreground",children:a==null?void 0:a.message})]})]}),value:o,type:"textarea",onChange:f=>i(f.toString()),textareaProps:{...s,className:S("underline text-[#101828] text-sm",s==null?void 0:s.className)}})}),l.jsx(fn,{className:"flex flex-row p-4 pt-0 gap-4 justify-end mt-4",children:l.jsx(ve,{className:"rounded",variant:"primary",onClick:c,disabled:o.toString().includes(" "),children:"Save"})})]})})})},trA=()=>{const{state:{value:A},dispatch:e,optionsQuery:{data:t,isLoading:n,fetchNextPage:r,hasNextPage:s,isFetchingNextPage:a},selectProps:o}=zn(),i=y.useMemo(()=>(t==null?void 0:t.pages.flatMap(x=>x==null?void 0:x.data).filter(x=>x!=null))??[],[t]),[c,u]=y.useState(""),[f,d]=y.useState(!1),{ref:g,inView:v}=fv(),m=y.useRef(null),p=x=>{d(!0),u(x),e({type:"SET_OPTIONS_SEARCH_VALUE",payload:x})},h=x=>{let z=[];A&&Array.isArray(A)&&A.every(M=>typeof M=="object"&&"label"in M&&"value"in M)&&(z=A);const D=z.find(M=>M.value===x.value);let B;(o==null?void 0:o.multiple)===!1?B=D?[]:[x]:B=D?z.filter(M=>M.value!==x.value):[...z,x],e({type:"SET_VALUE",payload:B}),u("")},w=y.useMemo(()=>A?Array.isArray(A)?A.every(z=>typeof z=="object"&&"label"in z&&"value"in z)?A:[]:[]:[],[A]),b=x=>{var D;const z=(D=m.current)==null?void 0:D.value;x.key=="Enter"&&(x.preventDefault(),m.current&&z&&(o!=null&&o.createNewOption)&&(h({label:z,value:z}),m.current.value=""))};return y.useEffect(()=>{v&&s&&!a&&r()},[v,s,a,r]),l.jsxs(oa,{open:f&&(!!(o!=null&&o.queryConfig)||!!(o!=null&&o.options)),onOpenChange:d,modal:!1,children:[l.jsx(ia,{asChild:!0,onClick:x=>x.preventDefault(),children:l.jsxs("div",{className:S("w-full flex flex-wrap gap-2 p-2 items-center bg-background ",o==null?void 0:o.className),children:[w.map((x,z)=>l.jsxs(lt,{className:"flex h-fit gap-2 p-1 px-2 items-center bg-[#86FC6540] text-current capitalize",children:[x.label||x.value,l.jsx(Ls,{onClick:()=>h(x),className:"h-4 w-4 p-1 bg-[#65FB3A] rounded-full"})]},x.value||x.label||z)),l.jsx(Wt,{ref:m,placeholder:o==null?void 0:o.placeholder,className:"p-0 min-w-30 flex-1 border-none shadow-none bg-transparent hover:bg-transparent focus:bg-transparent focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none focus-visible:outline-none",value:c,onChange:x=>p(x.target.value),onKeyDown:b,onFocus:()=>d(!0)})]})}),l.jsx(cs,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",onOpenAutoFocus:x=>x.preventDefault(),children:l.jsx($c,{shouldFilter:!1,children:l.jsxs(wg,{className:"text-sm",children:[l.jsx(yg,{className:"flex items-center justify-center p-3 ",children:n?l.jsx(mi,{className:"h-6 w-6 animate-spin"}):"No Options found."}),l.jsxs(Pg,{children:[i.map(x=>x&&l.jsxs(bg,{value:x.value,onSelect:()=>h(x),className:"capitalize",children:[x.label,l.jsx(N4,{className:S("ml-auto",w.some(z=>x.value===z.value)?"opacity-100":"opacity-0")})]},x.value)),s&&l.jsx("div",{ref:g,className:"w-full flex justify-center",children:a?l.jsx(kAA,{className:"h-6 w-6 animate-spin"}):l.jsx(pA,{variant:"ghost",onClick:()=>r(),children:"Load more"})})]})]})})})]})};function K2({defaultValue:A,onChange:e}){const[t,n]=y.useState(A!=null&&A.length?new Date(A):void 0),r=s=>{n(s),e==null||e(s)};return l.jsxs(oa,{children:[l.jsx(ia,{asChild:!0,children:l.jsxs(pA,{variant:"outline",className:S("w-fit flex-1 justify-start text-left font-normal cursor-pointer h-10",!t&&"text-muted-foreground"),children:[l.jsx(dc,{}),t?Te(t,"PPP"):l.jsx("span",{children:"Pick a date"})]})}),l.jsxs(cs,{className:"flex w-auto flex-col space-y-2 p-2",children:[l.jsxs(yi,{defaultValue:"0",onValueChange:s=>r(Bt(new Date,parseInt(s))),children:[l.jsx($a,{children:l.jsx(Pi,{placeholder:"Select"})}),l.jsxs(Ao,{position:"popper",children:[l.jsx(gr,{value:"-30",children:"Last 30 days"}),l.jsx(gr,{value:"-7",children:"Last Week"}),l.jsx(gr,{value:"-1",children:"Yesterday"}),l.jsx(gr,{value:"0",children:"Today"})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsx(Kc,{mode:"single",disabled:s=>Date.now()<s.getTime(),selected:t,onSelect:s=>s&&r(s)})})]})]})}function nrA(){for(var A=arguments.length,e=new Array(A),t=0;t<A;t++)e[t]=arguments[t];return P.useMemo(()=>n=>{e.forEach(r=>r(n))},e)}const hv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nl(A){const e=Object.prototype.toString.call(A);return e==="[object Window]"||e==="[object global]"}function k0(A){return"nodeType"in A}function en(A){var e,t;return A?nl(A)?A:k0(A)&&(e=(t=A.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function Z0(A){const{Document:e}=en(A);return A instanceof e}function bu(A){return nl(A)?!1:A instanceof en(A).HTMLElement}function q4(A){return A instanceof en(A).SVGElement}function rl(A){return A?nl(A)?A.document:k0(A)?Z0(A)?A:bu(A)||q4(A)?A.ownerDocument:document:document:document}const Dr=hv?P.useLayoutEffect:P.useEffect;function S0(A){const e=P.useRef(A);return Dr(()=>{e.current=A}),P.useCallback(function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.current==null?void 0:e.current(...n)},[])}function rrA(){const A=P.useRef(null),e=P.useCallback((n,r)=>{A.current=setInterval(n,r)},[]),t=P.useCallback(()=>{A.current!==null&&(clearInterval(A.current),A.current=null)},[]);return[e,t]}function Cc(A,e){e===void 0&&(e=[A]);const t=P.useRef(A);return Dr(()=>{t.current!==A&&(t.current=A)},e),t}function xu(A,e){const t=P.useRef();return P.useMemo(()=>{const n=A(t.current);return t.current=n,n},[...e])}function kd(A){const e=S0(A),t=P.useRef(null),n=P.useCallback(r=>{r!==t.current&&(e==null||e(r,t.current)),t.current=r},[]);return[t,n]}function U2(A){const e=P.useRef();return P.useEffect(()=>{e.current=A},[A]),e.current}let qm={};function zu(A,e){return P.useMemo(()=>{if(e)return e;const t=qm[A]==null?0:qm[A]+1;return qm[A]=t,A+"-"+t},[A,e])}function R4(A){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((s,a)=>{const o=Object.entries(a);for(const[i,c]of o){const u=s[i];u!=null&&(s[i]=u+A*c)}return s},{...e})}}const Ko=R4(1),jc=R4(-1);function srA(A){return"clientX"in A&&"clientY"in A}function V0(A){if(!A)return!1;const{KeyboardEvent:e}=en(A.target);return e&&A instanceof e}function arA(A){if(!A)return!1;const{TouchEvent:e}=en(A.target);return e&&A instanceof e}function _2(A){if(arA(A)){if(A.touches&&A.touches.length){const{clientX:e,clientY:t}=A.touches[0];return{x:e,y:t}}else if(A.changedTouches&&A.changedTouches.length){const{clientX:e,clientY:t}=A.changedTouches[0];return{x:e,y:t}}}return srA(A)?{x:A.clientX,y:A.clientY}:null}const is=Object.freeze({Translate:{toString(A){if(!A)return;const{x:e,y:t}=A;return"translate3d("+(e?Math.round(e):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(A){if(!A)return;const{scaleX:e,scaleY:t}=A;return"scaleX("+e+") scaleY("+t+")"}},Transform:{toString(A){if(A)return[is.Translate.toString(A),is.Scale.toString(A)].join(" ")}},Transition:{toString(A){let{property:e,duration:t,easing:n}=A;return e+" "+t+"ms "+n}}}),iP="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function orA(A){return A.matches(iP)?A:A.querySelector(iP)}const irA={display:"none"};function lrA(A){let{id:e,value:t}=A;return P.createElement("div",{id:e,style:irA},t)}function crA(A){let{id:e,announcement:t,ariaLiveType:n="assertive"}=A;const r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:e,style:r,role:"status","aria-live":n,"aria-atomic":!0},t)}function urA(){const[A,e]=P.useState("");return{announce:P.useCallback(n=>{n!=null&&e(n)},[]),announcement:A}}const W4=P.createContext(null);function frA(A){const e=P.useContext(W4);P.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(A)},[A,e])}function drA(){const[A]=P.useState(()=>new Set),e=P.useCallback(n=>(A.add(n),()=>A.delete(n)),[A]);return[P.useCallback(n=>{let{type:r,event:s}=n;A.forEach(a=>{var o;return(o=a[r])==null?void 0:o.call(a,s)})},[A]),e]}const grA={draggable:`
|
|
445
445
|
To pick up a draggable item, press the space bar.
|
|
@@ -447,7 +447,7 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var U=W(R,_,J,K,nA+"."+_
|
|
|
447
447
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
448
448
|
`},vrA={onDragStart(A){let{active:e}=A;return"Picked up draggable item "+e.id+"."},onDragOver(A){let{active:e,over:t}=A;return t?"Draggable item "+e.id+" was moved over droppable area "+t.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(A){let{active:e,over:t}=A;return t?"Draggable item "+e.id+" was dropped over droppable area "+t.id:"Draggable item "+e.id+" was dropped."},onDragCancel(A){let{active:e}=A;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function mrA(A){let{announcements:e=vrA,container:t,hiddenTextDescribedById:n,screenReaderInstructions:r=grA}=A;const{announce:s,announcement:a}=urA(),o=zu("DndLiveRegion"),[i,c]=P.useState(!1);if(P.useEffect(()=>{c(!0)},[]),frA(P.useMemo(()=>({onDragStart(f){let{active:d}=f;s(e.onDragStart({active:d}))},onDragMove(f){let{active:d,over:g}=f;e.onDragMove&&s(e.onDragMove({active:d,over:g}))},onDragOver(f){let{active:d,over:g}=f;s(e.onDragOver({active:d,over:g}))},onDragEnd(f){let{active:d,over:g}=f;s(e.onDragEnd({active:d,over:g}))},onDragCancel(f){let{active:d,over:g}=f;s(e.onDragCancel({active:d,over:g}))}}),[s,e])),!i)return null;const u=P.createElement(P.Fragment,null,P.createElement(lrA,{id:n,value:r.draggable}),P.createElement(crA,{id:o,announcement:a}));return t?Ts.createPortal(u,t):u}var ot;(function(A){A.DragStart="dragStart",A.DragMove="dragMove",A.DragEnd="dragEnd",A.DragCancel="dragCancel",A.DragOver="dragOver",A.RegisterDroppable="registerDroppable",A.SetDroppableDisabled="setDroppableDisabled",A.UnregisterDroppable="unregisterDroppable"})(ot||(ot={}));function Zd(){}function Br(A,e){return P.useMemo(()=>({sensor:A,options:e??{}}),[A,e])}function Du(){for(var A=arguments.length,e=new Array(A),t=0;t<A;t++)e[t]=arguments[t];return P.useMemo(()=>[...e].filter(n=>n!=null),[...e])}const Rn=Object.freeze({x:0,y:0});function F4(A,e){return Math.sqrt(Math.pow(A.x-e.x,2)+Math.pow(A.y-e.y,2))}function K4(A,e){let{data:{value:t}}=A,{data:{value:n}}=e;return t-n}function prA(A,e){let{data:{value:t}}=A,{data:{value:n}}=e;return n-t}function lP(A){let{left:e,top:t,height:n,width:r}=A;return[{x:e,y:t},{x:e+r,y:t},{x:e,y:t+n},{x:e+r,y:t+n}]}function U4(A,e){if(!A||A.length===0)return null;const[t]=A;return t[e]}function cP(A,e,t){return e===void 0&&(e=A.left),t===void 0&&(t=A.top),{x:e+A.width*.5,y:t+A.height*.5}}const Bu=A=>{let{collisionRect:e,droppableRects:t,droppableContainers:n}=A;const r=cP(e,e.left,e.top),s=[];for(const a of n){const{id:o}=a,i=t.get(o);if(i){const c=F4(cP(i),r);s.push({id:o,data:{droppableContainer:a,value:c}})}}return s.sort(K4)},hrA=A=>{let{collisionRect:e,droppableRects:t,droppableContainers:n}=A;const r=lP(e),s=[];for(const a of n){const{id:o}=a,i=t.get(o);if(i){const c=lP(i),u=r.reduce((d,g,v)=>d+F4(c[v],g),0),f=Number((u/4).toFixed(4));s.push({id:o,data:{droppableContainer:a,value:f}})}}return s.sort(K4)};function wrA(A,e){const t=Math.max(e.top,A.top),n=Math.max(e.left,A.left),r=Math.min(e.left+e.width,A.left+A.width),s=Math.min(e.top+e.height,A.top+A.height),a=r-n,o=s-t;if(n<r&&t<s){const i=e.width*e.height,c=A.width*A.height,u=a*o,f=u/(i+c-u);return Number(f.toFixed(4))}return 0}const yrA=A=>{let{collisionRect:e,droppableRects:t,droppableContainers:n}=A;const r=[];for(const s of n){const{id:a}=s,o=t.get(a);if(o){const i=wrA(o,e);i>0&&r.push({id:a,data:{droppableContainer:s,value:i}})}}return r.sort(prA)};function PrA(A,e,t){return{...A,scaleX:e&&t?e.width/t.width:1,scaleY:e&&t?e.height/t.height:1}}function _4(A,e){return A&&e?{x:A.left-e.left,y:A.top-e.top}:Rn}function brA(A){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((a,o)=>({...a,top:a.top+A*o.y,bottom:a.bottom+A*o.y,left:a.left+A*o.x,right:a.right+A*o.x}),{...t})}}const xrA=brA(1);function zrA(A){if(A.startsWith("matrix3d(")){const e=A.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(A.startsWith("matrix(")){const e=A.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function DrA(A,e,t){const n=zrA(e);if(!n)return A;const{scaleX:r,scaleY:s,x:a,y:o}=n,i=A.left-a-(1-r)*parseFloat(t),c=A.top-o-(1-s)*parseFloat(t.slice(t.indexOf(" ")+1)),u=r?A.width/r:A.width,f=s?A.height/s:A.height;return{width:u,height:f,top:c,right:i+u,bottom:c+f,left:i}}const BrA={ignoreTransform:!1};function sl(A,e){e===void 0&&(e=BrA);let t=A.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:u}=en(A).getComputedStyle(A);c&&(t=DrA(t,c,u))}const{top:n,left:r,width:s,height:a,bottom:o,right:i}=t;return{top:n,left:r,width:s,height:a,bottom:o,right:i}}function uP(A){return sl(A,{ignoreTransform:!0})}function MrA(A){const e=A.innerWidth,t=A.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}function CrA(A,e){return e===void 0&&(e=en(A).getComputedStyle(A)),e.position==="fixed"}function jrA(A,e){e===void 0&&(e=en(A).getComputedStyle(A));const t=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const s=e[r];return typeof s=="string"?t.test(s):!1})}function wv(A,e){const t=[];function n(r){if(e!=null&&t.length>=e||!r)return t;if(Z0(r)&&r.scrollingElement!=null&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!bu(r)||q4(r)||t.includes(r))return t;const s=en(A).getComputedStyle(r);return r!==A&&jrA(r,s)&&t.push(r),CrA(r,s)?t:n(r.parentNode)}return A?n(A):t}function $4(A){const[e]=wv(A,1);return e??null}function Rm(A){return!hv||!A?null:nl(A)?A:k0(A)?Z0(A)||A===rl(A).scrollingElement?window:bu(A)?A:null:null}function Aj(A){return nl(A)?A.scrollX:A.scrollLeft}function ej(A){return nl(A)?A.scrollY:A.scrollTop}function $2(A){return{x:Aj(A),y:ej(A)}}var dt;(function(A){A[A.Forward=1]="Forward",A[A.Backward=-1]="Backward"})(dt||(dt={}));function tj(A){return!hv||!A?!1:A===document.scrollingElement}function nj(A){const e={x:0,y:0},t=tj(A)?{height:window.innerHeight,width:window.innerWidth}:{height:A.clientHeight,width:A.clientWidth},n={x:A.scrollWidth-t.width,y:A.scrollHeight-t.height},r=A.scrollTop<=e.y,s=A.scrollLeft<=e.x,a=A.scrollTop>=n.y,o=A.scrollLeft>=n.x;return{isTop:r,isLeft:s,isBottom:a,isRight:o,maxScroll:n,minScroll:e}}const OrA={x:.2,y:.2};function TrA(A,e,t,n,r){let{top:s,left:a,right:o,bottom:i}=t;n===void 0&&(n=10),r===void 0&&(r=OrA);const{isTop:c,isBottom:u,isLeft:f,isRight:d}=nj(A),g={x:0,y:0},v={x:0,y:0},m={height:e.height*r.y,width:e.width*r.x};return!c&&s<=e.top+m.height?(g.y=dt.Backward,v.y=n*Math.abs((e.top+m.height-s)/m.height)):!u&&i>=e.bottom-m.height&&(g.y=dt.Forward,v.y=n*Math.abs((e.bottom-m.height-i)/m.height)),!d&&o>=e.right-m.width?(g.x=dt.Forward,v.x=n*Math.abs((e.right-m.width-o)/m.width)):!f&&a<=e.left+m.width&&(g.x=dt.Backward,v.x=n*Math.abs((e.left+m.width-a)/m.width)),{direction:g,speed:v}}function ErA(A){if(A===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:e,left:t,right:n,bottom:r}=A.getBoundingClientRect();return{top:e,left:t,right:n,bottom:r,width:A.clientWidth,height:A.clientHeight}}function rj(A){return A.reduce((e,t)=>Ko(e,$2(t)),Rn)}function HrA(A){return A.reduce((e,t)=>e+Aj(t),0)}function NrA(A){return A.reduce((e,t)=>e+ej(t),0)}function krA(A,e){if(e===void 0&&(e=sl),!A)return;const{top:t,left:n,bottom:r,right:s}=e(A);$4(A)&&(r<=0||s<=0||t>=window.innerHeight||n>=window.innerWidth)&&A.scrollIntoView({block:"center",inline:"center"})}const ZrA=[["x",["left","right"],HrA],["y",["top","bottom"],NrA]];class X0{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=wv(t),r=rj(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,a,o]of ZrA)for(const i of a)Object.defineProperty(this,i,{get:()=>{const c=o(n),u=r[s]-c;return this.rect[i]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ll{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(t=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...t)})},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function SrA(A){const{EventTarget:e}=en(A);return A instanceof e?A:rl(A)}function Wm(A,e){const t=Math.abs(A.x),n=Math.abs(A.y);return typeof e=="number"?Math.sqrt(t**2+n**2)>e:"x"in e&&"y"in e?t>e.x&&n>e.y:"x"in e?t>e.x:"y"in e?n>e.y:!1}var pn;(function(A){A.Click="click",A.DragStart="dragstart",A.Keydown="keydown",A.ContextMenu="contextmenu",A.Resize="resize",A.SelectionChange="selectionchange",A.VisibilityChange="visibilitychange"})(pn||(pn={}));function fP(A){A.preventDefault()}function VrA(A){A.stopPropagation()}var le;(function(A){A.Space="Space",A.Down="ArrowDown",A.Right="ArrowRight",A.Left="ArrowLeft",A.Up="ArrowUp",A.Esc="Escape",A.Enter="Enter",A.Tab="Tab"})(le||(le={}));const sj={start:[le.Space,le.Enter],cancel:[le.Esc],end:[le.Space,le.Enter,le.Tab]},XrA=(A,e)=>{let{currentCoordinates:t}=e;switch(A.code){case le.Right:return{...t,x:t.x+25};case le.Left:return{...t,x:t.x-25};case le.Down:return{...t,y:t.y+25};case le.Up:return{...t,y:t.y-25}}};class go{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Ll(rl(t)),this.windowListeners=new Ll(en(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(pn.Resize,this.handleCancel),this.windowListeners.add(pn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(pn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&krA(n),t(Rn)}handleKeyDown(e){if(V0(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:s=sj,coordinateGetter:a=XrA,scrollBehavior:o="smooth"}=r,{code:i}=e;if(s.end.includes(i)){this.handleEnd(e);return}if(s.cancel.includes(i)){this.handleCancel(e);return}const{collisionRect:c}=n.current,u=c?{x:c.left,y:c.top}:Rn;this.referenceCoordinates||(this.referenceCoordinates=u);const f=a(e,{active:t,context:n.current,currentCoordinates:u});if(f){const d=jc(f,u),g={x:0,y:0},{scrollableAncestors:v}=n.current;for(const m of v){const p=e.code,{isTop:h,isRight:w,isLeft:b,isBottom:x,maxScroll:z,minScroll:D}=nj(m),B=ErA(m),M={x:Math.min(p===le.Right?B.right-B.width/2:B.right,Math.max(p===le.Right?B.left:B.left+B.width/2,f.x)),y:Math.min(p===le.Down?B.bottom-B.height/2:B.bottom,Math.max(p===le.Down?B.top:B.top+B.height/2,f.y))},I=p===le.Right&&!w||p===le.Left&&!b,X=p===le.Down&&!x||p===le.Up&&!h;if(I&&M.x!==f.x){const V=m.scrollLeft+d.x,E=p===le.Right&&V<=z.x||p===le.Left&&V>=D.x;if(E&&!d.y){m.scrollTo({left:V,behavior:o});return}E?g.x=m.scrollLeft-V:g.x=p===le.Right?m.scrollLeft-z.x:m.scrollLeft-D.x,g.x&&m.scrollBy({left:-g.x,behavior:o});break}else if(X&&M.y!==f.y){const V=m.scrollTop+d.y,E=p===le.Down&&V<=z.y||p===le.Up&&V>=D.y;if(E&&!d.x){m.scrollTo({top:V,behavior:o});return}E?g.y=m.scrollTop-V:g.y=p===le.Down?m.scrollTop-z.y:m.scrollTop-D.y,g.y&&m.scrollBy({top:-g.y,behavior:o});break}}this.handleMove(e,Ko(jc(f,this.referenceCoordinates),g))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}go.activators=[{eventName:"onKeyDown",handler:(A,e,t)=>{let{keyboardCodes:n=sj,onActivation:r}=e,{active:s}=t;const{code:a}=A.nativeEvent;if(n.start.includes(a)){const o=s.activatorNode.current;return o&&A.target!==o?!1:(A.preventDefault(),r==null||r({event:A.nativeEvent}),!0)}return!1}}];function dP(A){return!!(A&&"distance"in A)}function gP(A){return!!(A&&"delay"in A)}class Y0{constructor(e,t,n){var r;n===void 0&&(n=SrA(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:s}=e,{target:a}=s;this.props=e,this.events=t,this.document=rl(a),this.documentListeners=new Ll(this.document),this.listeners=new Ll(n),this.windowListeners=new Ll(en(a)),this.initialCoordinates=(r=_2(s))!=null?r:Rn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(pn.Resize,this.handleCancel),this.windowListeners.add(pn.DragStart,fP),this.windowListeners.add(pn.VisibilityChange,this.handleCancel),this.windowListeners.add(pn.ContextMenu,fP),this.documentListeners.add(pn.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gP(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(dP(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(pn.Click,VrA,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(pn.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:s}=this,{onMove:a,options:{activationConstraint:o}}=s;if(!r)return;const i=(t=_2(e))!=null?t:Rn,c=jc(r,i);if(!n&&o){if(dP(o)){if(o.tolerance!=null&&Wm(c,o.tolerance))return this.handleCancel();if(Wm(c,o.distance))return this.handleStart()}if(gP(o)&&Wm(c,o.tolerance))return this.handleCancel();this.handlePending(o,c);return}e.cancelable&&e.preventDefault(),a(i)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===le.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const YrA={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class vo extends Y0{constructor(e){const{event:t}=e,n=rl(t.target);super(e,YrA,n)}}vo.activators=[{eventName:"onPointerDown",handler:(A,e)=>{let{nativeEvent:t}=A,{onActivation:n}=e;return!t.isPrimary||t.button!==0?!1:(n==null||n({event:t}),!0)}}];const GrA={move:{name:"mousemove"},end:{name:"mouseup"}};var Ah;(function(A){A[A.RightClick=2]="RightClick"})(Ah||(Ah={}));class IrA extends Y0{constructor(e){super(e,GrA,rl(e.event.target))}}IrA.activators=[{eventName:"onMouseDown",handler:(A,e)=>{let{nativeEvent:t}=A,{onActivation:n}=e;return t.button===Ah.RightClick?!1:(n==null||n({event:t}),!0)}}];const Fm={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class QrA extends Y0{constructor(e){super(e,Fm)}static setup(){return window.addEventListener(Fm.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Fm.move.name,e)};function e(){}}}QrA.activators=[{eventName:"onTouchStart",handler:(A,e)=>{let{nativeEvent:t}=A,{onActivation:n}=e;const{touches:r}=t;return r.length>1?!1:(n==null||n({event:t}),!0)}}];var Jl;(function(A){A[A.Pointer=0]="Pointer",A[A.DraggableRect=1]="DraggableRect"})(Jl||(Jl={}));var Sd;(function(A){A[A.TreeOrder=0]="TreeOrder",A[A.ReversedTreeOrder=1]="ReversedTreeOrder"})(Sd||(Sd={}));function LrA(A){let{acceleration:e,activator:t=Jl.Pointer,canScroll:n,draggingRect:r,enabled:s,interval:a=5,order:o=Sd.TreeOrder,pointerCoordinates:i,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:d}=A;const g=qrA({delta:f,disabled:!s}),[v,m]=rrA(),p=P.useRef({x:0,y:0}),h=P.useRef({x:0,y:0}),w=P.useMemo(()=>{switch(t){case Jl.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case Jl.DraggableRect:return r}},[t,r,i]),b=P.useRef(null),x=P.useCallback(()=>{const D=b.current;if(!D)return;const B=p.current.x*h.current.x,M=p.current.y*h.current.y;D.scrollBy(B,M)},[]),z=P.useMemo(()=>o===Sd.TreeOrder?[...c].reverse():c,[o,c]);P.useEffect(()=>{if(!s||!c.length||!w){m();return}for(const D of z){if((n==null?void 0:n(D))===!1)continue;const B=c.indexOf(D),M=u[B];if(!M)continue;const{direction:I,speed:X}=TrA(D,M,w,e,d);for(const V of["x","y"])g[V][I[V]]||(X[V]=0,I[V]=0);if(X.x>0||X.y>0){m(),b.current=D,v(x,a),p.current=X,h.current=I;return}}p.current={x:0,y:0},h.current={x:0,y:0},m()},[e,x,n,m,s,a,JSON.stringify(w),JSON.stringify(g),v,c,z,u,JSON.stringify(d)])}const JrA={x:{[dt.Backward]:!1,[dt.Forward]:!1},y:{[dt.Backward]:!1,[dt.Forward]:!1}};function qrA(A){let{delta:e,disabled:t}=A;const n=U2(e);return xu(r=>{if(t||!n||!r)return JrA;const s={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[dt.Backward]:r.x[dt.Backward]||s.x===-1,[dt.Forward]:r.x[dt.Forward]||s.x===1},y:{[dt.Backward]:r.y[dt.Backward]||s.y===-1,[dt.Forward]:r.y[dt.Forward]||s.y===1}}},[t,e,n])}function RrA(A,e){const t=e!=null?A.get(e):void 0,n=t?t.node.current:null;return xu(r=>{var s;return e==null?null:(s=n??r)!=null?s:null},[n,e])}function WrA(A,e){return P.useMemo(()=>A.reduce((t,n)=>{const{sensor:r}=n,s=r.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,n)}));return[...t,...s]},[]),[A,e])}var Oc;(function(A){A[A.Always=0]="Always",A[A.BeforeDragging=1]="BeforeDragging",A[A.WhileDragging=2]="WhileDragging"})(Oc||(Oc={}));var eh;(function(A){A.Optimized="optimized"})(eh||(eh={}));const vP=new Map;function FrA(A,e){let{dragging:t,dependencies:n,config:r}=e;const[s,a]=P.useState(null),{frequency:o,measure:i,strategy:c}=r,u=P.useRef(A),f=p(),d=Cc(f),g=P.useCallback(function(h){h===void 0&&(h=[]),!d.current&&a(w=>w===null?h:w.concat(h.filter(b=>!w.includes(b))))},[d]),v=P.useRef(null),m=xu(h=>{if(f&&!t)return vP;if(!h||h===vP||u.current!==A||s!=null){const w=new Map;for(let b of A){if(!b)continue;if(s&&s.length>0&&!s.includes(b.id)&&b.rect.current){w.set(b.id,b.rect.current);continue}const x=b.node.current,z=x?new X0(i(x),x):null;b.rect.current=z,z&&w.set(b.id,z)}return w}return h},[A,s,t,f,i]);return P.useEffect(()=>{u.current=A},[A]),P.useEffect(()=>{f||g()},[t,f]),P.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),P.useEffect(()=>{f||typeof o!="number"||v.current!==null||(v.current=setTimeout(()=>{g(),v.current=null},o))},[o,f,g,...n]),{droppableRects:m,measureDroppableContainers:g,measuringScheduled:s!=null};function p(){switch(c){case Oc.Always:return!1;case Oc.BeforeDragging:return t;default:return!t}}}function aj(A,e){return xu(t=>A?t||(typeof e=="function"?e(A):A):null,[e,A])}function KrA(A,e){return aj(A,e)}function UrA(A){let{callback:e,disabled:t}=A;const n=S0(e),r=P.useMemo(()=>{if(t||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(n)},[n,t]);return P.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function yv(A){let{callback:e,disabled:t}=A;const n=S0(e),r=P.useMemo(()=>{if(t||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(n)},[t]);return P.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function _rA(A){return new X0(sl(A),A)}function mP(A,e,t){e===void 0&&(e=_rA);const[n,r]=P.useState(null);function s(){r(i=>{if(!A)return null;if(A.isConnected===!1){var c;return(c=i??t)!=null?c:null}const u=e(A);return JSON.stringify(i)===JSON.stringify(u)?i:u})}const a=UrA({callback(i){if(A)for(const c of i){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(A)){s();break}}}}),o=yv({callback:s});return Dr(()=>{s(),A?(o==null||o.observe(A),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(o==null||o.disconnect(),a==null||a.disconnect())},[A]),n}function $rA(A){const e=aj(A);return _4(A,e)}const pP=[];function AsA(A){const e=P.useRef(A),t=xu(n=>A?n&&n!==pP&&A&&e.current&&A.parentNode===e.current.parentNode?n:wv(A):pP,[A]);return P.useEffect(()=>{e.current=A},[A]),t}function esA(A){const[e,t]=P.useState(null),n=P.useRef(A),r=P.useCallback(s=>{const a=Rm(s.target);a&&t(o=>o?(o.set(a,$2(a)),new Map(o)):null)},[]);return P.useEffect(()=>{const s=n.current;if(A!==s){a(s);const o=A.map(i=>{const c=Rm(i);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,$2(c)]):null}).filter(i=>i!=null);t(o.length?new Map(o):null),n.current=A}return()=>{a(A),a(s)};function a(o){o.forEach(i=>{const c=Rm(i);c==null||c.removeEventListener("scroll",r)})}},[r,A]),P.useMemo(()=>A.length?e?Array.from(e.values()).reduce((s,a)=>Ko(s,a),Rn):rj(A):Rn,[A,e])}function hP(A,e){e===void 0&&(e=[]);const t=P.useRef(null);return P.useEffect(()=>{t.current=null},e),P.useEffect(()=>{const n=A!==Rn;n&&!t.current&&(t.current=A),!n&&t.current&&(t.current=null)},[A]),t.current?jc(A,t.current):Rn}function tsA(A){P.useEffect(()=>{if(!hv)return;const e=A.map(t=>{let{sensor:n}=t;return n.setup==null?void 0:n.setup()});return()=>{for(const t of e)t==null||t()}},A.map(e=>{let{sensor:t}=e;return t}))}function nsA(A,e){return P.useMemo(()=>A.reduce((t,n)=>{let{eventName:r,handler:s}=n;return t[r]=a=>{s(a,e)},t},{}),[A,e])}function oj(A){return P.useMemo(()=>A?MrA(A):null,[A])}const wP=[];function rsA(A,e){e===void 0&&(e=sl);const[t]=A,n=oj(t?en(t):null),[r,s]=P.useState(wP);function a(){s(()=>A.length?A.map(i=>tj(i)?n:new X0(e(i),i)):wP)}const o=yv({callback:a});return Dr(()=>{o==null||o.disconnect(),a(),A.forEach(i=>o==null?void 0:o.observe(i))},[A]),r}function ssA(A){if(!A)return null;if(A.children.length>1)return A;const e=A.children[0];return bu(e)?e:A}function asA(A){let{measure:e}=A;const[t,n]=P.useState(null),r=P.useCallback(c=>{for(const{target:u}of c)if(bu(u)){n(f=>{const d=e(u);return f?{...f,width:d.width,height:d.height}:d});break}},[e]),s=yv({callback:r}),a=P.useCallback(c=>{const u=ssA(c);s==null||s.disconnect(),u&&(s==null||s.observe(u)),n(u?e(u):null)},[e,s]),[o,i]=kd(a);return P.useMemo(()=>({nodeRef:o,rect:t,setRef:i}),[t,o,i])}const osA=[{sensor:vo,options:{}},{sensor:go,options:{}}],isA={current:{}},Sf={draggable:{measure:uP},droppable:{measure:uP,strategy:Oc.WhileDragging,frequency:eh.Optimized},dragOverlay:{measure:sl}};class ql extends Map{get(e){var t;return e!=null&&(t=super.get(e))!=null?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return(t=(n=this.get(e))==null?void 0:n.node.current)!=null?t:void 0}}const lsA={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ql,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Zd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Sf,measureDroppableContainers:Zd,windowRect:null,measuringScheduled:!1},csA={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Zd,draggableNodes:new Map,over:null,measureDroppableContainers:Zd},Pv=P.createContext(csA),ij=P.createContext(lsA);function usA(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ql}}}function fsA(A,e){switch(e.type){case ot.DragStart:return{...A,draggable:{...A.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ot.DragMove:return A.draggable.active==null?A:{...A,draggable:{...A.draggable,translate:{x:e.coordinates.x-A.draggable.initialCoordinates.x,y:e.coordinates.y-A.draggable.initialCoordinates.y}}};case ot.DragEnd:case ot.DragCancel:return{...A,draggable:{...A.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ot.RegisterDroppable:{const{element:t}=e,{id:n}=t,r=new ql(A.droppable.containers);return r.set(n,t),{...A,droppable:{...A.droppable,containers:r}}}case ot.SetDroppableDisabled:{const{id:t,key:n,disabled:r}=e,s=A.droppable.containers.get(t);if(!s||n!==s.key)return A;const a=new ql(A.droppable.containers);return a.set(t,{...s,disabled:r}),{...A,droppable:{...A.droppable,containers:a}}}case ot.UnregisterDroppable:{const{id:t,key:n}=e,r=A.droppable.containers.get(t);if(!r||n!==r.key)return A;const s=new ql(A.droppable.containers);return s.delete(t),{...A,droppable:{...A.droppable,containers:s}}}default:return A}}function dsA(A){let{disabled:e}=A;const{active:t,activatorEvent:n,draggableNodes:r}=P.useContext(Pv),s=U2(n),a=U2(t==null?void 0:t.id);return P.useEffect(()=>{if(!e&&!n&&s&&a!=null){if(!V0(s)||document.activeElement===s.target)return;const o=r.get(a);if(!o)return;const{activatorNode:i,node:c}=o;if(!i.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[i.current,c.current]){if(!u)continue;const f=orA(u);if(f){f.focus();break}}})}},[n,e,r,a,s]),null}function gsA(A,e){let{transform:t,...n}=e;return A!=null&&A.length?A.reduce((r,s)=>s({transform:r,...n}),t):t}function vsA(A){return P.useMemo(()=>({draggable:{...Sf.draggable,...A==null?void 0:A.draggable},droppable:{...Sf.droppable,...A==null?void 0:A.droppable},dragOverlay:{...Sf.dragOverlay,...A==null?void 0:A.dragOverlay}}),[A==null?void 0:A.draggable,A==null?void 0:A.droppable,A==null?void 0:A.dragOverlay])}function msA(A){let{activeNode:e,measure:t,initialRect:n,config:r=!0}=A;const s=P.useRef(!1),{x:a,y:o}=typeof r=="boolean"?{x:r,y:r}:r;Dr(()=>{if(!a&&!o||!e){s.current=!1;return}if(s.current||!n)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const u=t(c),f=_4(u,n);if(a||(f.x=0),o||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const d=$4(c);d&&d.scrollBy({top:f.y,left:f.x})}},[e,a,o,n,t])}const lj=P.createContext({...Rn,scaleX:1,scaleY:1});var Ps;(function(A){A[A.Uninitialized=0]="Uninitialized",A[A.Initializing=1]="Initializing",A[A.Initialized=2]="Initialized"})(Ps||(Ps={}));const Mu=P.memo(function(e){var t,n,r,s;let{id:a,accessibility:o,autoScroll:i=!0,children:c,sensors:u=osA,collisionDetection:f=yrA,measuring:d,modifiers:g,...v}=e;const m=P.useReducer(fsA,void 0,usA),[p,h]=m,[w,b]=drA(),[x,z]=P.useState(Ps.Uninitialized),D=x===Ps.Initialized,{draggable:{active:B,nodes:M,translate:I},droppable:{containers:X}}=p,V=B!=null?M.get(B):null,E=P.useRef({initial:null,translated:null}),k=P.useMemo(()=>{var ue;return B!=null?{id:B,data:(ue=V==null?void 0:V.data)!=null?ue:isA,rect:E}:null},[B,V]),Z=P.useRef(null),[C,Q]=P.useState(null),[Y,T]=P.useState(null),H=Cc(v,Object.values(v)),N=zu("DndDescribedBy",a),j=P.useMemo(()=>X.getEnabled(),[X]),O=vsA(d),{droppableRects:G,measureDroppableContainers:J,measuringScheduled:K}=FrA(j,{dragging:D,dependencies:[I.x,I.y],config:O.droppable}),nA=RrA(M,B),R=P.useMemo(()=>Y?_2(Y):null,[Y]),eA=tt(),AA=KrA(nA,O.draggable.measure);msA({activeNode:B!=null?M.get(B):null,config:eA.layoutShiftCompensation,initialRect:AA,measure:O.draggable.measure});const _=mP(nA,O.draggable.measure,AA),W=mP(nA?nA.parentElement:null),U=P.useRef({activatorEvent:null,active:null,activeNode:nA,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:X,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),PA=X.getNodeFor((t=U.current.over)==null?void 0:t.id),TA=asA({measure:O.dragOverlay.measure}),YA=(n=TA.nodeRef.current)!=null?n:nA,ee=D?(r=TA.rect)!=null?r:_:null,hA=!!(TA.nodeRef.current&&TA.rect),pe=$rA(hA?null:_),GA=oj(YA?en(YA):null),L=AsA(D?PA??nA:null),$=rsA(L),tA=gsA(g,{transform:{x:I.x-pe.x,y:I.y-pe.y,scaleX:1,scaleY:1},activatorEvent:Y,active:k,activeNodeRect:_,containerNodeRect:W,draggingNodeRect:ee,over:U.current.over,overlayNodeRect:TA.rect,scrollableAncestors:L,scrollableAncestorRects:$,windowRect:GA}),cA=R?Ko(R,I):null,lA=esA(L),iA=hP(lA),uA=hP(lA,[_]),HA=Ko(tA,iA),qA=ee?xrA(ee,tA):null,jA=k&&qA?f({active:k,collisionRect:qA,droppableRects:G,droppableContainers:j,pointerCoordinates:cA}):null,be=U4(jA,"id"),[ce,Ze]=P.useState(null),he=hA?tA:Ko(tA,uA),$n=PrA(he,(s=ce==null?void 0:ce.rect)!=null?s:null,_),Mn=P.useRef(null),Cn=P.useCallback((ue,se)=>{let{sensor:BA,options:oe}=se;if(Z.current==null)return;const fe=M.get(Z.current);if(!fe)return;const ye=ue.nativeEvent,je=new BA({active:Z.current,activeNode:fe,event:ye,options:oe,context:U,onAbort(RA){if(!M.get(RA))return;const{onDragAbort:Xe}=H.current,Se={id:RA};Xe==null||Xe(Se),w({type:"onDragAbort",event:Se})},onPending(RA,zt,Xe,Se){if(!M.get(RA))return;const{onDragPending:tn}=H.current,Hr={id:RA,constraint:zt,initialCoordinates:Xe,offset:Se};tn==null||tn(Hr),w({type:"onDragPending",event:Hr})},onStart(RA){const zt=Z.current;if(zt==null)return;const Xe=M.get(zt);if(!Xe)return;const{onDragStart:Se}=H.current,Ar={activatorEvent:ye,active:{id:zt,data:Xe.data,rect:E}};Ts.unstable_batchedUpdates(()=>{Se==null||Se(Ar),z(Ps.Initializing),h({type:ot.DragStart,initialCoordinates:RA,active:zt}),w({type:"onDragStart",event:Ar}),Q(Mn.current),T(ye)})},onMove(RA){h({type:ot.DragMove,coordinates:RA})},onEnd:ge(ot.DragEnd),onCancel:ge(ot.DragCancel)});Mn.current=je;function ge(RA){return async function(){const{active:Xe,collisions:Se,over:Ar,scrollAdjustedTranslate:tn}=U.current;let Hr=null;if(Xe&&tn){const{cancelDrop:il}=H.current;Hr={activatorEvent:ye,active:Xe,collisions:Se,delta:tn,over:Ar},RA===ot.DragEnd&&typeof il=="function"&&await Promise.resolve(il(Hr))&&(RA=ot.DragCancel)}Z.current=null,Ts.unstable_batchedUpdates(()=>{h({type:RA}),z(Ps.Uninitialized),Ze(null),Q(null),T(null),Mn.current=null;const il=RA===ot.DragEnd?"onDragEnd":"onDragCancel";if(Hr){const Ov=H.current[il];Ov==null||Ov(Hr),w({type:il,event:Hr})}})}}},[M]),gs=P.useCallback((ue,se)=>(BA,oe)=>{const fe=BA.nativeEvent,ye=M.get(oe);if(Z.current!==null||!ye||fe.dndKit||fe.defaultPrevented)return;const je={active:ye};ue(BA,se.options,je)===!0&&(fe.dndKit={capturedBy:se.sensor},Z.current=oe,Cn(BA,se))},[M,Cn]),Tt=WrA(u,gs);tsA(u),Dr(()=>{_&&x===Ps.Initializing&&z(Ps.Initialized)},[_,x]),P.useEffect(()=>{const{onDragMove:ue}=H.current,{active:se,activatorEvent:BA,collisions:oe,over:fe}=U.current;if(!se||!BA)return;const ye={active:se,activatorEvent:BA,collisions:oe,delta:{x:HA.x,y:HA.y},over:fe};Ts.unstable_batchedUpdates(()=>{ue==null||ue(ye),w({type:"onDragMove",event:ye})})},[HA.x,HA.y]),P.useEffect(()=>{const{active:ue,activatorEvent:se,collisions:BA,droppableContainers:oe,scrollAdjustedTranslate:fe}=U.current;if(!ue||Z.current==null||!se||!fe)return;const{onDragOver:ye}=H.current,je=oe.get(be),ge=je&&je.rect.current?{id:je.id,rect:je.rect.current,data:je.data,disabled:je.disabled}:null,RA={active:ue,activatorEvent:se,collisions:BA,delta:{x:fe.x,y:fe.y},over:ge};Ts.unstable_batchedUpdates(()=>{Ze(ge),ye==null||ye(RA),w({type:"onDragOver",event:RA})})},[be]),Dr(()=>{U.current={activatorEvent:Y,active:k,activeNode:nA,collisionRect:qA,collisions:jA,droppableRects:G,draggableNodes:M,draggingNode:YA,draggingNodeRect:ee,droppableContainers:X,over:ce,scrollableAncestors:L,scrollAdjustedTranslate:HA},E.current={initial:ee,translated:qA}},[k,nA,jA,qA,M,YA,ee,G,X,ce,L,HA]),LrA({...eA,delta:I,draggingRect:qA,pointerCoordinates:cA,scrollableAncestors:L,scrollableAncestorRects:$});const gn=P.useMemo(()=>({active:k,activeNode:nA,activeNodeRect:_,activatorEvent:Y,collisions:jA,containerNodeRect:W,dragOverlay:TA,draggableNodes:M,droppableContainers:X,droppableRects:G,over:ce,measureDroppableContainers:J,scrollableAncestors:L,scrollableAncestorRects:$,measuringConfiguration:O,measuringScheduled:K,windowRect:GA}),[k,nA,_,Y,jA,W,TA,M,X,G,ce,J,L,$,O,K,GA]),bA=P.useMemo(()=>({activatorEvent:Y,activators:Tt,active:k,activeNodeRect:_,ariaDescribedById:{draggable:N},dispatch:h,draggableNodes:M,over:ce,measureDroppableContainers:J}),[Y,Tt,k,_,h,N,M,ce,J]);return P.createElement(W4.Provider,{value:b},P.createElement(Pv.Provider,{value:bA},P.createElement(ij.Provider,{value:gn},P.createElement(lj.Provider,{value:$n},c)),P.createElement(dsA,{disabled:(o==null?void 0:o.restoreFocus)===!1})),P.createElement(mrA,{...o,hiddenTextDescribedById:N}));function tt(){const ue=(C==null?void 0:C.autoScrollEnabled)===!1,se=typeof i=="object"?i.enabled===!1:i===!1,BA=D&&!ue&&!se;return typeof i=="object"?{...i,enabled:BA}:{enabled:BA}}}),psA=P.createContext(null),yP="button",hsA="Draggable";function wsA(A){let{id:e,data:t,disabled:n=!1,attributes:r}=A;const s=zu(hsA),{activators:a,activatorEvent:o,active:i,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:d}=P.useContext(Pv),{role:g=yP,roleDescription:v="draggable",tabIndex:m=0}=r??{},p=(i==null?void 0:i.id)===e,h=P.useContext(p?lj:psA),[w,b]=kd(),[x,z]=kd(),D=nsA(a,e),B=Cc(t);Dr(()=>(f.set(e,{id:e,key:s,node:w,activatorNode:x,data:B}),()=>{const I=f.get(e);I&&I.key===s&&f.delete(e)}),[f,e]);const M=P.useMemo(()=>({role:g,tabIndex:m,"aria-disabled":n,"aria-pressed":p&&g===yP?!0:void 0,"aria-roledescription":v,"aria-describedby":u.draggable}),[n,g,m,p,v,u.draggable]);return{active:i,activatorEvent:o,activeNodeRect:c,attributes:M,isDragging:p,listeners:n?void 0:D,node:w,over:d,setNodeRef:b,setActivatorNodeRef:z,transform:h}}function ysA(){return P.useContext(ij)}const PsA="Droppable",bsA={timeout:25};function xsA(A){let{data:e,disabled:t=!1,id:n,resizeObserverConfig:r}=A;const s=zu(PsA),{active:a,dispatch:o,over:i,measureDroppableContainers:c}=P.useContext(Pv),u=P.useRef({disabled:t}),f=P.useRef(!1),d=P.useRef(null),g=P.useRef(null),{disabled:v,updateMeasurementsFor:m,timeout:p}={...bsA,...r},h=Cc(m??n),w=P.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(h.current)?h.current:[h.current]),g.current=null},p)},[p]),b=yv({callback:w,disabled:v||!a}),x=P.useCallback((M,I)=>{b&&(I&&(b.unobserve(I),f.current=!1),M&&b.observe(M))},[b]),[z,D]=kd(x),B=Cc(e);return P.useEffect(()=>{!b||!z.current||(b.disconnect(),f.current=!1,b.observe(z.current))},[z,b]),P.useEffect(()=>(o({type:ot.RegisterDroppable,element:{id:n,key:s,disabled:t,node:z,rect:d,data:B}}),()=>o({type:ot.UnregisterDroppable,key:s,id:n})),[n]),P.useEffect(()=>{t!==u.current.disabled&&(o({type:ot.SetDroppableDisabled,id:n,key:s,disabled:t}),u.current.disabled=t)},[n,s,t,o]),{active:a,rect:d,isOver:(i==null?void 0:i.id)===n,node:z,over:i,setNodeRef:D}}function cj(A,e,t){const n=A.slice();return n.splice(t<0?n.length+t:t,0,n.splice(e,1)[0]),n}function zsA(A,e){return A.reduce((t,n,r)=>{const s=e.get(n);return s&&(t[r]=s),t},Array(A.length))}function cf(A){return A!==null&&A>=0}function DsA(A,e){if(A===e)return!0;if(A.length!==e.length)return!1;for(let t=0;t<A.length;t++)if(A[t]!==e[t])return!1;return!0}function BsA(A){return typeof A=="boolean"?{draggable:A,droppable:A}:A}const uj=A=>{let{rects:e,activeIndex:t,overIndex:n,index:r}=A;const s=cj(e,n,t),a=e[r],o=s[r];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},uf={scaleX:1,scaleY:1},Cu=A=>{var e;let{activeIndex:t,activeNodeRect:n,index:r,rects:s,overIndex:a}=A;const o=(e=s[t])!=null?e:n;if(!o)return null;if(r===t){const c=s[a];return c?{x:0,y:t<a?c.top+c.height-(o.top+o.height):c.top-o.top,...uf}:null}const i=MsA(s,r,t);return r>t&&r<=a?{x:0,y:-o.height-i,...uf}:r<t&&r>=a?{x:0,y:o.height+i,...uf}:{x:0,y:0,...uf}};function MsA(A,e,t){const n=A[e],r=A[e-1],s=A[e+1];return n?t<e?r?n.top-(r.top+r.height):s?s.top-(n.top+n.height):0:s?s.top-(n.top+n.height):r?n.top-(r.top+r.height):0:0}const fj="Sortable",dj=P.createContext({activeIndex:-1,containerId:fj,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:uj,disabled:{draggable:!1,droppable:!1}});function ju(A){let{children:e,id:t,items:n,strategy:r=uj,disabled:s=!1}=A;const{active:a,dragOverlay:o,droppableRects:i,over:c,measureDroppableContainers:u}=ysA(),f=zu(fj,t),d=o.rect!==null,g=P.useMemo(()=>n.map(D=>typeof D=="object"&&"id"in D?D.id:D),[n]),v=a!=null,m=a?g.indexOf(a.id):-1,p=c?g.indexOf(c.id):-1,h=P.useRef(g),w=!DsA(g,h.current),b=p!==-1&&m===-1||w,x=BsA(s);Dr(()=>{w&&v&&u(g)},[w,g,v,u]),P.useEffect(()=>{h.current=g},[g]);const z=P.useMemo(()=>({activeIndex:m,containerId:f,disabled:x,disableTransforms:b,items:g,overIndex:p,useDragOverlay:d,sortedRects:zsA(g,i),strategy:r}),[m,f,x.draggable,x.droppable,b,g,p,i,d,r]);return P.createElement(dj.Provider,{value:z},e)}const CsA=A=>{let{id:e,items:t,activeIndex:n,overIndex:r}=A;return cj(t,n,r).indexOf(e)},jsA=A=>{let{containerId:e,isSorting:t,wasDragging:n,index:r,items:s,newIndex:a,previousItems:o,previousContainerId:i,transition:c}=A;return!c||!n||o!==s&&r===a?!1:t?!0:a!==r&&e===i},OsA={duration:200,easing:"ease"},gj="transform",TsA=is.Transition.toString({property:gj,duration:0,easing:"linear"}),EsA={roleDescription:"sortable"};function HsA(A){let{disabled:e,index:t,node:n,rect:r}=A;const[s,a]=P.useState(null),o=P.useRef(t);return Dr(()=>{if(!e&&t!==o.current&&n.current){const i=r.current;if(i){const c=sl(n.current,{ignoreTransform:!0}),u={x:i.left-c.left,y:i.top-c.top,scaleX:i.width/c.width,scaleY:i.height/c.height};(u.x||u.y)&&a(u)}}t!==o.current&&(o.current=t)},[e,t,n,r]),P.useEffect(()=>{s&&a(null)},[s]),s}function Ou(A){let{animateLayoutChanges:e=jsA,attributes:t,disabled:n,data:r,getNewIndex:s=CsA,id:a,strategy:o,resizeObserverConfig:i,transition:c=OsA}=A;const{items:u,containerId:f,activeIndex:d,disabled:g,disableTransforms:v,sortedRects:m,overIndex:p,useDragOverlay:h,strategy:w}=P.useContext(dj),b=NsA(n,g),x=u.indexOf(a),z=P.useMemo(()=>({sortable:{containerId:f,index:x,items:u},...r}),[f,r,x,u]),D=P.useMemo(()=>u.slice(u.indexOf(a)),[u,a]),{rect:B,node:M,isOver:I,setNodeRef:X}=xsA({id:a,data:z,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...i}}),{active:V,activatorEvent:E,activeNodeRect:k,attributes:Z,setNodeRef:C,listeners:Q,isDragging:Y,over:T,setActivatorNodeRef:H,transform:N}=wsA({id:a,data:z,attributes:{...EsA,...t},disabled:b.draggable}),j=nrA(X,C),O=!!V,G=O&&!v&&cf(d)&&cf(p),J=!h&&Y,K=J&&G?N:null,R=G?K??(o??w)({rects:m,activeNodeRect:k,activeIndex:d,overIndex:p,index:x}):null,eA=cf(d)&&cf(p)?s({id:a,items:u,activeIndex:d,overIndex:p}):x,AA=V==null?void 0:V.id,_=P.useRef({activeId:AA,items:u,newIndex:eA,containerId:f}),W=u!==_.current.items,U=e({active:V,containerId:f,isDragging:Y,isSorting:O,id:a,index:x,items:u,newIndex:_.current.newIndex,previousItems:_.current.items,previousContainerId:_.current.containerId,transition:c,wasDragging:_.current.activeId!=null}),PA=HsA({disabled:!U,index:x,node:M,rect:B});return P.useEffect(()=>{O&&_.current.newIndex!==eA&&(_.current.newIndex=eA),f!==_.current.containerId&&(_.current.containerId=f),u!==_.current.items&&(_.current.items=u)},[O,eA,f,u]),P.useEffect(()=>{if(AA===_.current.activeId)return;if(AA!=null&&_.current.activeId==null){_.current.activeId=AA;return}const YA=setTimeout(()=>{_.current.activeId=AA},50);return()=>clearTimeout(YA)},[AA]),{active:V,activeIndex:d,attributes:Z,data:z,rect:B,index:x,newIndex:eA,items:u,isOver:I,isSorting:O,isDragging:Y,listeners:Q,node:M,overIndex:p,over:T,setNodeRef:j,setActivatorNodeRef:H,setDroppableNodeRef:X,setDraggableNodeRef:C,transform:PA??R,transition:TA()};function TA(){if(PA||W&&_.current.newIndex===x)return TsA;if(!(J&&!V0(E)||!c)&&(O||U))return is.Transition.toString({...c,property:gj})}}function NsA(A,e){var t,n;return typeof A=="boolean"?{draggable:A,droppable:!1}:{draggable:(t=A==null?void 0:A.draggable)!=null?t:e.draggable,droppable:(n=A==null?void 0:A.droppable)!=null?n:e.droppable}}function Vd(A){if(!A)return!1;const e=A.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const ksA=[le.Down,le.Right,le.Up,le.Left],Tu=(A,e)=>{let{context:{active:t,collisionRect:n,droppableRects:r,droppableContainers:s,over:a,scrollableAncestors:o}}=e;if(ksA.includes(A.code)){if(A.preventDefault(),!t||!n)return;const i=[];s.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const d=r.get(f.id);if(d)switch(A.code){case le.Down:n.top<d.top&&i.push(f);break;case le.Up:n.top>d.top&&i.push(f);break;case le.Left:n.left>d.left&&i.push(f);break;case le.Right:n.left<d.left&&i.push(f);break}});const c=hrA({collisionRect:n,droppableRects:r,droppableContainers:i});let u=U4(c,"id");if(u===(a==null?void 0:a.id)&&c.length>1&&(u=c[1].id),u!=null){const f=s.get(t.id),d=s.get(u),g=d?r.get(d.id):null,v=d==null?void 0:d.node.current;if(v&&g&&f&&d){const p=wv(v).some((D,B)=>o[B]!==D),h=vj(f,d),w=ZsA(f,d),b=p||!h?{x:0,y:0}:{x:w?n.width-g.width:0,y:w?n.height-g.height:0},x={x:g.left,y:g.top};return b.x&&b.y?x:jc(x,b)}}}};function vj(A,e){return!Vd(A)||!Vd(e)?!1:A.data.current.sortable.containerId===e.data.current.sortable.containerId}function ZsA(A,e){return!Vd(A)||!Vd(e)||!vj(A,e)?!1:A.data.current.sortable.index<e.data.current.sortable.index}const SsA=({index:A,item:e,updateItem:t,removeItem:n})=>{var p;const r=P.useRef({});e.unit&&e.quantity&&!r.current[e.unit]&&(r.current[e.unit]=e.quantity);const{attributes:s,listeners:a,setNodeRef:o,transform:i,isDragging:c}=Ou({id:e.id}),{inputGroupProps:u}=zn(),{showValue:f=!0,showQuantity:d=!0,isMultiple:g=!0,placeholder:v}=u||{},m={transform:is.Transform.toString(i)};return l.jsx("div",{ref:o,style:m,...s,className:"sortable-item",children:l.jsxs("div",{id:e.id,"data-id":e.id,className:S("grid grid-cols-22 gap-2 items-center group p-2 py-4",{"bg-accent/50 border border-b-4 border-accent":c,"grid-cols-12":!f||!d,"grid-cols-10":(!f||!d)&&!g,"p-0":!g}),"aria-disabled":!0,children:[g&&l.jsx("div",{className:"col-span-1 flex items-center justify-center ",...a,children:l.jsx("div",{className:S("cursor-grab active:cursor-grabbing rounded"),children:l.jsx(Th,{className:"h-6 w-7 text-muted-foreground "})})}),f&&l.jsx("div",{className:"col-span-10 ",children:l.jsx(Wt,{placeholder:v||`Enter ${u==null?void 0:u.type}`,value:e.value,onChange:h=>t(A,"value",h.target.value),className:S("border bg-transparent","focus-visible:ring-0 focus-visible:ring-offset-0","transition-all duration-200",{"border-0 rounded-none ring-0":!g})})}),d&&l.jsxs("div",{className:"col-span-10 flex flex-1 items-stretch justify-items-stretch",children:[l.jsx(Wt,{placeholder:e.unit==="Custom"?"Enter time with qualitative info (e.g., 10 mins plus overnight chilling)":e.unit==="N/A"?"":f?"Enter quantity":v,value:e.unit==="N/A"?"":e.quantity,disabled:e.unit==="N/A",onChange:h=>{const w=e.unit==="N/A"?null:h.target.value;t(A,"quantity",w),e.unit&&e.unit!=="N/A"&&w&&(r.current[e.unit]=w)},className:S("border bg-transparent rounded-r-none","focus-visible:ring-0 focus-visible:ring-offset-0","transition-all duration-200",{"border-0 border-r-1 rounded-none ring-0":!g},{"opacity-50 cursor-not-allowed":e.unit==="N/A"})}),(u==null?void 0:u.units)&&(typeof u.units=="string"||u.freeTextUnits?l.jsx(Wt,{placeholder:u.unitsPlaceholder||"Enter unit",value:e.unit,onChange:h=>t(A,"unit",h.target.value),className:S("w-fit border border-l-0 bg-background h-9 rounded-l-none","focus-visible:ring-0 focus-visible:ring-offset-0","transition-all duration-200",{"border-0 rounded-none":!g})}):l.jsxs(yi,{value:e.unit,defaultValue:(p=u.units[0])==null?void 0:p.value,onValueChange:h=>{if(e.unit&&e.unit!=="N/A"&&e.quantity&&e.quantity.trim()!==""&&(r.current[e.unit]=e.quantity),t(A,"unit",h),h==="N/A")t(A,"quantity",null);else{const w=r.current[h]||"";t(A,"quantity",w)}},children:[l.jsx($a,{className:S("w-fit border border-l-0 bg-muted h-9 rounded-l-none","focus:ring-0 focus:ring-offset-0","transition-all duration-200",{"border-0 rounded-none ":!g}),children:l.jsx(Pi,{className:"capitalize"})}),l.jsx(Ao,{children:u.units.map(h=>l.jsx(gr,{value:h.value,className:"capitalize",children:h.label},h.value))})]}))]}),g&&l.jsx("div",{className:"col-span-1 flex justify-end ",children:l.jsx(pA,{variant:"ghost",size:"sm",onClick:()=>n(A),className:S("h-6 w-6 p-0","transition-opacity duration-200","hover:bg-destructive/10"),children:l.jsx(yn,{className:"h-3 w-3 text-destructive"})})})]},e.id)})},VsA=()=>{const{state:A,dispatch:e,labelProps:t,inputGroupProps:n}=zn(),{showValue:r=!0,showQuantity:s=!0,isMultiple:a=!0}=n||{},{value:o}=A,i=y.useMemo(()=>Array.isArray(o)&&o.length>0?o:[{id:Date.now().toString(),value:"",quantity:"",unit:""}],[o,n==null?void 0:n.units]),c=m=>{e({type:"SET_VALUE",payload:m})},u=(m,p,h)=>{const w=[...i];w[m]&&(w[m][p]=h||""),c(w)},f=()=>{const m={id:Date.now().toString(),value:"",quantity:"",unit:""};c([...i,m])},d=m=>{const p=i.filter((h,w)=>w!==m);c(p)},g=Du(Br(vo),Br(go,{coordinateGetter:Tu}));function v(m){const{active:p,over:h}=m,w=[...i],b=i.findIndex(D=>D.id==(h==null?void 0:h.id)),x=i.findIndex(D=>D.id==(p==null?void 0:p.id)),z=i[x];z&&(w.splice(x,1),w.splice(b,0,z)),c(w)}return l.jsxs("div",{className:S("bg-background",n==null?void 0:n.className),children:[l.jsxs("div",{className:S("grid grid-cols-22 gap-2 px-2 py-2 text-sm text-muted-foreground bg-muted border text-muted-forground rounded rounded-b-none",t==null?void 0:t.className),children:[a&&l.jsx("span",{className:"col-span-1"}),r&&l.jsx("span",{className:"col-span-10 capitalize text-sm text-muted-foreground",children:n==null?void 0:n.type}),s&&l.jsx("span",{className:"col-span-10 capitalize text-sm text-muted-foreground",children:!r&&(n!=null&&n.type)?n==null?void 0:n.type:"Quantity"}),a&&l.jsx("span",{className:"col-span-1"})]}),l.jsx("div",{className:S("border border-t-0 rounded rounded-t-none"),children:l.jsx(Mu,{sensors:g,collisionDetection:Bu,onDragEnd:v,children:l.jsx(ju,{items:i.map(m=>m.id),strategy:Cu,children:i.map((m,p)=>l.jsx(SsA,{item:m,removeItem:d,updateItem:u,index:p},m.id))})})}),a&&l.jsx("div",{className:"flex justify-end items-center gap-4 py-4 ",children:l.jsxs(pA,{variant:"outline",onClick:f,className:S("capitalize hover:bg-primary","transition-colors duration-200"),children:[l.jsx(As,{}),"Add another ",n==null?void 0:n.type]})})]})},XsA=({index:A,item:e,updateItem:t,removeItem:n})=>{const{attributes:r,listeners:s,setNodeRef:a,transform:o,isDragging:i}=Ou({id:e.id}),{sortableGroupProps:c}=zn(),{isMultiple:u=!0}=c||{},f={transform:is.Transform.toString(o)};return l.jsx("div",{ref:a,style:f,...r,className:"sortable-item",children:l.jsxs("div",{id:e.id,"data-id":e.id,className:S("grid grid-cols-16 gap-2 items-center group p-2 py-4",{"bg-accent/50 border border-b-4 border-accent":i,"p-0":!u}),"aria-disabled":!0,children:[u&&l.jsx("div",{className:"col-span-1 flex items-center justify-center ",...s,children:l.jsx("div",{className:S("cursor-grab active:cursor-grabbing rounded"),children:l.jsx(Th,{className:"h-6 w-7 text-muted-foreground "})})}),l.jsx("div",{className:"col-span-14 ",children:l.jsx($e,{...c==null?void 0:c.itemProps,onChange:d=>t(A,"value",d)})}),u&&l.jsx("div",{className:"col-span-1 flex justify-end ",children:l.jsx(pA,{variant:"ghost",size:"sm",onClick:()=>n(A),className:S("h-6 w-6 p-0","transition-opacity duration-200","hover:bg-destructive/10"),children:l.jsx(yn,{className:"h-3 w-3 text-destructive"})})})]},e.id)})},YsA=()=>{const{state:A,sortableGroupProps:e}=zn(),{isMultiple:t=!0}=e||{},{value:n}=A;console.log("SortableGroup value:",JSON.stringify(n));const r=y.useMemo(()=>Array.isArray(n)&&n.length>0?n:[{id:Date.now().toString(),value:""}],[n]),s=f=>{console.log("Updating items:",f)},a=(f,d,g)=>{const v=[...r];if(v[f])switch(d){case"value":v[f].value=g;break;case"id":v[f].id=g;break}s(v)},o=()=>{const f={id:Date.now().toString(),value:""};s([...r,f])},i=f=>{const d=r.filter((g,v)=>v!==f);s(d)},c=Du(Br(vo),Br(go,{coordinateGetter:Tu}));function u(f){const{active:d,over:g}=f,v=[...r],m=r.findIndex(w=>w.id==(g==null?void 0:g.id)),p=r.findIndex(w=>w.id==(d==null?void 0:d.id)),h=r[p];h&&(v.splice(p,1),v.splice(m,0,h)),s(v)}return l.jsxs("div",{className:S("bg-background",e==null?void 0:e.className),children:[l.jsx("div",{className:S("border border-t-0 rounded rounded-t-none"),children:l.jsx(Mu,{sensors:c,collisionDetection:Bu,onDragEnd:u,children:l.jsx(ju,{items:r.map(f=>f.id),strategy:Cu,children:r.map((f,d)=>l.jsx(XsA,{item:f,removeItem:i,updateItem:a,index:d},f.id))})})}),t&&l.jsx("div",{className:"flex justify-end items-center gap-4 py-4 ",children:l.jsxs(pA,{variant:"outline",onClick:o,className:S("capitalize hover:bg-primary","transition-colors duration-200"),children:[l.jsx(As,{}),"Add another ",e==null?void 0:e.type]})})]})},GsA=({item:A,index:e,definition:t,updateItem:n,removeItem:r,sortable:s,fallbackPlaceholder:a})=>{const{attributes:o,setNodeRef:i,transform:c,isDragging:u}=Ou({id:A.id,disabled:!s}),f={transform:is.Transform.toString(c)},d=(t==null?void 0:t.placeholder)||a||"Enter value...";return l.jsx("div",{ref:i,style:f,...o,className:"sortable-item",children:l.jsxs("div",{className:S("flex items-center gap-3 px-3 py-3 border-b last:border-b-0 bg-background transition-colors",{"bg-accent/50 border border-b-4 border-accent shadow-sm":u}),children:[(t==null?void 0:t.icon)&&l.jsx("div",{className:"shrink-0 flex items-center justify-center w-8 h-8",children:t.icon}),l.jsx(Wt,{type:"text",value:A.value,placeholder:d,onChange:g=>n(e,g.target.value),className:S("flex-1 border-0 shadow-none bg-transparent p-1 ")}),l.jsx(pA,{variant:"ghost",size:"sm",onClick:()=>r(e),className:"shrink-0 h-8 w-8 p-0 hover:bg-destructive/10",children:l.jsx(yn,{className:"h-4 w-4 text-destructive"})})]})})},IsA=()=>{const{state:A,dispatch:e,customListProps:t}=zn(),{value:n}=A,{definitions:r=[],allowDuplicates:s=!1,sortable:a=!0,placeholder:o,addLabel:i="Add item",className:c}=t||{},u=y.useMemo(()=>{const b=new Map;return r.forEach(x=>b.set(x.key,x)),b},[r]),f=y.useMemo(()=>Array.isArray(n)&&n.length>0&&n.every(x=>typeof x=="object"&&x!==null&&"id"in x&&"key"in x&&"value"in x)?n:[],[n]),d=b=>{e({type:"SET_VALUE",payload:b})},g=(b,x)=>{const z=[...f];z[b]&&(z[b]={...z[b],value:x}),d(z)},v=b=>{const x={id:Date.now().toString(),key:b,value:""};d([...f,x])},m=b=>{d(f.filter((x,z)=>z!==b))},p=y.useMemo(()=>s?r:r.filter(b=>!f.some(x=>x.key===b.key)),[r,f,s]),h=Du(Br(vo),Br(go,{coordinateGetter:Tu})),w=b=>{const{active:x,over:z}=b;if(!z||x.id===z.id)return;const D=[...f],B=D.findIndex(X=>X.id===x.id),M=D.findIndex(X=>X.id===z.id),[I]=D.splice(B,1);I&&D.splice(M,0,I),d(D)};return l.jsxs("div",{className:S("bg-background",c),children:[f.length>0&&l.jsx("div",{className:"border rounded overflow-hidden",children:l.jsx(Mu,{sensors:h,collisionDetection:Bu,onDragEnd:w,children:l.jsx(ju,{items:f.map(b=>b.id),strategy:Cu,children:f.map((b,x)=>l.jsx(GsA,{item:b,index:x,definition:u.get(b.key),updateItem:g,removeItem:m,sortable:a,fallbackPlaceholder:o},b.id))})})}),p.length>0&&l.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-3",children:p.map(b=>l.jsxs(pA,{variant:"outline",size:"sm",onClick:()=>v(b.key),className:"capitalize hover:bg-primary transition-colors duration-200 gap-1.5",children:[b.icon?l.jsx("span",{className:"w-4 h-4 flex items-center justify-center",children:b.icon}):l.jsx(As,{className:"h-3.5 w-3.5"}),b.label]},b.key))}),r.length===0&&l.jsx("div",{className:"flex justify-end items-center gap-4 py-4",children:l.jsxs(pA,{variant:"outline",onClick:()=>v("default"),className:"capitalize hover:bg-primary transition-colors duration-200",children:[l.jsx(As,{className:"mr-1"}),i]})})]})},PP=({className:A,inputProps:e,linkProps:t,textareaProps:n,wysiwygProps:r,switchProps:s,labelProps:a,label:o,defaultValue:i,type:c="input",maxLetterCount:u,name:f=""})=>{const{state:d,dispatch:g,onChange:v,imageGalleryConfig:m,blogPostsConfig:p,error:h}=zn(),{value:w}=d,b=y.useRef(null),x=P.useCallback(E=>{g({type:"SET_VALUE",payload:E.target.value})},[g]),z=P.useCallback(E=>{g({type:"SET_VALUE",payload:E.target.value})},[g]),D=P.useCallback(E=>{g({type:"SET_VALUE",payload:E})},[g]),B=P.useCallback(E=>{g({type:"SET_VALUE",payload:E})},[g]),M=P.useCallback(()=>{g({type:"TOGGLE_EDIT_LINK_MODAL"})},[g]),I=P.useMemo(()=>{var k,Z;if(!u)return null;const E=((Z=w==null?void 0:(k=w.toString()).trim)==null?void 0:Z.call(k).length)||0;return{currentLength:E,isOverLimit:E>u}},[w,u]);function X(E){var k;try{const Z=(k=b==null?void 0:b.current)==null?void 0:k.value;navigator.clipboard.writeText(`${E}${Z}`)}catch(Z){console.error("Failed to copy text: ",Z)}}const V=()=>{switch(c){case"switch":return l.jsx(N9,{...s,checked:w,onCheckedChange:D});case"textarea":return l.jsxs("div",{className:"w-full flex gap-1 items-stretch",children:[(n==null?void 0:n.prefix)&&l.jsx("span",{className:S("flex items-center p-2 opacity-70 text-sm"),children:n.prefix}),l.jsx(Vg,{defaultValue:i,...n,rows:3,value:w,onChange:E=>{z(E),v&&v(E.target.value)},className:S("p-2 h-fit !min-h-0 !text-sm rounded-none border-0 focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none focus-visible:outline-none bg-background",n==null?void 0:n.className)})]});case"optionslist":return l.jsx(trA,{});case"select":return l.jsx(tnA,{});case"image":return l.jsx(enA,{});case"blogposts":return l.jsx(UnA,{});case"video":return l.jsx(KnA,{});case"inputgroup":return l.jsx(VsA,{});case"sortablegroup":return l.jsx(YsA,{});case"sociallinks":case"customlist":return l.jsx(IsA,{});case"wysiwyg":return l.jsx(FnA,{...r,imageGalleryConfig:(r==null?void 0:r.imageGalleryConfig)||m,blogPostsConfig:(r==null?void 0:r.blogPostsConfig)||p,initialValue:w,onChange:E=>{B(E),v&&v(E)},className:S(r==null?void 0:r.className),asChild:!0});case"link":return l.jsxs("div",{className:"w-full flex items-center gap-1 overflow-auto",children:[(t==null?void 0:t.prefix)&&l.jsx("span",{className:S("p-2 opacity-70 text-sm"),children:t.prefix}),l.jsxs("div",{className:"flex-1 w-fit flex items-center gap-1 bg-background p-2",children:[l.jsx(Wt,{className:S("disabled:opacity-100 flex-1 w-10 underline text-sm truncate border-0 p-0 shadow-none",t==null?void 0:t.className),disabled:!0,ref:b,value:w.toString(),placeholder:t==null?void 0:t.placeholder}),l.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:M,children:l.jsx(Rs,{})}),l.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>X(t==null?void 0:t.prefix),children:l.jsx(cnA,{className:"text-primary font-bold"})})]})]});case"input":default:return l.jsxs("div",{className:"w-full flex grow bg-accent gap-1 items-stretch",children:[(e==null?void 0:e.prefix)&&l.jsx("span",{className:S("flex items-center p-2 opacity-70 text-sm"),children:e.prefix}),(e==null?void 0:e.type)=="date"?l.jsx(K2,{defaultValue:i,onChange:E=>{const k=Te(E,"yyyy-MM-dd");g({type:"SET_VALUE",payload:k}),v&&v(k)}}):l.jsx(Wt,{type:"text",defaultValue:i,...e,value:w,onChange:E=>{x(E),v&&v(E.target.value)},className:S("p-2 rounded-none bg-background border-0 focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none focus-visible:outline-none",e==null?void 0:e.className)})]})}};return l.jsxs("div",{className:S("waz_input_box w-full rounded border flex flex-col bg-muted text-[#101828] overflow-hidden",{"flex-row justify-between items-center p-1 pr-4":c=="switch"},{"bg-background":c=="blogposts"||c=="wysiwyg"||c=="customlist"},{"border-none":c=="blogposts"||c=="inputgroup"||c=="sociallinks"||c=="customlist"},A),"data-testid":"input-box:"+f,children:[l.jsxs(Ez,{...a,className:S("waz_input_box_label p-2 border-b text-muted-foreground text-sm flex gap-2 items-center !opacity-100",{"border-none ":c=="switch"},{"hidden border-none":c=="blogposts"||c=="inputgroup"},{"bg-muted border-b-0 pb-0 ":c=="wysiwyg"},a==null?void 0:a.className),children:[o,h&&l.jsxs("span",{className:"flex items-center justify-center gap-1",children:[l.jsx(N0,{className:"text-destructive text-xl"}),l.jsx("span",{className:"capitalize text-xs text-muted-foreground",children:h==null?void 0:h.message})]})]}),V(),I&&l.jsx("div",{className:S("flex justify-end text-muted-foreground p-2 bg-background w-full text-sm",{"text-destructive font-bold":I.isOverLimit}),children:l.jsx("span",{className:"opacity-60",children:`${I.currentLength}/${u}`})}),c=="link"&&l.jsx(erA,{})]})},bP=(A,e)=>e==="select"?Array.isArray(A)?A.every(t=>typeof t=="object"&&"label"in t&&"value"in t)?A:[]:typeof A=="object"&&A!==null&&"label"in A&&"value"in A?A:[]:e==="optionslist"?Array.isArray(A)?A.every(t=>typeof t=="object"&&"label"in t&&"value"in t)?A:[]:[]:e==="inputgroup"?Array.isArray(A)?A.every(t=>typeof t=="object"&&"id"in t)?A:[]:[]:e==="customlist"?Array.isArray(A)?A.every(t=>typeof t=="object"&&"id"in t&&"key"in t&&"value"in t)?A:[]:[]:e==="switch"?typeof A=="boolean"?A:A=="true":e==="image"?typeof A=="object"?A:{id:"",url:typeof A=="string"?A:"",title:"",caption:"",description:"",alternative_text:"",created_at:"",uuid:""}:e=="blogposts"?Array.isArray(A)?A:[]:typeof A=="number"?A:A==null?"":String(A),$e=A=>{const e=P.useMemo(()=>bP(A.value,A.type),[A.value,A.type]),t=P.useMemo(()=>bP(A.defaultValue,A.type),[A.defaultValue,A.type]),n={defaultValue:e||t,onChange:A.onChange,imageGalleryConfig:A.imageGalleryConfig,blogPostsConfig:A.blogPostsConfig,selectProps:A.selectProps,apolloUri:A.apolloUri,validationError:A.validationError,label:A.label,linkProps:A.linkProps,error:A.error,inputGroupProps:A.inputGroupProps,sortableGroupProps:A.sortableGroupProps,customListProps:A.customListProps,className:A.className};if(A.apolloUri){let r;return A.type=="image"||A.type=="wysiwyg"?r=ds(A.apolloUri):r=tl(A.apolloUri),l.jsx(Xt,{client:r,children:l.jsx(U3,{...n,children:l.jsx(PP,{...A})})})}return l.jsx(U3,{...n,children:l.jsx(PP,{...A})})},QsA=[];function LsA({open:A,onOpenChange:e,onRepost:t,post:n,repostOptions:r=QsA,title:s="Repost Article",description:a="Select a website you would like to repost this article to"}){const[o,i]=P.useState({label:"",value:""}),c=()=>{n&&o&&(t(n,o.value),i({label:"",value:""}))},u=()=>{i({label:"",value:""}),e(!1)};return l.jsx(xt,{open:A,onOpenChange:e,children:l.jsxs(vt,{className:"max-w-[425px] p-0 overflow-hidden rounded-xl",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{children:l.jsx("h1",{className:"text-md capitalize",children:s})})}),l.jsx(ls,{className:"px-4 py-2 text-sm text-muted-foreground",children:a}),l.jsx("div",{className:"px-4 pb-4",children:l.jsx($e,{label:"Repost article to",type:"select",value:o,onChange:f=>{i(f)},selectProps:{options:r.map(f=>({label:f.label,value:f.value})),placeholder:"Select an option"}})}),l.jsxs(fn,{className:"flex flex-row p-4 pt-0 gap-4 justify-end",children:[l.jsx(pA,{variant:"outline",className:"rounded",onClick:u,children:"Cancel"}),l.jsx(ve,{variant:"primary",className:"rounded",onClick:c,disabled:!o,children:"Repost"})]})]})})}function JsA(A){return JA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112z"},child:[]},{tag:"circle",attr:{cx:"256",cy:"256",r:"80",fill:"none",strokeMiterlimit:"10",strokeWidth:"32"},child:[]}]})(A)}function Oo(A){return JA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M322 416c0 35.35-20.65 64-56 64H134c-35.35 0-56-28.65-56-64m258-80c17.67 0 32 17.91 32 40h0c0 22.09-14.33 40-32 40H64c-17.67 0-32-17.91-32-40h0c0-22.09 14.33-40 32-40"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M344 336H179.31a8 8 0 0 0-5.65 2.34l-26.83 26.83a4 4 0 0 1-5.66 0l-26.83-26.83a8 8 0 0 0-5.65-2.34H56a24 24 0 0 1-24-24h0a24 24 0 0 1 24-24h288a24 24 0 0 1 24 24h0a24 24 0 0 1-24 24zM64 276v-.22c0-55 45-83.78 100-83.78h72c55 0 100 29 100 84v-.22M241 112l7.44 63.97"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 480h139.31a32 32 0 0 0 31.91-29.61L463 112"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"m368 112 16-64 47-16"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M224 112h256"},child:[]}]})(A)}function xP(A){return JA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M472 168H40a24 24 0 0 1 0-48h432a24 24 0 0 1 0 48zm-80 112H120a24 24 0 0 1 0-48h272a24 24 0 0 1 0 48zm-96 112h-80a24 24 0 0 1 0-48h80a24 24 0 0 1 0 48z"},child:[]}]})(A)}function qsA(A){return JA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"36",d:"M208 352h-64a96 96 0 0 1 0-192h64m96 0h64a96 96 0 0 1 0 192h-64m-140.71-96h187.42"},child:[]}]})(A)}const RsA=Ee({filters:Sl(Ee({column:dA(),operator:dA(),value:dA()}))});function WsA(){const[A,e]=y.useState(!1),[t,n]=y.useState(!1),r=[],[s,a]=y.useState(r);y.useEffect(()=>{n(!0)},[]);const{state:o,dispatch:i,filterFields:c=[]}=fa(),{filter:{filters:u}}=o;y.useEffect(()=>{a(u.length?u:[{column:"",operator:"",value:"",label:""}])},[u]);function f(z){i({type:XA.SET_FILTER_FIELDS,payload:z})}function d(z,D,B){m(z,"value",B?[Te(D,"yyyy-MM-dd 00:00:00"),Te(B,"yyyy-MM-dd 00:00:00")]:Te(D,"yyyy-MM-dd 00:00:00"),{label:B?`${Te(D,"PPP")} and ${Te(B,"PPP")}`:Te(D,"PPP")})}function g(){s.length>=5||a([...s,{column:"",operator:"",value:"",label:""}])}function v(z){a(s.filter((D,B)=>B!==z))}function m(z,D,B,M){const I=[...s],X=I[z];X&&(D==="column"?I[z]={...X,column:B,operator:"",value:"",label:"",rawValue:void 0,...M}:D==="operator"?I[z]={...X,operator:B,value:"",label:"",...M}:I[z]={...X,[D]:B,...M},a(I))}function p(){const z=s.filter(D=>D.column&&D.operator&&(D.value||D.label));f(z),e(!1)}function h(){a(r)}const w=(z,D)=>{const B=s[z];if(!B)return;const M=c.find(E=>E.id===B.column);if(!M)return;const I=Wp.includes((B==null?void 0:B.operator)??""),X=BR(D,M,B.operator);let V="";I&&Array.isArray(D)?V=D.map(k=>k.label).join(", "):M.type===zA.SELECT&&typeof D=="object"&&D!==null?V=D.label:V=String(D||""),m(z,"value",X,{label:V,rawValue:D})},b=(z,D,B)=>{const M={label:"",value:z.rawValue,onChange:V=>w(D,V),className:"border border-border rounded overflow-hidden ",labelProps:{className:"hidden"}},I=s[D],X=Wp.includes((I==null?void 0:I.operator)??"");if(X&&B.type!=zA.DATE)return l.jsx($e,{...M,type:"select",selectProps:{placeholder:"Select multiple...",searchPlaceholder:"Search options...",...B.selectProps,maximumLabelItems:1,multiple:!0}});switch(B==null?void 0:B.type){case zA.SELECT:return l.jsx($e,{...M,type:"select",selectProps:{placeholder:"Select value...",searchPlaceholder:"Search option...",...B.selectProps}});case zA.DATE:return l.jsxs("div",{className:"flex gap-2 flex-wrap lg:flex-nowrap items-center",children:[l.jsx(K2,{defaultValue:X?z.value[1]:z.value,onChange:V=>d(D,V,X?new Date(z.value[1]||Date.now()):void 0)}),X&&l.jsxs(l.Fragment,{children:["and",l.jsx(K2,{defaultValue:z.value[1],onChange:V=>d(D,new Date(z.value[0]||Date.now()),V)})]})]});case zA.NUMBER:default:return l.jsx($e,{...M,type:"input",inputProps:{type:B==null?void 0:B.type,placeholder:"Enter value...",className:"h-10"}})}},x=Dg({resolver:pv(RsA),defaultValues:{filters:r}});return t?l.jsxs(M9,{open:A,onOpenChange:e,children:[l.jsx(e5,{asChild:!0,children:l.jsx(pA,{variant:"ghost",className:"h-10 p-3 rounded-none bg-primary hover:bg-primary cursor-pointer",children:l.jsx(xP,{className:"text-xl"})})}),l.jsxs(C9,{className:"w-full sm:max-w-[95w] md:max-w-2xl p-0 rounded-l-xl border-0 overflow-auto flex flex-col",children:[l.jsxs(j9,{className:"flex flex-col items-start justify-start space-y-0 bg-secondary p-4 gap-4 text-black",children:[l.jsx(O9,{className:"text-md h-fit leading-normal text-black",children:"Filter Options"}),l.jsx(T9,{className:"text-black",children:"Select your prefered options below"})]}),l.jsx(h9,{...x,children:l.jsxs("form",{onSubmit:x.handleSubmit(p),className:"grow flex flex-col justify-between p-4",children:[l.jsxs("div",{className:"space-y-4",children:[s.map((z,D)=>l.jsx(y.Fragment,{children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(w9,{className:"flex gap-1 items-center text-base",htmlFor:`filter-${D}`,children:"Table Column"}),l.jsxs("div",{className:"grid grid-cols-[1fr_1fr_1fr_auto] gap-2 items-stretch",children:[l.jsx(mr,{children:l.jsxs(yi,{value:z.column,onValueChange:B=>m(D,"column",B),children:[l.jsx($a,{className:"",children:l.jsx(Pi,{placeholder:"Select column"})}),l.jsx(Ao,{className:"!p-0",position:"popper",children:c.map(B=>l.jsx(gr,{value:B.id,className:"[&>span:first-child]:hidden p-4 border-b !m-0 w-full ",children:l.jsxs("div",{className:"flex items-center gap-4 ",children:[B.icon&&l.jsx("span",{className:"flex items-center justify-center",children:B.icon}),B.label]})},B.id))})]})}),l.jsx(mr,{children:l.jsxs(yi,{value:z.operator,onValueChange:B=>m(D,"operator",B),children:[l.jsx($a,{children:l.jsx(Pi,{placeholder:"Select operator"})}),l.jsx(Ao,{children:MR(c.find(B=>B.id===z.column)).map(B=>l.jsx(gr,{value:B.id,className:"[&>span:first-child]:hidden p-2 text-sm",children:B.label},B.id))})]})}),l.jsx(mr,{children:b(z,D,c.find(B=>B.id===z.column))}),s.length>1&&l.jsx(pA,{type:"button",variant:"ghost",size:"icon",onClick:()=>v(D),children:l.jsx(yn,{className:"h-4 w-4 text-destructive"})})]})]})},D)),l.jsxs(pA,{type:"button",variant:"outline",size:"sm",onClick:g,className:"flex items-center gap-2 rounded border mt-4 cursor-pointer",children:[l.jsx(As,{className:"h-4 w-4"}),"Add Filter"]})]}),l.jsxs(t5,{className:"w-full flex flex-row justify-between items-center mt-auto",children:[l.jsx(pA,{variant:"outline",type:"button",className:"rounded flex-1 border cursor-pointer h-10",onClick:h,children:"Clear all filters"}),l.jsx(pA,{className:"rounded flex-1 border cursor-pointer h-10",type:"submit",children:"Apply Filters"})]})]})})]})]}):l.jsx(pA,{variant:"ghost",className:"h-10 p-3 rounded-none bg-primary hover:bg-primary cursor-pointer",disabled:!0,children:l.jsx(xP,{className:"text-xl"})})}function FsA(){const{filterFields:A,postType:e=""}=fa();return A!=null&&A.length?l.jsxs("div",{className:"flex w-40 md:w-74 items-center gap-0 border rounded relative bg-background overflow-hidden",children:[l.jsx(Wt,{placeholder:`Filter ${e}...`,className:"w-19 h-10 flex-1 text-xs px-3 rounded-none border-none bg-muted hover:bg-transparent disabled:opacity-100 focus:bg-transparent focus:rounded-r-none",disabled:!0}),l.jsx(WsA,{})]}):null}function KsA(A){return JA({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M4.10876 14L9.46582 1H10.8178L5.46074 14H4.10876Z",fill:"currentColor"},child:[]}]})(A)}const G0=({url:A,pageTitle:e})=>{const t=A.split("/"),n=t.length;return l.jsx(Iz,{className:"bg-muted w-fit h-12 flex items-center p-2 !m-0 rounded waz_shadow slight_border !border-[#E3E3E3]",children:l.jsx(Qz,{className:"md:gap-1",children:t.map((r,s)=>{if(s<n-1){const a=t.slice(0,s+1).join("/");return l.jsxs(P.Fragment,{children:[l.jsx(Dp,{children:l.jsx(Lz,{asChild:!0,className:"hover:underline cursor-pointer",onClick:()=>window.location.href=a,children:l.jsx("span",{children:s?l.jsx("span",{className:"capitalize opacity-70 text-sm",children:r}):l.jsx(onA,{className:"text-md text-muted-foreground"})})})}),l.jsx(qz,{children:l.jsx(KsA,{height:"10px",className:"text-3xl text-muted-foreground"})})]},s)}else return l.jsx(Dp,{children:l.jsx(Jz,{className:"capitalize text-sm text-[#4D4D4D]",children:e||r})},s)})})})},UsA={table:{sorting:[],columnFilters:[],columnVisibility:{},pagination:{pageIndex:0,pageSize:0}},view:"list",search:{inputValue:"",searchTerm:""},filter:{status:2,filters:[]},totals:{draft:0,published:0,all:0,pages:1},delete:{dialogOpen:!1},repost:{dialogOpen:!1},activePost:null,selection:{selectedPosts:[],tableRowSelection:{}}};function _sA({config:A,pagination:e,searchTerm:t,statusFilter:n,postFilters:r}){const s=Yt(),a=A.variables;return nv({queryKey:[A.cacheKey||A.dataKey,(a==null?void 0:a.blog_uuid)||(a==null?void 0:a.site_uuid),e.pageIndex,e.pageSize,t,n,r],placeholderData:sU,staleTime:120*1e3,gcTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,queryFn:async()=>{const o={blog_uuid:{eq:a==null?void 0:a.blog_uuid}};n!==2&&(o.status={eq:n.toString()}),r!=null&&r.length&&r.forEach(d=>{o[d.column]?o[d.column]={...o[d.column],[d.operator]:d.value}:o[d.column]={[d.operator]:d.value}});const i={...a,page:e.pageIndex+1,first:e.pageSize||1,search:t,filter:o,sort:[{field:"UPDATED_AT",order:"DESC"}]},{data:c,error:u}=await s.query({query:A.query,variables:i,fetchPolicy:"network-only"});if(c&&!u){const d=c[A.dataKey];if(d){const{data:g,paginatorInfo:v}=d;return{tableData:g.map(p=>{var w;const h={totalPageViews:0,shares:0,isLoading:!1};if(p.metadata){const b=p.metadata,x=pE(typeof b=="string"?b:JSON.stringify(b));h.totalPageViews=(w=x==null?void 0:x.analytics)==null?void 0:w.totalPageViews}return{...p,statistics:h}}),pagination:v}}}if(u)throw u;const f=c[A.dataKey];return f?{tableData:f.data,pagination:f.paginatorInfo}:{tableData:[],pagination:{total:0,count:0,currentPage:1,hasMorePages:!1,lastPage:1,perPage:0}}}})}function $sA({config:A,fetchConfig:e,postTypeSng:t=""}){const n=ga(),r=Yt(),s=A==null?void 0:A.query,{showSuccess:a,showError:o}=Gt();return fs({mutationFn:async i=>{if(s)return await r.mutate({mutation:s,variables:i});throw console.error("Invalid Query Configuration"),Error("Invalid Query Configuration")},onSuccess:i=>{i!=null&&i.data&&(n.invalidateQueries({queryKey:[(A==null?void 0:A.mutationInvalidateKey)||(e==null?void 0:e.cacheKey)||(e==null?void 0:e.dataKey)],refetchType:"all"}),a(`${t} Deleted`,`You have deleted the ${t} successfully`,{cancelText:"Done"}))},onError:i=>{console.log(i),n.invalidateQueries({queryKey:[(A==null?void 0:A.mutationInvalidateKey)||(e==null?void 0:e.cacheKey)||(e==null?void 0:e.dataKey)],refetchType:"all"}),o(`Failed to Delete ${t||"Post"}`,`An unexpected error occurred while deleting the ${t}.`,{confirmText:"Try Again",onAction:()=>{console.log("Retry create post")}})}})}const AaA={minItemsPerPage:6,maxItemsPerPage:50,tableHeaderHeight:20,tableRowHeight:80,gridCardHeight:300,gridGap:16,minCardWidth:288},eaA=A=>{const[e,t]=P.useState({width:1920,height:1080}),[n,r]=P.useState({tableRows:0,gridCards:0,cols:0,cardWidth:0}),s=P.useCallback((a,o)=>{const i={...AaA,...A};if(a===0||o===0)return{tableRows:0,gridCards:0,cols:0,cardWidth:0};const c=i.minCardWidth||290,u=i.gridGap||16,d=Math.ceil(Math.max(1,Math.floor(a/(c+u)))),g=Math.ceil(Math.max(1,o/(i.gridCardHeight+u))),v=d*u-u,m=a-v-d*c,p=c+Math.floor(m/d),h=Math.max(i.minItemsPerPage,Math.min(i.maxItemsPerPage,Math.floor((o-i.tableHeaderHeight)/i.tableRowHeight))),w=Math.max(i.minItemsPerPage,Math.min(i.maxItemsPerPage,d*g));return{tableRows:h,gridCards:w,cols:d,cardWidth:p}},[A]);return P.useEffect(()=>{if(typeof document>"u")return;const a=document.getElementById("blog-content-area");if(!a)return;const o=()=>{const{clientWidth:c,clientHeight:u}=a;t({width:c,height:u}),r(s(c,u))},i=new ResizeObserver(()=>o());return i.observe(a),()=>i.disconnect()},[s]),{...n,...e,getItemsPerPage:a=>a==="list"?n.tableRows:n.gridCards}};function zP({children:A,queryConfig:e,filterFields:t,postType:n,postTypeSng:r,isSelect:s,baseUrl:a="",defaultState:o,columns:i,onSave:c,onCreateClick:u,onEditClick:f,selectedPosts:d=[],gridCardHeight:g,tableRowHeight:v,gridCardWidth:m,authors:p,editType:h="edit",sites:w=[]}){const b=P.useRef(!1),[x,z]=P.useState(null),D=P.useRef(!0),B=P.useMemo(()=>{const bA={};return g&&(bA.gridCardHeight=g),m&&(bA.minCardWidth=m),v&&(bA.tableRowHeight=v),bA},[g,m,v]),{getItemsPerPage:M,cardWidth:I,cols:X}=eaA(B),[V,E]=P.useState(!1),k=P.useMemo(()=>{const bA={...UsA,view:"list"},tt=12;return bA.table.pagination.pageSize=tt,bA},[]),[Z,C]=P.useReducer(xR,k);P.useEffect(()=>{E(!0)},[]);const{table:{sorting:Q,columnFilters:Y,columnVisibility:T,pagination:H},search:{inputValue:N,searchTerm:j},filter:{status:O,filters:G},selection:{selectedPosts:J,tableRowSelection:K},delete:{dialogOpen:nA},repost:{dialogOpen:R},totals:eA,view:AA}=Z,_=P.useCallback(bA=>{typeof window<"u"&&window.history.replaceState({},"",bA)},[]);P.useEffect(()=>{d&&d.length>0&&D.current&&(C({type:XA.SET_SELECTED_POSTS,payload:d}),D.current=!1)},[d]),P.useEffect(()=>{if(!V)return;if(o!=null&&o.view&&o.view!==AA){C({type:XA.SET_VIEW,payload:o.view});return}const bA=PR((o==null?void 0:o.view)||"list",n);bA!==AA&&C({type:XA.SET_VIEW,payload:bA})},[V]);const{data:W,isLoading:U,isFetching:PA,error:TA}=_sA({config:e.fetch,pagination:H,searchTerm:j,statusFilter:O,postFilters:G}),YA=$sA({config:e.delete,fetchConfig:e.fetch,postTypeSng:r}),{showError:ee}=Gt(),hA=P.useCallback(bA=>{C({type:XA.SET_SORTING,payload:typeof bA=="function"?bA(Q):bA})},[Q]),pe=P.useCallback(bA=>{C({type:XA.SET_COLUMN_FILTERS,payload:typeof bA=="function"?bA(Y):bA})},[Y]),GA=P.useCallback(bA=>{C({type:XA.SET_COLUMN_VISIBILITY,payload:typeof bA=="function"?bA(T):bA})},[T]),L=P.useCallback(bA=>{const tt=typeof bA=="function"?bA(H):bA;C({type:XA.SET_PAGINATION,payload:tt})},[H]),$=P.useCallback(bA=>{C({type:XA.SET_VIEW,payload:bA}),bR(bA,n)},[n]),tA=P.useCallback(bA=>{C({type:XA.SET_ACTIVE_POST,payload:bA}),C({type:XA.SET_DELETE_DIALOG_OPEN,payload:!0})},[]),cA=P.useCallback(bA=>{C({type:XA.SET_ACTIVE_POST,payload:bA}),C({type:XA.SET_REPOST_DIALOG_OPEN,payload:!0})},[]),lA=P.useCallback(bA=>{C({type:XA.SET_ACTIVE_POST,payload:bA}),f?f(bA):window.location.href=`${a}/${bA.uuid}`},[f,a]),iA=P.useCallback(bA=>{C({type:XA.SET_DELETE_DIALOG_OPEN,payload:bA}),bA||C({type:XA.SET_ACTIVE_POST,payload:null})},[]),uA=P.useCallback(async()=>{var bA,tt;try{await YA.mutateAsync({uuid:((bA=Z.activePost)==null?void 0:bA.uuid)||((tt=Z.activePost)==null?void 0:tt.id)}),iA(!1)}catch(ue){console.error("Error deleting post:",ue)}},[YA,Z.activePost,iA]),HA=P.useCallback(bA=>{C({type:XA.SET_REPOST_DIALOG_OPEN,payload:bA}),bA||C({type:XA.SET_ACTIVE_POST,payload:null})},[]),qA=P.useCallback(async(bA,tt)=>{var ue;try{const se=w.find(oe=>oe.blog_uuid===tt);if(!se){console.error("Target site not found in sites array");return}if(!se.blog_uuid){console.error("Target site found but blog_uuid not found:",se);return}const BA=(ue=e.fetch.variables)==null?void 0:ue.blog_uuid;if(!BA){console.error("Original blog_uuid not found");return}window.open(`${a}/${bA.uuid}?from_blog_uuid=${BA}&to_blog_uuid=${se.blog_uuid}`,"_blank"),HA(!1)}catch(se){console.error("Repost failed:",se),ee("Failed to Repost Article","An error occurred while reposting the article. Please try again.",{confirmText:"Try Again",onAction:()=>{}})}},[w,e.fetch.variables,a,HA,ee]),jA=P.useCallback(bA=>{const ue=typeof bA=="function"?bA(K):bA;C({type:XA.SET_TABLE_ROW_SELECTION,payload:ue});const se=W!=null&&W.tableData.length?W==null?void 0:W.tableData:(W==null?void 0:W.tableData)||[],BA=[...J];se.forEach((oe,fe)=>{const ye=ue[fe.toString()],je=BA.findIndex(ge=>ge.uuid===oe.uuid);ye&&je===-1?BA.push(oe):!ye&&je!==-1&&BA.splice(je,1)}),C({type:XA.SET_SELECTED_POSTS,payload:BA})},[J,K,W==null?void 0:W.tableData]);P.useEffect(()=>{s&&(W!=null&&W.tableData)&&C({type:XA.UPDATE_SELECTION_FROM_UUIDS,payload:{tableData:W.tableData}})},[W==null?void 0:W.tableData,J,s]);const be=P.useMemo(()=>zR({onEdit:lA,onDelete:e.delete&&tA,onRepost:w.length?cA:void 0,baseUrl:a,editIcon:h==="view"?l.jsx(Sz,{size:"small",className:"text-[#0D282FC9]"}):void 0}),[lA,tA,cA,a,w.length,h,e.delete]),ce=DR(),Ze=P.useMemo(()=>eA.pages||1,[eA.pages]),he=zB({data:W!=null&&W.tableData&&W.tableData.length>0?W.tableData:(W==null?void 0:W.tableData)??[],columns:s?[ce,...i]:[...i,be],pageCount:Ze,getCoreRowModel:wB(),getPaginationRowModel:bB(),onSortingChange:hA,onColumnFiltersChange:pe,onColumnVisibilityChange:GA,onPaginationChange:L,getSortedRowModel:xB(),getFilteredRowModel:PB(),onRowSelectionChange:jA,state:{sorting:Q,columnFilters:Y,columnVisibility:T,pagination:H,rowSelection:K},manualPagination:!0,enableRowSelection:s,autoResetPageIndex:!1}),$n=P.useCallback(()=>{c==null||c(J)},[c,J]),Mn=P.useCallback(()=>{u?u():window.location.href=a+"/new"},[u,a]),Cn=P.useCallback(()=>J.length,[J]),gs=P.useCallback(()=>{C({type:XA.CLEAR_ALL_SELECTIONS})},[]),Tt=M(AA);P.useEffect(()=>{!x&&he&&he.getState().pagination.pageSize!==Tt&&he.setPageSize(Tt)},[Tt,v,g,m,e.fetch.dataKey,x,he]),P.useEffect(()=>{if(W&&W.pagination&&W.pagination.lastPage!==void 0){const bA={draft:O===0?W.pagination.total:eA.draft,published:O===1?W.pagination.total:eA.published,all:O===2?W.pagination.total:eA.all,pages:W.pagination.lastPage};C({type:XA.UPDATE_TOTALS,payload:bA}),he&&bA.pages!==eA.pages&&H.pageIndex>=bA.pages&&he.resetPageIndex(),W.pagination.perPage!==H.pageSize&&C({type:XA.SET_PAGINATION,payload:{pageIndex:H.pageIndex,pageSize:W.pagination.perPage}})}},[W==null?void 0:W.pagination,O,eA.all,eA.draft,eA.published,H.pageIndex,H.pageSize]),P.useEffect(()=>{if(!V||!he||b.current)return;const bA=typeof window<"u"?window.location:{search:""},tt=new URLSearchParams(bA.search),ue=[];let se,BA=0,oe=0,fe;tt.forEach((je,ge)=>{if(ge.startsWith("filter_")){const RA=ge.replace("filter_",""),[zt,...Xe]=je.split(":"),Se=Xe.join(":");if(RA&&zt&&Se!==void 0){const Ar=lR(RA,Se,t,p);ue.push({column:RA,operator:zt,value:Se,label:Ar})}}else if(ge==="search")se=je;else if(ge==="page"){const RA=parseInt(je);isNaN(RA)||(BA=Math.max(0,RA-1))}else if(ge==="pageSize"){const RA=parseInt(je);isNaN(RA)||(oe=RA,z(RA))}else if(ge==="status"){const RA=parseInt(je,10);isNaN(RA)||(fe=RA)}}),oe===void 0&&z(null),ue.length>0&&C({type:XA.SET_FILTER_FIELDS,payload:ue}),C({type:XA.SET_SEARCH_TERM,payload:se||""}),C({type:XA.SET_STATUS_FILTER,payload:fe??2}),(()=>{if(he&&he.setPageIndex&&he.setPageSize)if(BA>0&&he.setPageIndex(BA),oe)he.setPageSize(oe);else{const je=M(k.view);he.setPageSize(je)}})(),b.current=!0},[V,he]),P.useEffect(()=>{if(!V||!b.current)return;const bA=new URLSearchParams;bA.set("page",String((H.pageIndex||0)+1)),bA.set("pageSize",String(H.pageSize)),bA.set("status",String(O)),N!=null&&N.trim()&&bA.set("search",N),Array.isArray(G)&&G.forEach(se=>{se!=null&&se.column&&se.value!==void 0&&se.value!==null&&se.value!==""&&bA.set(`filter_${se.column}`,`${se.operator}:${se.value}`)});const tt=typeof window<"u"?window.location:{search:"",pathname:""},ue=`${tt.pathname}?${bA.toString()}`;ue!==tt.pathname+tt.search&&_(ue)},[H.pageIndex,H.pageSize,O,N,G,_]);const gn=P.useMemo(()=>({state:Z,dispatch:C,queryConfig:e,filterFields:t,postType:n,postTypeSng:r,isSelect:s,baseUrl:a,table:he,queryData:W,isLoading:U,isFetching:PA,error:TA,deleteMutation:YA,deleteDialogOpen:nA,repostDialogOpen:R,dynamicPageSize:Tt,handleSortingChange:hA,handleColumnFiltersChange:pe,handleColumnVisibilityChange:GA,handlePaginationChange:L,handleViewChange:$,handleDeleteClick:tA,handleEditClick:lA,handleRepostClick:cA,handleDeleteDialogClose:iA,handleRepostDialogClose:HA,handleRepostConfirm:qA,handleSave:$n,handleCreate:Mn,handleDeleteConfirm:uA,getSelectedPostsCount:Cn,clearAllSelections:gs,authors:p||[],sites:w||[],calculatedGridCardWidth:I,calculatedGridCardCols:X}),[Z,C,e,t,n,r,s,a,he,W,U,PA,TA,YA,nA,R,Tt,hA,pe,GA,L,$,tA,lA,cA,iA,HA,qA,$n,Mn,uA,Cn,gs,p,w,I,X]);return l.jsx(I5.Provider,{value:gn,children:A})}function taA(A){return JA({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M.5 0a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-1 0V.5A.5.5 0 0 1 .5 0M2 1.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-4a.5.5 0 0 1-.5-.5zm2 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5zm2 4a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-6a.5.5 0 0 1-.5-.5zm2 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5z"},child:[]}]})(A)}function wr(A){return JA({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M6.445 12.688V7.354h-.633A13 13 0 0 0 4.5 8.16v.695c.375-.257.969-.62 1.258-.777h.012v4.61zm1.188-1.305c.047.64.594 1.406 1.703 1.406 1.258 0 2-1.066 2-2.871 0-1.934-.781-2.668-1.953-2.668-.926 0-1.797.672-1.797 1.809 0 1.16.824 1.77 1.676 1.77.746 0 1.23-.376 1.383-.79h.027c-.004 1.316-.461 2.164-1.305 2.164-.664 0-1.008-.45-1.05-.82zm2.953-2.317c0 .696-.559 1.18-1.184 1.18-.601 0-1.144-.383-1.144-1.2 0-.823.582-1.21 1.168-1.21.633 0 1.16.398 1.16 1.23"},child:[]},{tag:"path",attr:{d:"M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M2 2a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1z"},child:[]},{tag:"path",attr:{d:"M2.5 4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5z"},child:[]}]})(A)}function ff(A){return JA({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},child:[]}]})(A)}function naA(A){return JA({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M6 1H1v14h5zm9 0h-5v5h5zm0 9v5h-5v-5zM0 1a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1zm9 0a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1zm1 8a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1z"},child:[]}]})(A)}function DP({rootClassName:A,rowClassName:e,cardClassName:t,cellClassName:n,postBaseURL:r="",gridCard:s,toggleView:a=!0,showCTA:o=!0,tableRowHeight:i,blog_uuid:c,disableAnchorTags:u=!1}){var nA,R,eA,AA,_,W;const{state:f,postType:d,postTypeSng:g="",isSelect:v,baseUrl:m,table:p,isLoading:h,isFetching:w,error:b,handleViewChange:x,handleDeleteClick:z,handleEditClick:D,handleRepostClick:B,handleDeleteDialogClose:M,handleRepostDialogClose:I,handleRepostConfirm:X,handleSave:V,handleDeleteConfirm:E,deleteMutation:k,handleCreate:Z,getSelectedPostsCount:C,clearAllSelections:Q,calculatedGridCardWidth:Y,calculatedGridCardCols:T,dynamicPageSize:H,sites:N}=fa(),{view:j,search:{searchTerm:O},delete:{dialogOpen:G},repost:{dialogOpen:J}}=f,K=C();return l.jsxs("div",{className:S("relative h-screen flex flex-col overflow-auto bg-background",A),children:[l.jsxs("div",{className:S("flex flex-1 flex-col gap-y-5 p-4 overflow-auto h-full "),"data-testid":"blog-component",children:[l.jsxs("div",{className:"space-y-4",children:[l.jsx("h1",{className:"text-3xl font-[UniversalFeature]","data-testid":"page-title",children:d||"Posts"}),m&&l.jsx(G0,{url:m,pageTitle:d})]}),l.jsxs("div",{className:"flex items-center justify-between w-full gap-4","data-testid":"blog-component-header",children:[l.jsx(uR,{}),l.jsx("div",{className:"flex-1",children:l.jsx(FsA,{})}),a&&l.jsxs("div",{className:"flex items-center p-1.5 px-2 slight_border rounded border-[#efefef]!","data-testid":"view-toggle",children:[l.jsx(ve,{variant:"ghost",size:"icon",className:S("w-fit h-7 p-2 rounded group",{"bg-muted":j==="grid"}),onClick:()=>x("grid"),"data-testid":"grid-view-button",children:l.jsx(naA,{className:S("group:hover:text-muted",{"text-muted-foreground":j==="grid"})})}),l.jsx(ve,{variant:"ghost",size:"icon",className:S("w-fit h-7 p-2 rounded",{"bg-muted":j==="list"}),onClick:()=>x("list"),"data-testid":"list-view-button",children:l.jsx(Eh,{className:S({"text-muted-foreground":j==="list"})})})]}),o&&l.jsxs("div",{className:"flex items-center gap-2",children:[v&&K>0&&l.jsx(ve,{onClick:Q,size:"lg",variant:"outline",className:"text-base rounded","data-testid":"clear-selections-button",children:"Clear"}),u?l.jsxs(ve,{onClick:v?V:Z,size:"lg",variant:"primary",className:"text-base rounded","data-testid":"action-button",children:[v?`Save${K>0?` (${K})`:""}`:"Create"," ",g]}):l.jsx("a",{href:v?void 0:`${m}/new`,onClick:U=>U.preventDefault(),children:l.jsxs(ve,{onClick:v?V:Z,size:"lg",variant:"primary",className:"text-base rounded","data-testid":"action-button",children:[v?`Save${K>0?` (${K})`:""}`:"Create"," ",g]})})]})]}),l.jsx(CR,{}),l.jsxs("div",{className:"relative flex-1 h-0 overflow-auto",id:"blog-content-area","data-testid":"content-area",children:[(h||w||!H)&&l.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-secondary/10 backdrop-blur-sm","data-testid":"loading-overlay",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Hh,{className:"w-6 h-6 animate-spin"}),l.jsx("span",{children:"Loading..."})]})}),b&&l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-white/50 backdrop-blur-sm","data-testid":"error-overlay",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ls,{className:"w-6 h-6 animate-spin"}),l.jsxs("span",{children:["Error: ",b==null?void 0:b.message]})]})}),(R=(nA=p.getRowModel())==null?void 0:nA.rows)!=null&&R.length?j==="list"?l.jsx(aR,{table:p,cellClassName:n,rowClassName:S(e,{[`h-[${i}px]`]:i}),"data-testid":"data-table",onEdit:D}):l.jsx("div",{className:S("grid flex-1 gap-4 relative"),style:{gridTemplateColumns:`repeat(${T||0}, ${Y||288}px)`},"data-testid":"grid-view",children:(AA=(eA=p.getRowModel())==null?void 0:eA.rows)==null?void 0:AA.map(U=>{const PA=U.original;return s&&l.jsx(s,{data:{...PA},className:S("w-full",t),onDeleteClick:z,postBaseURL:r,blogBaseUrl:m,onEditClick:D,onRepostClick:B,isSelect:v,selected:U.getIsSelected(),onSelect:()=>U.toggleSelected()},U.id)})}):l.jsx(cR,{search:O,filters:f.filter.filters})]})]}),(W=(_=p.getRowModel())==null?void 0:_.rows)!=null&&W.length?l.jsx(jq,{}):null,l.jsx(jR,{open:G,onOpenChange:M,onConfirm:E,pending:k.isPending}),N&&N.length>0&&l.jsx(LsA,{open:J,onOpenChange:I,onRepost:X,post:f.activePost,repostOptions:N.filter(U=>U.blog_uuid!==c).map(U=>{var PA;return{value:U.blog_uuid||U.site.uuid,label:((PA=U.site)==null?void 0:PA.name)||U.name}})})]})}function dn(A){const{queryConfig:e,filterFields:t,postType:n,postTypeSng:r,isSelect:s,baseUrl:a,defaultState:o,columns:i,onSave:c,selectedPosts:u,gridCardHeight:f,gridCardWidth:d,tableRowHeight:g,onCreateClick:v,onEditClick:m,authors:p,sites:h,editType:w,disableAnchorTags:b,...x}=A,[z]=P.useState(()=>new ev),D={queryConfig:e,filterFields:t,postType:n,postTypeSng:r,isSelect:s,baseUrl:a,defaultState:o,columns:i,onSave:c,onCreateClick:v,onEditClick:m,selectedPosts:u,tableRowHeight:g,gridCardWidth:d,gridCardHeight:f,authors:p,editType:w,sites:h||[]};if(A.apolloUri){const B=tl(A.apolloUri);return l.jsx(tv,{client:z,children:l.jsx(Xt,{client:B,children:l.jsx(Zi,{children:l.jsx(zP,{...D,children:l.jsx(DP,{...x,tableRowHeight:g,disableAnchorTags:b})})})})})}return l.jsx(Zi,{children:l.jsx(zP,{...D,children:l.jsx(DP,{...x,tableRowHeight:g,disableAnchorTags:b})})})}var raA=["date","verboseDate","tooltip","children"];function th(){return th=Object.assign||function(A){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(A[n]=t[n])}return A},th.apply(this,arguments)}function saA(A,e){if(A==null)return{};var t=aaA(A,e),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(A);for(r=0;r<s.length;r++)n=s[r],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(A,n)&&(t[n]=A[n])}return t}function aaA(A,e){if(A==null)return{};var t={},n=Object.keys(A),r,s;for(s=0;s<n.length;s++)r=n[s],!(e.indexOf(r)>=0)&&(t[r]=A[r]);return t}function Xd(A,e){var t=A.date,n=A.verboseDate,r=A.tooltip,s=A.children,a=saA(A,raA),o=P.useMemo(function(){return t.toISOString()},[t]);return P.createElement("time",th({ref:e},a,{dateTime:o,title:r?n:void 0}),s)}Xd=P.forwardRef(Xd);Xd.propTypes={date:VA.instanceOf(Date).isRequired,verboseDate:VA.string,tooltip:VA.bool.isRequired,children:VA.string.isRequired};var BP=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function oaA(A,e){return!!(A===e||BP(A)&&BP(e))}function iaA(A,e){if(A.length!==e.length)return!1;for(var t=0;t<A.length;t++)if(!oaA(A[t],e[t]))return!1;return!0}function laA(A,e){e===void 0&&(e=iaA);var t=null;function n(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];if(t&&t.lastThis===this&&e(r,t.lastArgs))return t.lastResult;var a=A.apply(this,r);return t={lastResult:a,lastArgs:r,lastThis:this},a}return n.clear=function(){t=null},n}function nh(A){"@babel/helpers - typeof";return nh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nh(A)}function caA(A){if(mj())return Intl.DateTimeFormat.supportedLocalesOf(A)[0]}function mj(){var A=(typeof Intl>"u"?"undefined":nh(Intl))==="object";return A&&typeof Intl.DateTimeFormat=="function"}function Yd(A){"@babel/helpers - typeof";return Yd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yd(A)}function uaA(A,e){if(!(A instanceof e))throw new TypeError("Cannot call a class as a function")}function faA(A,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(A,n.key,n)}}function daA(A,e,t){return e&&faA(A.prototype,e),Object.defineProperty(A,"prototype",{writable:!1}),A}var pj=(function(){function A(){uaA(this,A),this.cache={}}return daA(A,[{key:"get",value:function(){for(var t=this.cache,n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];for(var a=0,o=r;a<o.length;a++){var i=o[a];if(Yd(t)!=="object")return;t=t[i]}return t}},{key:"put",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var s=n.pop(),a=n.pop(),o=this.cache,i=0,c=n;i<c.length;i++){var u=c[i];Yd(o[u])!=="object"&&(o[u]={}),o=o[u]}return o[a]=s}}]),A})(),MP=new pj,gaA=mj(),vaA=function(e){return e.toString()};function maA(A,e){if(!gaA)return vaA;var t=haA(A),n=JSON.stringify(e),r=MP.get(String(t),n)||MP.put(String(t),n,new Intl.DateTimeFormat(t,e));return function(s){return r.format(s)}}const paA=laA(maA);var Km={};function haA(A){var e=A.toString();return Km[e]?Km[e]:Km[e]=caA(A)}function rh(A){"@babel/helpers - typeof";return rh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rh(A)}function waA(A){return yaA(A)?A:new Date(A)}function yaA(A){return A instanceof Date||PaA(A)}function PaA(A){return rh(A)==="object"&&typeof A.getTime=="function"}var CP=new pj;function baA(A,e){var t=e.polyfill,n=String(A)+":"+String(t);return CP.get(n)||CP.put(n,new Le(A,{polyfill:t}))}var xl={exports:{}},ba={exports:{}},xaA=ba.exports,jP;function zaA(){return jP||(jP=1,(function(){var A,e,t,n,r,s;typeof performance<"u"&&performance!==null&&performance.now?ba.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(ba.exports=function(){return(A()-r)/1e6},e=process.hrtime,A=function(){var a;return a=e(),a[0]*1e9+a[1]},n=A(),s=process.uptime()*1e9,r=n-s):Date.now?(ba.exports=function(){return Date.now()-t},t=Date.now()):(ba.exports=function(){return new Date().getTime()-t},t=new Date().getTime())}).call(xaA)),ba.exports}var OP;function DaA(){if(OP)return xl.exports;OP=1;for(var A=zaA(),e=typeof window>"u"?If:window,t=["moz","webkit"],n="AnimationFrame",r=e["request"+n],s=e["cancel"+n]||e["cancelRequest"+n],a=0;!r&&a<t.length;a++)r=e[t[a]+"Request"+n],s=e[t[a]+"Cancel"+n]||e[t[a]+"CancelRequest"+n];if(!r||!s){var o=0,i=0,c=[],u=1e3/60;r=function(f){if(c.length===0){var d=A(),g=Math.max(0,u-(d-o));o=g+d,setTimeout(function(){var v=c.slice(0);c.length=0;for(var m=0;m<v.length;m++)if(!v[m].cancelled)try{v[m].callback(o)}catch(p){setTimeout(function(){throw p},0)}},Math.round(g))}return c.push({handle:++i,callback:f,cancelled:!1}),i},s=function(f){for(var d=0;d<c.length;d++)c[d].handle===f&&(c[d].cancelled=!0)}}return xl.exports=function(f){return r.call(e,f)},xl.exports.cancel=function(){s.apply(e,arguments)},xl.exports.polyfill=function(f){f||(f=e),f.requestAnimationFrame=r,f.cancelAnimationFrame=s},xl.exports}var BaA=DaA();const TP=Zc(BaA);function MaA(A,e){if(A.length===0)return 0;for(var t=0,n=A.length-1,r;t<=n;){r=Math.floor((n+t)/2);var s=e(A[r]);if(s===0)return r;if(s<0){if(t=r+1,t>n)return t}else if(n=r-1,n<t)return t}}function CaA(A,e){return EaA(A)||TaA(A,e)||OaA(A,e)||jaA()}function jaA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
449
449
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OaA(A,e){if(A){if(typeof A=="string")return EP(A,e);var t=Object.prototype.toString.call(A).slice(8,-1);if(t==="Object"&&A.constructor&&(t=A.constructor.name),t==="Map"||t==="Set")return Array.from(A);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return EP(A,e)}}function EP(A,e){(e==null||e>A.length)&&(e=A.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=A[t];return n}function TaA(A,e){var t=A==null?null:typeof Symbol<"u"&&A[Symbol.iterator]||A["@@iterator"];if(t!=null){var n=[],r=!0,s=!1,a,o;try{for(t=t.call(A);!(r=(a=t.next()).done)&&(n.push(a.value),!(e&&n.length===e));r=!0);}catch(i){s=!0,o=i}finally{try{!r&&t.return!=null&&t.return()}finally{if(s)throw o}}return n}}function EaA(A){if(Array.isArray(A))return A}const HaA={instances:[],add:function(e){var t=this,n=this.instances.length===0;return hj(this.instances,e),n&&this.start(),{stop:function(){wj(t.instances,e),t.instances.length===0&&t.stop()},forceUpdate:function(){HP(e,t.instances)}}},tick:function(){for(var e=Date.now();;){var t=this.instances[0];if(e>=t.nextUpdateTime)HP(t,this.instances);else break}},scheduleNextTick:function(){var e=this;this.scheduledTick=TP(function(){e.tick(),e.scheduleNextTick()})},start:function(){this.scheduleNextTick()},stop:function(){TP.cancel(this.scheduledTick)}};function NaA(A){var e=A.getNextValue(),t=CaA(e,2),n=t[0],r=t[1];A.setValue(n),A.nextUpdateTime=r}function HP(A,e){NaA(A),wj(e,A),hj(e,A)}function hj(A,e){var t=kaA(A,e);A.splice(t,0,e)}function wj(A,e){var t=A.indexOf(e);A.splice(t,1)}function kaA(A,e){var t=e.nextUpdateTime;return MaA(A,function(n){return n.nextUpdateTime===t?0:n.nextUpdateTime>t?1:-1})}function df(A,e){return XaA(A)||VaA(A,e)||SaA(A,e)||ZaA()}function ZaA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
450
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SaA(A,e){if(A){if(typeof A=="string")return NP(A,e);var t=Object.prototype.toString.call(A).slice(8,-1);if(t==="Object"&&A.constructor&&(t=A.constructor.name),t==="Map"||t==="Set")return Array.from(A);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return NP(A,e)}}function NP(A,e){(e==null||e>A.length)&&(e=A.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=A[t];return n}function VaA(A,e){var t=A==null?null:typeof Symbol<"u"&&A[Symbol.iterator]||A["@@iterator"];if(t!=null){var n=[],r=!0,s=!1,a,o;try{for(t=t.call(A);!(r=(a=t.next()).done)&&(n.push(a.value),!(e&&n.length===e));r=!0);}catch(i){s=!0,o=i}finally{try{!r&&t.return!=null&&t.return()}finally{if(s)throw o}}return n}}function XaA(A){if(Array.isArray(A))return A}function YaA(A){var e=A.date,t=A.future,n=A.locale,r=A.locales,s=A.timeStyle,a=A.round,o=A.minTimeLeft,i=A.formatVerboseDate,c=A.verboseDateFormat,u=c===void 0?QaA:c,f=A.updateInterval,d=A.tick,g=d===void 0?!0:d,v=A.now,m=A.timeOffset,p=m===void 0?0:m,h=A.polyfill,w=P.useMemo(function(){return n&&(r=[n]),r.concat(Le.getDefaultLocale())},[n,r]),b=P.useMemo(function(){return baA(w,{polyfill:h})},[w,h]);e=P.useMemo(function(){return waA(e)},[e]);var x=P.useCallback(function(){var Y=(v||Date.now())-p,T;if(t&&Y>=e.getTime()&&(Y=e.getTime(),T=!0),o!==void 0){var H=e.getTime()-o*1e3;Y>H&&(Y=H,T=!0)}var N=b.format(e,s,{getTimeToNextUpdate:!0,now:Y,future:t,round:a}),j=df(N,2),O=j[0],G=j[1];return T?G=IaA:G=f||G||60*1e3,[O,Y+G]},[e,t,s,f,a,o,b,v]),z=P.useRef();z.current=x;var D=P.useMemo(x,[]),B=df(D,2),M=B[0],I=B[1],X=P.useState(M),V=df(X,2),E=V[0],k=V[1],Z=P.useRef();P.useEffect(function(){if(g)return Z.current=HaA.add({getNextValue:function(){return z.current()},setValue:k,nextUpdateTime:I}),function(){return Z.current.stop()}},[g]),P.useEffect(function(){if(Z.current)Z.current.forceUpdate();else{var Y=x(),T=df(Y,1),H=T[0];k(H)}},[x]);var C=P.useMemo(function(){return paA(w,u)},[w,u]),Q=P.useMemo(function(){return i?i(e):C(e)},[e,i,C]);return{date:e,formattedDate:E,verboseDate:Q}}var GaA=365*24*60*60*1e3,IaA=1e3*GaA,QaA={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"},sh=VA.oneOfType,kP=VA.arrayOf,Xo=VA.string,ZP=VA.number,Vl=VA.shape,gf=VA.func,LaA=sh([Vl({minTime:ZP,formatAs:Xo.isRequired}),Vl({test:gf,formatAs:Xo.isRequired}),Vl({minTime:ZP,format:gf.isRequired}),Vl({test:gf,format:gf.isRequired})]),JaA=sh([Xo,Vl({steps:kP(LaA).isRequired,labels:sh([Xo,kP(Xo)]).isRequired,round:Xo})]),qaA=["date","future","timeStyle","round","minTimeLeft","locale","locales","formatVerboseDate","verboseDateFormat","updateInterval","tick","now","timeOffset","polyfill","tooltip","component","container","wrapperComponent","wrapperProps"];function Gd(){return Gd=Object.assign||function(A){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(A[n]=t[n])}return A},Gd.apply(this,arguments)}function RaA(A,e){if(A==null)return{};var t=WaA(A,e),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(A);for(r=0;r<s.length;r++)n=s[r],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(A,n)&&(t[n]=A[n])}return t}function WaA(A,e){if(A==null)return{};var t={},n=Object.keys(A),r,s;for(s=0;s<n.length;s++)r=n[s],!(e.indexOf(r)>=0)&&(t[r]=A[r]);return t}function Si(A){var e=A.date,t=A.future,n=A.timeStyle,r=A.round,s=A.minTimeLeft,a=A.locale,o=A.locales,i=o===void 0?[]:o,c=A.formatVerboseDate,u=A.verboseDateFormat,f=A.updateInterval,d=A.tick,g=A.now,v=A.timeOffset,m=A.polyfill,p=A.tooltip,h=p===void 0?!0:p,w=A.component,b=w===void 0?Xd:w,x=A.container,z=A.wrapperComponent,D=A.wrapperProps,B=RaA(A,qaA),M=YaA({date:e,future:t,timeStyle:n,round:r,minTimeLeft:s,locale:a,locales:i,formatVerboseDate:c,verboseDateFormat:u,updateInterval:f,tick:d,now:g,timeOffset:v,polyfill:m}),I=M.date,X=M.verboseDate,V=M.formattedDate,E=P.createElement(b,Gd({date:I,verboseDate:X,tooltip:h},B),V),k=z||x;return k?P.createElement(k,Gd({},D,{verboseDate:X}),E):E}Si.propTypes={date:VA.oneOfType([VA.instanceOf(Date),VA.number]).isRequired,locale:VA.string,locales:VA.arrayOf(VA.string),future:VA.bool,timeStyle:JaA,round:VA.string,minTimeLeft:VA.number,component:VA.elementType,tooltip:VA.bool,formatVerboseDate:VA.func,verboseDateFormat:VA.object,updateInterval:VA.oneOfType([VA.number,VA.arrayOf(VA.shape({threshold:VA.number,interval:VA.number.isRequired}))]),tick:VA.bool,now:VA.number,timeOffset:VA.number,polyfill:VA.bool,wrapperComponent:VA.elementType,wrapperProps:VA.object};Si=P.memo(Si);const Eu=({categories:A=[],maxDisplay:e=2,badgeVariant:t="outline"})=>{const n=A.slice(0,e),r=A.length-n.length;return l.jsxs("div",{className:"gap-2 flex flex-row items-center",children:[!n.length&&l.jsx(lt,{variant:t,className:"line-clamp-1 text-sm text-[#869DA5] p-1 px-3 truncate font-normal",children:"none"}),n.map((s,a)=>l.jsx("div",{className:S("p-1 rounded-full text-sm px-3 truncate font-normal max-w-20 xxl:max-w-24",{"bg-[#FDF2FA] text-[#C11574]":!((a+1)%2)},{"bg-[#EEF4FF] text-[#3538CD]":(a+1)%2}),children:s.name},s.uuid||a)),r>0&&l.jsxs("p",{className:"text-sm text-[#869DA5]",children:["+",r]})]})},al=({tags:A=[],maxDisplay:e=2,badgeVariant:t="outline"})=>{const n=A.slice(0,e),r=A.length-n.length;return l.jsxs("div",{className:"gap-1 flex flex-row items-center",children:[!n.length&&l.jsx(lt,{variant:t,className:"line-clamp-1 text-sm p-1 px-3 truncate font-normal text-[#869DA5]",children:"none"}),n.map((s,a)=>l.jsx(lt,{variant:t,className:"line-clamp-1 text-[#869DA5] text-sm p-1 px-3 truncate font-normal max-w-20 xxl:max-w-24",children:s.name},s.uuid||a)),r>0&&l.jsxs("p",{className:"text-sm text-[#869DA5]",children:["+",r]})]})},Hu=({statistics:A,className:e,isGrid:t})=>{const n=Go((A==null?void 0:A.totalPageViews)??0);return A!=null&&A.isLoading?l.jsxs("div",{className:S("w-full flex flex-row gap-1 text-[#596970] justify-center items-center",{"justify-start":!t},e),children:[l.jsx(Hh,{size:12,className:"animate-spin"}),l.jsx("p",{className:"font-[UniversalFeature] text-xs",children:"Loading..."})]}):!(A!=null&&A.totalPageViews)&&!(A!=null&&A.shares)?l.jsx("p",{className:S("text-xs p-1",e),children:"No statistics"}):l.jsxs("div",{className:S(`w-full flex flex-row gap-3 text-[#596970] ${t?"justify-center":"justify-start"} items-center`,e),children:[l.jsxs("div",{className:"flex flex-row items-center justify-center gap-1",children:[l.jsx(JsA,{className:"text-sm"}),l.jsx("p",{className:"font-[UniversalFeature] text-xs",children:n})]}),l.jsxs("div",{className:"flex flex-row items-center justify-center gap-1",children:[l.jsx(ZAA,{className:"text-sm"}),l.jsx("p",{className:"font-[UniversalFeature] text-xs",children:"0"})]})]})};function I0({data:A,className:e,onDeleteClick:t,postBaseURL:n="",blogBaseUrl:r="",isSelect:s,selected:a,onSelect:o,onEditClick:i,onRepostClick:c}){var g;let u={};const f=A.status===Ye.PUBLISHED,d=f?n:`${n}/preview`;try{u=JSON.parse(A==null?void 0:A.featured_image)}catch(v){console.log(v)}return l.jsxs(Qn,{className:S("max-w-[450px] flex flex-col cursor-pointer group justify-between overflow-hidden rounded-md focus:border-accent focus:border focus:bg-[#BEFEF72B] hover:border-accent hover:border hover:bg-[#BEFEF72B] ",e),"data-testid":"post-card:"+A.uuid,onDoubleClick:()=>i==null?void 0:i(A),children:[l.jsxs("div",{className:"flex flex-col grow",children:[l.jsxs(es,{className:"p-0 relative h-[178px]",children:[l.jsx(lt,{variant:"outline",className:S("text-xs absolute z-10 top-2 left-2 bg-muted text-muted-foreground",{hidden:f||A.published_at&&new Date(A.published_at+"Z")<new Date,"border-[#F0D08A] bg-[#FFF4E0] text-[#6B4400]":!f&&A.published_at}),children:A.published_at?"Scheduled":"Draft"}),l.jsx(pA,{variant:"ghost",size:"icon","data-active":a,"data-testid":"post-select",className:S("rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7 absolute top-2 right-2 z-10",{hidden:!s},{"bg-primary":a}),onClick:()=>o==null?void 0:o(A),children:l.jsx("div",{className:"flex items-center justify-center w-4 h-4 border-2 rounded-full border-foreground",children:a&&l.jsx("div",{className:"w-2 h-2 rounded-full bg-foreground"})})}),l.jsxs("div",{className:S("flex items-center gap-1 absolute top-2 right-2 z-10",{hidden:s}),children:[l.jsx(pA,{variant:"ghost",size:"icon",className:"rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7",onClick:()=>c==null?void 0:c(A),children:l.jsx(MB,{size:"small",className:"text-[#0D282FC9]"})}),l.jsx("a",{href:`${r}/${A.uuid}`,onClick:v=>v.preventDefault(),className:"leading-0",children:l.jsx(pA,{variant:"ghost",size:"icon",className:"rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7",onClick:()=>i==null?void 0:i(A),children:l.jsx(Rs,{size:"small",className:"text-accent-foreground"})})}),l.jsx(pA,{variant:"ghost",size:"icon",className:"rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7",onClick:()=>t==null?void 0:t(A),children:l.jsx(zi,{size:"small",className:"text-destructive"})})]}),l.jsx(as,{url:u==null?void 0:u.src,transformations:{height:178}}),l.jsx("div",{className:"absolute bottom-0 left-0 px-2 rounded-tr-[0.75rem] bg-white opacity-90",children:l.jsx(Hu,{statistics:A.statistics,className:"h-7 p-2 text-[#101828]",isGrid:!0})})]}),l.jsxs(ts,{className:"p-2 flex flex-col gap-1.5 grow justify-between align-top flex-1",children:[l.jsx("a",{className:"text-base leading-tight cursor-pointer group-hover:underline hover:underline line-clamp-3",href:d+A.slug,target:"_blank",rel:"noopener noreferrer",children:Ur(A.title)}),l.jsx("p",{className:"flex-1 my-auto text-sm leading-tight line-clamp-3",children:Ur(A.excerpt)})]})]}),l.jsxs(Uc,{className:"flex flex-row justify-between p-2 items-baseline-last ",children:[l.jsxs("div",{className:"flex flex-row items-start justify-between gap-2 text-muted-foreground",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("p",{className:"text-[10px]",children:"Categories"}),l.jsx(Eu,{categories:A.categories,maxDisplay:1})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("p",{className:"text-[10px]",children:"Tags"}),l.jsx(al,{tags:A.tags,maxDisplay:1,badgeVariant:"outline"})]})]}),l.jsxs("div",{className:"flex items-center justify-between gap-2 text-muted-foreground",children:[l.jsx("div",{className:"flex items-center justify-center w-4.5 h-4.5 font-semi-bold rounded-full bg-secondary",children:l.jsx("p",{className:"text-[8px] text-black",children:Yi(((g=A.author)==null?void 0:g.name)||"")})}),l.jsx(Si,{date:new Date(A.updated_at||""),locale:"en-US",className:"text-xs"})]})]})]})}const FaA=({onEdit:A,onDelete:e,editDisabled:t=!1,deleteDisabled:n=!1})=>l.jsxs("div",{className:"flex items-center",children:[l.jsx(pA,{variant:"ghost",size:"icon",onClick:A,disabled:t,children:l.jsx(hS,{color:"gray",size:"small"})}),l.jsx(pA,{variant:"ghost",size:"icon",onClick:e,disabled:n,children:l.jsx(yn,{color:"red",size:"small"})})]}),KaA={theme:"system",setTheme:()=>null},yj=P.createContext(KaA);function UaA({children:A,defaultTheme:e="system",storageKey:t="vite-ui-theme",...n}){const[r,s]=P.useState(()=>typeof window<"u"&&window.localStorage.getItem(t)||e);P.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark","brand"),r==="system"){const i=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(i);return}o.classList.add(r)},[r]);const a={theme:r,setTheme:o=>{window.localStorage.setItem(t,o),s(o)}};return l.jsx(yj.Provider,{...n,value:a,children:A})}const _aA=()=>{const A=P.useContext(yj);if(A===void 0)throw new Error("useTheme must be used within a ThemeProvider");return A},$aA=new ev;function AoA({children:A}){return l.jsx(tv,{client:$aA,children:A})}const eoA=new ev,toA=A=>l.jsx(tv,{client:eoA,children:l.jsx(A,{})}),Pj=A=>A==null?void 0:A.toLowerCase().includes("configuration");function noA(A,e){const t=Yt();return nv({staleTime:12e4,gcTime:12e4,queryKey:[(A==null?void 0:A.cacheKey)||(A==null?void 0:A.dataKey),e],queryFn:async()=>{var n;if(A!=null&&A.query&&(A!=null&&A.variables)&&e){const r=A==null?void 0:A.query,s=A==null?void 0:A.variables,o=(await t.query({query:r,variables:{...s||{},uuid:e},fetchPolicy:"network-only"})).data[A.dataKey];if((n=o==null?void 0:o.config)!=null&&n.related_recipes_config)try{const i=JSON.parse(o.config.related_recipes_config);if(Array.isArray(i)&&i.length>0){const f=(i[0]==="AUTO"?i.slice(1):i).map(v=>t.query({query:r,variables:{uuid:v},fetchPolicy:"network-only"})),g=(await Promise.all(f)).map(v=>{var h;return(h=v.data)==null?void 0:h[A.dataKey]}).filter(v=>v!=null).map(v=>({uuid:v.uuid,value:v.uuid,title:v.title,label:v.title}));return{...o,_relatedRecipesData:g}}}catch(i){console.error("Error fetching related recipes:",i)}return o}else throw new Error("No query or variables provided")},enabled:!!(A!=null&&A.query)&&!!e,refetchOnMount:!1,refetchOnWindowFocus:!1})}function roA({config:A,postBaseUrl:e,baseUrl:t,postType:n,createMessage:r,showDescription:s=!0,onSuccess:a}){const o=ga(),i=Yt(),c=A==null?void 0:A.query,{showSuccess:u,showError:f}=Gt();return fs({mutationFn:async d=>{if(c)return await i.mutate({mutation:c,variables:{...A.variables||{},...d}})},onSuccess:(d,g)=>{var b;const v=(b=d==null?void 0:d.data)==null?void 0:b[(A==null?void 0:A.dataKey)||"createPost"],m=(g==null?void 0:g.status)||(g==null?void 0:g.titleStatus)||!1,p=(g==null?void 0:g.showActionModals)??!0,h="You have published your article successfully.",w="You have saved your article as draft successfully. You can publish your article when ready!";if(o.invalidateQueries({queryKey:[A==null?void 0:A.mutationInvalidateKey],refetchType:"all"}),p){const x=Pj(n||""),z=m?x?e:t:void 0;u(r||`${n||"Article"} ${m?"Published":"Saved as draft"}`,s?m?h:w:void 0,{type:m?"action":"info",confirmText:`View ${n||"Article"}`,onAction:m&&z?()=>{window.location.href=z}:void 0,cancelText:"Done",onCancel:()=>{!m&&t||(t?window.location.href=t:window.history.back())}})}if(!m){const x=window.location.pathname,z=x.endsWith("/new")?x.replace("/new",`/${v==null?void 0:v.uuid}`):`${x}/${v==null?void 0:v.uuid}`;window.history.replaceState(null,"",z)}a==null||a(g,v==null?void 0:v.uuid)},onError:(d,g)=>{console.error(d),((g==null?void 0:g.showActionModals)??!0)&&f(`Failed to Create ${n||"Article"}`,d.message||"An unexpected error occurred while creating the post.",{confirmText:"Try Again",onAction:()=>{console.log("Retry create post")}})}})}function soA({config:A,fetchConfig:e,postBaseUrl:t,baseUrl:n,updateMessage:r,postType:s="Article",showDescription:a=!0,onSuccess:o,user_config:i}){const c=ga(),u=Yt(),f=A==null?void 0:A.query,{showSuccess:d,showError:g}=Gt(),v=bj(t||"",i);return fs({mutationFn:async m=>{if(f)return await u.mutate({mutation:f,variables:{...A.variables||{},...m}})},onSuccess:(m,p)=>{var D;const h=(p==null?void 0:p.showActionModals)??!0,w=(D=m==null?void 0:m.data)==null?void 0:D[(A==null?void 0:A.dataKey)||"updatePost"],b=(p==null?void 0:p.status)||(p==null?void 0:p.titleStatus)||!1,x="You have published your article successfully.",z="You have saved your article as draft successfully. You can publish your article when ready!";if(c.invalidateQueries({queryKey:[A==null?void 0:A.mutationInvalidateKey],refetchType:"all"}),c.invalidateQueries({queryKey:[(e==null?void 0:e.cacheKey)||(e==null?void 0:e.dataKey)],refetchType:"all"}),h){const B=Pj(s||"");let M=t;B&&(t!=null&&t.includes("/articles"))&&(M=t.replace("/articles",""));const I=b?B?M:n:void 0;d(r||`${s||"Article"} ${b?"Published":"Updated"} Successfully!`,a?b?x:z:void 0,{type:b?"action":"info",confirmText:b?`View ${s||"Article"}`:void 0,onAction:b&&I?()=>{window.location.href=I}:void 0,cancelText:"Done"})}if(o==null||o(p),v&&!(p!=null&&p.skipRevalidate)){const B=(w==null?void 0:w.slug)??"",M=B.startsWith("/")?`/preview${B}`:`/preview/${B}`;v(b?B:M,!!(p!=null&&p.is_autosave),p.updated_fields)}},onError:(m,p)=>{console.error(m),((p==null?void 0:p.showActionModals)??!0)&&g(`Failed to Update ${s||"Article"}`,m.message||"An unexpected error occurred while updating the post.",{confirmText:"Retry",onAction:()=>{console.log("Retry update post")}})}})}const bj=(A,e)=>{A.endsWith("/")&&(A=A.slice(0,-1));const{showError:t,showSuccess:n}=Gt(),r=async(s,a,o,i=!1)=>{s.startsWith("/")||(s=`/${s}`);const c=new URL(A),u=c.hostname,f=c.pathname,g=`${f==="/"?"":f}${s}`;return await Ge.post(`https://${u}/api/revalidate`,{slug:g.trim(),username:`${e==null?void 0:e.name}${a?"-autosave":""}`,email:e==null?void 0:e.email,date:new Date().toLocaleString(),updated_fields:`${o}`.split(",").filter(v=>v),token:A.includes("vt")?de.NEXT_PUBLIC_REVALIDATION_VT_TOKEN:de.NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN}).then(v=>(i&&n("Cache cleared sucessfully","",{type:"action",confirmText:"View Page",cancelText:"Done",onAction:()=>{var m;(m=window==null?void 0:window.open)==null||m.call(window,`${A}${g}`,"_blank")}}),v)).catch(v=>{throw t("Failed to revalidate cache",v.message,{}),v})};if(A)return r},aoA=({storageKey:A,form:e,enabled:t=!0,interval:n=6e4,onSave:r,onError:s})=>{const[a,o]=P.useState(null),[i,c]=P.useState(null),u=P.useRef(null),f=P.useRef(null),d=P.useRef(""),g=P.useCallback(()=>`autosave_enabled_${A}`,[A]),v=P.useCallback(()=>{if(typeof window>"u"||typeof localStorage>"u")return t;try{const B=localStorage.getItem(g());if(B!==null)return JSON.parse(B)}catch(B){console.error("Failed to load autosave enabled state from localStorage:",B)}return t},[g,t]),m=P.useCallback(B=>{if(!(typeof window>"u"||typeof localStorage>"u"))try{localStorage.setItem(g(),JSON.stringify(B))}catch(M){console.error("Failed to save autosave enabled state to localStorage:",M)}},[g]),[p,h]=P.useState(()=>v()),w=P.useCallback(B=>{h(B),m(B)},[m]),b=P.useCallback(async()=>{if(p)try{const B=e.getValues(),M=JSON.stringify(B),I=new Date;await(r==null?void 0:r(B)),d.current=M,c(I),o({status:"saved"})}catch(B){const M=B instanceof Error?B:new Error("Failed to save form data");console.error("Failed to save form data to sessionStorage:",M),o({status:"error",error:M}),s==null||s(M)}},[p,e,r,s]),x=P.useCallback(async()=>{await b()},[b]),z=P.useCallback(()=>{!p||!e.formState.isDirty||(a==null?void 0:a.status)=="error"||(o({status:"saving"}),f.current=setTimeout(()=>{b()},5e3))},[p,e.formState.isDirty,b,a]),D=()=>{const B=e.getValues("updated_at");B&&c(new Date(B))};return P.useEffect(()=>{if(!p||e.getValues("updated_at"))return;D();const B=e.watch((M,{values:I,type:X})=>{const V=JSON.stringify(I);if(X=="change"&&V!==d.current)try{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{z()},n),o({status:"pending"})}catch(E){console.error("Error in form watch subscription:",E)}});return()=>{console.log("Cleaning up autosave..."),u.current&&clearTimeout(u.current),f.current&&clearTimeout(f.current),B.unsubscribe()}},[p,n,e]),{state:a,saveNow:x,lastSaveDate:i,autoSaveEnabled:p,updateLastSave:D,toggleEnableAutoSave:w}},ooA={isDraft:!0,isCreate:!0,activeGroupId:"",formValues:{},sectionStates:{}},ioA=(A,e)=>{switch(e.type){case"SET_ACTIVE_GROUP":return{...A,activeGroupId:e.payload};case"SET_FORM_VALUES":return{...A,formValues:{...A.formValues,...e.payload}};case"TOGGLE_DRAFT":return{...A,isDraft:e.payload};case"PUBLISH_POST":return{...A,isDraft:!1,isCreate:!1};case"SAVE_DRAFT":return{...A,isDraft:!0,isCreate:!1};case"SET_UUID":return{...A,uuid:e.payload};default:return A}},xj=P.createContext(void 0),mo=()=>{const A=P.useContext(xj);if(A===void 0)throw new Error("useBlogPost must be used within a BlogPostProvider");return A},pt=[];for(let A=0;A<256;++A)pt.push((A+256).toString(16).slice(1));function loA(A,e=0){return(pt[A[e+0]]+pt[A[e+1]]+pt[A[e+2]]+pt[A[e+3]]+"-"+pt[A[e+4]]+pt[A[e+5]]+"-"+pt[A[e+6]]+pt[A[e+7]]+"-"+pt[A[e+8]]+pt[A[e+9]]+"-"+pt[A[e+10]]+pt[A[e+11]]+pt[A[e+12]]+pt[A[e+13]]+pt[A[e+14]]+pt[A[e+15]]).toLowerCase()}let Um;const coA=new Uint8Array(16);function uoA(){if(!Um){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Um=crypto.getRandomValues.bind(crypto)}return Um(coA)}const foA=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),SP={randomUUID:foA};function doA(A,e,t){var r;if(SP.randomUUID&&!A)return SP.randomUUID();A=A||{};const n=A.random??((r=A.rng)==null?void 0:r.call(A))??uoA();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,loA(n)}const goA=({hasUnsavedChanges:A,onSave:e,onDiscard:t})=>{const[n,r]=P.useState(!1),[s,a]=P.useState("/new-page");P.useEffect(()=>{const u=d=>{if(A)return d.preventDefault(),!0},f=d=>{if(A)throw a(d),r(!0),"Route change aborted by user."};if(A&&(window.addEventListener("beforeunload",u),typeof window<"u")){try{const d=window.__NEXT_ROUTER__;d!=null&&d.events&&d.events.on("routeChangeStart",f)}catch{console.debug("Next.js router not available in standalone environment")}return()=>{window.removeEventListener("beforeunload",u);try{const d=window.__NEXT_ROUTER__;d!=null&&d.events&&d.events.off("routeChangeStart",f)}catch{console.debug("Next.js router cleanup not needed in standalone environment")}}}return()=>{window.removeEventListener("beforeunload",u)}},[A]);const o=async()=>{try{await(e==null?void 0:e()),r(!1),typeof window<"u"&&(window.location.href=s)}catch(u){console.error("Save failed:",u)}},i=()=>{t==null||t(),r(!1),typeof window<"u"&&(window.location.href=s)},c=()=>{r(!1)};return l.jsx(l.Fragment,{children:l.jsx(xt,{open:n,onOpenChange:c,children:l.jsxs(vt,{className:"max-w-[500px] p-0 overflow-hidden gap-6",children:[l.jsx($t,{className:"bg-secondary p-5 py-4 items-start",children:l.jsx(An,{children:l.jsx("h1",{className:"text-md",children:"Unsaved Changes"})})}),l.jsx(gg,{className:"px-5",children:"You have unsaved changes that will be lost"}),l.jsx("div",{className:"px-5",children:l.jsx("div",{className:"bg-muted rounded p-3 border border-bg-muted-foreground mb-4",children:l.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[l.jsx("span",{children:"Navigating to:"}),l.jsx("div",{className:"flex items-center space-x-1 bg-background p-2 rounded border-bg-muted-foreground border",children:l.jsx("span",{className:" ",children:s})})]})})}),l.jsxs(fn,{className:"flex flex-row p-4 pt-0 gap-4 justify-end",children:[l.jsx(ve,{variant:"outline",className:"rounded capitalize",onClick:o,children:"save and continue"}),l.jsx(ve,{variant:"primary",className:"rounded capitalize",onClick:i,children:"Discard and continue"})]})]})})})};function _m(A){return typeof A=="object"&&A!==null&&!Array.isArray(A)&&("url"in A||"src"in A)}const voA=({children:A,type:e,initialState:t={},validators:n,requiredDraftFields:r,postQueryConfig:s,formFieldsMapper:a,submitFieldsMapper:o,onBack:i,groups:c,mainForm:u,showTitle:f,baseUrl:d,postBaseUrl:g,isPopup:v,actionButtonTitle:m,showDraft:p,showSchedule:h=!1,formTitle:w,createMessage:b,updateMessage:x,showDescriptionOnSubmit:z,autoSave:D=!1,onChange:B,user_config:M})=>{var ee;const I=t.uuid||((ee=t.formValues)==null?void 0:ee.uuid),X=t.isCreate||!I||I==="new",[V,E]=P.useReducer(ioA,{...ooA,...t,isCreate:X});let k=V.formValues;if(k!=null&&k.featured_image){if(typeof k.featured_image=="string")try{const hA=JSON.parse(k.featured_image);hA&&(hA.url||hA.src)&&(k={...k,featured_image:hA})}catch(hA){console.warn("Failed to parse initial featured_image JSON:",hA)}else if(_m(k.featured_image)){const hA=k.featured_image;hA.src&&!hA.url&&(k={...k,featured_image:{...hA,url:hA.src}})}}const Z=Dg({...n&&{resolver:pv(n)},defaultValues:k,reValidateMode:"onChange",mode:"onChange"}),C=aoA({storageKey:`${e}_${V.uuid||"new"}`,form:Z,enabled:D&&V.isDraft&&!V.isCreate,interval:3e4,onSave:async()=>{Z.setValue("status",!V.isDraft),Z.setValue("is_autosave",!0),await G(V.isCreate,!1),V.isCreate||await j({titleOnly:!1,showActionModals:!1}),Z.setValue("is_autosave",!1)}}),Q=noA(V.uuid&&V.uuid!=="new"?s==null?void 0:s.fetch:void 0,V.uuid),Y=(hA,pe)=>{E({type:Z.getValues("status")?"PUBLISH_POST":"SAVE_DRAFT"}),pe&&E({type:"SET_UUID",payload:pe})},T=roA({config:s==null?void 0:s.create,postBaseUrl:g,baseUrl:d,postType:e,createMessage:b,showDescription:z,onSuccess:Y});let H=soA({config:s==null?void 0:s.update,fetchConfig:s==null?void 0:s.fetch,postBaseUrl:g,baseUrl:d,postType:e,updateMessage:x,showDescription:z,onSuccess:Y,user_config:M});s!=null&&s.update||(H=T);const{showError:N}=Gt();async function j({titleOnly:hA,showActionModals:pe=!0,overrides:GA,skipRevalidate:L}){try{const $=V.isCreate;let tA=Z.getValues("uuid");tA||(tA=$?doA():V.uuid||I||"",Z.setValue("uuid",tA),E({type:"SET_UUID",payload:tA}));const cA=Z.getValues("featured_image");_m(cA)&&cA.src&&!cA.url&&Z.setValue("featured_image",{...cA,url:cA.src});const lA={...Z.getValues(),...GA||{}},iA=Object.keys(Z.formState.dirtyFields);GA&&Object.keys(GA).forEach(HA=>{iA.includes(HA)||iA.push(HA)});const uA=o?o(lA):lA;if(uA.showActionModals=pe,uA.is_autosave=lA==null?void 0:lA.is_autosave,L&&(uA.skipRevalidate=!0),uA.updated_fields=iA.join(","),hA){const HA={uuid:uA.uuid,blog_uuid:uA.blog_uuid,author_uuid:uA.author_uuid,slug:uA.slug,title:uA.title,titleStatus:!!uA.status,is_autosave:uA.is_autosave,updated_fields:uA.updated_fields};$?await T.mutateAsync(HA):await H.mutateAsync(HA)}else $?await T.mutateAsync(uA):await H.mutateAsync(uA);Z.reset(lA)}catch($){console.error($);const tA=$ instanceof Error?$.message:String($);throw N("Error while saving article",tA),$}}const O=P.useMemo(()=>{const hA=c!=null&&c.length?c==null?void 0:c.flatMap(GA=>GA.sections.flatMap(L=>L.formItems)):[],pe=u!=null&&u.sections?u==null?void 0:u.sections.flatMap(GA=>GA.formItems):[];return[...hA,...pe]},[c,u]),G=async(hA=!1,pe=!0,GA=!1)=>{const L=Z.getValues("status");Z.clearErrors();const $=GA||L,tA=await Z.trigger($?void 0:r),iA=`Validation error on field(s): ${Object.keys(Z.formState.errors).map(uA=>uA).map(uA=>{const HA=O.find(qA=>qA.name==uA);return HA?HA.label:uA}).join(", ")}. Please fix all issues before submitting.`;if(!tA){pe&&N(`Failed to ${hA?"Create":"Update"} ${e||"Article"}`,iA);const uA=new Error(iA);throw uA.cause="Form validation failed",uA.message=iA,uA}return tA},J=async(hA=!0)=>{Z.setValue("status",!1),await G(V.isCreate),await j({titleOnly:!1,showActionModals:hA})},K=async()=>{Z.setValue("status",!0),Z.setValue("published_at",new Date),await G(V.isCreate),await j({titleOnly:!1})},nA=async hA=>{try{await G(V.isCreate,!0,!0),await j({titleOnly:!1,overrides:{status:!1,published_at:hA},skipRevalidate:!0})}catch{}},R=async()=>{try{await G(V.isCreate),await j({titleOnly:!1,overrides:{status:!1,published_at:null}})}catch{}},eA=async()=>{Z.setValue("status",!!Z.getValues("status")),await G(V.isCreate),await j({titleOnly:!0})},AA=()=>{i==null||i()},_=()=>{if(!Q.data)return;let hA=a?a(Q.data):Q.data||Object.create(null);if(hA.featured_image){if(typeof hA.featured_image=="string")try{const L=JSON.parse(hA.featured_image);L&&(L.url||L.src)&&(hA={...hA,featured_image:L})}catch(L){console.warn("Failed to parse featured_image JSON:",L)}else if(_m(hA.featured_image)){const L=hA.featured_image;L.src&&!L.url&&(hA={...hA,featured_image:{...L,url:L.src}})}}Z.reset(hA),C.updateLastSave(),V.isCreate||E({type:hA!=null&&hA.status?"PUBLISH_POST":"SAVE_DRAFT"});const pe=Object.entries(hA).reduce((L,[$,tA])=>({...L,[$]:tA}),{});E({type:"SET_FORM_VALUES",payload:pe});const GA=Z.getValues("status");C.toggleEnableAutoSave(!GA)},W=()=>{_()};P.useEffect(()=>{var pe,GA;const hA=()=>{const L=window.location.hash.replace("#","");L&&c&&c.some($=>$.id===L)&&E({type:"SET_ACTIVE_GROUP",payload:L})};return!V.activeGroupId&&c&&c.length>0?(E({type:"SET_ACTIVE_GROUP",payload:(pe=c==null?void 0:c[0])==null?void 0:pe.id}),window.location.hash=(GA=c==null?void 0:c[0])==null?void 0:GA.id):hA(),window.addEventListener("hashchange",hA),()=>{window.removeEventListener("hashchange",hA)}},[V.activeGroupId,c,E]),P.useEffect(()=>{const hA=Z.watch((pe,{name:GA,values:L})=>{B==null||B(Z,GA,L)});return()=>hA.unsubscribe()},[Z,E,B]),P.useEffect(()=>{_()},[Q.isFetched]);const[U,PA]=P.useState(()=>Z.getValues("published_at"));P.useEffect(()=>{PA(Z.getValues("published_at"));const hA=Z.watch((pe,GA)=>{(!GA.name||GA.name==="published_at")&&PA(pe.published_at)});return()=>hA.unsubscribe()},[Z]);const TA=P.useMemo(()=>{if(!U)return null;const hA=U instanceof Date?U:new Date(U);return Number.isNaN(hA.getTime())?null:hA},[U]),YA=!!(V.isDraft&&TA&&TA.getTime()>Date.now());return l.jsxs(xj.Provider,{value:{state:V,initialState:t,type:e,dispatch:E,handleSaveDraft:J,handleSaveTitle:eA,handlePublish:K,handleSchedule:nA,handleCancelSchedule:R,isScheduled:YA,scheduledAt:TA,showSchedule:h,handleBack:AA,form:Z,postQuery:Q,groups:c,mainForm:u,createMutation:T,updateMutation:H,showTitle:f,baseUrl:d,postBaseUrl:g,isPopup:v,formTitle:w,showDraft:p,actionButtonTitle:m,autosave:C,showAutoSave:D&&!V.isCreate&&V.isDraft},children:[A,l.jsx(goA,{hasUnsavedChanges:Z.formState.isDirty,onSave:Z.getValues("status")?K:J,onDiscard:W})]})};function bv(A){return JA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M170.718 216.482L141.6 245.6l93.6 93.6 208-208-29.118-29.118L235.2 279.918l-64.482-63.436zM422.4 256c0 91.518-74.883 166.4-166.4 166.4S89.6 347.518 89.6 256 164.482 89.6 256 89.6c15.6 0 31.2 2.082 45.764 6.241L334 63.6C310.082 53.2 284.082 48 256 48 141.6 48 48 141.6 48 256s93.6 208 208 208 208-93.6 208-208h-41.6z"},child:[]}]})(A)}const Q0=(A,e,t,n)=>{var c,u,f,d,g,v;const r=m=>{e.onChange?e.onChange(m,A):t.onChange(m)},s=t.value,a={...e,error:n.error,onChange:r,value:s,validationError:(c=n.error)==null?void 0:c.message},o=e.linkedField&&A.getValues(e.linkedField),i=()=>{o&&(s||A.setValue(e.name,o))};switch(e.type){case"switch":return l.jsx($e,{...a,className:S("w-full",e.className)});case"wysiwyg":return l.jsx($e,{...a,defaultValue:e.linkedField&&A.getValues(e.linkedField),className:S("w-full h-full",e.className),wysiwygProps:{...e.wysiwygProps,className:S("w-full p-0 bg-background border-none",(u=e.wysiwygProps)==null?void 0:u.className)}});case"custom":return(f=e.contentRender)==null?void 0:f.call(e,s);case"select":case"optionslist":case"image":case"blogposts":return l.jsx($e,{...a,className:S("w-full",e.className,{"[&_.waz-input-box-content]:opacity-30":!s&&o}),value:s||o});case"link":return l.jsx($e,{...a,className:S("w-full",e.className),linkProps:{...a.linkProps,placeholder:e.linkedField&&A.getValues(e.linkedField)||((d=a.linkProps)==null?void 0:d.placeholder),onFocus:o&&i,disabled:t.disabled}});case"textarea":return l.jsx($e,{...a,className:S("w-full",e.className),textareaProps:{...a.textareaProps,placeholder:o||((g=a.textareaProps)==null?void 0:g.placeholder),onFocus:o&&i,disabled:t.disabled}});default:return l.jsx($e,{...a,className:S("w-full",e.className),inputProps:{...a.inputProps,onKeyDown:m=>{var p;(p=e.onKeyDown)==null||p.call(e,m,A)},onFocus:o&&i,placeholder:o||((v=a.inputProps)==null?void 0:v.placeholder),disabled:t.disabled}})}},moA=({section:A,item:e,itemIndex:t,form:n,onRemove:r,canRemove:s})=>{const[a,o]=P.useState(!0),i=()=>{o(!a)},{attributes:c,listeners:u,setNodeRef:f,transform:d,transition:g,isDragging:v}=Ou({id:e.id}),m={transform:is.Transform.toString(d),transition:g};return l.jsxs("div",{ref:f,style:m,className:S("group relative border p-4 transition-all duration-200 rounded",{"bg-accent/50 border-2 border-accent shadow-lg":v}),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[A.maxItems!==1&&l.jsx("div",{...c,...u,className:"cursor-grab active:cursor-grabbing p-1 rounded hover:bg-muted",children:l.jsx(Th,{className:"h-4 w-4 text-muted-foreground"})}),A.maxItems!==1?l.jsxs("p",{className:"",children:[l.jsxs("span",{className:"text-muted-foreground capitalize mr-1",children:[t+1,"."]}),l.jsxs("span",{className:"text-primary-foreground",children:[A.dynamicType," Group "]})]}):l.jsxs("span",{className:"text-primary-foreground",children:[A.dynamicType," "]})]}),l.jsxs("div",{className:"flex items-center",children:[s&&l.jsx(pA,{variant:"ghost",size:"sm",onClick:r,className:S("h-8 w-8 p-0 text-red-500 hover:text-red-700 hover:bg-red-50 transition-opacity","opacity-0 group-hover:opacity-100"),children:l.jsx(yn,{className:"w-4 h-4"})}),A.collapsible&&l.jsx(pA,{variant:"ghost",size:"sm",onClick:i,className:S("h-8 w-8 p-0"),children:a?l.jsx(ig,{}):l.jsx(kz,{})})]})]}),l.jsx("div",{className:S("flex items-center flex-col gap-2",{hidden:!a},A.formItemsContainerClassName),children:A.formItems.map(p=>{const h=`${A.id}_${e.id}_${p.name}`;return l.jsx(io,{control:n.control,name:h,render:({field:w,fieldState:b})=>{var x;return l.jsxs(mr,{className:S("flex flex-col w-full",p.containerClassname),children:[p.description&&l.jsx("p",{className:"text-muted-foreground w-full h-fit",children:p.description}),l.jsx(lo,{className:"flex flex-1",children:Q0(n,p,w,b)}),b.error&&l.jsxs("div",{className:"flex items-center gap-2 mt-1 opacity-50",children:[l.jsx(YZ,{strokeWidth:2,className:"text-destructive"}),l.jsx("span",{className:"font-bold text-muted-foreground capitalize",children:(x=b.error)==null?void 0:x.message})]})]})}},h)})})]})};function zj(A){const e=/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)_(.+)$/,t=A.match(e);return t?{group_id:t[1],index:parseInt(t[2]||"0",10),fieldname:t[3]}:{group_id:"",index:0,fieldname:""}}function $m(A=""){var n,r;if(!A||A.trim()==="")return{quantity:"",unit:""};if(A.includes("//")){const s=A.indexOf("//"),a=A.substring(0,s).trim(),o=A.substring(s).replace(/\/+/g,"").trim();return{quantity:a||"",unit:o}}const e=/^(\d+(?:\s+\d+\/\d+|\.\d+|\/\d+)?)\s*(.*)$/,t=A.match(e);if(console.log("numericMatch",t,A),t){const s=((n=t[2])==null?void 0:n.trim())||"";return{quantity:((r=t[1])==null?void 0:r.trim())||"",unit:s||""}}return{quantity:A.trim(),unit:""}}const poA=({section:A})=>{const{form:e}=mo(),[t,n]=P.useState([{id:"0",values:A.template||{}}]);P.useEffect(()=>{const u=e.getValues(),f=A.formItems.map(g=>g.name),d=[];Object.entries(u).forEach(([g,v])=>{f.map(m=>{var p;if(g.includes(m)){const{index:h}=zj(g);d[h]?d[h]={id:h.toString(),values:{...(p=d[h])==null?void 0:p.values,[m]:v}}:d.push({id:h.toString(),values:{[m]:v}})}})}),d.length&&n(d)},[]);const r=u=>{const f=A.maxItems||1/0;if(t.length<f){const d={id:`${Date.now()}`,values:A.template||{}};if(u!==void 0&&u>=0&&u<=t.length){const g=[...t];g.splice(u+1,0,d);const v=g.map((m,p)=>({...m,id:p.toString()}));n(v)}else n([...t,d])}},s=u=>{const f=A.minItems||1;if(t.length>f){const g=t.filter(v=>v.id!==u).map((v,m)=>({...v,id:m.toString()}));n(g)}},a=Du(Br(vo),Br(go,{coordinateGetter:Tu}));function o(u){const{active:f,over:d}=u;if(f.id!==(d==null?void 0:d.id)&&(d!=null&&d.id)){const g=t.findIndex(z=>z.id===f.id),v=t.findIndex(z=>z.id===(d==null?void 0:d.id));if(g===-1||v===-1)return;const m=[...t],[p]=m.splice(g,1);if(!p)return;m.splice(v,0,p);const h=e.getValues(),w={...h},b=A.formItems.map(z=>z.name);Object.keys(h).forEach(z=>{b.forEach(D=>{z.includes(`${A.id}_`)&&z.includes(`_${D}`)&&delete w[z]})}),m.forEach((z,D)=>{b.forEach(B=>{const M=`${A.id}_${z.id}_${B}`,I=`${A.id}_${D}_${B}`,X=h[M];X!==void 0&&(w[I]=X)})});const x=m.map((z,D)=>({...z,id:D.toString()}));e.reset(w),n(x)}}const i=!A.maxItems||t.length<A.maxItems,c=t.length>(A.minItems||1);return l.jsxs(l.Fragment,{children:[A.description&&l.jsx("p",{className:"text-muted-foreground text-sm w-full",children:A.description}),l.jsx(Mu,{sensors:a,collisionDetection:Bu,onDragEnd:o,children:l.jsx("div",{className:"relative space-y-2",children:l.jsx(ju,{items:t.map(u=>u.id),strategy:Cu,children:t.map((u,f)=>l.jsxs("div",{children:[l.jsx(moA,{section:A,item:u,itemIndex:f,form:e,onRemove:()=>s(u.id),canRemove:c}),i&&l.jsx("div",{className:S("group w-full min-h-1 hover:bg-muted hover:p-4",{" bg-muted p-4":f===t.length-1}),children:l.jsxs("div",{className:S("hidden group-hover:flex items-center justify-center gap-2 transition-all duration-200 text-xs",{flex:f===t.length-1}),children:[l.jsx(pA,{variant:"ghost",onClick:()=>r(f),size:"icon",className:"border border-primary bg-background rounded-full hover:bg-primary",children:l.jsx(As,{})}),"Add New Group"]})})]},u.id))})})})]})},hoA=({section:A})=>{const{form:e}=mo();return l.jsxs(l.Fragment,{children:[A.description&&l.jsx("p",{className:S("text-muted-foreground w-full h-fit",A.descriptionClassName),children:A.description}),A.formItems.map((t,n)=>l.jsx(io,{control:e.control,name:t.name,render:({field:r,fieldState:s})=>l.jsxs(mr,{className:S("flex flex-col w-full",t.containerClassname),children:[t.description&&l.jsx("p",{className:"w-full h-fit leading-5",children:t.description}),l.jsx(lo,{className:"flex flex-1",children:Q0(e,t,r,s)})]})},`${t.name}-${n}`))]})},woA=({index:A,step:e,section:t,formField:n,disabled:r,onDelete:s})=>{var m;const{attributes:a,listeners:o,setNodeRef:i,transform:c,isDragging:u,isOver:f}=Ou({id:e.id}),d={transform:is.Transform.toString(c)},{form:g}=mo(),v=(m=g.getValues(`${t.id}_${e.id}_${n==null?void 0:n.name}`))==null?void 0:m.toString();return l.jsx("div",{ref:i,style:d,...a,className:"sortable-item",children:l.jsxs("div",{className:S("group border-l-[2px] pt-4 pl-5 border-border bg-background relative z-10",{"border-primary-foreground":v==null?void 0:v.length,"bg-accent/50 border border-b-4 border-accent z-100":u,"z-1":f,"pt-0 ":!A}),children:[l.jsx("div",{...o,className:S("p-[7px] bg-background rounded-full absolute top-5 left-[-13px] z-10 cursor-grab active:cursor-grabbing",{"top-2":!A}),children:l.jsx("div",{className:S("p-[5px] rounded-full bg-primary-foreground",{"bg-background ":f})})}),l.jsx(io,{control:g.control,name:`${t.id}_${e.id}_${n==null?void 0:n.name}`,disabled:r,render:({field:p,fieldState:h})=>l.jsx(mr,{className:S("flex flex-col w-full",n==null?void 0:n.containerClassname),children:l.jsx(lo,{className:"flex flex-1",children:Q0(g,{...n,label:(n.label||"Step")+` ${A+1}`},p,h)})})}),l.jsx(pA,{variant:"ghost",size:"sm",onClick:s,className:S("hidden group-hover:flex absolute top-4 right-2 h-8 w-8 p-0 text-red-500 hover:text-red-700 hover:bg-transparent transition-opacity",{"top-0":!A}),children:l.jsx(yn,{className:"w-4 h-4"})})]},e.id)})},yoA=({section:A})=>{const e=A.formItems[0],{form:t}=mo(),[n,r]=P.useState([]),s=()=>{const u={id:n.length.toString(),order:n.length,value:""};r([...n,u])},a=u=>{if(console.log(n,u),n.findIndex(m=>m.id===u)<=0)return;const g=n.filter(m=>m.id!==u).map((m,p)=>({...m,id:p.toString(),order:p}));r(g);const v=t.getValues();Object.keys(v).filter(m=>m.startsWith(`${A.id}_`)&&m.endsWith(`_${e==null?void 0:e.name}`)).forEach(m=>{t.unregister(m)}),g.forEach(m=>{t.setValue(`${A.id}_${m.id}_${e==null?void 0:e.name}`,m.value)})},o=Du(Br(vo),Br(go,{coordinateGetter:Tu}));function i(u){const{active:f,over:d}=u,g=[...n],v=n.findIndex(h=>h.id==(d==null?void 0:d.id)),m=n.findIndex(h=>h.id==(f==null?void 0:f.id)),p=n[m];p&&(g.splice(m,1),g.splice(v,0,p)),g.forEach((h,w)=>[t.setValue(`${A.id}_${w}_${e==null?void 0:e.name}`,h.value)])}const c=()=>{const u=t.getValues(),f=Object.keys(u).filter(d=>d.startsWith(`${A.id}_`)&&d.endsWith(`_${e==null?void 0:e.name}`)).sort();if(f.length===0){r([{id:"0",order:0,value:""}]);return}r(f.map((d,g)=>({id:g.toString(),order:g,value:u[d]||""})))};if(P.useEffect(()=>{c()},[]),P.useEffect(()=>{const u=t.watch((f,{name:d})=>{d!=null&&d.includes(A.id)&&c()});return()=>u.unsubscribe()},[t]),!!e)return l.jsxs("div",{className:"border-l-6 border-transparent",children:[l.jsx(Mu,{sensors:o,collisionDetection:Bu,onDragEnd:i,children:l.jsx(ju,{items:n.map(u=>u.id),strategy:Cu,children:n.map((u,f)=>{var d;return l.jsx(woA,{index:f,step:u,section:A,formField:e,disabled:f?!((d=n[f-1])!=null&&d.value):!1,onDelete:()=>a(u.id)},u.id)})})}),l.jsx("div",{className:"relative py-2 pl-5 flex justify-start mt-2",children:l.jsxs(pA,{variant:"primary",onClick:s,children:[l.jsx(As,{className:"w-4 h-4"}),"Add another step"]})})]})},VP=({main:A=!1,className:e=""})=>{var d,g,v,m;const{state:t,mainForm:n,groups:r}=mo(),{activeGroupId:s}=t,a=A?n:(d=r==null?void 0:r.find)==null?void 0:d.call(r,p=>p.id===s),[o,i]=P.useState(a?(v=(g=a==null?void 0:a.sections)==null?void 0:g[0])==null?void 0:v.id:""),c=a==null?void 0:a.sections,u=c?(m=c.filter)==null?void 0:m.call(c,p=>p.title):[];if(P.useEffect(()=>{var p;i(((p=c==null?void 0:c[0])==null?void 0:p.id)||"")},[a]),!a)return null;const f=p=>p.isDynamic&&p.dynamicType==="steps"?l.jsx(yoA,{section:p}):p.isDynamic?l.jsx(poA,{section:p}):l.jsx(hoA,{section:p});return l.jsx("div",{className:S("w-full h-full overflow-auto flex p-4",e),children:l.jsxs(Zg,{value:o,className:"flex flex-col w-0 flex-1 h-full no-scrollbar overflow-auto !p-0 gap-4",children:[l.jsx(su,{className:S("m-0 rounded-none bg-background h-fit gap-4 w-full overflow-x-auto justify-start shadow-none",{hidden:!u.length}),children:u.map(p=>p.title?l.jsxs(au,{className:"rounded-full flex gap-2 px-4 py-2 border border-primary opacity-50 data-[state=active]:opacity-100 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",value:p.id,onClick:()=>i(p.id),children:[p.icon&&l.jsx(pA,{variant:"ghost",disabled:!0,size:"icon",className:"h-5 w-5 p-0 disabled:opacity-100",children:p.icon}),p.title]},p.id):null)}),c==null?void 0:c.map(p=>l.jsx(Sg,{value:p.id,className:S("flex flex-col max-w-full gap-4 h-0 overflow-auto flex-1 m-0",p.className),children:f(p)},p.id))]})})},PoA=(A=3)=>{const e=P.useRef(null);return P.useEffect(()=>{const t=e.current;if(!t)return;const{lineHeight:n}=getComputedStyle(t),r=parseFloat(n)*A,s=()=>{t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,r)}px`};return s(),t.addEventListener("input",s),t.addEventListener("focusin",s),()=>{t.removeEventListener("input",s),t.removeEventListener("focusin",s)}},[A]),e},boA=()=>{var d,g,v,m,p,h,w,b,x,z,D,B,M,I,X,V,E,k,Z,C,Q;const{autosave:A}=mo(),[e,t]=P.useState(!1);P.useEffect(()=>{t(!0)},[]);const n=()=>{A.toggleEnableAutoSave(!A.autoSaveEnabled)},[r,s]=P.useState(0),a=((d=A.state)==null?void 0:d.status)=="saving",o=((g=A.state)==null?void 0:g.status)=="pending",i=((v=A.state)==null?void 0:v.status)=="error",c=typeof((p=(m=A.state)==null?void 0:m.error)==null?void 0:p.cause)=="string"?(w=(h=A.state)==null?void 0:h.error)==null?void 0:w.cause:((x=(b=A.state)==null?void 0:b.error)==null?void 0:x.message)||"Autosave Error",{showError:u}=Gt(),f=P.useCallback(()=>{var Y,T;u(c,(T=(Y=A.state)==null?void 0:Y.error)==null?void 0:T.message)},[u,c,(D=(z=A.state)==null?void 0:z.error)==null?void 0:D.message]);return P.useEffect(()=>{s(Y=>Y+1)},[A.state]),e?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"group flex justify-end items-center min-w-70",children:[l.jsxs("div",{className:S("group-hover:hidden p-5 py-2 rounded-full border border-primary flex items-center text-sm gap-2",{"flex-wrap gap-y-0":a||o,hidden:!((B=A.state)!=null&&B.status)&&!A.lastSaveDate}),children:[l.jsx(Uu,{className:"text-base"}),l.jsx("p",{className:S("hidden gap-1 items-center",{flex:!A.autoSaveEnabled}),children:"Autosave off"}),A.autoSaveEnabled&&l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:!((M=A.state)!=null&&M.status)&&A.lastSaveDate}),children:["Last Saved:",l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"dd-MM-yyyy")}),l.jsx(ff,{className:"text-xs"}),l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"HH:mm:ss")})]}),l.jsxs("p",{className:S("hidden gap-1 items-center",{block:o||a}),children:["Autosave: ",a?"In Progress":"Waiting"]}),(a||o)&&l.jsx("div",{className:"relative h-[2px] w-full overflow-hidden rounded-full ",children:l.jsx("div",{className:"absolute inset-0 h-full w-full bg-primary",style:{animation:`wazui_progress_bar ${a?"5s":"30s"} ease-in-out`}})},`progress-${r}`),l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:((I=A.state)==null?void 0:I.status)=="saved"}),children:["Autosave Complete",l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"dd-mm-yyyy")}),l.jsx(ff,{className:"text-xs"}),l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"HH:mm:ss")})]}),l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:i}),children:["Autosave",l.jsxs("span",{className:"text-destructive hover:underline max-w-50 truncate",onClick:f,children:["Error | ",c]})]})]})]}),l.jsxs("div",{className:S("hidden group-hover:invisible p-5 py-2 rounded-full border border-primary items-center text-sm gap-2",{"flex-wrap gap-y-0":a||o,flex:!((X=A.state)!=null&&X.status)&&!A.lastSaveDate&&!A.autoSaveEnabled}),children:[l.jsx(Uu,{className:"text-base"}),l.jsx("p",{className:S("hidden gap-1 items-center",{flex:!A.autoSaveEnabled||!((V=A.state)!=null&&V.status)}),children:"Autosave off"}),A.autoSaveEnabled&&l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:!((E=A.state)!=null&&E.status)&&A.lastSaveDate}),children:["Last Saved:",l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"dd-MM-yyyy")}),l.jsx(ff,{className:"text-xs"}),l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"HH:mm:ss")})]}),l.jsxs("p",{className:S("hidden gap-1 items-center",{block:o||a}),children:["Autosave: ",a?"In Progress":"Waiting"]}),(a||o)&&l.jsx("div",{className:"relative h-[2px] w-full overflow-hidden rounded-full ",children:l.jsx("div",{className:"absolute inset-0 h-full w-full bg-primary",style:{animation:`wazui_progress_bar ${a?"5s":"30s"} ease-in-out`}})},`progress-${r}`),l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:((k=A.state)==null?void 0:k.status)=="saved"}),children:["Autosave Complete",l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"dd-mm-yyyy")}),l.jsx(ff,{className:"text-xs"}),l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"HH:mm:ss")})]}),l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:((Z=A.state)==null?void 0:Z.status)=="error"}),children:["Autosave",l.jsxs("span",{className:"text-destructive max-w-50 truncate",children:["Error | ",(Q=(C=A.state)==null?void 0:C.error)==null?void 0:Q.message]})]})]})]}),l.jsxs("div",{className:S("hidden group-hover:flex border cursor-pointer rounded-full p-4 py-2 text-xs items-center gap-2",{"border-destructive text-destructive ":A.autoSaveEnabled}),onClick:n,children:[l.jsx(Uu,{className:"text-base"}),l.jsx("p",{children:A.autoSaveEnabled?"Disable Autosave":"Enable Autosave"})]})]}),i&&l.jsx(_nA,{className:"text-destructive text-md animate-bounce",onClick:f})]}):l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("div",{className:"group flex justify-end items-center min-w-70",children:l.jsxs("div",{className:"p-5 py-2 rounded-full border border-primary flex items-center text-sm gap-2",children:[l.jsx(Uu,{className:"text-base"}),l.jsx("p",{className:"gap-1 items-center flex",children:"Loading..."})]})})})},xoA=A=>A.toLocaleDateString(void 0,{weekday:"short",day:"2-digit",month:"short",year:"numeric"}),XP=A=>{const e=String(A.getHours()).padStart(2,"0"),t=String(A.getMinutes()).padStart(2,"0");return`${e}:${t}`},zoA=()=>{var A;try{const n=((A=new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(new Date).find(s=>s.type==="timeZoneName"))==null?void 0:A.value)||"",r=Intl.DateTimeFormat().resolvedOptions().timeZone;return n?`${r} ${n}`:r}catch{return"Local time"}},DoA=({open:A,onOpenChange:e,mode:t,initialDate:n,isSubmitting:r=!1,onConfirm:s})=>{const a=()=>{const w=new Date;return w.setMinutes(0,0,0),w.setHours(w.getHours()+1),w},[o,i]=P.useState(()=>n??a()),[c,u]=P.useState(()=>XP(n??a())),[f,d]=P.useState(!1),[g,v]=P.useState(null);P.useEffect(()=>{if(A){const w=n??a();i(w),u(XP(w)),v(null)}},[A,n]);const m=P.useMemo(zoA,[]),p=async()=>{const[w,b]=c.split(":"),x=Number(w),z=Number(b);if(Number.isNaN(x)||Number.isNaN(z)){v("Enter a valid time");return}const D=new Date(o);if(D.setHours(x,z,0,0),D.getTime()<=Date.now()){v("Pick a time in the future");return}v(null),await s(D)},h=t==="reschedule";return l.jsx(xt,{open:A,onOpenChange:e,children:l.jsxs(vt,{className:"max-w-[450px] p-0 overflow-hidden",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{className:"text-secondary-foreground",children:l.jsx("h1",{className:"text-md capitalize",children:h?"Reschedule post":"Schedule post"})})}),l.jsx(ls,{className:"px-4",children:h?"Pick a new publish time. Your content and all edits stay exactly as they are.":"Schedule when this article should go live. You can change this any time before it publishes."}),l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("label",{className:"text-sm",children:"Date"}),l.jsxs(oa,{open:f,onOpenChange:d,children:[l.jsx(ia,{asChild:!0,children:l.jsxs(pA,{variant:"outline",type:"button",className:S("justify-between font-normal"),children:[l.jsx("span",{className:"text-black",children:xoA(o)}),l.jsx(dc,{className:"h-4 w-4 text-muted-foreground"})]})}),l.jsx(cs,{className:"w-auto p-0",align:"start",children:l.jsx(Kc,{mode:"single",selected:o,onSelect:w=>{w&&(i(w),d(!1))},disabled:w=>{const b=new Date;return b.setHours(0,0,0,0),w<b},initialFocus:!0})})]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("label",{className:"text-sm",children:"Time"}),l.jsxs("div",{className:"relative",children:[l.jsx(Wt,{type:"time",value:c,step:"1",onChange:w=>u(w.target.value),className:"text-black pr-8 [&::-webkit-calendar-picker-indicator]:hidden"}),l.jsx(Zz,{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"})]})]})]}),l.jsxs("div",{className:"flex items-center justify-between rounded-md border bg-muted/40 px-3 py-2 text-sm",children:[l.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[l.jsx(eS,{className:"h-4 w-4"}),"Timezone"]}),l.jsx("span",{className:"text-black bg-white p-2 rounded-full",children:m})]}),g&&l.jsx("p",{className:"text-sm text-destructive",children:g})]}),l.jsxs(fn,{className:"p-4 flex flex-row justify-end gap-2 sm:justify-end",children:[l.jsx(pA,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:r,children:"Cancel"}),l.jsx(pA,{type:"button",onClick:p,disabled:r,className:"bg-primary text-primary-foreground",children:h?"Reschedule":"Schedule"})]})]})})},BoA=({open:A,onOpenChange:e,isSubmitting:t=!1,onConfirm:n})=>l.jsx(xt,{open:A,onOpenChange:e,children:l.jsxs(vt,{className:"max-w-[450px] p-0 overflow-hidden",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{className:"text-secondary-foreground",children:"Cancel this schedule?"})}),l.jsx(ls,{className:"px-4 lowercase first-letter:uppercase",children:"The post will return to Draft. Your content and edits are kept — only the scheduled publish time is removed."}),l.jsxs(fn,{className:"p-4 flex flex-row justify-end gap-2 sm:justify-end",children:[l.jsx(pA,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:t,children:"Keep schedule"}),l.jsx(pA,{type:"button",onClick:n,disabled:t,className:"bg-primary text-primary-foreground",children:"Yes, cancel schedule"})]})]})}),MoA=A=>{var r;const e=A.toLocaleDateString(void 0,{weekday:"short",day:"2-digit",month:"short"}),t=A.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});let n="";try{n=((r=new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(A).find(a=>a.type==="timeZoneName"))==null?void 0:r.value)||""}catch{n=""}return`${e} at ${t}${n?` · ${n}`:""}`},CoA=({scheduledAt:A,onChangeTime:e})=>l.jsxs("div",{className:"flex h-12 w-fit items-center justify-between gap-3 rounded-md border border-[#F0D08A] bg-[#FFF4E0] p-2 waz_shadow",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#6B4400]",children:[l.jsx(Zz,{className:"h-4 w-4"}),l.jsxs("span",{children:["Scheduled to publish ",MoA(A)]})]}),l.jsx(pA,{type:"button",variant:"outline",size:"sm",className:"h-7 border-[#FFAA00]/60 bg-[#F4DAAA] text-[#6B4400] hover:bg-[#FFAA00]/10",onClick:e,children:"Change time"})]}),joA=({label:A,disabled:e,onPublish:t,onScheduleClick:n,className:r})=>{const[s,a]=P.useState(!1);return l.jsxs("div",{className:S("flex items-stretch waz_shadow rounded-md overflow-hidden",r),children:[l.jsxs(pA,{type:"button",disabled:e,onClick:t,className:"rounded-none rounded-l-md bg-primary text-[#101828] font-bold text-base px-4 gap-2 hover:bg-primary/90",children:[A,l.jsx(Z4,{})]}),l.jsxs(oa,{open:s,onOpenChange:a,children:[l.jsx(ia,{asChild:!0,children:l.jsx(pA,{type:"button",disabled:e,"aria-label":"More publish options",className:"rounded-none rounded-r-md bg-primary/60 text-[#101828] px-2 hover:bg-primary/90 border-none m-0",children:l.jsx(ig,{className:"h-4 w-4"})})}),l.jsx(cs,{align:"end",className:"w-56 p-1",children:l.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-2 text-sm hover:bg-muted",onClick:()=>{a(!1),n()},children:[l.jsx(dc,{className:"h-4 w-4"}),"Schedule for later"]})})]})]})},OoA=()=>{var R,eA;const{state:A,form:e,handlePublish:t,handleSaveDraft:n,handleSchedule:r,handleCancelSchedule:s,isScheduled:a,scheduledAt:o,showSchedule:i,handleSaveTitle:c,postQuery:{isLoading:u,error:f},type:d,mainForm:g,groups:v,createMutation:{isPending:m},updateMutation:{isPending:p},dispatch:h,showTitle:w,baseUrl:b,isPopup:x,formTitle:z,actionButtonTitle:D,showDraft:B,showAutoSave:M}=mo(),{activeGroupId:I}=A,X=e.getValues("uuid"),V=A.isDraft,E=e.formState.isDirty,[k,Z]=P.useState(!0),C=PoA(k?1:3),[Q,Y]=P.useState({open:!1,mode:"schedule"}),[T,H]=P.useState(!1),N=m||p,j=AA=>{h({type:"SET_ACTIVE_GROUP",payload:AA})},O=A.isCreate;let G=z,J=D;G||(O?G="Create "+d:G="Edit "+d),J||(O||V?J="Publish "+d:J="Update "+d);const K=async()=>{e.getValues("title")&&await c(),Z(!0)},nA=AA=>AA>=75?"text-destructive":AA>=65?"text-[#FFAA00]":AA>=55?"text-[#229954]":AA>=45?"text-[#FFAA00]":"text-muted-foreground";return l.jsx(h9,{...e,children:l.jsxs("form",{className:"w-full flex flex-col p-0",onSubmit:AA=>AA.preventDefault(),onKeyDown:AA=>{AA.key==="Enter"&&!(AA.target instanceof HTMLButtonElement&&AA.target.type==="submit")&&AA.preventDefault()},children:[u&&!X&&l.jsx("div",{className:"absolute inset-0 bg-white/50 backdrop-blur-sm flex items-center justify-center z-10",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Hh,{className:"h-6 w-6 animate-spin"}),l.jsx("span",{children:"Loading..."})]})}),f&&!O&&!X&&l.jsx("div",{className:"absolute inset-0 bg-white/50 backdrop-blur-sm flex items-center justify-center z-10",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ls,{className:"h-6 w-6"}),l.jsxs("span",{children:["Error: ",f==null?void 0:f.message]})]})}),x&&l.jsx("h1",{className:S("text-md font-bold bg-[#FADDD3] w-full p-4"),children:G}),l.jsxs("div",{className:"w-full h-full flex overflow-auto gap-2 items-stretch","data-testid":"main-form",children:[l.jsxs("div",{className:S("flex-2/3 flex flex-col items-start justify-between gap-5 p-4",{"pb-0":!x}),children:[l.jsxs("div",{className:"w-full flex items-center justify-between",children:[l.jsx("h1",{className:S("text-3xl font-bold font-[UniversalFeature] !m-0",{hidden:x}),children:G}),M&&l.jsx(boA,{})]}),l.jsxs("div",{className:S("w-full flex items-center justify-between flex-wrap gap-2",{hidden:!b&&!M}),children:[b&&l.jsx(G0,{url:b,pageTitle:`${O?"Create":"Edit"} ${d}`}),i&&a&&o&&l.jsx(CoA,{scheduledAt:o,onChangeTime:()=>Y({open:!0,mode:"reschedule"})})]}),w&&l.jsx(io,{control:e.control,name:"title",render:({field:AA,fieldState:_})=>{var U,PA,TA;const W=(PA=(U=AA.value)==null?void 0:U.toString())==null?void 0:PA.trim();return l.jsxs("div",{className:"w-full",children:[_.error&&l.jsxs("span",{className:"flex items-center mb-1 gap-1",children:[l.jsx(N0,{className:"text-destructive text-xl"}),l.jsx("span",{className:" capitalize text-xs text-muted-foreground",children:(TA=_.error)==null?void 0:TA.message})]}),l.jsxs("div",{className:S("flex items-center justify-center w-full gap-2"),children:[l.jsxs("div",{className:S("flex items-center justify-center w-full gap-2 slight_border border-secondary! p-1 px-2 rounded",{"border-primary!":!k}),children:[l.jsx(mr,{className:"flex-1",children:l.jsx(lo,{className:"w-full",children:l.jsx(Vg,{className:S("h-fit min-h-0 p-0 w-full placeholder:opacity-50 text-2xl! font-[UniversalFeature] no-scrollbar shadow-none flex-1 border-0 bg-transparent hover:bg-transparent focus:border-0 focus:outline-none focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0",{"opacity-50":k}),ref:C,placeholder:"Enter Title here","aria-disabled":k,value:AA.value,onChange:AA.onChange,rows:1,onBlur:()=>Z(!0),"data-testid":"title-input",onClick:()=>Z(!1)})})}),l.jsxs(pA,{variant:"outline",className:S("p-3 h-5 rounded-full border-secondary gap-1 hover:bg-transparent capitalize text-muted-foreground text-sm",{"border-primary":!k}),onClick:()=>k?Z(!1):K(),children:[k?l.jsx(Rs,{className:"text-sm"}):l.jsx(bv,{className:"text-sm text-primary"}),k?"edit":"save"]})]}),l.jsx("div",{className:S("flex",nA(W==null?void 0:W.length)),"data-testid":"title-word-count",children:l.jsx("span",{className:"text-sm",children:`${(W==null?void 0:W.length)||0}/65`})}),l.jsx(lt,{className:S("capitalize bg-muted w-fit p-2 py-1",{"border-[#229954] text-[#229954] bg-transparent":!V}),children:V?"draft":"published"})]})]})}},"title"),g&&l.jsx(VP,{main:!0,className:"flex-1 grow w-full p-0 "})]}),(v==null?void 0:v.length)&&l.jsxs(Zg,{defaultValue:(R=v[0])==null?void 0:R.id,value:I,className:"flex-1/3 flex flex-col h-full no-scrollbar overflow-auto p-0 flex-wrap",children:[l.jsx(su,{className:"rounded-none justify-start bg-black p-4 h-fit gap-4 w-full overflow-x-auto no-scrollbar",children:(v==null?void 0:v.length)&&v.map(AA=>l.jsxs(au,{className:"rounded-full p-2 px-4 gap-1 slight_border text-[#9C9C9C] group data-[state=active]:text-primary-foreground data-[state=active]:bg-primary data-[state=active]:border-none cursor-pointer",value:AA.id,onClick:_=>{_.preventDefault(),j(AA.id)},children:[AA.icon&&l.jsx("div",{className:"opacity-100 h-5 w-5 flex items-center justify-center",children:AA.icon&&AA.icon}),AA.title]},AA.id))}),l.jsx(Sg,{className:"flex-1 h-0 m-0 border-l",value:I||((eA=v[0])==null?void 0:eA.id),children:l.jsx(VP,{})})]})]}),l.jsxs("div",{className:S("flex gap-4 p-2 bg-muted w-full justify-end ",{hidden:x||!B}),children:[i&&a?l.jsx(ve,{className:" p-4 flex waz_shadow bg-transparent border border-destructive font-bold text-base px-4 text-destructive hover:bg-destructive/5",onClick:()=>H(!0),type:"button",disabled:N,children:"Cancel schedule"}):l.jsx(ve,{className:S(" p-4 hidden waz_shadow bg-[#A9D3B8] font-bold text-base px-4 text-[#101828]",{flex:V||O}),onClick:()=>n(),type:"button",disabled:N,children:"Save as Draft"}),i&&!a&&(V||O)?l.jsx(joA,{label:J,disabled:N,onPublish:()=>t(),onScheduleClick:()=>Y({open:!0,mode:"schedule"})}):l.jsx(ve,{className:S(" p-4 flex waz_shadow font-bold text-[#101828] text-base px-4 gap-1"),disabled:N,onClick:()=>t(),trailingIcon:l.jsx(Z4,{}),children:J})]}),(x||!B)&&l.jsx("div",{className:S("flex gap-4 p-2 w-full justify-end "),children:l.jsx(ve,{className:S(" p-4 hidden waz_shadow font-bold text-[#101828] text-base px-4 gap-1",{flex:E||V}),disabled:N,onClick:t,children:J})}),i&&l.jsxs(l.Fragment,{children:[l.jsx(DoA,{open:Q.open,onOpenChange:AA=>Y(_=>({..._,open:AA})),mode:Q.mode,initialDate:o,isSubmitting:N,onConfirm:async AA=>{await r(AA),Y(_=>({..._,open:!1}))}}),l.jsx(BoA,{open:T,onOpenChange:H,isSubmitting:N,onConfirm:async()=>{await s(),H(!1)}})]})]})})},Nu=({type:A="Post",showDraft:e=!0,showSchedule:t=!1,formTitle:n,actionButtonTitle:r,showTitle:s=!0,isPopup:a=!1,baseUrl:o="",postBaseUrl:i,className:c,post_uuid:u="",groups:f,initialState:d={},mainForm:g,validators:v,requiredDraftFields:m,postQueryConfig:p,createMessage:h,updateMessage:w,formFieldsMapper:b,submitFieldsMapper:x,onBack:z,onSave:D,onChange:B,showDescriptionOnSubmit:M,autoSave:I,user_config:X})=>{var V;return l.jsx(Zi,{children:l.jsx(voA,{initialState:{...d,uuid:u,activeGroupId:f&&(f==null?void 0:f.length)>0?(V=f[0])==null?void 0:V.id:""},showTitle:s,showDraft:e,showSchedule:t,formTitle:n,createMessage:h,updateMessage:w,actionButtonTitle:r,baseUrl:o,postBaseUrl:i,type:A,postQueryConfig:p,validators:v,requiredDraftFields:m,formFieldsMapper:b,submitFieldsMapper:x,onBack:z,onSave:D,groups:f,onChange:B,mainForm:g,isPopup:a,showDescriptionOnSubmit:M,autoSave:I,user_config:X,children:l.jsx("main",{className:S("w-full h-screen bg-background flex flex-1 overflow-y-auto p-0",c),children:l.jsx(OoA,{})})})})};function Dj(A){return JA({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"},child:[]},{tag:"path",attr:{d:"M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M9 12l.01 0"},child:[]},{tag:"path",attr:{d:"M13 12l2 0"},child:[]},{tag:"path",attr:{d:"M9 16l.01 0"},child:[]},{tag:"path",attr:{d:"M13 16l2 0"},child:[]}]})(A)}function Uo(A){return JA({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"},child:[]},{tag:"path",attr:{d:"M9 17h6"},child:[]},{tag:"path",attr:{d:"M9 13h6"},child:[]}]})(A)}const Bj=vA(`
|
|
450
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SaA(A,e){if(A){if(typeof A=="string")return NP(A,e);var t=Object.prototype.toString.call(A).slice(8,-1);if(t==="Object"&&A.constructor&&(t=A.constructor.name),t==="Map"||t==="Set")return Array.from(A);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return NP(A,e)}}function NP(A,e){(e==null||e>A.length)&&(e=A.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=A[t];return n}function VaA(A,e){var t=A==null?null:typeof Symbol<"u"&&A[Symbol.iterator]||A["@@iterator"];if(t!=null){var n=[],r=!0,s=!1,a,o;try{for(t=t.call(A);!(r=(a=t.next()).done)&&(n.push(a.value),!(e&&n.length===e));r=!0);}catch(i){s=!0,o=i}finally{try{!r&&t.return!=null&&t.return()}finally{if(s)throw o}}return n}}function XaA(A){if(Array.isArray(A))return A}function YaA(A){var e=A.date,t=A.future,n=A.locale,r=A.locales,s=A.timeStyle,a=A.round,o=A.minTimeLeft,i=A.formatVerboseDate,c=A.verboseDateFormat,u=c===void 0?QaA:c,f=A.updateInterval,d=A.tick,g=d===void 0?!0:d,v=A.now,m=A.timeOffset,p=m===void 0?0:m,h=A.polyfill,w=P.useMemo(function(){return n&&(r=[n]),r.concat(Le.getDefaultLocale())},[n,r]),b=P.useMemo(function(){return baA(w,{polyfill:h})},[w,h]);e=P.useMemo(function(){return waA(e)},[e]);var x=P.useCallback(function(){var Y=(v||Date.now())-p,T;if(t&&Y>=e.getTime()&&(Y=e.getTime(),T=!0),o!==void 0){var H=e.getTime()-o*1e3;Y>H&&(Y=H,T=!0)}var N=b.format(e,s,{getTimeToNextUpdate:!0,now:Y,future:t,round:a}),j=df(N,2),O=j[0],G=j[1];return T?G=IaA:G=f||G||60*1e3,[O,Y+G]},[e,t,s,f,a,o,b,v]),z=P.useRef();z.current=x;var D=P.useMemo(x,[]),B=df(D,2),M=B[0],I=B[1],X=P.useState(M),V=df(X,2),E=V[0],k=V[1],Z=P.useRef();P.useEffect(function(){if(g)return Z.current=HaA.add({getNextValue:function(){return z.current()},setValue:k,nextUpdateTime:I}),function(){return Z.current.stop()}},[g]),P.useEffect(function(){if(Z.current)Z.current.forceUpdate();else{var Y=x(),T=df(Y,1),H=T[0];k(H)}},[x]);var C=P.useMemo(function(){return paA(w,u)},[w,u]),Q=P.useMemo(function(){return i?i(e):C(e)},[e,i,C]);return{date:e,formattedDate:E,verboseDate:Q}}var GaA=365*24*60*60*1e3,IaA=1e3*GaA,QaA={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"},sh=VA.oneOfType,kP=VA.arrayOf,Xo=VA.string,ZP=VA.number,Vl=VA.shape,gf=VA.func,LaA=sh([Vl({minTime:ZP,formatAs:Xo.isRequired}),Vl({test:gf,formatAs:Xo.isRequired}),Vl({minTime:ZP,format:gf.isRequired}),Vl({test:gf,format:gf.isRequired})]),JaA=sh([Xo,Vl({steps:kP(LaA).isRequired,labels:sh([Xo,kP(Xo)]).isRequired,round:Xo})]),qaA=["date","future","timeStyle","round","minTimeLeft","locale","locales","formatVerboseDate","verboseDateFormat","updateInterval","tick","now","timeOffset","polyfill","tooltip","component","container","wrapperComponent","wrapperProps"];function Gd(){return Gd=Object.assign||function(A){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(A[n]=t[n])}return A},Gd.apply(this,arguments)}function RaA(A,e){if(A==null)return{};var t=WaA(A,e),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(A);for(r=0;r<s.length;r++)n=s[r],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(A,n)&&(t[n]=A[n])}return t}function WaA(A,e){if(A==null)return{};var t={},n=Object.keys(A),r,s;for(s=0;s<n.length;s++)r=n[s],!(e.indexOf(r)>=0)&&(t[r]=A[r]);return t}function Si(A){var e=A.date,t=A.future,n=A.timeStyle,r=A.round,s=A.minTimeLeft,a=A.locale,o=A.locales,i=o===void 0?[]:o,c=A.formatVerboseDate,u=A.verboseDateFormat,f=A.updateInterval,d=A.tick,g=A.now,v=A.timeOffset,m=A.polyfill,p=A.tooltip,h=p===void 0?!0:p,w=A.component,b=w===void 0?Xd:w,x=A.container,z=A.wrapperComponent,D=A.wrapperProps,B=RaA(A,qaA),M=YaA({date:e,future:t,timeStyle:n,round:r,minTimeLeft:s,locale:a,locales:i,formatVerboseDate:c,verboseDateFormat:u,updateInterval:f,tick:d,now:g,timeOffset:v,polyfill:m}),I=M.date,X=M.verboseDate,V=M.formattedDate,E=P.createElement(b,Gd({date:I,verboseDate:X,tooltip:h},B),V),k=z||x;return k?P.createElement(k,Gd({},D,{verboseDate:X}),E):E}Si.propTypes={date:VA.oneOfType([VA.instanceOf(Date),VA.number]).isRequired,locale:VA.string,locales:VA.arrayOf(VA.string),future:VA.bool,timeStyle:JaA,round:VA.string,minTimeLeft:VA.number,component:VA.elementType,tooltip:VA.bool,formatVerboseDate:VA.func,verboseDateFormat:VA.object,updateInterval:VA.oneOfType([VA.number,VA.arrayOf(VA.shape({threshold:VA.number,interval:VA.number.isRequired}))]),tick:VA.bool,now:VA.number,timeOffset:VA.number,polyfill:VA.bool,wrapperComponent:VA.elementType,wrapperProps:VA.object};Si=P.memo(Si);const Eu=({categories:A=[],maxDisplay:e=2,badgeVariant:t="outline"})=>{const n=A.slice(0,e),r=A.length-n.length;return l.jsxs("div",{className:"gap-2 flex flex-row items-center",children:[!n.length&&l.jsx(lt,{variant:t,className:"line-clamp-1 text-sm text-[#869DA5] p-1 px-3 truncate font-normal",children:"none"}),n.map((s,a)=>l.jsx("div",{className:S("p-1 rounded-full text-sm px-3 truncate font-normal max-w-20 xxl:max-w-24",{"bg-[#FDF2FA] text-[#C11574]":!((a+1)%2)},{"bg-[#EEF4FF] text-[#3538CD]":(a+1)%2}),children:s.name},s.uuid||a)),r>0&&l.jsxs("p",{className:"text-sm text-[#869DA5]",children:["+",r]})]})},al=({tags:A=[],maxDisplay:e=2,badgeVariant:t="outline"})=>{const n=A.slice(0,e),r=A.length-n.length;return l.jsxs("div",{className:"gap-1 flex flex-row items-center",children:[!n.length&&l.jsx(lt,{variant:t,className:"line-clamp-1 text-sm p-1 px-3 truncate font-normal text-[#869DA5]",children:"none"}),n.map((s,a)=>l.jsx(lt,{variant:t,className:"line-clamp-1 text-[#869DA5] text-sm p-1 px-3 truncate font-normal max-w-20 xxl:max-w-24",children:s.name},s.uuid||a)),r>0&&l.jsxs("p",{className:"text-sm text-[#869DA5]",children:["+",r]})]})},Hu=({statistics:A,className:e,isGrid:t})=>{const n=Go((A==null?void 0:A.totalPageViews)??0);return A!=null&&A.isLoading?l.jsxs("div",{className:S("w-full flex flex-row gap-1 text-[#596970] justify-center items-center",{"justify-start":!t},e),children:[l.jsx(Hh,{size:12,className:"animate-spin"}),l.jsx("p",{className:"font-[UniversalFeature] text-xs",children:"Loading..."})]}):!(A!=null&&A.totalPageViews)&&!(A!=null&&A.shares)?l.jsx("p",{className:S("text-xs p-1",e),children:"No statistics"}):l.jsxs("div",{className:S(`w-full flex flex-row gap-3 text-[#596970] ${t?"justify-center":"justify-start"} items-center`,e),children:[l.jsxs("div",{className:"flex flex-row items-center justify-center gap-1",children:[l.jsx(JsA,{className:"text-sm"}),l.jsx("p",{className:"font-[UniversalFeature] text-xs",children:n})]}),l.jsxs("div",{className:"flex flex-row items-center justify-center gap-1",children:[l.jsx(ZAA,{className:"text-sm"}),l.jsx("p",{className:"font-[UniversalFeature] text-xs",children:"0"})]})]})};function I0({data:A,className:e,onDeleteClick:t,postBaseURL:n="",blogBaseUrl:r="",isSelect:s,selected:a,onSelect:o,onEditClick:i,onRepostClick:c}){var v;let u={};const f=A.status===Ye.PUBLISHED,d=f?n:`${n}/preview`,g=!f&&A.published_at&&new Date(A.published_at+"Z").getTime()&&new Date(A.published_at+"Z")>new Date;try{u=JSON.parse(A==null?void 0:A.featured_image)}catch(m){console.log(m)}return l.jsxs(Qn,{className:S("max-w-[450px] flex flex-col cursor-pointer group justify-between overflow-hidden rounded-md focus:border-accent focus:border focus:bg-[#BEFEF72B] hover:border-accent hover:border hover:bg-[#BEFEF72B] ",e),"data-testid":"post-card:"+A.uuid,onDoubleClick:()=>i==null?void 0:i(A),children:[l.jsxs("div",{className:"flex flex-col grow",children:[l.jsxs(es,{className:"p-0 relative h-[178px]",children:[l.jsx(lt,{variant:"outline",className:S("text-xs absolute z-10 top-2 left-2 bg-muted text-muted-foreground",{hidden:f,"border-[#F0D08A] bg-[#FFF4E0] text-[#6B4400]":g}),children:g?"Scheduled":"Draft"}),l.jsx(pA,{variant:"ghost",size:"icon","data-active":a,"data-testid":"post-select",className:S("rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7 absolute top-2 right-2 z-10",{hidden:!s},{"bg-primary":a}),onClick:()=>o==null?void 0:o(A),children:l.jsx("div",{className:"flex items-center justify-center w-4 h-4 border-2 rounded-full border-foreground",children:a&&l.jsx("div",{className:"w-2 h-2 rounded-full bg-foreground"})})}),l.jsxs("div",{className:S("flex items-center gap-1 absolute top-2 right-2 z-10",{hidden:s}),children:[l.jsx(pA,{variant:"ghost",size:"icon",className:"rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7",onClick:()=>c==null?void 0:c(A),children:l.jsx(MB,{size:"small",className:"text-[#0D282FC9]"})}),l.jsx("a",{href:`${r}/${A.uuid}`,onClick:m=>m.preventDefault(),className:"leading-0",children:l.jsx(pA,{variant:"ghost",size:"icon",className:"rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7",onClick:()=>i==null?void 0:i(A),children:l.jsx(Rs,{size:"small",className:"text-accent-foreground"})})}),l.jsx(pA,{variant:"ghost",size:"icon",className:"rounded-md shadow-[0px_4.29px_12.86px_0px_#00000012] bg-background w-7 h-7",onClick:()=>t==null?void 0:t(A),children:l.jsx(zi,{size:"small",className:"text-destructive"})})]}),l.jsx(as,{url:u==null?void 0:u.src,transformations:{height:178}}),l.jsx("div",{className:"absolute bottom-0 left-0 px-2 rounded-tr-[0.75rem] bg-white opacity-90",children:l.jsx(Hu,{statistics:A.statistics,className:"h-7 p-2 text-[#101828]",isGrid:!0})})]}),l.jsxs(ts,{className:"p-2 flex flex-col gap-1.5 grow justify-between align-top flex-1",children:[l.jsx("a",{className:"text-base leading-tight cursor-pointer group-hover:underline hover:underline line-clamp-3",href:d+A.slug,target:"_blank",rel:"noopener noreferrer",children:Ur(A.title)}),l.jsx("p",{className:"flex-1 my-auto text-sm leading-tight line-clamp-3",children:Ur(A.excerpt)})]})]}),l.jsxs(Uc,{className:"flex flex-row justify-between p-2 items-baseline-last ",children:[l.jsxs("div",{className:"flex flex-row items-start justify-between gap-2 text-muted-foreground",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("p",{className:"text-[10px]",children:"Categories"}),l.jsx(Eu,{categories:A.categories,maxDisplay:1})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("p",{className:"text-[10px]",children:"Tags"}),l.jsx(al,{tags:A.tags,maxDisplay:1,badgeVariant:"outline"})]})]}),l.jsxs("div",{className:"flex items-center justify-between gap-2 text-muted-foreground",children:[l.jsx("div",{className:"flex items-center justify-center w-4.5 h-4.5 font-semi-bold rounded-full bg-secondary",children:l.jsx("p",{className:"text-[8px] text-black",children:Yi(((v=A.author)==null?void 0:v.name)||"")})}),l.jsx(Si,{date:new Date(A.updated_at||""),locale:"en-US",className:"text-xs"})]})]})]})}const FaA=({onEdit:A,onDelete:e,editDisabled:t=!1,deleteDisabled:n=!1})=>l.jsxs("div",{className:"flex items-center",children:[l.jsx(pA,{variant:"ghost",size:"icon",onClick:A,disabled:t,children:l.jsx(hS,{color:"gray",size:"small"})}),l.jsx(pA,{variant:"ghost",size:"icon",onClick:e,disabled:n,children:l.jsx(yn,{color:"red",size:"small"})})]}),KaA={theme:"system",setTheme:()=>null},yj=P.createContext(KaA);function UaA({children:A,defaultTheme:e="system",storageKey:t="vite-ui-theme",...n}){const[r,s]=P.useState(()=>typeof window<"u"&&window.localStorage.getItem(t)||e);P.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark","brand"),r==="system"){const i=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(i);return}o.classList.add(r)},[r]);const a={theme:r,setTheme:o=>{window.localStorage.setItem(t,o),s(o)}};return l.jsx(yj.Provider,{...n,value:a,children:A})}const _aA=()=>{const A=P.useContext(yj);if(A===void 0)throw new Error("useTheme must be used within a ThemeProvider");return A},$aA=new ev;function AoA({children:A}){return l.jsx(tv,{client:$aA,children:A})}const eoA=new ev,toA=A=>l.jsx(tv,{client:eoA,children:l.jsx(A,{})}),Pj=A=>A==null?void 0:A.toLowerCase().includes("configuration");function noA(A,e){const t=Yt();return nv({staleTime:12e4,gcTime:12e4,queryKey:[(A==null?void 0:A.cacheKey)||(A==null?void 0:A.dataKey),e],queryFn:async()=>{var n;if(A!=null&&A.query&&(A!=null&&A.variables)&&e){const r=A==null?void 0:A.query,s=A==null?void 0:A.variables,o=(await t.query({query:r,variables:{...s||{},uuid:e},fetchPolicy:"network-only"})).data[A.dataKey];if((n=o==null?void 0:o.config)!=null&&n.related_recipes_config)try{const i=JSON.parse(o.config.related_recipes_config);if(Array.isArray(i)&&i.length>0){const f=(i[0]==="AUTO"?i.slice(1):i).map(v=>t.query({query:r,variables:{uuid:v},fetchPolicy:"network-only"})),g=(await Promise.all(f)).map(v=>{var h;return(h=v.data)==null?void 0:h[A.dataKey]}).filter(v=>v!=null).map(v=>({uuid:v.uuid,value:v.uuid,title:v.title,label:v.title}));return{...o,_relatedRecipesData:g}}}catch(i){console.error("Error fetching related recipes:",i)}return o}else throw new Error("No query or variables provided")},enabled:!!(A!=null&&A.query)&&!!e,refetchOnMount:!1,refetchOnWindowFocus:!1})}function roA({config:A,postBaseUrl:e,baseUrl:t,postType:n,createMessage:r,showDescription:s=!0,onSuccess:a}){const o=ga(),i=Yt(),c=A==null?void 0:A.query,{showSuccess:u,showError:f}=Gt();return fs({mutationFn:async d=>{if(c)return await i.mutate({mutation:c,variables:{...A.variables||{},...d}})},onSuccess:(d,g)=>{var b;const v=(b=d==null?void 0:d.data)==null?void 0:b[(A==null?void 0:A.dataKey)||"createPost"],m=(g==null?void 0:g.status)||(g==null?void 0:g.titleStatus)||!1,p=(g==null?void 0:g.showActionModals)??!0,h="You have published your article successfully.",w="You have saved your article as draft successfully. You can publish your article when ready!";if(o.invalidateQueries({queryKey:[A==null?void 0:A.mutationInvalidateKey],refetchType:"all"}),p){const x=Pj(n||""),z=m?x?e:t:void 0;u(r||`${n||"Article"} ${m?"Published":"Saved as draft"}`,s?m?h:w:void 0,{type:m?"action":"info",confirmText:`View ${n||"Article"}`,onAction:m&&z?()=>{window.location.href=z}:void 0,cancelText:"Done",onCancel:()=>{!m&&t||(t?window.location.href=t:window.history.back())}})}if(!m){const x=window.location.pathname,z=x.endsWith("/new")?x.replace("/new",`/${v==null?void 0:v.uuid}`):`${x}/${v==null?void 0:v.uuid}`;window.history.replaceState(null,"",z)}a==null||a(g,v==null?void 0:v.uuid)},onError:(d,g)=>{console.error(d),((g==null?void 0:g.showActionModals)??!0)&&f(`Failed to Create ${n||"Article"}`,d.message||"An unexpected error occurred while creating the post.",{confirmText:"Try Again",onAction:()=>{console.log("Retry create post")}})}})}function soA({config:A,fetchConfig:e,postBaseUrl:t,baseUrl:n,updateMessage:r,postType:s="Article",showDescription:a=!0,onSuccess:o,user_config:i}){const c=ga(),u=Yt(),f=A==null?void 0:A.query,{showSuccess:d,showError:g}=Gt(),v=bj(t||"",i);return fs({mutationFn:async m=>{if(f)return await u.mutate({mutation:f,variables:{...A.variables||{},...m}})},onSuccess:(m,p)=>{var D;const h=(p==null?void 0:p.showActionModals)??!0,w=(D=m==null?void 0:m.data)==null?void 0:D[(A==null?void 0:A.dataKey)||"updatePost"],b=(p==null?void 0:p.status)||(p==null?void 0:p.titleStatus)||!1,x="You have published your article successfully.",z="You have saved your article as draft successfully. You can publish your article when ready!";if(c.invalidateQueries({queryKey:[A==null?void 0:A.mutationInvalidateKey],refetchType:"all"}),c.invalidateQueries({queryKey:[(e==null?void 0:e.cacheKey)||(e==null?void 0:e.dataKey)],refetchType:"all"}),h){const B=Pj(s||"");let M=t;B&&(t!=null&&t.includes("/articles"))&&(M=t.replace("/articles",""));const I=b?B?M:n:void 0;d(r||`${s||"Article"} ${b?"Published":"Updated"} Successfully!`,a?b?x:z:void 0,{type:b?"action":"info",confirmText:b?`View ${s||"Article"}`:void 0,onAction:b&&I?()=>{window.location.href=I}:void 0,cancelText:"Done"})}if(o==null||o(p),v&&!(p!=null&&p.skipRevalidate)){const B=(w==null?void 0:w.slug)??"",M=B.startsWith("/")?`/preview${B}`:`/preview/${B}`;v(b?B:M,!!(p!=null&&p.is_autosave),p.updated_fields)}},onError:(m,p)=>{console.error(m),((p==null?void 0:p.showActionModals)??!0)&&g(`Failed to Update ${s||"Article"}`,m.message||"An unexpected error occurred while updating the post.",{confirmText:"Retry",onAction:()=>{console.log("Retry update post")}})}})}const bj=(A,e)=>{A.endsWith("/")&&(A=A.slice(0,-1));const{showError:t,showSuccess:n}=Gt(),r=async(s,a,o,i=!1)=>{s.startsWith("/")||(s=`/${s}`);const c=new URL(A),u=c.hostname,f=c.pathname,g=`${f==="/"?"":f}${s}`;return await Ge.post(`https://${u}/api/revalidate`,{slug:g.trim(),username:`${e==null?void 0:e.name}${a?"-autosave":""}`,email:e==null?void 0:e.email,date:new Date().toLocaleString(),updated_fields:`${o}`.split(",").filter(v=>v),token:A.includes("vt")?de.NEXT_PUBLIC_REVALIDATION_VT_TOKEN:de.NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN}).then(v=>(i&&n("Cache cleared sucessfully","",{type:"action",confirmText:"View Page",cancelText:"Done",onAction:()=>{var m;(m=window==null?void 0:window.open)==null||m.call(window,`${A}${g}`,"_blank")}}),v)).catch(v=>{throw t("Failed to revalidate cache",v.message,{}),v})};if(A)return r},aoA=({storageKey:A,form:e,enabled:t=!0,interval:n=6e4,onSave:r,onError:s})=>{const[a,o]=P.useState(null),[i,c]=P.useState(null),u=P.useRef(null),f=P.useRef(null),d=P.useRef(""),g=P.useCallback(()=>`autosave_enabled_${A}`,[A]),v=P.useCallback(()=>{if(typeof window>"u"||typeof localStorage>"u")return t;try{const B=localStorage.getItem(g());if(B!==null)return JSON.parse(B)}catch(B){console.error("Failed to load autosave enabled state from localStorage:",B)}return t},[g,t]),m=P.useCallback(B=>{if(!(typeof window>"u"||typeof localStorage>"u"))try{localStorage.setItem(g(),JSON.stringify(B))}catch(M){console.error("Failed to save autosave enabled state to localStorage:",M)}},[g]),[p,h]=P.useState(()=>v()),w=P.useCallback(B=>{h(B),m(B)},[m]),b=P.useCallback(async()=>{if(p)try{const B=e.getValues(),M=JSON.stringify(B),I=new Date;await(r==null?void 0:r(B)),d.current=M,c(I),o({status:"saved"})}catch(B){const M=B instanceof Error?B:new Error("Failed to save form data");console.error("Failed to save form data to sessionStorage:",M),o({status:"error",error:M}),s==null||s(M)}},[p,e,r,s]),x=P.useCallback(async()=>{await b()},[b]),z=P.useCallback(()=>{!p||!e.formState.isDirty||(a==null?void 0:a.status)=="error"||(o({status:"saving"}),f.current=setTimeout(()=>{b()},5e3))},[p,e.formState.isDirty,b,a]),D=()=>{const B=e.getValues("updated_at");B&&c(new Date(B))};return P.useEffect(()=>{if(!p||e.getValues("updated_at"))return;D();const B=e.watch((M,{values:I,type:X})=>{const V=JSON.stringify(I);if(X=="change"&&V!==d.current)try{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{z()},n),o({status:"pending"})}catch(E){console.error("Error in form watch subscription:",E)}});return()=>{console.log("Cleaning up autosave..."),u.current&&clearTimeout(u.current),f.current&&clearTimeout(f.current),B.unsubscribe()}},[p,n,e]),{state:a,saveNow:x,lastSaveDate:i,autoSaveEnabled:p,updateLastSave:D,toggleEnableAutoSave:w}},ooA={isDraft:!0,isCreate:!0,activeGroupId:"",formValues:{},sectionStates:{}},ioA=(A,e)=>{switch(e.type){case"SET_ACTIVE_GROUP":return{...A,activeGroupId:e.payload};case"SET_FORM_VALUES":return{...A,formValues:{...A.formValues,...e.payload}};case"TOGGLE_DRAFT":return{...A,isDraft:e.payload};case"PUBLISH_POST":return{...A,isDraft:!1,isCreate:!1};case"SAVE_DRAFT":return{...A,isDraft:!0,isCreate:!1};case"SET_UUID":return{...A,uuid:e.payload};default:return A}},xj=P.createContext(void 0),mo=()=>{const A=P.useContext(xj);if(A===void 0)throw new Error("useBlogPost must be used within a BlogPostProvider");return A},pt=[];for(let A=0;A<256;++A)pt.push((A+256).toString(16).slice(1));function loA(A,e=0){return(pt[A[e+0]]+pt[A[e+1]]+pt[A[e+2]]+pt[A[e+3]]+"-"+pt[A[e+4]]+pt[A[e+5]]+"-"+pt[A[e+6]]+pt[A[e+7]]+"-"+pt[A[e+8]]+pt[A[e+9]]+"-"+pt[A[e+10]]+pt[A[e+11]]+pt[A[e+12]]+pt[A[e+13]]+pt[A[e+14]]+pt[A[e+15]]).toLowerCase()}let Um;const coA=new Uint8Array(16);function uoA(){if(!Um){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Um=crypto.getRandomValues.bind(crypto)}return Um(coA)}const foA=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),SP={randomUUID:foA};function doA(A,e,t){var r;if(SP.randomUUID&&!A)return SP.randomUUID();A=A||{};const n=A.random??((r=A.rng)==null?void 0:r.call(A))??uoA();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,loA(n)}const goA=({hasUnsavedChanges:A,onSave:e,onDiscard:t})=>{const[n,r]=P.useState(!1),[s,a]=P.useState("/new-page");P.useEffect(()=>{const u=d=>{if(A)return d.preventDefault(),!0},f=d=>{if(A)throw a(d),r(!0),"Route change aborted by user."};if(A&&(window.addEventListener("beforeunload",u),typeof window<"u")){try{const d=window.__NEXT_ROUTER__;d!=null&&d.events&&d.events.on("routeChangeStart",f)}catch{console.debug("Next.js router not available in standalone environment")}return()=>{window.removeEventListener("beforeunload",u);try{const d=window.__NEXT_ROUTER__;d!=null&&d.events&&d.events.off("routeChangeStart",f)}catch{console.debug("Next.js router cleanup not needed in standalone environment")}}}return()=>{window.removeEventListener("beforeunload",u)}},[A]);const o=async()=>{try{await(e==null?void 0:e()),r(!1),typeof window<"u"&&(window.location.href=s)}catch(u){console.error("Save failed:",u)}},i=()=>{t==null||t(),r(!1),typeof window<"u"&&(window.location.href=s)},c=()=>{r(!1)};return l.jsx(l.Fragment,{children:l.jsx(xt,{open:n,onOpenChange:c,children:l.jsxs(vt,{className:"max-w-[500px] p-0 overflow-hidden gap-6",children:[l.jsx($t,{className:"bg-secondary p-5 py-4 items-start",children:l.jsx(An,{children:l.jsx("h1",{className:"text-md",children:"Unsaved Changes"})})}),l.jsx(gg,{className:"px-5",children:"You have unsaved changes that will be lost"}),l.jsx("div",{className:"px-5",children:l.jsx("div",{className:"bg-muted rounded p-3 border border-bg-muted-foreground mb-4",children:l.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[l.jsx("span",{children:"Navigating to:"}),l.jsx("div",{className:"flex items-center space-x-1 bg-background p-2 rounded border-bg-muted-foreground border",children:l.jsx("span",{className:" ",children:s})})]})})}),l.jsxs(fn,{className:"flex flex-row p-4 pt-0 gap-4 justify-end",children:[l.jsx(ve,{variant:"outline",className:"rounded capitalize",onClick:o,children:"save and continue"}),l.jsx(ve,{variant:"primary",className:"rounded capitalize",onClick:i,children:"Discard and continue"})]})]})})})};function _m(A){return typeof A=="object"&&A!==null&&!Array.isArray(A)&&("url"in A||"src"in A)}const voA=({children:A,type:e,initialState:t={},validators:n,requiredDraftFields:r,postQueryConfig:s,formFieldsMapper:a,submitFieldsMapper:o,onBack:i,groups:c,mainForm:u,showTitle:f,baseUrl:d,postBaseUrl:g,isPopup:v,actionButtonTitle:m,showDraft:p,showSchedule:h=!1,formTitle:w,createMessage:b,updateMessage:x,showDescriptionOnSubmit:z,autoSave:D=!1,onChange:B,user_config:M})=>{var ee;const I=t.uuid||((ee=t.formValues)==null?void 0:ee.uuid),X=t.isCreate||!I||I==="new",[V,E]=P.useReducer(ioA,{...ooA,...t,isCreate:X});let k=V.formValues;if(k!=null&&k.featured_image){if(typeof k.featured_image=="string")try{const hA=JSON.parse(k.featured_image);hA&&(hA.url||hA.src)&&(k={...k,featured_image:hA})}catch(hA){console.warn("Failed to parse initial featured_image JSON:",hA)}else if(_m(k.featured_image)){const hA=k.featured_image;hA.src&&!hA.url&&(k={...k,featured_image:{...hA,url:hA.src}})}}const Z=Dg({...n&&{resolver:pv(n)},defaultValues:k,reValidateMode:"onChange",mode:"onChange"}),C=aoA({storageKey:`${e}_${V.uuid||"new"}`,form:Z,enabled:D&&V.isDraft&&!V.isCreate,interval:3e4,onSave:async()=>{Z.setValue("status",!V.isDraft),Z.setValue("is_autosave",!0),await G(V.isCreate,!1),V.isCreate||await j({titleOnly:!1,showActionModals:!1}),Z.setValue("is_autosave",!1)}}),Q=noA(V.uuid&&V.uuid!=="new"?s==null?void 0:s.fetch:void 0,V.uuid),Y=(hA,pe)=>{E({type:Z.getValues("status")?"PUBLISH_POST":"SAVE_DRAFT"}),pe&&E({type:"SET_UUID",payload:pe})},T=roA({config:s==null?void 0:s.create,postBaseUrl:g,baseUrl:d,postType:e,createMessage:b,showDescription:z,onSuccess:Y});let H=soA({config:s==null?void 0:s.update,fetchConfig:s==null?void 0:s.fetch,postBaseUrl:g,baseUrl:d,postType:e,updateMessage:x,showDescription:z,onSuccess:Y,user_config:M});s!=null&&s.update||(H=T);const{showError:N}=Gt();async function j({titleOnly:hA,showActionModals:pe=!0,overrides:GA,skipRevalidate:L}){try{const $=V.isCreate;let tA=Z.getValues("uuid");tA||(tA=$?doA():V.uuid||I||"",Z.setValue("uuid",tA),E({type:"SET_UUID",payload:tA}));const cA=Z.getValues("featured_image");_m(cA)&&cA.src&&!cA.url&&Z.setValue("featured_image",{...cA,url:cA.src});const lA={...Z.getValues(),...GA||{}},iA=Object.keys(Z.formState.dirtyFields);GA&&Object.keys(GA).forEach(HA=>{iA.includes(HA)||iA.push(HA)});const uA=o?o(lA):lA;if(uA.showActionModals=pe,uA.is_autosave=lA==null?void 0:lA.is_autosave,L&&(uA.skipRevalidate=!0),uA.updated_fields=iA.join(","),hA){const HA={uuid:uA.uuid,blog_uuid:uA.blog_uuid,author_uuid:uA.author_uuid,slug:uA.slug,title:uA.title,titleStatus:!!uA.status,is_autosave:uA.is_autosave,updated_fields:uA.updated_fields};$?await T.mutateAsync(HA):await H.mutateAsync(HA)}else $?await T.mutateAsync(uA):await H.mutateAsync(uA);Z.reset(lA)}catch($){console.error($);const tA=$ instanceof Error?$.message:String($);throw N("Error while saving article",tA),$}}const O=P.useMemo(()=>{const hA=c!=null&&c.length?c==null?void 0:c.flatMap(GA=>GA.sections.flatMap(L=>L.formItems)):[],pe=u!=null&&u.sections?u==null?void 0:u.sections.flatMap(GA=>GA.formItems):[];return[...hA,...pe]},[c,u]),G=async(hA=!1,pe=!0,GA=!1)=>{const L=Z.getValues("status");Z.clearErrors();const $=GA||L,tA=await Z.trigger($?void 0:r),iA=`Validation error on field(s): ${Object.keys(Z.formState.errors).map(uA=>uA).map(uA=>{const HA=O.find(qA=>qA.name==uA);return HA?HA.label:uA}).join(", ")}. Please fix all issues before submitting.`;if(!tA){pe&&N(`Failed to ${hA?"Create":"Update"} ${e||"Article"}`,iA);const uA=new Error(iA);throw uA.cause="Form validation failed",uA.message=iA,uA}return tA},J=async(hA=!0)=>{Z.setValue("status",!1),await G(V.isCreate),await j({titleOnly:!1,showActionModals:hA})},K=async()=>{Z.setValue("status",!0),Z.setValue("published_at",new Date),await G(V.isCreate),await j({titleOnly:!1})},nA=async hA=>{try{await G(V.isCreate,!0,!0),await j({titleOnly:!1,overrides:{status:!1,published_at:hA},skipRevalidate:!0})}catch{}},R=async()=>{try{await G(V.isCreate),await j({titleOnly:!1,overrides:{status:!1,published_at:null}})}catch{}},eA=async()=>{Z.setValue("status",!!Z.getValues("status")),await G(V.isCreate),await j({titleOnly:!0})},AA=()=>{i==null||i()},_=()=>{if(!Q.data)return;let hA=a?a(Q.data):Q.data||Object.create(null);if(hA.featured_image){if(typeof hA.featured_image=="string")try{const L=JSON.parse(hA.featured_image);L&&(L.url||L.src)&&(hA={...hA,featured_image:L})}catch(L){console.warn("Failed to parse featured_image JSON:",L)}else if(_m(hA.featured_image)){const L=hA.featured_image;L.src&&!L.url&&(hA={...hA,featured_image:{...L,url:L.src}})}}Z.reset(hA),C.updateLastSave(),V.isCreate||E({type:hA!=null&&hA.status?"PUBLISH_POST":"SAVE_DRAFT"});const pe=Object.entries(hA).reduce((L,[$,tA])=>({...L,[$]:tA}),{});E({type:"SET_FORM_VALUES",payload:pe});const GA=Z.getValues("status");C.toggleEnableAutoSave(!GA)},W=()=>{_()};P.useEffect(()=>{var pe,GA;const hA=()=>{const L=window.location.hash.replace("#","");L&&c&&c.some($=>$.id===L)&&E({type:"SET_ACTIVE_GROUP",payload:L})};return!V.activeGroupId&&c&&c.length>0?(E({type:"SET_ACTIVE_GROUP",payload:(pe=c==null?void 0:c[0])==null?void 0:pe.id}),window.location.hash=(GA=c==null?void 0:c[0])==null?void 0:GA.id):hA(),window.addEventListener("hashchange",hA),()=>{window.removeEventListener("hashchange",hA)}},[V.activeGroupId,c,E]),P.useEffect(()=>{const hA=Z.watch((pe,{name:GA,values:L})=>{B==null||B(Z,GA,L)});return()=>hA.unsubscribe()},[Z,E,B]),P.useEffect(()=>{_()},[Q.isFetched]);const[U,PA]=P.useState(()=>Z.getValues("published_at"));P.useEffect(()=>{PA(Z.getValues("published_at"));const hA=Z.watch((pe,GA)=>{(!GA.name||GA.name==="published_at")&&PA(pe.published_at)});return()=>hA.unsubscribe()},[Z]);const TA=P.useMemo(()=>{if(!U)return null;const hA=U instanceof Date?U:new Date(U);return Number.isNaN(hA.getTime())?null:hA},[U]),YA=!!(V.isDraft&&TA&&TA.getTime()>Date.now());return l.jsxs(xj.Provider,{value:{state:V,initialState:t,type:e,dispatch:E,handleSaveDraft:J,handleSaveTitle:eA,handlePublish:K,handleSchedule:nA,handleCancelSchedule:R,isScheduled:YA,scheduledAt:TA,showSchedule:h,handleBack:AA,form:Z,postQuery:Q,groups:c,mainForm:u,createMutation:T,updateMutation:H,showTitle:f,baseUrl:d,postBaseUrl:g,isPopup:v,formTitle:w,showDraft:p,actionButtonTitle:m,autosave:C,showAutoSave:D&&!V.isCreate&&V.isDraft},children:[A,l.jsx(goA,{hasUnsavedChanges:Z.formState.isDirty,onSave:Z.getValues("status")?K:J,onDiscard:W})]})};function bv(A){return JA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M170.718 216.482L141.6 245.6l93.6 93.6 208-208-29.118-29.118L235.2 279.918l-64.482-63.436zM422.4 256c0 91.518-74.883 166.4-166.4 166.4S89.6 347.518 89.6 256 164.482 89.6 256 89.6c15.6 0 31.2 2.082 45.764 6.241L334 63.6C310.082 53.2 284.082 48 256 48 141.6 48 48 141.6 48 256s93.6 208 208 208 208-93.6 208-208h-41.6z"},child:[]}]})(A)}const Q0=(A,e,t,n)=>{var c,u,f,d,g,v;const r=m=>{e.onChange?e.onChange(m,A):t.onChange(m)},s=t.value,a={...e,error:n.error,onChange:r,value:s,validationError:(c=n.error)==null?void 0:c.message},o=e.linkedField&&A.getValues(e.linkedField),i=()=>{o&&(s||A.setValue(e.name,o))};switch(e.type){case"switch":return l.jsx($e,{...a,className:S("w-full",e.className)});case"wysiwyg":return l.jsx($e,{...a,defaultValue:e.linkedField&&A.getValues(e.linkedField),className:S("w-full h-full",e.className),wysiwygProps:{...e.wysiwygProps,className:S("w-full p-0 bg-background border-none",(u=e.wysiwygProps)==null?void 0:u.className)}});case"custom":return(f=e.contentRender)==null?void 0:f.call(e,s);case"select":case"optionslist":case"image":case"blogposts":return l.jsx($e,{...a,className:S("w-full",e.className,{"[&_.waz-input-box-content]:opacity-30":!s&&o}),value:s||o});case"link":return l.jsx($e,{...a,className:S("w-full",e.className),linkProps:{...a.linkProps,placeholder:e.linkedField&&A.getValues(e.linkedField)||((d=a.linkProps)==null?void 0:d.placeholder),onFocus:o&&i,disabled:t.disabled}});case"textarea":return l.jsx($e,{...a,className:S("w-full",e.className),textareaProps:{...a.textareaProps,placeholder:o||((g=a.textareaProps)==null?void 0:g.placeholder),onFocus:o&&i,disabled:t.disabled}});default:return l.jsx($e,{...a,className:S("w-full",e.className),inputProps:{...a.inputProps,onKeyDown:m=>{var p;(p=e.onKeyDown)==null||p.call(e,m,A)},onFocus:o&&i,placeholder:o||((v=a.inputProps)==null?void 0:v.placeholder),disabled:t.disabled}})}},moA=({section:A,item:e,itemIndex:t,form:n,onRemove:r,canRemove:s})=>{const[a,o]=P.useState(!0),i=()=>{o(!a)},{attributes:c,listeners:u,setNodeRef:f,transform:d,transition:g,isDragging:v}=Ou({id:e.id}),m={transform:is.Transform.toString(d),transition:g};return l.jsxs("div",{ref:f,style:m,className:S("group relative border p-4 transition-all duration-200 rounded",{"bg-accent/50 border-2 border-accent shadow-lg":v}),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[A.maxItems!==1&&l.jsx("div",{...c,...u,className:"cursor-grab active:cursor-grabbing p-1 rounded hover:bg-muted",children:l.jsx(Th,{className:"h-4 w-4 text-muted-foreground"})}),A.maxItems!==1?l.jsxs("p",{className:"",children:[l.jsxs("span",{className:"text-muted-foreground capitalize mr-1",children:[t+1,"."]}),l.jsxs("span",{className:"text-primary-foreground",children:[A.dynamicType," Group "]})]}):l.jsxs("span",{className:"text-primary-foreground",children:[A.dynamicType," "]})]}),l.jsxs("div",{className:"flex items-center",children:[s&&l.jsx(pA,{variant:"ghost",size:"sm",onClick:r,className:S("h-8 w-8 p-0 text-red-500 hover:text-red-700 hover:bg-red-50 transition-opacity","opacity-0 group-hover:opacity-100"),children:l.jsx(yn,{className:"w-4 h-4"})}),A.collapsible&&l.jsx(pA,{variant:"ghost",size:"sm",onClick:i,className:S("h-8 w-8 p-0"),children:a?l.jsx(ig,{}):l.jsx(kz,{})})]})]}),l.jsx("div",{className:S("flex items-center flex-col gap-2",{hidden:!a},A.formItemsContainerClassName),children:A.formItems.map(p=>{const h=`${A.id}_${e.id}_${p.name}`;return l.jsx(io,{control:n.control,name:h,render:({field:w,fieldState:b})=>{var x;return l.jsxs(mr,{className:S("flex flex-col w-full",p.containerClassname),children:[p.description&&l.jsx("p",{className:"text-muted-foreground w-full h-fit",children:p.description}),l.jsx(lo,{className:"flex flex-1",children:Q0(n,p,w,b)}),b.error&&l.jsxs("div",{className:"flex items-center gap-2 mt-1 opacity-50",children:[l.jsx(YZ,{strokeWidth:2,className:"text-destructive"}),l.jsx("span",{className:"font-bold text-muted-foreground capitalize",children:(x=b.error)==null?void 0:x.message})]})]})}},h)})})]})};function zj(A){const e=/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)_(.+)$/,t=A.match(e);return t?{group_id:t[1],index:parseInt(t[2]||"0",10),fieldname:t[3]}:{group_id:"",index:0,fieldname:""}}function $m(A=""){var n,r;if(!A||A.trim()==="")return{quantity:"",unit:""};if(A.includes("//")){const s=A.indexOf("//"),a=A.substring(0,s).trim(),o=A.substring(s).replace(/\/+/g,"").trim();return{quantity:a||"",unit:o}}const e=/^(\d+(?:\s+\d+\/\d+|\.\d+|\/\d+)?)\s*(.*)$/,t=A.match(e);if(console.log("numericMatch",t,A),t){const s=((n=t[2])==null?void 0:n.trim())||"";return{quantity:((r=t[1])==null?void 0:r.trim())||"",unit:s||""}}return{quantity:A.trim(),unit:""}}const poA=({section:A})=>{const{form:e}=mo(),[t,n]=P.useState([{id:"0",values:A.template||{}}]);P.useEffect(()=>{const u=e.getValues(),f=A.formItems.map(g=>g.name),d=[];Object.entries(u).forEach(([g,v])=>{f.map(m=>{var p;if(g.includes(m)){const{index:h}=zj(g);d[h]?d[h]={id:h.toString(),values:{...(p=d[h])==null?void 0:p.values,[m]:v}}:d.push({id:h.toString(),values:{[m]:v}})}})}),d.length&&n(d)},[]);const r=u=>{const f=A.maxItems||1/0;if(t.length<f){const d={id:`${Date.now()}`,values:A.template||{}};if(u!==void 0&&u>=0&&u<=t.length){const g=[...t];g.splice(u+1,0,d);const v=g.map((m,p)=>({...m,id:p.toString()}));n(v)}else n([...t,d])}},s=u=>{const f=A.minItems||1;if(t.length>f){const g=t.filter(v=>v.id!==u).map((v,m)=>({...v,id:m.toString()}));n(g)}},a=Du(Br(vo),Br(go,{coordinateGetter:Tu}));function o(u){const{active:f,over:d}=u;if(f.id!==(d==null?void 0:d.id)&&(d!=null&&d.id)){const g=t.findIndex(z=>z.id===f.id),v=t.findIndex(z=>z.id===(d==null?void 0:d.id));if(g===-1||v===-1)return;const m=[...t],[p]=m.splice(g,1);if(!p)return;m.splice(v,0,p);const h=e.getValues(),w={...h},b=A.formItems.map(z=>z.name);Object.keys(h).forEach(z=>{b.forEach(D=>{z.includes(`${A.id}_`)&&z.includes(`_${D}`)&&delete w[z]})}),m.forEach((z,D)=>{b.forEach(B=>{const M=`${A.id}_${z.id}_${B}`,I=`${A.id}_${D}_${B}`,X=h[M];X!==void 0&&(w[I]=X)})});const x=m.map((z,D)=>({...z,id:D.toString()}));e.reset(w),n(x)}}const i=!A.maxItems||t.length<A.maxItems,c=t.length>(A.minItems||1);return l.jsxs(l.Fragment,{children:[A.description&&l.jsx("p",{className:"text-muted-foreground text-sm w-full",children:A.description}),l.jsx(Mu,{sensors:a,collisionDetection:Bu,onDragEnd:o,children:l.jsx("div",{className:"relative space-y-2",children:l.jsx(ju,{items:t.map(u=>u.id),strategy:Cu,children:t.map((u,f)=>l.jsxs("div",{children:[l.jsx(moA,{section:A,item:u,itemIndex:f,form:e,onRemove:()=>s(u.id),canRemove:c}),i&&l.jsx("div",{className:S("group w-full min-h-1 hover:bg-muted hover:p-4",{" bg-muted p-4":f===t.length-1}),children:l.jsxs("div",{className:S("hidden group-hover:flex items-center justify-center gap-2 transition-all duration-200 text-xs",{flex:f===t.length-1}),children:[l.jsx(pA,{variant:"ghost",onClick:()=>r(f),size:"icon",className:"border border-primary bg-background rounded-full hover:bg-primary",children:l.jsx(As,{})}),"Add New Group"]})})]},u.id))})})})]})},hoA=({section:A})=>{const{form:e}=mo();return l.jsxs(l.Fragment,{children:[A.description&&l.jsx("p",{className:S("text-muted-foreground w-full h-fit",A.descriptionClassName),children:A.description}),A.formItems.map((t,n)=>l.jsx(io,{control:e.control,name:t.name,render:({field:r,fieldState:s})=>l.jsxs(mr,{className:S("flex flex-col w-full",t.containerClassname),children:[t.description&&l.jsx("p",{className:"w-full h-fit leading-5",children:t.description}),l.jsx(lo,{className:"flex flex-1",children:Q0(e,t,r,s)})]})},`${t.name}-${n}`))]})},woA=({index:A,step:e,section:t,formField:n,disabled:r,onDelete:s})=>{var m;const{attributes:a,listeners:o,setNodeRef:i,transform:c,isDragging:u,isOver:f}=Ou({id:e.id}),d={transform:is.Transform.toString(c)},{form:g}=mo(),v=(m=g.getValues(`${t.id}_${e.id}_${n==null?void 0:n.name}`))==null?void 0:m.toString();return l.jsx("div",{ref:i,style:d,...a,className:"sortable-item",children:l.jsxs("div",{className:S("group border-l-[2px] pt-4 pl-5 border-border bg-background relative z-10",{"border-primary-foreground":v==null?void 0:v.length,"bg-accent/50 border border-b-4 border-accent z-100":u,"z-1":f,"pt-0 ":!A}),children:[l.jsx("div",{...o,className:S("p-[7px] bg-background rounded-full absolute top-5 left-[-13px] z-10 cursor-grab active:cursor-grabbing",{"top-2":!A}),children:l.jsx("div",{className:S("p-[5px] rounded-full bg-primary-foreground",{"bg-background ":f})})}),l.jsx(io,{control:g.control,name:`${t.id}_${e.id}_${n==null?void 0:n.name}`,disabled:r,render:({field:p,fieldState:h})=>l.jsx(mr,{className:S("flex flex-col w-full",n==null?void 0:n.containerClassname),children:l.jsx(lo,{className:"flex flex-1",children:Q0(g,{...n,label:(n.label||"Step")+` ${A+1}`},p,h)})})}),l.jsx(pA,{variant:"ghost",size:"sm",onClick:s,className:S("hidden group-hover:flex absolute top-4 right-2 h-8 w-8 p-0 text-red-500 hover:text-red-700 hover:bg-transparent transition-opacity",{"top-0":!A}),children:l.jsx(yn,{className:"w-4 h-4"})})]},e.id)})},yoA=({section:A})=>{const e=A.formItems[0],{form:t}=mo(),[n,r]=P.useState([]),s=()=>{const u={id:n.length.toString(),order:n.length,value:""};r([...n,u])},a=u=>{if(console.log(n,u),n.findIndex(m=>m.id===u)<=0)return;const g=n.filter(m=>m.id!==u).map((m,p)=>({...m,id:p.toString(),order:p}));r(g);const v=t.getValues();Object.keys(v).filter(m=>m.startsWith(`${A.id}_`)&&m.endsWith(`_${e==null?void 0:e.name}`)).forEach(m=>{t.unregister(m)}),g.forEach(m=>{t.setValue(`${A.id}_${m.id}_${e==null?void 0:e.name}`,m.value)})},o=Du(Br(vo),Br(go,{coordinateGetter:Tu}));function i(u){const{active:f,over:d}=u,g=[...n],v=n.findIndex(h=>h.id==(d==null?void 0:d.id)),m=n.findIndex(h=>h.id==(f==null?void 0:f.id)),p=n[m];p&&(g.splice(m,1),g.splice(v,0,p)),g.forEach((h,w)=>[t.setValue(`${A.id}_${w}_${e==null?void 0:e.name}`,h.value)])}const c=()=>{const u=t.getValues(),f=Object.keys(u).filter(d=>d.startsWith(`${A.id}_`)&&d.endsWith(`_${e==null?void 0:e.name}`)).sort();if(f.length===0){r([{id:"0",order:0,value:""}]);return}r(f.map((d,g)=>({id:g.toString(),order:g,value:u[d]||""})))};if(P.useEffect(()=>{c()},[]),P.useEffect(()=>{const u=t.watch((f,{name:d})=>{d!=null&&d.includes(A.id)&&c()});return()=>u.unsubscribe()},[t]),!!e)return l.jsxs("div",{className:"border-l-6 border-transparent",children:[l.jsx(Mu,{sensors:o,collisionDetection:Bu,onDragEnd:i,children:l.jsx(ju,{items:n.map(u=>u.id),strategy:Cu,children:n.map((u,f)=>{var d;return l.jsx(woA,{index:f,step:u,section:A,formField:e,disabled:f?!((d=n[f-1])!=null&&d.value):!1,onDelete:()=>a(u.id)},u.id)})})}),l.jsx("div",{className:"relative py-2 pl-5 flex justify-start mt-2",children:l.jsxs(pA,{variant:"primary",onClick:s,children:[l.jsx(As,{className:"w-4 h-4"}),"Add another step"]})})]})},VP=({main:A=!1,className:e=""})=>{var d,g,v,m;const{state:t,mainForm:n,groups:r}=mo(),{activeGroupId:s}=t,a=A?n:(d=r==null?void 0:r.find)==null?void 0:d.call(r,p=>p.id===s),[o,i]=P.useState(a?(v=(g=a==null?void 0:a.sections)==null?void 0:g[0])==null?void 0:v.id:""),c=a==null?void 0:a.sections,u=c?(m=c.filter)==null?void 0:m.call(c,p=>p.title):[];if(P.useEffect(()=>{var p;i(((p=c==null?void 0:c[0])==null?void 0:p.id)||"")},[a]),!a)return null;const f=p=>p.isDynamic&&p.dynamicType==="steps"?l.jsx(yoA,{section:p}):p.isDynamic?l.jsx(poA,{section:p}):l.jsx(hoA,{section:p});return l.jsx("div",{className:S("w-full h-full overflow-auto flex p-4",e),children:l.jsxs(Zg,{value:o,className:"flex flex-col w-0 flex-1 h-full no-scrollbar overflow-auto !p-0 gap-4",children:[l.jsx(su,{className:S("m-0 rounded-none bg-background h-fit gap-4 w-full overflow-x-auto justify-start shadow-none",{hidden:!u.length}),children:u.map(p=>p.title?l.jsxs(au,{className:"rounded-full flex gap-2 px-4 py-2 border border-primary opacity-50 data-[state=active]:opacity-100 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",value:p.id,onClick:()=>i(p.id),children:[p.icon&&l.jsx(pA,{variant:"ghost",disabled:!0,size:"icon",className:"h-5 w-5 p-0 disabled:opacity-100",children:p.icon}),p.title]},p.id):null)}),c==null?void 0:c.map(p=>l.jsx(Sg,{value:p.id,className:S("flex flex-col max-w-full gap-4 h-0 overflow-auto flex-1 m-0",p.className),children:f(p)},p.id))]})})},PoA=(A=3)=>{const e=P.useRef(null);return P.useEffect(()=>{const t=e.current;if(!t)return;const{lineHeight:n}=getComputedStyle(t),r=parseFloat(n)*A,s=()=>{t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,r)}px`};return s(),t.addEventListener("input",s),t.addEventListener("focusin",s),()=>{t.removeEventListener("input",s),t.removeEventListener("focusin",s)}},[A]),e},boA=()=>{var d,g,v,m,p,h,w,b,x,z,D,B,M,I,X,V,E,k,Z,C,Q;const{autosave:A}=mo(),[e,t]=P.useState(!1);P.useEffect(()=>{t(!0)},[]);const n=()=>{A.toggleEnableAutoSave(!A.autoSaveEnabled)},[r,s]=P.useState(0),a=((d=A.state)==null?void 0:d.status)=="saving",o=((g=A.state)==null?void 0:g.status)=="pending",i=((v=A.state)==null?void 0:v.status)=="error",c=typeof((p=(m=A.state)==null?void 0:m.error)==null?void 0:p.cause)=="string"?(w=(h=A.state)==null?void 0:h.error)==null?void 0:w.cause:((x=(b=A.state)==null?void 0:b.error)==null?void 0:x.message)||"Autosave Error",{showError:u}=Gt(),f=P.useCallback(()=>{var Y,T;u(c,(T=(Y=A.state)==null?void 0:Y.error)==null?void 0:T.message)},[u,c,(D=(z=A.state)==null?void 0:z.error)==null?void 0:D.message]);return P.useEffect(()=>{s(Y=>Y+1)},[A.state]),e?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"group flex justify-end items-center min-w-70",children:[l.jsxs("div",{className:S("group-hover:hidden p-5 py-2 rounded-full border border-primary flex items-center text-sm gap-2",{"flex-wrap gap-y-0":a||o,hidden:!((B=A.state)!=null&&B.status)&&!A.lastSaveDate}),children:[l.jsx(Uu,{className:"text-base"}),l.jsx("p",{className:S("hidden gap-1 items-center",{flex:!A.autoSaveEnabled}),children:"Autosave off"}),A.autoSaveEnabled&&l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:!((M=A.state)!=null&&M.status)&&A.lastSaveDate}),children:["Last Saved:",l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"dd-MM-yyyy")}),l.jsx(ff,{className:"text-xs"}),l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"HH:mm:ss")})]}),l.jsxs("p",{className:S("hidden gap-1 items-center",{block:o||a}),children:["Autosave: ",a?"In Progress":"Waiting"]}),(a||o)&&l.jsx("div",{className:"relative h-[2px] w-full overflow-hidden rounded-full ",children:l.jsx("div",{className:"absolute inset-0 h-full w-full bg-primary",style:{animation:`wazui_progress_bar ${a?"5s":"30s"} ease-in-out`}})},`progress-${r}`),l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:((I=A.state)==null?void 0:I.status)=="saved"}),children:["Autosave Complete",l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"dd-mm-yyyy")}),l.jsx(ff,{className:"text-xs"}),l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"HH:mm:ss")})]}),l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:i}),children:["Autosave",l.jsxs("span",{className:"text-destructive hover:underline max-w-50 truncate",onClick:f,children:["Error | ",c]})]})]})]}),l.jsxs("div",{className:S("hidden group-hover:invisible p-5 py-2 rounded-full border border-primary items-center text-sm gap-2",{"flex-wrap gap-y-0":a||o,flex:!((X=A.state)!=null&&X.status)&&!A.lastSaveDate&&!A.autoSaveEnabled}),children:[l.jsx(Uu,{className:"text-base"}),l.jsx("p",{className:S("hidden gap-1 items-center",{flex:!A.autoSaveEnabled||!((V=A.state)!=null&&V.status)}),children:"Autosave off"}),A.autoSaveEnabled&&l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:!((E=A.state)!=null&&E.status)&&A.lastSaveDate}),children:["Last Saved:",l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"dd-MM-yyyy")}),l.jsx(ff,{className:"text-xs"}),l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"HH:mm:ss")})]}),l.jsxs("p",{className:S("hidden gap-1 items-center",{block:o||a}),children:["Autosave: ",a?"In Progress":"Waiting"]}),(a||o)&&l.jsx("div",{className:"relative h-[2px] w-full overflow-hidden rounded-full ",children:l.jsx("div",{className:"absolute inset-0 h-full w-full bg-primary",style:{animation:`wazui_progress_bar ${a?"5s":"30s"} ease-in-out`}})},`progress-${r}`),l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:((k=A.state)==null?void 0:k.status)=="saved"}),children:["Autosave Complete",l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"dd-mm-yyyy")}),l.jsx(ff,{className:"text-xs"}),l.jsx("span",{children:A.lastSaveDate&&Te(A.lastSaveDate,"HH:mm:ss")})]}),l.jsxs("p",{className:S("hidden gap-1 items-center",{flex:((Z=A.state)==null?void 0:Z.status)=="error"}),children:["Autosave",l.jsxs("span",{className:"text-destructive max-w-50 truncate",children:["Error | ",(Q=(C=A.state)==null?void 0:C.error)==null?void 0:Q.message]})]})]})]}),l.jsxs("div",{className:S("hidden group-hover:flex border cursor-pointer rounded-full p-4 py-2 text-xs items-center gap-2",{"border-destructive text-destructive ":A.autoSaveEnabled}),onClick:n,children:[l.jsx(Uu,{className:"text-base"}),l.jsx("p",{children:A.autoSaveEnabled?"Disable Autosave":"Enable Autosave"})]})]}),i&&l.jsx(_nA,{className:"text-destructive text-md animate-bounce",onClick:f})]}):l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("div",{className:"group flex justify-end items-center min-w-70",children:l.jsxs("div",{className:"p-5 py-2 rounded-full border border-primary flex items-center text-sm gap-2",children:[l.jsx(Uu,{className:"text-base"}),l.jsx("p",{className:"gap-1 items-center flex",children:"Loading..."})]})})})},xoA=A=>A.toLocaleDateString(void 0,{weekday:"short",day:"2-digit",month:"short",year:"numeric"}),XP=A=>{const e=String(A.getHours()).padStart(2,"0"),t=String(A.getMinutes()).padStart(2,"0");return`${e}:${t}`},zoA=()=>{var A;try{const n=((A=new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(new Date).find(s=>s.type==="timeZoneName"))==null?void 0:A.value)||"",r=Intl.DateTimeFormat().resolvedOptions().timeZone;return n?`${r} ${n}`:r}catch{return"Local time"}},DoA=({open:A,onOpenChange:e,mode:t,initialDate:n,isSubmitting:r=!1,onConfirm:s})=>{const a=()=>{const w=new Date;return w.setMinutes(0,0,0),w.setHours(w.getHours()+1),w},[o,i]=P.useState(()=>n??a()),[c,u]=P.useState(()=>XP(n??a())),[f,d]=P.useState(!1),[g,v]=P.useState(null);P.useEffect(()=>{if(A){const w=n??a();i(w),u(XP(w)),v(null)}},[A,n]);const m=P.useMemo(zoA,[]),p=async()=>{const[w,b]=c.split(":"),x=Number(w),z=Number(b);if(Number.isNaN(x)||Number.isNaN(z)){v("Enter a valid time");return}const D=new Date(o);if(D.setHours(x,z,0,0),D.getTime()<=Date.now()){v("Pick a time in the future");return}v(null),await s(D)},h=t==="reschedule";return l.jsx(xt,{open:A,onOpenChange:e,children:l.jsxs(vt,{className:"max-w-[450px] p-0 overflow-hidden",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{className:"text-secondary-foreground",children:l.jsx("h1",{className:"text-md capitalize",children:h?"Reschedule post":"Schedule post"})})}),l.jsx(ls,{className:"px-4",children:h?"Pick a new publish time. Your content and all edits stay exactly as they are.":"Schedule when this article should go live. You can change this any time before it publishes."}),l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("label",{className:"text-sm",children:"Date"}),l.jsxs(oa,{open:f,onOpenChange:d,children:[l.jsx(ia,{asChild:!0,children:l.jsxs(pA,{variant:"outline",type:"button",className:S("justify-between font-normal"),children:[l.jsx("span",{className:"text-black",children:xoA(o)}),l.jsx(dc,{className:"h-4 w-4 text-muted-foreground"})]})}),l.jsx(cs,{className:"w-auto p-0",align:"start",children:l.jsx(Kc,{mode:"single",selected:o,onSelect:w=>{w&&(i(w),d(!1))},disabled:w=>{const b=new Date;return b.setHours(0,0,0,0),w<b},initialFocus:!0})})]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("label",{className:"text-sm",children:"Time"}),l.jsxs("div",{className:"relative",children:[l.jsx(Wt,{type:"time",value:c,step:"1",onChange:w=>u(w.target.value),className:"text-black pr-8 [&::-webkit-calendar-picker-indicator]:hidden"}),l.jsx(Zz,{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"})]})]})]}),l.jsxs("div",{className:"flex items-center justify-between rounded-md border bg-muted/40 px-3 py-2 text-sm",children:[l.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[l.jsx(eS,{className:"h-4 w-4"}),"Timezone"]}),l.jsx("span",{className:"text-black bg-white p-2 rounded-full",children:m})]}),g&&l.jsx("p",{className:"text-sm text-destructive",children:g})]}),l.jsxs(fn,{className:"p-4 flex flex-row justify-end gap-2 sm:justify-end",children:[l.jsx(pA,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:r,children:"Cancel"}),l.jsx(pA,{type:"button",onClick:p,disabled:r,className:"bg-primary text-primary-foreground",children:h?"Reschedule":"Schedule"})]})]})})},BoA=({open:A,onOpenChange:e,isSubmitting:t=!1,onConfirm:n})=>l.jsx(xt,{open:A,onOpenChange:e,children:l.jsxs(vt,{className:"max-w-[450px] p-0 overflow-hidden",children:[l.jsx($t,{className:"bg-secondary p-4 py-4 items-start",children:l.jsx(An,{className:"text-secondary-foreground",children:"Cancel this schedule?"})}),l.jsx(ls,{className:"px-4 lowercase first-letter:uppercase",children:"The post will return to Draft. Your content and edits are kept — only the scheduled publish time is removed."}),l.jsxs(fn,{className:"p-4 flex flex-row justify-end gap-2 sm:justify-end",children:[l.jsx(pA,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:t,children:"Keep schedule"}),l.jsx(pA,{type:"button",onClick:n,disabled:t,className:"bg-primary text-primary-foreground",children:"Yes, cancel schedule"})]})]})}),MoA=A=>{var r;const e=A.toLocaleDateString(void 0,{weekday:"short",day:"2-digit",month:"short"}),t=A.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});let n="";try{n=((r=new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(A).find(a=>a.type==="timeZoneName"))==null?void 0:r.value)||""}catch{n=""}return`${e} at ${t}${n?` · ${n}`:""}`},CoA=({scheduledAt:A,onChangeTime:e})=>l.jsxs("div",{className:"flex h-12 w-fit items-center justify-between gap-3 rounded-md border border-[#F0D08A] bg-[#FFF4E0] p-2 waz_shadow",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#6B4400]",children:[l.jsx(Zz,{className:"h-4 w-4"}),l.jsxs("span",{children:["Scheduled to publish ",MoA(A)]})]}),l.jsx(pA,{type:"button",variant:"outline",size:"sm",className:"h-7 border-[#FFAA00]/60 bg-[#F4DAAA] text-[#6B4400] hover:bg-[#FFAA00]/10",onClick:e,children:"Change time"})]}),joA=({label:A,disabled:e,onPublish:t,onScheduleClick:n,className:r})=>{const[s,a]=P.useState(!1);return l.jsxs("div",{className:S("flex items-stretch waz_shadow rounded-md overflow-hidden",r),children:[l.jsxs(pA,{type:"button",disabled:e,onClick:t,className:"rounded-none rounded-l-md bg-primary text-[#101828] font-bold text-base px-4 gap-2 hover:bg-primary/90",children:[A,l.jsx(Z4,{})]}),l.jsxs(oa,{open:s,onOpenChange:a,children:[l.jsx(ia,{asChild:!0,children:l.jsx(pA,{type:"button",disabled:e,"aria-label":"More publish options",className:"rounded-none rounded-r-md bg-primary/60 text-[#101828] px-2 hover:bg-primary/90 border-none m-0",children:l.jsx(ig,{className:"h-4 w-4"})})}),l.jsx(cs,{align:"end",className:"w-56 p-1",children:l.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-2 text-sm hover:bg-muted",onClick:()=>{a(!1),n()},children:[l.jsx(dc,{className:"h-4 w-4"}),"Schedule for later"]})})]})]})},OoA=()=>{var R,eA;const{state:A,form:e,handlePublish:t,handleSaveDraft:n,handleSchedule:r,handleCancelSchedule:s,isScheduled:a,scheduledAt:o,showSchedule:i,handleSaveTitle:c,postQuery:{isLoading:u,error:f},type:d,mainForm:g,groups:v,createMutation:{isPending:m},updateMutation:{isPending:p},dispatch:h,showTitle:w,baseUrl:b,isPopup:x,formTitle:z,actionButtonTitle:D,showDraft:B,showAutoSave:M}=mo(),{activeGroupId:I}=A,X=e.getValues("uuid"),V=A.isDraft,E=e.formState.isDirty,[k,Z]=P.useState(!0),C=PoA(k?1:3),[Q,Y]=P.useState({open:!1,mode:"schedule"}),[T,H]=P.useState(!1),N=m||p,j=AA=>{h({type:"SET_ACTIVE_GROUP",payload:AA})},O=A.isCreate;let G=z,J=D;G||(O?G="Create "+d:G="Edit "+d),J||(O||V?J="Publish "+d:J="Update "+d);const K=async()=>{e.getValues("title")&&await c(),Z(!0)},nA=AA=>AA>=75?"text-destructive":AA>=65?"text-[#FFAA00]":AA>=55?"text-[#229954]":AA>=45?"text-[#FFAA00]":"text-muted-foreground";return l.jsx(h9,{...e,children:l.jsxs("form",{className:"w-full flex flex-col p-0",onSubmit:AA=>AA.preventDefault(),onKeyDown:AA=>{AA.key==="Enter"&&!(AA.target instanceof HTMLButtonElement&&AA.target.type==="submit")&&AA.preventDefault()},children:[u&&!X&&l.jsx("div",{className:"absolute inset-0 bg-white/50 backdrop-blur-sm flex items-center justify-center z-10",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Hh,{className:"h-6 w-6 animate-spin"}),l.jsx("span",{children:"Loading..."})]})}),f&&!O&&!X&&l.jsx("div",{className:"absolute inset-0 bg-white/50 backdrop-blur-sm flex items-center justify-center z-10",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ls,{className:"h-6 w-6"}),l.jsxs("span",{children:["Error: ",f==null?void 0:f.message]})]})}),x&&l.jsx("h1",{className:S("text-md font-bold bg-[#FADDD3] w-full p-4"),children:G}),l.jsxs("div",{className:"w-full h-full flex overflow-auto gap-2 items-stretch","data-testid":"main-form",children:[l.jsxs("div",{className:S("flex-2/3 flex flex-col items-start justify-between gap-5 p-4",{"pb-0":!x}),children:[l.jsxs("div",{className:"w-full flex items-center justify-between",children:[l.jsx("h1",{className:S("text-3xl font-bold font-[UniversalFeature] !m-0",{hidden:x}),children:G}),M&&l.jsx(boA,{})]}),l.jsxs("div",{className:S("w-full flex items-center justify-between flex-wrap gap-2",{hidden:!b&&!M}),children:[b&&l.jsx(G0,{url:b,pageTitle:`${O?"Create":"Edit"} ${d}`}),i&&a&&o&&l.jsx(CoA,{scheduledAt:o,onChangeTime:()=>Y({open:!0,mode:"reschedule"})})]}),w&&l.jsx(io,{control:e.control,name:"title",render:({field:AA,fieldState:_})=>{var U,PA,TA;const W=(PA=(U=AA.value)==null?void 0:U.toString())==null?void 0:PA.trim();return l.jsxs("div",{className:"w-full",children:[_.error&&l.jsxs("span",{className:"flex items-center mb-1 gap-1",children:[l.jsx(N0,{className:"text-destructive text-xl"}),l.jsx("span",{className:" capitalize text-xs text-muted-foreground",children:(TA=_.error)==null?void 0:TA.message})]}),l.jsxs("div",{className:S("flex items-center justify-center w-full gap-2"),children:[l.jsxs("div",{className:S("flex items-center justify-center w-full gap-2 slight_border border-secondary! p-1 px-2 rounded",{"border-primary!":!k}),children:[l.jsx(mr,{className:"flex-1",children:l.jsx(lo,{className:"w-full",children:l.jsx(Vg,{className:S("h-fit min-h-0 p-0 w-full placeholder:opacity-50 text-2xl! font-[UniversalFeature] no-scrollbar shadow-none flex-1 border-0 bg-transparent hover:bg-transparent focus:border-0 focus:outline-none focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0",{"opacity-50":k}),ref:C,placeholder:"Enter Title here","aria-disabled":k,value:AA.value,onChange:AA.onChange,rows:1,onBlur:()=>Z(!0),"data-testid":"title-input",onClick:()=>Z(!1)})})}),l.jsxs(pA,{variant:"outline",className:S("p-3 h-5 rounded-full border-secondary gap-1 hover:bg-transparent capitalize text-muted-foreground text-sm",{"border-primary":!k}),onClick:()=>k?Z(!1):K(),children:[k?l.jsx(Rs,{className:"text-sm"}):l.jsx(bv,{className:"text-sm text-primary"}),k?"edit":"save"]})]}),l.jsx("div",{className:S("flex",nA(W==null?void 0:W.length)),"data-testid":"title-word-count",children:l.jsx("span",{className:"text-sm",children:`${(W==null?void 0:W.length)||0}/65`})}),l.jsx(lt,{className:S("capitalize bg-muted w-fit p-2 py-1",{"border-[#229954] text-[#229954] bg-transparent":!V}),children:V?"draft":"published"})]})]})}},"title"),g&&l.jsx(VP,{main:!0,className:"flex-1 grow w-full p-0 "})]}),(v==null?void 0:v.length)&&l.jsxs(Zg,{defaultValue:(R=v[0])==null?void 0:R.id,value:I,className:"flex-1/3 flex flex-col h-full no-scrollbar overflow-auto p-0 flex-wrap",children:[l.jsx(su,{className:"rounded-none justify-start bg-black p-4 h-fit gap-4 w-full overflow-x-auto no-scrollbar",children:(v==null?void 0:v.length)&&v.map(AA=>l.jsxs(au,{className:"rounded-full p-2 px-4 gap-1 slight_border text-[#9C9C9C] group data-[state=active]:text-primary-foreground data-[state=active]:bg-primary data-[state=active]:border-none cursor-pointer",value:AA.id,onClick:_=>{_.preventDefault(),j(AA.id)},children:[AA.icon&&l.jsx("div",{className:"opacity-100 h-5 w-5 flex items-center justify-center",children:AA.icon&&AA.icon}),AA.title]},AA.id))}),l.jsx(Sg,{className:"flex-1 h-0 m-0 border-l",value:I||((eA=v[0])==null?void 0:eA.id),children:l.jsx(VP,{})})]})]}),l.jsxs("div",{className:S("flex gap-4 p-2 bg-muted w-full justify-end ",{hidden:x||!B}),children:[i&&a?l.jsx(ve,{className:" p-4 flex waz_shadow bg-transparent border border-destructive font-bold text-base px-4 text-destructive hover:bg-destructive/5",onClick:()=>H(!0),type:"button",disabled:N,children:"Cancel schedule"}):l.jsx(ve,{className:S(" p-4 hidden waz_shadow bg-[#A9D3B8] font-bold text-base px-4 text-[#101828]",{flex:V||O}),onClick:()=>n(),type:"button",disabled:N,children:"Save as Draft"}),i&&!a&&(V||O)?l.jsx(joA,{label:J,disabled:N,onPublish:()=>t(),onScheduleClick:()=>Y({open:!0,mode:"schedule"})}):l.jsx(ve,{className:S(" p-4 flex waz_shadow font-bold text-[#101828] text-base px-4 gap-1"),disabled:N,onClick:()=>t(),trailingIcon:l.jsx(Z4,{}),children:J})]}),(x||!B)&&l.jsx("div",{className:S("flex gap-4 p-2 w-full justify-end "),children:l.jsx(ve,{className:S(" p-4 hidden waz_shadow font-bold text-[#101828] text-base px-4 gap-1",{flex:E||V}),disabled:N,onClick:t,children:J})}),i&&l.jsxs(l.Fragment,{children:[l.jsx(DoA,{open:Q.open,onOpenChange:AA=>Y(_=>({..._,open:AA})),mode:Q.mode,initialDate:o,isSubmitting:N,onConfirm:async AA=>{await r(AA),Y(_=>({..._,open:!1}))}}),l.jsx(BoA,{open:T,onOpenChange:H,isSubmitting:N,onConfirm:async()=>{await s(),H(!1)}})]})]})})},Nu=({type:A="Post",showDraft:e=!0,showSchedule:t=!1,formTitle:n,actionButtonTitle:r,showTitle:s=!0,isPopup:a=!1,baseUrl:o="",postBaseUrl:i,className:c,post_uuid:u="",groups:f,initialState:d={},mainForm:g,validators:v,requiredDraftFields:m,postQueryConfig:p,createMessage:h,updateMessage:w,formFieldsMapper:b,submitFieldsMapper:x,onBack:z,onSave:D,onChange:B,showDescriptionOnSubmit:M,autoSave:I,user_config:X})=>{var V;return l.jsx(Zi,{children:l.jsx(voA,{initialState:{...d,uuid:u,activeGroupId:f&&(f==null?void 0:f.length)>0?(V=f[0])==null?void 0:V.id:""},showTitle:s,showDraft:e,showSchedule:t,formTitle:n,createMessage:h,updateMessage:w,actionButtonTitle:r,baseUrl:o,postBaseUrl:i,type:A,postQueryConfig:p,validators:v,requiredDraftFields:m,formFieldsMapper:b,submitFieldsMapper:x,onBack:z,onSave:D,groups:f,onChange:B,mainForm:g,isPopup:a,showDescriptionOnSubmit:M,autoSave:I,user_config:X,children:l.jsx("main",{className:S("w-full h-screen bg-background flex flex-1 overflow-y-auto p-0",c),children:l.jsx(OoA,{})})})})};function Dj(A){return JA({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"},child:[]},{tag:"path",attr:{d:"M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M9 12l.01 0"},child:[]},{tag:"path",attr:{d:"M13 12l2 0"},child:[]},{tag:"path",attr:{d:"M9 16l.01 0"},child:[]},{tag:"path",attr:{d:"M13 16l2 0"},child:[]}]})(A)}function Uo(A){return JA({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"},child:[]},{tag:"path",attr:{d:"M9 17h6"},child:[]},{tag:"path",attr:{d:"M9 13h6"},child:[]}]})(A)}const Bj=vA(`
|
|
451
451
|
query MyQuery(
|
|
452
452
|
$first: Int!
|
|
453
453
|
$blog_uuid: String
|
|
@@ -777,7 +777,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
777
777
|
message
|
|
778
778
|
}
|
|
779
779
|
}
|
|
780
|
-
`;function koA({post:A}){return l.jsx("div",{className:"min-w-10 md:min-w-20",children:l.jsx(Hu,{statistics:A.statistics,className:"p-0 text-base",isGrid:!1})})}function jj({postBaseUrl:A}){return[{accessorKey:"post",header:"Post",meta:{width:"grow"},cell:({row:e})=>{var
|
|
780
|
+
`;function koA({post:A}){return l.jsx("div",{className:"min-w-10 md:min-w-20",children:l.jsx(Hu,{statistics:A.statistics,className:"p-0 text-base",isGrid:!1})})}function jj({postBaseUrl:A}){return[{accessorKey:"post",header:"Post",meta:{width:"grow"},cell:({row:e})=>{var o,i;const t=e.original,n=JSON.parse(t.featured_image),r=t.status===Ye.PUBLISHED,s=r?A:`${A}/preview`,a=!r&&t.published_at&&new Date(t.published_at+"Z").getTime()&&new Date(t.published_at+"Z")>new Date;return l.jsxs("div",{className:"flex flex-row items-center justify-between flex-1 w-full h-16 gap-4 min-w-110 pr-15 ",children:[l.jsx(as,{url:n==null?void 0:n.src,transformations:{width:80,height:64},classname:"w-[5rem] h-full rounded-sm overflow-hidden"}),l.jsxs("div",{className:S(" relative flex flex-col justify-between w-0 gap-y-1 flex-1 h-full ",{"pr-15":!r}),children:[l.jsx("a",{className:"cursor-pointer hover:underline group-hover:underline line-clamp-2",href:s+t.slug,target:"_blank",rel:"noopener noreferrer",children:Ur(t.title)}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center justify-center w-[20px] h-[20px] rounded-full bg-secondary",children:l.jsx("p",{className:"text-[7.43px] text-black uppercase",children:Yi((o=t==null?void 0:t.author)==null?void 0:o.name)})}),l.jsx("p",{className:"text-xs capitalize text-muted-foreground",children:(i=t==null?void 0:t.author)==null?void 0:i.name})]}),l.jsx(lt,{variant:"outline",className:S("text-xs absolute top-0 right-0 bg-muted text-muted-foreground",{hidden:r,"border-[#F0D08A] bg-[#FFF4E0] text-[#6B4400]":a}),children:a?"Scheduled":"Draft"})]})]})}},{accessorKey:"categories",header:"Categories",cell:({row:e})=>{const t=e.original;return l.jsx("div",{className:"min-w-10 md:min-w-20",children:l.jsx(Eu,{categories:t.categories||[]})})}},{accessorKey:"tags",header:"Tags",cell:({row:e})=>{const t=e.original;return l.jsx("div",{className:"min-w-10 md:min-w-20",children:l.jsx(al,{tags:t.tags})})}},{accessorKey:"statistics",header:"Statistics",cell:({row:e})=>{const t=e.original;return l.jsx(koA,{post:t})}},{accessorKey:"updated_at",header:"Last Modified",cell:({row:e})=>{const t=e.original,n=new Le("en-US");return l.jsx("div",{className:"min-w-10 md:min-w-20",children:n.format(new Date(t.updated_at||""))})}}]}function Oj({authors:A,blog_uuid:e}){return[{id:"title",label:"Title",type:zA.TEXT,icon:l.jsx(Dj,{className:"text-xl text-primary"}),selectProps:{placeholder:"Enter multiple titles"},operators:["contains","notContains"]},{id:"slug",label:"Slug",type:zA.TEXT,icon:l.jsx(W2,{className:"text-[#298BFC] text-xl"}),selectProps:{placeholder:"Enter multiple slugs"},operators:["contains","notContains"]},{id:"author_uuid",label:"Author",type:zA.SELECT,icon:l.jsx(k4,{className:"text-xl text-primary"}),selectProps:{options:(A||[]).map(t=>({label:t.name,value:t.uuid})),createNewOption:!1,placeholder:"Type to search authors"}},{id:"category_name",label:"Category",type:zA.SELECT,icon:l.jsx(lnA,{className:"text-[#6941C6] text-xl"}),selectProps:{queryConfig:{query:Bj,variables:{blog_uuid:e},dataKey:"categories",cacheKey:"article-categories"},optionsMapper:t=>({label:t.name,value:t.uuid}),createNewOption:!1,placeholder:"Type to search categories"},optionFilterField:"label"},{id:"tag_name",label:"Tags",type:zA.SELECT,icon:l.jsx(wR,{className:"text-[#C01574] text-xl"}),selectProps:{queryConfig:{query:Mj,variables:{blog_uuid:e},dataKey:"tags",cacheKey:"article-tags"},optionsMapper:t=>({label:t.name,value:t.uuid}),createNewOption:!1,placeholder:"Type to search tags"},optionFilterField:"label"},{id:"status",label:"Status",type:zA.SELECT,icon:l.jsx(bv,{className:"text-[#298BFC] text-xl"}),selectProps:{options:[{value:0,label:"Draft"},{value:1,label:"Published"}],createNewOption:!1},operators:["eq","neq"]},{id:"updated_at",label:"Last Modified",type:zA.DATE,icon:l.jsx(wr,{className:"text-xl text-primary"})}]}const Tj=[{value:Ye.ALL,label:"All Blogs"},{value:Ye.PUBLISHED,label:"Published"},{value:Ye.DRAFT,label:"In Draft"}],Ej=vA(`
|
|
781
781
|
query GqlPosts(
|
|
782
782
|
$first: Int!
|
|
783
783
|
$page: Int
|
|
@@ -2376,5 +2376,5 @@ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}
|
|
|
2376
2376
|
}
|
|
2377
2377
|
}
|
|
2378
2378
|
}
|
|
2379
|
-
`;function quA({searchValue:A,apolloUri:e}){const t=P.useMemo(()=>({query:JuA,variables:{first:350},dataKey:"users"}),[]),n=tl(e),r=sv(A||"",300),s=P.useCallback(async({pageParam:a=1})=>{if(t!=null&&t.query){const o=t==null?void 0:t.query,i=t==null?void 0:t.variables,f=(await n.query({query:o,variables:{...i||{},search:r,page:a}})).data[t.dataKey];return{paginatorInfo:f.paginatorInfo||{currentPage:1,lastPage:1},data:f==null?void 0:f.data}}else throw console.error("Invalid Query Configuration"),Error("Invalid Query Configuration")},[n,t,r]);return rv({queryKey:[t==null?void 0:t.dataKey,r],queryFn:s,getNextPageParam:a=>{var o,i;if(((o=a==null?void 0:a.paginatorInfo)==null?void 0:o.currentPage)<((i=a==null?void 0:a.paginatorInfo)==null?void 0:i.lastPage))return a.paginatorInfo.currentPage+1},initialPageParam:1,staleTime:300*1e3,gcTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1})}const RP={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_ATHENS_APP_ID:"app_05498783b46321910c53bc6511a42990",VITE_ATHENS_APP_SECRET:"42bab1f92993033610c623e2a841eca1d40e8bd5abd397eb192ed9fb87fa4b5e",VITE_DOLOS_TRANSFORMATION_ENDPOINT:"https://images.twistedfood.co.uk",VITE_DOLOS_URL:"https://dolos.hogfort.com/graphql",VITE_MERCURY_GRAPHQL_URL:"https://mercury.hogfort.com/graphql",VITE_MERCURY_TOKEN_ENDPOINT:"https://mercury.hogfort.com/project/token",VITE_MUSE_GRAPHQL_URL:"https://muse.hogfort.com/graphql",VITE_PHOENIX_ENDPOINT:"http://51.38.80.88:8001/graphql",VITE_PROMETHEUS_GRAPHQL_ENDPOINT:"https://prometheus.tiadara.com/graphql",VITE_RECIPE_GRAPHQL_URL:"https://recipes-api.junglecreations.com/graphql",VITE_REVALIDATION_TWISTEDFOOD_TOKEN:"token",VITE_REVALIDATION_VT_TOKEN:"df870c4335ad9d4402dfccdf7000a3c9",VITE_TWITTER_EMBED_ENDPOINT:"http://localhost:3000/api/twitter-embeds"},x6=Ee({NEXT_PUBLIC_DOLOS_URL:dA().default("https://localhost:3001"),NEXT_PUBLIC_RECIPE_GRAPHQL_URL:dA().default("https://localhost:3002"),NEXT_PUBLIC_PHOENIX_ENDPOINT:dA().default("https://localhost:3004"),NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT:dA().default("https://localhost:3005/token"),NEXT_PUBLIC_ATHENS_APP_ID:dA().default("dev-athens-id"),NEXT_PUBLIC_ATHENS_APP_SECRET:dA().default("dev-athens-secret"),NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN:dA().default("dev-revalidation-token"),NEXT_PUBLIC_REVALIDATION_VT_TOKEN:dA().default("dev-vt-token"),NEXT_PUBLIC_MUSE_GRAPHQL_URL:dA().optional()});function _0(){var t,n,r,s;const A=typeof window<"u";if(typeof process<"u"&&((t=process.env)==null?void 0:t.NODE_ENV)==="test")return{NEXT_PUBLIC_DOLOS_URL:process.env.NEXT_PUBLIC_DOLOS_URL||"https://fallback.test",NEXT_PUBLIC_RECIPE_GRAPHQL_URL:process.env.NEXT_PUBLIC_RECIPE_GRAPHQL_URL||"https://fallback.test",NEXT_PUBLIC_PHOENIX_ENDPOINT:process.env.NEXT_PUBLIC_PHOENIX_ENDPOINT||"https://fallback.test",NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT:process.env.NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT||"https://fallback.test",NEXT_PUBLIC_ATHENS_APP_ID:process.env.NEXT_PUBLIC_ATHENS_APP_ID||"fallback-id",NEXT_PUBLIC_ATHENS_APP_SECRET:process.env.NEXT_PUBLIC_ATHENS_APP_SECRET||"fallback-secret",NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN:process.env.NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN||"fallback-token",NEXT_PUBLIC_REVALIDATION_VT_TOKEN:process.env.NEXT_PUBLIC_REVALIDATION_VT_TOKEN||"fallback-token",NEXT_PUBLIC_MUSE_GRAPHQL_URL:process.env.NEXT_PUBLIC_MUSE_GRAPHQL_URL||""};let e={};if(typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:Ev&&Ev.tagName.toUpperCase()==="SCRIPT"&&Ev.src||new URL("index-BUTSH4-8.cjs",document.baseURI).href}<"u"&&RP)e=RP;else if(typeof process<"u"&&process.env)e=process.env;else if(A&&typeof window<"u"){const a=window;(n=a.__NEXT_DATA__)!=null&&n.env?e=a.__NEXT_DATA__.env:(r=a.__NEXT_DATA__)!=null&&r.runtimeConfig?e=a.__NEXT_DATA__.runtimeConfig:(s=a.process)!=null&&s.env&&(e=a.process.env)}return{NEXT_PUBLIC_DOLOS_URL:e.NEXT_PUBLIC_DOLOS_URL,NEXT_PUBLIC_RECIPE_GRAPHQL_URL:e.NEXT_PUBLIC_RECIPE_GRAPHQL_URL,NEXT_PUBLIC_PHOENIX_ENDPOINT:e.NEXT_PUBLIC_PHOENIX_ENDPOINT,NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT:e.NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT,NEXT_PUBLIC_ATHENS_APP_ID:e.NEXT_PUBLIC_ATHENS_APP_ID,NEXT_PUBLIC_ATHENS_APP_SECRET:e.NEXT_PUBLIC_ATHENS_APP_SECRET,NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN:e.NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN,NEXT_PUBLIC_REVALIDATION_VT_TOKEN:e.NEXT_PUBLIC_REVALIDATION_VT_TOKEN,NEXT_PUBLIC_MUSE_GRAPHQL_URL:e.NEXT_PUBLIC_MUSE_GRAPHQL_URL}}const z6=P.createContext(null);function RuA({children:A,env:e}){const t=e||_0(),n=x6.parse(t);return l.jsx(z6.Provider,{value:n,children:A})}function WuA(){const A=P.useContext(z6);if(A)return A;const e=_0();return x6.parse(e)}Le.addDefaultLocale(wT);Le.addLocale(yT);exports.Alert=oV;exports.AlertDescription=lV;exports.AlertTitle=iV;exports.AuthorsComponent=LuA;exports.Badge=lt;exports.BlogCategoryContent=kj;exports.BlogPostContentComponent=ecA;exports.BlogPostsComponent=SoA;exports.BlogStatus=Ye;exports.BlogTagContent=a6;exports.Breadcrumb=Iz;exports.BreadcrumbEllipsis=cV;exports.BreadcrumbItem=Dp;exports.BreadcrumbLink=Lz;exports.BreadcrumbList=Qz;exports.BreadcrumbPage=Jz;exports.BreadcrumbSeparator=qz;exports.Button=pA;exports.Calendar=Kc;exports.Card=Qn;exports.CardContent=ts;exports.CardDescription=f8;exports.CardFooter=Uc;exports.CardHeader=es;exports.CardTitle=hi;exports.CategoriesComponent=qoA;exports.Checkbox=y8;exports.ClearCacheHistory=acA;exports.Collapsible=aG;exports.CollapsibleContent=iG;exports.CollapsibleTrigger=oG;exports.ColumnFaceting=R5;exports.ColumnFiltering=tB;exports.ColumnGrouping=nB;exports.ColumnOrdering=sB;exports.ColumnPinning=aB;exports.ColumnSizing=oB;exports.ColumnVisibility=lB;exports.Command=$c;exports.CommandDialog=$G;exports.CommandEmpty=yg;exports.CommandGroup=Pg;exports.CommandInput=i9;exports.CommandItem=bg;exports.CommandList=wg;exports.CommandSeparator=K8;exports.CommandShortcut=U8;exports.ContextMenu=w1;exports.ContextMenuCheckboxItem=NI;exports.ContextMenuContent=P1;exports.ContextMenuGroup=CI;exports.ContextMenuItem=Op;exports.ContextMenuLabel=ZI;exports.ContextMenuPortal=jI;exports.ContextMenuRadioGroup=TI;exports.ContextMenuRadioItem=kI;exports.ContextMenuSeparator=b1;exports.ContextMenuShortcut=x1;exports.ContextMenuSub=OI;exports.ContextMenuSubContent=HI;exports.ContextMenuSubTrigger=EI;exports.ContextMenuTrigger=y1;exports.Dialog=xt;exports.DialogClose=_G;exports.DialogContent=vt;exports.DialogDescription=ls;exports.DialogFooter=fn;exports.DialogHeader=$t;exports.DialogOverlay=o9;exports.DialogPortal=F8;exports.DialogTitle=An;exports.DialogTrigger=UG;exports.DropdownMenu=JS;exports.DropdownMenuCheckboxItem=US;exports.DropdownMenuContent=WS;exports.DropdownMenuGroup=FS;exports.DropdownMenuItem=KS;exports.DropdownMenuLabel=AV;exports.DropdownMenuPortal=qS;exports.DropdownMenuRadioGroup=_S;exports.DropdownMenuRadioItem=$S;exports.DropdownMenuSeparator=eV;exports.DropdownMenuShortcut=tV;exports.DropdownMenuSub=nV;exports.DropdownMenuSubContent=sV;exports.DropdownMenuSubTrigger=rV;exports.DropdownMenuTrigger=RS;exports.FilterFieldType=zA;exports.Form=h9;exports.FormControl=lo;exports.FormDescription=X1;exports.FormField=io;exports.FormItem=mr;exports.FormLabel=w9;exports.FormMessage=Y1;exports.FormResponsesComponent=SuA;exports.GlobalFaceting=cB;exports.GlobalFiltering=uB;exports.Headers=q5;exports.Input=Wt;exports.Label=Bg;exports.PagesComponent=BuA;exports.Popover=oa;exports.PopoverContent=cs;exports.PopoverTrigger=ia;exports.PurgeCacheWrapper=ncA;exports.QueryProvider=AoA;exports.RadioGroup=b9;exports.RadioGroupItem=x9;exports.RecipeCategories=ScA;exports.RecipeContentComponentWithApollo=mcA;exports.RecipeTags=BcA;exports.RecipesComponent=TlA;exports.RedirectsComponent=YlA;exports.RowExpanding=fB;exports.RowPagination=dB;exports.RowPinning=gB;exports.RowSelection=vB;exports.RowSorting=pB;exports.Select=yi;exports.SelectContent=Ao;exports.SelectGroup=vL;exports.SelectItem=gr;exports.SelectLabel=KD;exports.SelectScrollDownButton=B9;exports.SelectScrollUpButton=D9;exports.SelectSeparator=UD;exports.SelectTrigger=$a;exports.SelectValue=Pi;exports.Separator=A5;exports.Sheet=M9;exports.SheetClose=OL;exports.SheetContent=C9;exports.SheetDescription=T9;exports.SheetFooter=t5;exports.SheetHeader=j9;exports.SheetTitle=O9;exports.SheetTrigger=e5;exports.Sidebar=oJ;exports.SidebarContent=vJ;exports.SidebarFooter=dJ;exports.SidebarGroup=mJ;exports.SidebarGroupAction=hJ;exports.SidebarGroupContent=wJ;exports.SidebarGroupLabel=pJ;exports.SidebarHeader=fJ;exports.SidebarInput=uJ;exports.SidebarInset=cJ;exports.SidebarMenu=yJ;exports.SidebarMenuAction=zJ;exports.SidebarMenuBadge=DJ;exports.SidebarMenuButton=xJ;exports.SidebarMenuItem=PJ;exports.SidebarMenuSkeleton=BJ;exports.SidebarMenuSub=MJ;exports.SidebarMenuSubButton=jJ;exports.SidebarMenuSubItem=CJ;exports.SidebarProvider=aJ;exports.SidebarRail=lJ;exports.SidebarSeparator=gJ;exports.SidebarTrigger=iJ;exports.Skeleton=id;exports.Switch=N9;exports.Table=Pq;exports.TableBody=xq;exports.TableCaption=Cq;exports.TableCell=Mq;exports.TableFooter=zq;exports.TableHead=Bq;exports.TableHeader=bq;exports.TableRow=Dq;exports.Tabs=Zg;exports.TabsContent=Sg;exports.TabsList=su;exports.TabsTrigger=au;exports.TagsComponent=blA;exports.Textarea=Vg;exports.ThemeProvider=UaA;exports.Toaster=yq;exports.Toggle=Y5;exports.ToggleGroup=cd;exports.ToggleGroupItem=ud;exports.Tooltip=Es;exports.TooltipContent=Ns;exports.TooltipProvider=xi;exports.TooltipTrigger=Hs;exports.TopicsComponent=jlA;exports.WazUIBlogComponent=dn;exports.WazUIBlogDashboard=wuA;exports.WazUIButton=ve;exports.WazUIEnvironmentProvider=RuA;exports.WazUIPostActions=FaA;exports.WazUIPostCategories=Eu;exports.WazUIPostStatistics=Hu;exports.WazUIPostTags=al;exports.WazUiCreateBlogContent=Nu;exports.WazUiGqlMediaLibrary=O4;exports.WazUiPostCard=I0;exports.WazuiActionModalProvider=Zi;exports._getVisibleLeafColumns=Jo;exports.aggregationFns=Pf;exports.badgeVariants=Gz;exports.buildHeaderGroups=Cl;exports.cleanHTML=Ur;exports.commonjsGlobal=If;exports.createCell=L5;exports.createColumn=J5;exports.createColumnHelper=Oq;exports.createNextConfig=gC;exports.createRow=lu;exports.createTable=hB;exports.debugNextConfig=vC;exports.defaultColumnSizing=jl;exports.env=de;exports.expandRows=I9;exports.fetchMercuryToken=y0;exports.filterFns=nr;exports.flattenBy=X9;exports.flexRender=qp;exports.functionalUpdate=Jr;exports.getAutoDetectedEnvironment=_0;exports.getCoreRowModel=wB;exports.getDefaultExportFromCjs=Zc;exports.getEnv=mC;exports.getExpandedRowModel=Fq;exports.getFacetedMinMaxValues=Kq;exports.getFacetedRowModel=$q;exports.getFacetedUniqueValues=AR;exports.getFilteredRowModel=PB;exports.getGroupedRowModel=eR;exports.getMemoOptions=SA;exports.getPaginationRowModel=bB;exports.getSortedRowModel=xB;exports.isFunction=iu;exports.isNumberArray=Q5;exports.isRowSelected=Yg;exports.isSubRowSelected=fd;exports.makeStateUpdater=Ut;exports.memo=ZA;exports.noop=Tq;exports.orderColumns=rB;exports.passiveEventSupported=iB;exports.reSplitAlphaNumeric=dd;exports.selectRowsFn=bf;exports.shouldAutoRemoveFilter=Ip;exports.sortingFns=Co;exports.toggleVariants=V9;exports.useAuthors=quA;exports.useFormField=eu;exports.useReactTable=zB;exports.useSidebar=ru;exports.useTheme=_aA;exports.useWazUIEnvironment=WuA;exports.withReactQuery=toA;
|
|
2380
|
-
//# sourceMappingURL=index-
|
|
2379
|
+
`;function quA({searchValue:A,apolloUri:e}){const t=P.useMemo(()=>({query:JuA,variables:{first:350},dataKey:"users"}),[]),n=tl(e),r=sv(A||"",300),s=P.useCallback(async({pageParam:a=1})=>{if(t!=null&&t.query){const o=t==null?void 0:t.query,i=t==null?void 0:t.variables,f=(await n.query({query:o,variables:{...i||{},search:r,page:a}})).data[t.dataKey];return{paginatorInfo:f.paginatorInfo||{currentPage:1,lastPage:1},data:f==null?void 0:f.data}}else throw console.error("Invalid Query Configuration"),Error("Invalid Query Configuration")},[n,t,r]);return rv({queryKey:[t==null?void 0:t.dataKey,r],queryFn:s,getNextPageParam:a=>{var o,i;if(((o=a==null?void 0:a.paginatorInfo)==null?void 0:o.currentPage)<((i=a==null?void 0:a.paginatorInfo)==null?void 0:i.lastPage))return a.paginatorInfo.currentPage+1},initialPageParam:1,staleTime:300*1e3,gcTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1})}const RP={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_ATHENS_APP_ID:"app_05498783b46321910c53bc6511a42990",VITE_ATHENS_APP_SECRET:"42bab1f92993033610c623e2a841eca1d40e8bd5abd397eb192ed9fb87fa4b5e",VITE_DOLOS_TRANSFORMATION_ENDPOINT:"https://images.twistedfood.co.uk",VITE_DOLOS_URL:"https://dolos.hogfort.com/graphql",VITE_MERCURY_GRAPHQL_URL:"https://mercury.hogfort.com/graphql",VITE_MERCURY_TOKEN_ENDPOINT:"https://mercury.hogfort.com/project/token",VITE_MUSE_GRAPHQL_URL:"https://muse.hogfort.com/graphql",VITE_PHOENIX_ENDPOINT:"http://51.38.80.88:8001/graphql",VITE_PROMETHEUS_GRAPHQL_ENDPOINT:"https://prometheus.tiadara.com/graphql",VITE_RECIPE_GRAPHQL_URL:"https://recipes-api.junglecreations.com/graphql",VITE_REVALIDATION_TWISTEDFOOD_TOKEN:"token",VITE_REVALIDATION_VT_TOKEN:"df870c4335ad9d4402dfccdf7000a3c9",VITE_TWITTER_EMBED_ENDPOINT:"http://localhost:3000/api/twitter-embeds"},x6=Ee({NEXT_PUBLIC_DOLOS_URL:dA().default("https://localhost:3001"),NEXT_PUBLIC_RECIPE_GRAPHQL_URL:dA().default("https://localhost:3002"),NEXT_PUBLIC_PHOENIX_ENDPOINT:dA().default("https://localhost:3004"),NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT:dA().default("https://localhost:3005/token"),NEXT_PUBLIC_ATHENS_APP_ID:dA().default("dev-athens-id"),NEXT_PUBLIC_ATHENS_APP_SECRET:dA().default("dev-athens-secret"),NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN:dA().default("dev-revalidation-token"),NEXT_PUBLIC_REVALIDATION_VT_TOKEN:dA().default("dev-vt-token"),NEXT_PUBLIC_MUSE_GRAPHQL_URL:dA().optional()});function _0(){var t,n,r,s;const A=typeof window<"u";if(typeof process<"u"&&((t=process.env)==null?void 0:t.NODE_ENV)==="test")return{NEXT_PUBLIC_DOLOS_URL:process.env.NEXT_PUBLIC_DOLOS_URL||"https://fallback.test",NEXT_PUBLIC_RECIPE_GRAPHQL_URL:process.env.NEXT_PUBLIC_RECIPE_GRAPHQL_URL||"https://fallback.test",NEXT_PUBLIC_PHOENIX_ENDPOINT:process.env.NEXT_PUBLIC_PHOENIX_ENDPOINT||"https://fallback.test",NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT:process.env.NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT||"https://fallback.test",NEXT_PUBLIC_ATHENS_APP_ID:process.env.NEXT_PUBLIC_ATHENS_APP_ID||"fallback-id",NEXT_PUBLIC_ATHENS_APP_SECRET:process.env.NEXT_PUBLIC_ATHENS_APP_SECRET||"fallback-secret",NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN:process.env.NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN||"fallback-token",NEXT_PUBLIC_REVALIDATION_VT_TOKEN:process.env.NEXT_PUBLIC_REVALIDATION_VT_TOKEN||"fallback-token",NEXT_PUBLIC_MUSE_GRAPHQL_URL:process.env.NEXT_PUBLIC_MUSE_GRAPHQL_URL||""};let e={};if(typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:Ev&&Ev.tagName.toUpperCase()==="SCRIPT"&&Ev.src||new URL("index-g3cHKL0U.cjs",document.baseURI).href}<"u"&&RP)e=RP;else if(typeof process<"u"&&process.env)e=process.env;else if(A&&typeof window<"u"){const a=window;(n=a.__NEXT_DATA__)!=null&&n.env?e=a.__NEXT_DATA__.env:(r=a.__NEXT_DATA__)!=null&&r.runtimeConfig?e=a.__NEXT_DATA__.runtimeConfig:(s=a.process)!=null&&s.env&&(e=a.process.env)}return{NEXT_PUBLIC_DOLOS_URL:e.NEXT_PUBLIC_DOLOS_URL,NEXT_PUBLIC_RECIPE_GRAPHQL_URL:e.NEXT_PUBLIC_RECIPE_GRAPHQL_URL,NEXT_PUBLIC_PHOENIX_ENDPOINT:e.NEXT_PUBLIC_PHOENIX_ENDPOINT,NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT:e.NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT,NEXT_PUBLIC_ATHENS_APP_ID:e.NEXT_PUBLIC_ATHENS_APP_ID,NEXT_PUBLIC_ATHENS_APP_SECRET:e.NEXT_PUBLIC_ATHENS_APP_SECRET,NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN:e.NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN,NEXT_PUBLIC_REVALIDATION_VT_TOKEN:e.NEXT_PUBLIC_REVALIDATION_VT_TOKEN,NEXT_PUBLIC_MUSE_GRAPHQL_URL:e.NEXT_PUBLIC_MUSE_GRAPHQL_URL}}const z6=P.createContext(null);function RuA({children:A,env:e}){const t=e||_0(),n=x6.parse(t);return l.jsx(z6.Provider,{value:n,children:A})}function WuA(){const A=P.useContext(z6);if(A)return A;const e=_0();return x6.parse(e)}Le.addDefaultLocale(wT);Le.addLocale(yT);exports.Alert=oV;exports.AlertDescription=lV;exports.AlertTitle=iV;exports.AuthorsComponent=LuA;exports.Badge=lt;exports.BlogCategoryContent=kj;exports.BlogPostContentComponent=ecA;exports.BlogPostsComponent=SoA;exports.BlogStatus=Ye;exports.BlogTagContent=a6;exports.Breadcrumb=Iz;exports.BreadcrumbEllipsis=cV;exports.BreadcrumbItem=Dp;exports.BreadcrumbLink=Lz;exports.BreadcrumbList=Qz;exports.BreadcrumbPage=Jz;exports.BreadcrumbSeparator=qz;exports.Button=pA;exports.Calendar=Kc;exports.Card=Qn;exports.CardContent=ts;exports.CardDescription=f8;exports.CardFooter=Uc;exports.CardHeader=es;exports.CardTitle=hi;exports.CategoriesComponent=qoA;exports.Checkbox=y8;exports.ClearCacheHistory=acA;exports.Collapsible=aG;exports.CollapsibleContent=iG;exports.CollapsibleTrigger=oG;exports.ColumnFaceting=R5;exports.ColumnFiltering=tB;exports.ColumnGrouping=nB;exports.ColumnOrdering=sB;exports.ColumnPinning=aB;exports.ColumnSizing=oB;exports.ColumnVisibility=lB;exports.Command=$c;exports.CommandDialog=$G;exports.CommandEmpty=yg;exports.CommandGroup=Pg;exports.CommandInput=i9;exports.CommandItem=bg;exports.CommandList=wg;exports.CommandSeparator=K8;exports.CommandShortcut=U8;exports.ContextMenu=w1;exports.ContextMenuCheckboxItem=NI;exports.ContextMenuContent=P1;exports.ContextMenuGroup=CI;exports.ContextMenuItem=Op;exports.ContextMenuLabel=ZI;exports.ContextMenuPortal=jI;exports.ContextMenuRadioGroup=TI;exports.ContextMenuRadioItem=kI;exports.ContextMenuSeparator=b1;exports.ContextMenuShortcut=x1;exports.ContextMenuSub=OI;exports.ContextMenuSubContent=HI;exports.ContextMenuSubTrigger=EI;exports.ContextMenuTrigger=y1;exports.Dialog=xt;exports.DialogClose=_G;exports.DialogContent=vt;exports.DialogDescription=ls;exports.DialogFooter=fn;exports.DialogHeader=$t;exports.DialogOverlay=o9;exports.DialogPortal=F8;exports.DialogTitle=An;exports.DialogTrigger=UG;exports.DropdownMenu=JS;exports.DropdownMenuCheckboxItem=US;exports.DropdownMenuContent=WS;exports.DropdownMenuGroup=FS;exports.DropdownMenuItem=KS;exports.DropdownMenuLabel=AV;exports.DropdownMenuPortal=qS;exports.DropdownMenuRadioGroup=_S;exports.DropdownMenuRadioItem=$S;exports.DropdownMenuSeparator=eV;exports.DropdownMenuShortcut=tV;exports.DropdownMenuSub=nV;exports.DropdownMenuSubContent=sV;exports.DropdownMenuSubTrigger=rV;exports.DropdownMenuTrigger=RS;exports.FilterFieldType=zA;exports.Form=h9;exports.FormControl=lo;exports.FormDescription=X1;exports.FormField=io;exports.FormItem=mr;exports.FormLabel=w9;exports.FormMessage=Y1;exports.FormResponsesComponent=SuA;exports.GlobalFaceting=cB;exports.GlobalFiltering=uB;exports.Headers=q5;exports.Input=Wt;exports.Label=Bg;exports.PagesComponent=BuA;exports.Popover=oa;exports.PopoverContent=cs;exports.PopoverTrigger=ia;exports.PurgeCacheWrapper=ncA;exports.QueryProvider=AoA;exports.RadioGroup=b9;exports.RadioGroupItem=x9;exports.RecipeCategories=ScA;exports.RecipeContentComponentWithApollo=mcA;exports.RecipeTags=BcA;exports.RecipesComponent=TlA;exports.RedirectsComponent=YlA;exports.RowExpanding=fB;exports.RowPagination=dB;exports.RowPinning=gB;exports.RowSelection=vB;exports.RowSorting=pB;exports.Select=yi;exports.SelectContent=Ao;exports.SelectGroup=vL;exports.SelectItem=gr;exports.SelectLabel=KD;exports.SelectScrollDownButton=B9;exports.SelectScrollUpButton=D9;exports.SelectSeparator=UD;exports.SelectTrigger=$a;exports.SelectValue=Pi;exports.Separator=A5;exports.Sheet=M9;exports.SheetClose=OL;exports.SheetContent=C9;exports.SheetDescription=T9;exports.SheetFooter=t5;exports.SheetHeader=j9;exports.SheetTitle=O9;exports.SheetTrigger=e5;exports.Sidebar=oJ;exports.SidebarContent=vJ;exports.SidebarFooter=dJ;exports.SidebarGroup=mJ;exports.SidebarGroupAction=hJ;exports.SidebarGroupContent=wJ;exports.SidebarGroupLabel=pJ;exports.SidebarHeader=fJ;exports.SidebarInput=uJ;exports.SidebarInset=cJ;exports.SidebarMenu=yJ;exports.SidebarMenuAction=zJ;exports.SidebarMenuBadge=DJ;exports.SidebarMenuButton=xJ;exports.SidebarMenuItem=PJ;exports.SidebarMenuSkeleton=BJ;exports.SidebarMenuSub=MJ;exports.SidebarMenuSubButton=jJ;exports.SidebarMenuSubItem=CJ;exports.SidebarProvider=aJ;exports.SidebarRail=lJ;exports.SidebarSeparator=gJ;exports.SidebarTrigger=iJ;exports.Skeleton=id;exports.Switch=N9;exports.Table=Pq;exports.TableBody=xq;exports.TableCaption=Cq;exports.TableCell=Mq;exports.TableFooter=zq;exports.TableHead=Bq;exports.TableHeader=bq;exports.TableRow=Dq;exports.Tabs=Zg;exports.TabsContent=Sg;exports.TabsList=su;exports.TabsTrigger=au;exports.TagsComponent=blA;exports.Textarea=Vg;exports.ThemeProvider=UaA;exports.Toaster=yq;exports.Toggle=Y5;exports.ToggleGroup=cd;exports.ToggleGroupItem=ud;exports.Tooltip=Es;exports.TooltipContent=Ns;exports.TooltipProvider=xi;exports.TooltipTrigger=Hs;exports.TopicsComponent=jlA;exports.WazUIBlogComponent=dn;exports.WazUIBlogDashboard=wuA;exports.WazUIButton=ve;exports.WazUIEnvironmentProvider=RuA;exports.WazUIPostActions=FaA;exports.WazUIPostCategories=Eu;exports.WazUIPostStatistics=Hu;exports.WazUIPostTags=al;exports.WazUiCreateBlogContent=Nu;exports.WazUiGqlMediaLibrary=O4;exports.WazUiPostCard=I0;exports.WazuiActionModalProvider=Zi;exports._getVisibleLeafColumns=Jo;exports.aggregationFns=Pf;exports.badgeVariants=Gz;exports.buildHeaderGroups=Cl;exports.cleanHTML=Ur;exports.commonjsGlobal=If;exports.createCell=L5;exports.createColumn=J5;exports.createColumnHelper=Oq;exports.createNextConfig=gC;exports.createRow=lu;exports.createTable=hB;exports.debugNextConfig=vC;exports.defaultColumnSizing=jl;exports.env=de;exports.expandRows=I9;exports.fetchMercuryToken=y0;exports.filterFns=nr;exports.flattenBy=X9;exports.flexRender=qp;exports.functionalUpdate=Jr;exports.getAutoDetectedEnvironment=_0;exports.getCoreRowModel=wB;exports.getDefaultExportFromCjs=Zc;exports.getEnv=mC;exports.getExpandedRowModel=Fq;exports.getFacetedMinMaxValues=Kq;exports.getFacetedRowModel=$q;exports.getFacetedUniqueValues=AR;exports.getFilteredRowModel=PB;exports.getGroupedRowModel=eR;exports.getMemoOptions=SA;exports.getPaginationRowModel=bB;exports.getSortedRowModel=xB;exports.isFunction=iu;exports.isNumberArray=Q5;exports.isRowSelected=Yg;exports.isSubRowSelected=fd;exports.makeStateUpdater=Ut;exports.memo=ZA;exports.noop=Tq;exports.orderColumns=rB;exports.passiveEventSupported=iB;exports.reSplitAlphaNumeric=dd;exports.selectRowsFn=bf;exports.shouldAutoRemoveFilter=Ip;exports.sortingFns=Co;exports.toggleVariants=V9;exports.useAuthors=quA;exports.useFormField=eu;exports.useReactTable=zB;exports.useSidebar=ru;exports.useTheme=_aA;exports.useWazUIEnvironment=WuA;exports.withReactQuery=toA;
|
|
2380
|
+
//# sourceMappingURL=index-g3cHKL0U.cjs.map
|