PageSourceSearch

https://saastore.ai/assets/EditProject-OTadZhkm.js

js saastore.ai collected 2026-10-05 12:33:41 UTC 83,548 bytes, 9 lines download raw bytes

1import{r as o,b5 as pe,X as et,u as Ke,j as s,h as ve,t as H,Y as Zn,aL as en,ab as tn,B as xt,g as Qn,m as er,a1 as nn,N as tr,aT as rn,L as sn,k as nr,I as mt,aR as rr,aS as sr,aU as ir,V as zt,T as ar,Q as or,R as lr,W as cr,aO as dr}from"./index-p4935ASL.js";import{a as ur,m as an,c as on,L as fr,G as ln,K as pr,e as hr,V as gr,S as mr,A as br,C as xr,r as vr,p as yr,f as wr}from"./VideoUploader-CV3FK1y0.js";import{C as cn,I as jr}from"./ImageCropDialog-7pDEFe07.js";import{U as tt}from"./upload-dQRfKndM.js";import{T as Sr}from"./textarea-DwEK1Os0.js";import{A as _r}from"./arrow-left-BWz8kzA2.js";import{S as Cr}from"./save-D2g-EGLB.js";import"./trash-2-DTM7kMBu.js";function Nr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.useMemo(()=>r=>{t.forEach(a=>a(r))},t)}const _t=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ve(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ht(e){return"nodeType"in e}function he(e){var t,n;return e?Ve(e)?e:Ht(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Xt(e){const{Document:t}=he(e);return e instanceof t}function ct(e){return Ve(e)?!1:e instanceof he(e).HTMLElement}function kn(e){return e instanceof he(e).SVGElement}function Ge(e){return e?Ve(e)?e.document:Ht(e)?Xt(e)?e:ct(e)||kn(e)?e.ownerDocument:document:document:document}const ke=_t?o.useLayoutEffect:o.useEffect;function qt(e){const t=o.useRef(e);return ke(()=>{t.current=e}),o.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t.current==null?void 0:t.current(...r)},[])}function Dr(){const e=o.useRef(null),t=o.useCallback((r,a)=>{e.current=setInterval(r,a)},[]),n=o.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function it(e,t){t===void 0&&(t=[e]);const n=o.useRef(e);return ke(()=>{n.current!==e&&(n.current=e)},t),n}function dt(e,t){const n=o.useRef();return o.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function yt(e){const t=qt(e),n=o.useRef(null),r=o.useCallback(a=>{a!==n.current&&t?.(a,n.current),n.current=a},[]);return[n,r]}function Pt(e){const t=o.useRef();return o.useEffect(()=>{t.current=e},[e]),t.current}let It={};function ut(e,t){return o.useMemo(()=>{if(t)return t;const n=It[e]==null?0:It[e]+1;return It[e]=n,e+"-"+n},[e,t])}function An(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((i,l)=>{const c=Object.entries(l);for(const[u,h]of c){const f=i[u];f!=null&&(i[u]=f+e*h)}return i},{...t})}}const Je=An(1),at=An(-1);function Rr(e){return"clientX"in e&&"clientY"in e}function Yt(e){if(!e)return!1;const{KeyboardEvent:t}=he(e.target);return t&&e instanceof t}function Er(e){if(!e)return!1;const{TouchEvent:t}=he(e.target);return t&&e instanceof t}function Bt(e){if(Er(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Rr(e)?{x:e.clientX,y:e.clientY}:null}const ot=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ot.Translate.toString(e),ot.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),dn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function kr(e){return e.matches(dn)?e:e.querySelector(dn)}const Ar={display:"none"};function Mr(e){let{id:t,value:n}=e;return pe.createElement("div",{id:t,style:Ar},n)}function Tr(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const a={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 pe.createElement("div",{id:t,style:a,role:"status","aria-live":r,"aria-atomic":!0},n)}function Ir(){const[e,t]=o.useState("");return{announce:o.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Mn=o.createContext(null);function Or(e){const t=o.useContext(Mn);o.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Lr(){const[e]=o.useState(()=>new Set),t=o.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[o.useCallback(r=>{let{type:a,event:i}=r;e.forEach(l=>{var c;return(c=l[a])==null?void 0:c.call(l,i)})},[e]),t]}const Fr={draggable:`
2    To pick up a draggable item, press the space bar.
3    While dragging, use the arrow keys to move the item.
4    Press space again to drop the item in its new position, or press escape to cancel.
5  `},zr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Pr(e){let{announcements:t=zr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=Fr}=e;const{announce:i,announcement:l}
5=Ir(),c=ut("DndLiveRegion"),[u,h]=o.useState(!1);if(o.useEffect(()=>{h(!0)},[]),Or(o.useMemo(()=>({onDragStart(p){let{active:m}=p;i(t.onDragStart({active:m}))},onDragMove(p){let{active:m,over:g}=p;t.onDragMove&&i(t.onDragMove({active:m,over:g}))},onDragOver(p){let{active:m,over:g}=p;i(t.onDragOver({active:m,over:g}))},onDragEnd(p){let{active:m,over:g}=p;i(t.onDragEnd({active:m,over:g}))},onDragCancel(p){let{active:m,over:g}=p;i(t.onDragCancel({active:m,over:g}))}}),[i,t])),!u)return null;const f=pe.createElement(pe.Fragment,null,pe.createElement(Mr,{id:r,value:a.draggable}),pe.createElement(Tr,{id:c,announcement:l}));return n?et.createPortal(f,n):f}var G;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(G||(G={}));function wt(){}function un(e,t){return o.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Br(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Ne=Object.freeze({x:0,y:0});function Tn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function In(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function $r(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function fn(e){let{left:t,top:n,height:r,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+r},{x:t+a,y:n+r}]}function On(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function pn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Ur=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=pn(t,t.left,t.top),i=[];for(const l of r){const{id:c}=l,u=n.get(c);if(u){const h=Tn(pn(u),a);i.push({id:c,data:{droppableContainer:l,value:h}})}}return i.sort(In)},Wr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=fn(t),i=[];for(const l of r){const{id:c}=l,u=n.get(c);if(u){const h=fn(u),f=a.reduce((m,g,S)=>m+Tn(h[S],g),0),p=Number((f/4).toFixed(4));i.push({id:c,data:{droppableContainer:l,value:p}})}}return i.sort(In)};function Hr(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),l=a-r,c=i-n;if(r<a&&n<i){const u=t.width*t.height,h=e.width*e.height,f=l*c,p=f/(u+h-f);return Number(p.toFixed(4))}return 0}const Xr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const u=Hr(c,t);u>0&&a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort($r)};function qr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Ln(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ne}function Yr(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];return a.reduce((l,c)=>({...l,top:l.top+e*c.y,bottom:l.bottom+e*c.y,left:l.left+e*c.x,right:l.right+e*c.x}),{...n})}}const Jr=Yr(1);function Kr(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Vr(e,t,n){const r=Kr(t);if(!r)return e;const{scaleX:a,scaleY:i,x:l,y:c}=r,u=e.left-l-(1-a)*parseFloat(n),h=e.top-c-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=a?e.width/a:e.width,p=i?e.height/i:e.height;return{width:f,height:p,top:h,right:u+f,bottom:h+p,left:u}}const Gr={ignoreTransform:!1};function Ze(e,t){t===void 0&&(t=Gr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:h,transformOrigin:f}=he(e).getComputedStyle(e);h&&(n=Vr(n,h,f))}const{top:r,left:a,width:i,height:l,bottom:c,right:u}=n;return{top:r,left:a,width:i,height:l,bottom:c,right:u}}function hn(e){return Ze(e,{ignoreTransform:!0})}function Zr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Qr(e,t){return t===void 0&&(t=he(e).getComputedStyle(e)),t.position==="fixed"}
5function es(e,t){t===void 0&&(t=he(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const i=t[a];return typeof i=="string"?n.test(i):!1})}function Ct(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(Xt(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!ct(a)||kn(a)||n.includes(a))return n;const i=he(e).getComputedStyle(a);return a!==e&&es(a,i)&&n.push(a),Qr(a,i)?n:r(a.parentNode)}return e?r(e):n}function Fn(e){const[t]=Ct(e,1);return t??null}function Ot(e){return!_t||!e?null:Ve(e)?e:Ht(e)?Xt(e)||e===Ge(e).scrollingElement?window:ct(e)?e:null:null}function zn(e){return Ve(e)?e.scrollX:e.scrollLeft}function Pn(e){return Ve(e)?e.scrollY:e.scrollTop}function $t(e){return{x:zn(e),y:Pn(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function Bn(e){return!_t||!e?!1:e===document.scrollingElement}function $n(e){const t={x:0,y:0},n=Bn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:a,isLeft:i,isBottom:l,isRight:c,maxScroll:r,minScroll:t}}const ts={x:.2,y:.2};function ns(e,t,n,r,a){let{top:i,left:l,right:c,bottom:u}=n;r===void 0&&(r=10),a===void 0&&(a=ts);const{isTop:h,isBottom:f,isLeft:p,isRight:m}=$n(e),g={x:0,y:0},S={x:0,y:0},b={height:t.height*a.y,width:t.width*a.x};return!h&&i<=t.top+b.height?(g.y=Q.Backward,S.y=r*Math.abs((t.top+b.height-i)/b.height)):!f&&u>=t.bottom-b.height&&(g.y=Q.Forward,S.y=r*Math.abs((t.bottom-b.height-u)/b.height)),!m&&c>=t.right-b.width?(g.x=Q.Forward,S.x=r*Math.abs((t.right-b.width-c)/b.width)):!p&&l<=t.left+b.width&&(g.x=Q.Backward,S.x=r*Math.abs((t.left+b.width-l)/b.width)),{direction:g,speed:S}}function rs(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:l}=window;return{top:0,left:0,right:i,bottom:l,width:i,height:l}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Un(e){return e.reduce((t,n)=>Je(t,$t(n)),Ne)}function ss(e){return e.reduce((t,n)=>t+zn(n),0)}function is(e){return e.reduce((t,n)=>t+Pn(n),0)}function as(e,t){if(t===void 0&&(t=Ze),!e)return;const{top:n,left:r,bottom:a,right:i}=t(e);Fn(e)&&(a<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const os=[["x",["left","right"],ss],["y",["top","bottom"],is]];class Jt{constructor(t,n){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 r=Ct(n),a=Un(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,l,c]of os)for(const u of l)Object.defineProperty(this,u,{get:()=>{const h=c(r),f=a[i]-h;return this.rect[u]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class nt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ls(e){const{EventTarget:t}=he(e);return e instanceof t?e:Ge(e)}function Lt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var _e;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(_e||(_e={}));function gn(e){e.preventDefault()}function cs(e){e.stopPropagation()}var T;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(T||(T={}));const Wn={start:[T.Space,T.Enter],cancel:[T.Esc],end:[T.Space,T.Enter,T.Tab]},ds=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case T.Right:return{...n,x:n.x+25};case T.Left:return{...n,x:n.x-25};case T.Down:return{...n,y:n.y+25};case T.Up:return{...n,y:n.y-25}}};class Kt{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new nt(Ge(n)),this.windowListeners=new nt(he(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(_e.Resize,this.handleCancel),this.windowListeners.add(_e.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(_e.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&as(r),n(Ne)}handleKeyDown(t){if(Yt(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:i=Wn,coordinateGetter:l=ds,scrollBehavior:c="smooth"}
5=a,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:h}=r.current,f=h?{x:h.left,y:h.top}:Ne;this.referenceCoordinates||(this.referenceCoordinates=f);const p=l(t,{active:n,context:r.current,currentCoordinates:f});if(p){const m=at(p,f),g={x:0,y:0},{scrollableAncestors:S}=r.current;for(const b of S){const y=t.code,{isTop:_,isRight:R,isLeft:w,isBottom:j,maxScroll:N,minScroll:k}=$n(b),C=rs(b),D={x:Math.min(y===T.Right?C.right-C.width/2:C.right,Math.max(y===T.Right?C.left:C.left+C.width/2,p.x)),y:Math.min(y===T.Down?C.bottom-C.height/2:C.bottom,Math.max(y===T.Down?C.top:C.top+C.height/2,p.y))},A=y===T.Right&&!R||y===T.Left&&!w,z=y===T.Down&&!j||y===T.Up&&!_;if(A&&D.x!==p.x){const M=b.scrollLeft+m.x,X=y===T.Right&&M<=N.x||y===T.Left&&M>=k.x;if(X&&!m.y){b.scrollTo({left:M,behavior:c});return}X?g.x=b.scrollLeft-M:g.x=y===T.Right?b.scrollLeft-N.x:b.scrollLeft-k.x,g.x&&b.scrollBy({left:-g.x,behavior:c});break}else if(z&&D.y!==p.y){const M=b.scrollTop+m.y,X=y===T.Down&&M<=N.y||y===T.Up&&M>=k.y;if(X&&!m.x){b.scrollTo({top:M,behavior:c});return}X?g.y=b.scrollTop-M:g.y=y===T.Down?b.scrollTop-N.y:b.scrollTop-k.y,g.y&&b.scrollBy({top:-g.y,behavior:c});break}}
5this.handleMove(t,Je(at(p,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Kt.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Wn,onActivation:a}=t,{active:i}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const c=i.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),a?.({event:e.nativeEvent}),!0)}return!1}}];function mn(e){return!!(e&&"distance"in e)}function bn(e){return!!(e&&"delay"in e)}class Vt{constructor(t,n,r){var a;r===void 0&&(r=ls(t.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=t,this.events=n;const{event:i}=t,{target:l}=i;this.props=t,this.events=n,this.document=Ge(l),this.documentListeners=new nt(this.document),this.listeners=new nt(r),this.windowListeners=new nt(he(l)),this.initialCoordinates=(a=Bt(i))!=null?a:Ne,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:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(_e.Resize,this.handleCancel),this.windowListeners.add(_e.DragStart,gn),this.windowListeners.add(_e.VisibilityChange,this.handleCancel),this.windowListeners.add(_e.ContextMenu,gn),this.documentListeners.add(_e.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(bn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(mn(n)){this.handlePending(n);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(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(_e.Click,cs,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(_e.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:i}=this,{onMove:l,options:{activationConstraint:c}}=i;if(!a)return;const u=(n=Bt(t))!=null?n:Ne,h=at(a,u);if(!r&&c){if(mn(c)){if(c.tolerance!=null&&Lt(h,c.tolerance))return this.handleCancel();if(Lt(h,c.distance))return this.handleStart()}if(bn(c)&&Lt(h,c.tolerance))return this.handleCancel();this.handlePending(c,h);return}t.cancelable&&t.preventDefault(),l(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===T.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const us={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Gt extends Vt{constructor(t){const{event:n}=t,r=Ge(n.target);super(t,us,r)}}Gt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const fs={move:{name:"mousemove"},end:{name:"mouseup"}};var Ut;(function(e){e[e.RightClick=2]="RightClick"})(Ut||(Ut={}));class ps extends Vt{constructor(t){super(t,fs,Ge(t.event.target))}}ps.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ut.RightClick?!1:(r?.({event:n}),!0)}}];const Ft={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hs extends Vt{constructor(t){super(t,Ft)}static setup(){return window.addEventListener(Ft.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ft.move.name,t)};function t(){}}}hs.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var rt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(rt||(rt={}));var jt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="Rever
5sedTreeOrder"})(jt||(jt={}));function gs(e){let{acceleration:t,activator:n=rt.Pointer,canScroll:r,draggingRect:a,enabled:i,interval:l=5,order:c=jt.TreeOrder,pointerCoordinates:u,scrollableAncestors:h,scrollableAncestorRects:f,delta:p,threshold:m}=e;const g=bs({delta:p,disabled:!i}),[S,b]=Dr(),y=o.useRef({x:0,y:0}),_=o.useRef({x:0,y:0}),R=o.useMemo(()=>{switch(n){case rt.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case rt.DraggableRect:return a}},[n,a,u]),w=o.useRef(null),j=o.useCallback(()=>{const k=w.current;if(!k)return;const C=y.current.x*_.current.x,D=y.current.y*_.current.y;k.scrollBy(C,D)},[]),N=o.useMemo(()=>c===jt.TreeOrder?[...h].reverse():h,[c,h]);o.useEffect(()=>{if(!i||!h.length||!R){b();return}for(const k of N){if(r?.(k)===!1)continue;const C=h.indexOf(k),D=f[C];if(!D)continue;const{direction:A,speed:z}=ns(k,D,R,t,m);for(const M of["x","y"])g[M][A[M]]||(z[M]=0,A[M]=0);if(z.x>0||z.y>0){b(),w.current=k,S(j,l),y.current=z,_.current=A;return}}y.current={x:0,y:0},_.current={x:0,y:0},b()},[t,j,r,b,i,l,JSON.stringify(R),JSON.stringify(g),S,h,N,f,JSON.stringify(m)])}const ms={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function bs(e){let{delta:t,disabled:n}=e;const r=Pt(t);return dt(a=>{if(n||!r||!a)return ms;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:a.x[Q.Backward]||i.x===-1,[Q.Forward]:a.x[Q.Forward]||i.x===1},y:{[Q.Backward]:a.y[Q.Backward]||i.y===-1,[Q.Forward]:a.y[Q.Forward]||i.y===1}}},[n,t,r])}function xs(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return dt(a=>{var i;return t==null?null:(i=r??a)!=null?i:null},[r,t])}function vs(e,t){return o.useMemo(()=>e.reduce((n,r)=>{const{sensor:a}=r,i=a.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...i]},[]),[e,t])}var lt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(lt||(lt={}));var Wt;(function(e){e.Optimized="optimized"})(Wt||(Wt={}));const xn=new Map;function ys(e,t){let{dragging:n,dependencies:r,config:a}=t;const[i,l]=o.useState(null),{frequency:c,measure:u,strategy:h}=a,f=o.useRef(e),p=y(),m=it(p),g=o.useCallback(function(_){_===void 0&&(_=[]),!m.current&&l(R=>R===null?_:R.concat(_.filter(w=>!R.includes(w))))},[m]),S=o.useRef(null),b=dt(_=>{if(p&&!n)return xn;if(!_||_===xn||f.current!==e||i!=null){const R=new Map;for(let w of e){if(!w)continue;if(i&&i.length>0&&!i.includes(w.id)&&w.rect.current){R.set(w.id,w.rect.current);continue}const j=w.node.current,N=j?new Jt(u(j),j):null;w.rect.current=N,N&&R.set(w.id,N)}return R}return _},[e,i,n,p,u]);return o.useEffect(()=>{f.current=e},[e]),o.useEffect(()=>{p||g()},[n,p]),o.useEffect(()=>{i&&i.length>0&&l(null)},[JSON.stringify(i)]),o.useEffect(()=>{p||typeof c!="number"||S.current!==null||(S.current=setTimeout(()=>{g(),S.current=null},c))},[c,p,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:i!=null};function y(){switch(h){case lt.Always:return!1;case lt.BeforeDragging:return n;default:return!n}}}function Hn(e,t){return dt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ws(e,t){return Hn(e,t)}function js(e){let{callback:t,disabled:n}=e;const r=qt(t),a=o.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return o.useEffect(()=>()=>a?.disconnect(),[a]),a}function Nt(e){let{callback:t,disabled:n}=e;const r=qt(t),a=o.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return o.useEffect(()=>()=>a?.disconnect(),[a]),a}function Ss(e){return new Jt(Ze(e),e)}
5function vn(e,t,n){t===void 0&&(t=Ss);const[r,a]=o.useState(null);function i(){a(u=>{if(!e)return null;if(e.isConnected===!1){var h;return(h=u??n)!=null?h:null}const f=t(e);return JSON.stringify(u)===JSON.stringify(f)?u:f})}const l=js({callback(u){if(e)for(const h of u){const{type:f,target:p}=h;if(f==="childList"&&p instanceof HTMLElement&&p.contains(e)){i();break}}}}),c=Nt({callback:i});return ke(()=>{i(),e?(c?.observe(e),l?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),l?.disconnect())},[e]),r}function _s(e){const t=Hn(e);return Ln(e,t)}const yn=[];function Cs(e){const t=o.useRef(e),n=dt(r=>e?r&&r!==yn&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ct(e):yn,[e]);return o.useEffect(()=>{t.current=e},[e]),n}function Ns(e){const[t,n]=o.useState(null),r=o.useRef(e),a=o.useCallback(i=>{const l=Ot(i.target);l&&n(c=>c?(c.set(l,$t(l)),new Map(c)):null)},[]);return o.useEffect(()=>{const i=r.current;if(e!==i){l(i);const c=e.map(u=>{const h=Ot(u);return h?(h.addEventListener("scroll",a,{passive:!0}),[h,$t(h)]):null}).filter(u=>u!=null);n(c.length?new Map(c):null),r.current=e}return()=>{l(e),l(i)};
5function l(c){c.forEach(u=>{const h=Ot(u);h?.removeEventListener("scroll",a)})}},[a,e]),o.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,l)=>Je(i,l),Ne):Un(e):Ne,[e,t])}function wn(e,t){t===void 0&&(t=[]);const n=o.useRef(null);return o.useEffect(()=>{n.current=null},t),o.useEffect(()=>{const r=e!==Ne;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?at(e,n.current):Ne}function Ds(e){o.useEffect(()=>{if(!_t)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Rs(e,t){return o.useMemo(()=>e.reduce((n,r)=>{let{eventName:a,handler:i}=r;return n[a]=l=>{i(l,t)},n},{}),[e,t])}function Xn(e){return o.useMemo(()=>e?Zr(e):null,[e])}const jn=[];function Es(e,t){t===void 0&&(t=Ze);const[n]=e,r=Xn(n?he(n):null),[a,i]=o.useState(jn);function l(){i(()=>e.length?e.map(u=>Bn(u)?r:new Jt(t(u),u)):jn)}const c=Nt({callback:l});return ke(()=>{c?.disconnect(),l(),e.forEach(u=>c?.observe(u))},[e]),a}function ks(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ct(t)?t:e}function As(e){let{measure:t}=e;const[n,r]=o.useState(null),a=o.useCallback(h=>{for(const{target:f}of h)if(ct(f)){r(p=>{const m=t(f);return p?{...p,width:m.width,height:m.height}:m});break}},[t]),i=Nt({callback:a}),l=o.useCallback(h=>{const f=ks(h);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[c,u]=yt(l);return o.useMemo(()=>({nodeRef:c,rect:n,setRef:u}),[n,c,u])}const Ms=[{sensor:Gt,options:{}},{sensor:Kt,options:{}}],Ts={current:{}},vt={draggable:{measure:hn},droppable:{measure:hn,strategy:lt.WhileDragging,frequency:Wt.Optimized},dragOverlay:{measure:Ze}};class st extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Is={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new st,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:vt,measureDroppableContainers:wt,windowRect:null,measuringScheduled:!1},Os={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:wt,draggableNodes:new Map,over:null,measureDroppableContainers:wt},Dt=o.createContext(Os),qn=o.createContext(Is);function Ls(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new st}}}function Fs(e,t){switch(t.type){case G.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case G.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case G.DragEnd:case G.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case G.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new st(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case G.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const l=new st(e.droppable.containers);return l.set(n,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:l}}}case G.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new st(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function zs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=o.useContext(Dt),i=Pt(r),l=Pt(n?.id);return o.useEffect(()=>{if(!t&&!r&&i&&l!=null){if(!Yt(i)||document.activeElement===i.target)return;const c=a.get(l);if(!c)return;const{activatorNode:u,node:h}=c;if(!u.current&&!h.current)return;requestAnimationFrame(()=>{for(const f of[u.current,h.current]){if(!f)continue;const p=kr(f);if(p){p.focus();break}}})}},[r,t,a,l,i]),null}function Ps(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,i)=>i({transform:a,...r}),n):n}function Bs(e){return o.useMemo(()=>({draggable:{...vt.draggable,...e?.draggable},droppable:{...vt.droppable,...e?.droppable},dragOverlay:{...vt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function $s(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const i=o.useRef(!1),{x:l,y:c}=typeof a=="boolean"?{x:a,y:a}:a;ke(()=>{if(!l&&!c||!t){i.current=!1;return}if(i.current||!r)return;const h=t?.node.current;if(!h||h.isConnected===!1)return;const f=n(h),p=Ln(f,r);if(l||(p.x=0),c||(p.y=0),i.current=!0,Math.abs(p.x)>0||Math.abs(p.y)>0){const m=Fn(h);m&&m.scrollBy({top:p.y,left:p.x})}},[t,l,c,r,n])}const Yn=o.createContext({...Ne,scaleX:1,scaleY:1}
5);var Fe;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Fe||(Fe={}));const Us=o.memo(function(t){var n,r,a,i;let{id:l,accessibility:c,autoScroll:u=!0,children:h,sensors:f=Ms,collisionDetection:p=Xr,measuring:m,modifiers:g,...S}=t;const b=o.useReducer(Fs,void 0,Ls),[y,_]=b,[R,w]=Lr(),[j,N]=o.useState(Fe.Uninitialized),k=j===Fe.Initialized,{draggable:{active:C,nodes:D,translate:A},droppable:{containers:z}}=y,M=C!=null?D.get(C):null,X=o.useRef({initial:null,translated:null}),ee=o.useMemo(()=>{var Z;return C!=null?{id:C,data:(Z=M?.data)!=null?Z:Ts,rect:X}:null},[C,M]),oe=o.useRef(null),[$,L]=o.useState(null),[I,W]=o.useState(null),q=it(S,Object.values(S)),ce=ut("DndDescribedBy",l),ye=o.useMemo(()=>z.getEnabled(),[z]),Y=Bs(m),{droppableRects:J,measureDroppableContainers:ge,measuringScheduled:Ae}=ys(ye,{dragging:k,dependencies:[A.x,A.y],config:Y.droppable}),re=xs(D,C),He=o.useMemo(()=>I?Bt(I):null,[I]),De=Tt(),me=ws(re,Y.draggable.measure);$s({activeNode:C!=null?D.get(C):null,config:De.layoutShiftCompensation,initialRect:me,measure:Y.draggable.measure});const O=vn(re,Y.draggable.measure,me),be=vn(re?re.parentElement:null),de=o.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:J,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ce=z.getNodeFor((n=de.current.over)==null?void 0:n.id),we=As({measure:Y.dragOverlay.measure}),Me=(r=we.nodeRef.current)!=null?r:re,Re=k?(a=we.rect)!=null?a:O:null,te=!!(we.nodeRef.current&&we.rect),Te=_s(te?null:O),ze=Xn(Me?he(Me):null),je=Cs(k?Ce??re:null),Pe=Es(je),Be=Ps(g,{transform:{x:A.x-Te.x,y:A.y-Te.y,scaleX:1,scaleY:1},activatorEvent:I,active:ee,activeNodeRect:O,containerNodeRect:be,draggingNodeRect:Re,over:de.current.over,overlayNodeRect:we.rect,scrollableAncestors:je,scrollableAncestorRects:Pe,windowRect:ze}),Ie=He?Je(He,A):null,Oe=Ns(je),P=wn(Oe),Rt=wn(Oe,[O]),ue=Je(Be,P),xe=Re?Jr(Re,Be):null,$e=ee&&xe?p({active:ee,collisionRect:xe,droppableRects:J,droppableContainers:ye,pointerCoordinates:Ie}):null,ft=On($e,"id"),[Ee,pt]=o.useState(null),Et=te?Be:Je(Be,Rt),kt=qr(Et,(i=Ee?.rect)!=null?i:null,O),Ue=o.useRef(null),Xe=o.useCallback((Z,le)=>{let{sensor:se,options:Se}=le;if(oe.current==null)return;const ie=D.get(oe.current);if(!ie)return;const ae=Z.nativeEvent,d=new se({active:oe.current,activeNode:ie,event:ae,options:Se,context:de,onAbort(x){if(!D.get(x))return;const{onDragAbort:E}=q.current,B={id:x};E?.(B),R({type:"onDragAbort",event:B})},onPending(x,F,E,B){if(!D.get(x))return;const{onDragPending:fe}=q.current,K={id:x,constraint:F,initialCoordinates:E,offset:B};fe?.(K),R({type:"onDragPending",event:K})},onStart(x){const F=oe.current;if(F==null)return;const E=D.get(F);if(!E)return;const{onDragStart:B}=q.current,ne={activatorEvent:ae,active:{id:F,data:E.data,rect:X}};et.unstable_batchedUpdates(()=>{B?.(ne),N(Fe.Initializing),_({type:G.DragStart,initialCoordinates:x,active:F}),R({type:"onDragStart",event:ne}),L(Ue.current),W(ae)})},onMove(x){_({type:G.DragMove,coordinates:x})},onEnd:v(G.DragEnd),onCancel:v(G.DragCancel)});Ue.current=d;function v(x){return async function(){const{active:E,collisions:B,over:ne,scrollAdjustedTranslate:fe}=de.current;let K=null;if(E&&fe){const{cancelDrop:U}=q.current;K={activatorEvent:ae,active:E,collisions:B,delta:fe,over:ne},x===G.DragEnd&&typeof U=="function"&&await Promise.resolve(U(K))&&(x=G.DragCancel)}oe.current=null,et.unstable_batchedUpdates(()=>{_({type:x}),N(Fe.Uninitialized),pt(null),L(null),W(null),Ue.current=null;const U=x===G.DragEnd?"onDragEnd":"onDragCancel";if(K){const V=q.current[U];V?.(K),R({type:U,event:K})}})}}},[D]),At=o.useCallback((Z,le)=>(se,Se)=>{const ie=se.nativeEvent,ae=D.get(Se);if(oe.current!==null||!ae||ie.dndKit||ie.defaultPrevented)return;const d={active:ae};Z(se,le.options,d)===!0&&(ie.dndKit={capturedBy:le.sensor},oe.current=Se,Xe(se,le))},[D,Xe]),ht=vs(f,At);Ds(f),ke(()=>{O&&j===Fe.Initializing&&N(Fe.Initialized)},[O,j]),o.useEffect(()=>{const{onDragMove:Z}=q.current,{active:le,activatorEvent:se,collisions:Se,over:ie}=de.current;if(!le||!se)return;const ae={active:le,activatorEvent:se,collisions:Se,delta:{x:ue.x,y:ue.y},over:ie};et.unstable_batchedUpdates(()=>{Z?.(ae),R({type:"onDragMove",event:ae})})},[ue.x,ue.y]),o.useEffect(()=>{const{active:Z,activatorEvent:le,collisions:se,droppableContainers:Se,scrollAdjustedTranslate:ie}=de.current;if(!Z||oe.current==null||!le||!ie)return;const{onDragOver:ae}=q.current,d=Se.get(ft),v=d&&d.rect.current?{id:d.id,rect:d.rect.current,data:d.data,disabled:d.disabled}:null,x={active:Z,activatorEvent:le,collisions:se,delta:{x:ie.x,y:ie.y},over:v};et.unstable_batchedUpdates(()=>{pt(v),ae?.(x),R({type:"onDragOver",event:x})})},[ft]),ke(()=>{de.current={activatorEvent:I,active:ee,activeNode:re,collisionRect:xe,collisions:$e,droppableRects:J,draggableNodes:D,draggingNode:Me,draggingNodeRect:Re,droppableContainers:z,over:Ee,scrollableAncestors:je,scrollAdjustedTranslate:ue},X.current={initial:Re,translated:xe}},[ee,re,$e,xe,D,Me,Re,J,z,Ee,je,ue]),gs({...De,delta:A,draggingRect:xe,pointerCoordinates:Ie,scrollableAncestors:je,scrollableAncestorRects:Pe});const Mt=o.useMemo(()=>({active:ee,activeNode:re,activeNodeRect:O,activatorEvent:I,collisions:$e,containerNodeRect:be,dragOverlay:we,draggableNodes:D,droppableContainers:z,droppableRects:J,over:Ee,measureDroppableContainers:ge,scrollableAncestors:je,scrollableAncestorRects:Pe,measuringConfiguration:Y,measuringScheduled:Ae,windowRect:ze}),[ee,re,O,I,$e,be,we,D,z,J,Ee,ge,je,Pe,Y,Ae,ze]),gt=o.useMemo(()=>({activatorEvent:I,activators:ht,active:ee,activeNodeRect:O,ariaDescribedById:{draggable:ce},dispatch:_,draggableNodes:D,over:Ee,measureDroppableContainers:ge}),[I,ht,ee,O,_,ce,D,Ee,ge]);return pe.createElement(Mn.Provider,{value:w},pe.createElement(Dt.Provider,{value:gt},pe.createElement(qn.Provider,{value:Mt},pe.createElement(Yn.Provider,{value:kt},h)),pe.createElement(zs,{disabled:c?.restoreFocus===!1})),pe.createElement(Pr,{...c,hiddenTextDescribedById:ce}));function Tt(){const Z=$?.autoScrollEnabled===!1,le=typeof u=="object"?u.enabled===!1:u===!1,se=k&&!Z&&!le;return typeof u=="object"?{...u,enabled:se}:{enabled:se}}}),Ws=o.createContext(null),Sn="button",Hs="Draggable";function Xs(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const i=ut(Hs),{activators:l,activatorEvent:c,active:u,activeNodeRect:h,ariaDescribedById:f,draggableNodes:p,over:m}=o.useContext(Dt),{role:g=Sn,roleDescription:S="draggable",tabIndex:b=0}=a??{},y=u?.id===t,_=o.useContext(y?Yn:Ws),[R,w]=yt(),[j,N]=yt(),k=Rs(l,t),C=it(n);ke(()=>(p.set(t,{id:t,key:i,node:R,activatorNode:j,data:C}),()=>{const A=p.get(t);A&&A.key===i&&p.delete(t)}),[p,t]);const D=o.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":y&&g===Sn?!0:void 0,"aria-roledescription":S,"aria-describedby":f.draggable}),[r,g,b,y,S,f.draggable]);return{active:u,activatorEvent:c,activeNodeRect:h,attributes:D,isDragging:y,listeners:r?void 0:k,node:R,over:m,setNodeRef:w,setActivatorNodeRef:N,transform:_}}function qs(){return o.useContext(qn)}const Ys="Droppable",Js={timeout:25};function Ks(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const i=ut(Ys),{active:l,dispatch:c,over:u,measureDroppableContainers:h}=o.useContext(Dt),f=o.useRef({disabled:n}),p=o.useRef(!1),m=o.useRef(null),g=o.useRef(null),{disabled:S,updateMeasurementsFor:b,timeout:y}={...Js,...a},_=it(b??r),R=o.useCallback(()=>
5{if(!p.current){p.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{h(Array.isArray(_.current)?_.current:[_.current]),g.current=null},y)},[y]),w=Nt({callback:R,disabled:S||!l}),j=o.useCallback((D,A)=>{w&&(A&&(w.unobserve(A),p.current=!1),D&&w.observe(D))},[w]),[N,k]=yt(j),C=it(t);return o.useEffect(()=>{!w||!N.current||(w.disconnect(),p.current=!1,w.observe(N.current))},[N,w]),o.useEffect(()=>(c({type:G.RegisterDroppable,element:{id:r,key:i,disabled:n,node:N,rect:m,data:C}}),()=>c({type:G.UnregisterDroppable,key:i,id:r})),[r]),o.useEffect(()=>{n!==f.current.disabled&&(c({type:G.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,c]),{active:l,rect:m,isOver:u?.id===r,node:N,over:u,setNodeRef:k}}function Zt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Vs(e,t){return e.reduce((n,r,a)=>{const i=t.get(r);return i&&(n[a]=i),n},Array(e.length))}function bt(e){return e!==null&&e>=0}function Gs(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Zs(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Qt=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e;const i=Zt(t,r,n),l=t[a],c=i[a];return!c||!l?null:{x:c.left-l.left,y:c.top-l.top,scaleX:c.width/l.width,scaleY:c.height/l.height}},Jn="Sortable",Kn=pe.createContext({activeIndex:-1,containerId:Jn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Qt,disabled:{draggable:!1,droppable:!1}});function Qs(e){let{children:t,id:n,items:r,strategy:a=Qt,disabled:i=!1}=e;const{active:l,dragOverlay:c,droppableRects:u,over:h,measureDroppableContainers:f}=qs(),p=ut(Jn,n),m=c.rect!==null,g=o.useMemo(()=>r.map(k=>typeof k=="object"&&"id"in k?k.id:k),[r]),S=l!=null,b=l?g.indexOf(l.id):-1,y=h?g.indexOf(h.id):-1,_=o.useRef(g),R=!Gs(g,_.current),w=y!==-1&&b===-1||R,j=Zs(i);ke(()=>{R&&S&&f(g)},[R,g,S,f]),o.useEffect(()=>{_.current=g},[g]);const N=o.useMemo(()=>({activeIndex:b,containerId:p,disabled:j,disableTransforms:w,items:g,overIndex:y,useDragOverlay:m,sortedRects:Vs(g,u),strategy:a}),[b,p,j.draggable,j.droppable,w,g,y,u,m,a]);return pe.createElement(Kn.Provider,{value:N},t)}const ei=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return Zt(n,r,a).indexOf(t)},ti=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:i,newIndex:l,previousItems:c,previousContainerId:u,transition:h}=e;return!h||!r||c!==i&&a===l?!1:n?!0:l!==a&&t===u},ni={duration:200,easing:"ease"},Vn="transform",ri=ot.Transition.toString({property:Vn,duration:0,easing:"linear"}),si={roleDescription:"sortable"};function ii(e){let{disabled:t,index:n,node:r,rect:a}=e;const[i,l]=o.useState(null),c=o.useRef(n);return ke(()=>{if(!t&&n!==c.current&&r.current){const u=a.current;if(u){const h=Ze(r.current,{ignoreTransform:!0}),f={x:u.left-h.left,y:u.top-h.top,scaleX:u.width/h.width,scaleY:u.height/h.height};(f.x||f.y)&&l(f)}}n!==c.current&&(c.current=n)},[t,n,r,a]),o.useEffect(()=>{i&&l(null)},[i]),i}function ai(e){let{animateLayoutChanges:t=ti,attributes:n,disabled:r,data:a,getNewIndex:i=ei,id:l,strategy:c,resizeObserverConfig:u,transition:h=ni}=e;const{items:f,containerId:p,activeIndex:m,disabled:g,disableTransforms:S,sortedRects:b,overIndex:y,useDragOverlay:_,strategy:R}=o.useContext(Kn),w=oi(r,g),j=f.indexOf(l),N=o.useMemo(()=>({sortable:{containerId:p,index:j,items:f},...a}),[p,a,j,f]),k=o.useMemo(()=>f.slice(f.indexOf(l)),[f,l]),{rect:C,node:D,isOver:A,setNodeRef:z}=Ks({id:l,data:N,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...u}}),{active:M,activatorEvent:X,activeNodeRect:ee,attributes:oe,setNodeRef:$,listeners:L,isDragging:I,over:W,setActivatorNodeRef:q,transform:ce}=Xs({id:l,data:N,attributes:{...si,...n},disabled:w.draggable}),ye=Nr(z,$),Y=!!M,J=Y&&!S&&bt(m)&&bt(y),ge=!_&&I,Ae=ge&&J?ce:null,He=J?Ae??(c??R)({rects:b,activeNodeRect:ee,activeIndex:m,overIndex:y,index:j}):null,De=bt(m)&&bt(y)?i({id:l,items:f,activeIndex:m,overIndex:y}):j,me=M?.id,O=o.useRef({activeId:me,items:f,newIndex:De,containerId:p}),be=f!==O.current.items,de=t({active:M,containerId:p,isDragging:I,isSorting:Y,id:l,index:j,items:f,newIndex:O.current.newIndex,previousItems:O.current.items,previousContainerId:O.current.containerId,transition:h,wasDragging:O.current.activeId!=null}),Ce=ii({disabled:!de,index:j,node:D,rect:C});return o.useEffect(()=>{Y&&O.current.newIndex!==De&&(O.current.newIndex=De),p!==O.current.containerId&&(O.current.containerId=p),f!==O.current.items&&(O.current.items=f)},[Y,De,p,f]),o.useEffect(()=>{if(me===O.current.activeId)return;if(me!=null&&O.current.activeId==null){O.current.activeId=me;return}const Me=setTimeout(()=>{O.current.activeId=me},50);return()=>
5clearTimeout(Me)},[me]),{active:M,activeIndex:m,attributes:oe,data:N,rect:C,index:j,newIndex:De,items:f,isOver:A,isSorting:Y,isDragging:I,listeners:L,node:D,overIndex:y,over:W,setNodeRef:ye,setActivatorNodeRef:q,setDroppableNodeRef:z,setDraggableNodeRef:$,transform:Ce??He,transition:we()};function we(){if(Ce||be&&O.current.newIndex===j)return ri;if(!(ge&&!Yt(X)||!h)&&(Y||de))return ot.Transition.toString({...h,property:Vn})}}function oi(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function St(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const li=[T.Down,T.Right,T.Up,T.Left],ci=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:a,droppableContainers:i,over:l,scrollableAncestors:c}}=t;if(li.includes(e.code)){if(e.preventDefault(),!n||!r)return;const u=[];i.getEnabled().forEach(p=>{if(!p||p!=null&&p.disabled)return;const m=a.get(p.id);if(m)switch(e.code){case T.Down:r.top<m.top&&u.push(p);break;case T.Up:r.top>m.top&&u.push(p);break;case T.Left:r.left>m.left&&u.push(p);break;case T.Right:r.left<m.left&&u.push(p);break}});const h=Wr({collisionRect:r,droppableRects:a,droppableContainers:u});let f=On(h,"id");if(f===l?.id&&h.length>1&&(f=h[1].id),f!=null){const p=i.get(n.id),m=i.get(f),g=m?a.get(m.id):null,S=m?.node.current;if(S&&g&&p&&m){const y=Ct(S).some((k,C)=>c[C]!==k),_=Gn(p,m),R=di(p,m),w=y||!_?{x:0,y:0}:{x:R?r.width-g.width:0,y:R?r.height-g.height:0},j={x:g.left,y:g.top};return w.x&&w.y?j:at(j,w)}}}};function Gn(e,t){return!St(e)||!St(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function di(e,t){return!St(e)||!St(t)||!Gn(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function ui({screenshot:e,onDelete:t,onAdjust:n}){const{t:r}=Ke(),{attributes:a,listeners:i,setNodeRef:l,transform:c,transition:u,isDragging:h}=ai({id:e.id}),f={transform:ot.Transform.toString(c),transition:u};return s.jsxs("div",{ref:l,style:f,className:`relative group rounded-lg overflow-hidden ${h?"opacity-50 ring-2 ring-[var(--accent-primary)]":""}`,children:[s.jsx("img",{src:e.url,alt:r("image.screenshot_alt"),className:"w-full h-28 object-cover"}),s.jsx("button",{...a,...i,"aria-label":r("image.reorder_aria"),className:"absolute top-1 start-1 p-1.5 rounded bg-black/40 text-white hover:text-[var(--accent-primary)] cursor-grab active:cursor-grabbing opacity-0 group-hover:opacity-100 transition-opacity",style:{minWidth:44,minHeight:44,display:"flex",alignItems:"center",justifyContent:"center"},children:s.jsx(ur,{size:20})}),n&&s.jsx("button",{onClick:()=>n(e),className:"absolute bottom-1 start-1 px-2 py-1 rounded bg-black/40 text-white text-xs hover:bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity",children:r("image.adjust")}),t&&s.jsx("button",{onClick:()=>t(e.id),"aria-label":r("image.remove_aria"),className:"absolute top-1 end-1 w-6 h-6 rounded-full bg-[var(--destructive)]/80 text-white flex items-center justify-center hover:bg-[var(--destructive)] opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsx(Zn,{size:14})})]})}function fi({projectId:e,screenshots:t,onScreenshotsChange:n,onDelete:r,onAdjust:a}){const{t:i}=Ke(),l=Br(un(Gt,{activationConstraint:{distance:5}}),un(Kt,{coordinateGetter:ci})),c=async u=>{const{active:h,over:f}=u;if(!f||h.id===f.id)return;const p=t.findIndex(S=>S.id===h.id),m=t.findIndex(S=>S.id===f.id),g=Zt(t,p,m);n(g.map((S,b)=>({...S,sort_order:b})));try{await ve.put(`/projects/${e}/screenshots/reorder`,{order:g.map(S=>S.id)})}catch{n(t),H.error(i("image.save_order_failed"))}};return t.length===0?s.jsx("p",{className:"text-sm text-muted-foreground py-4",children:i("image.no_screenshots")}):s.jsx(Us,{sensors:l,collisionDetection:Ur,onDragEnd:c,children:s.jsx(Qs,{items:t.map(u=>u.id),strategy:Qt,children:s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:t.map(u=>s.jsx(ui,{screenshot:u,onDelete:r,onAdjust:a},u.id))})})})}async function _n(e,t){const n=new Image;n.crossOrigin="anonymous",await new Promise((i,l)=>{n.onload=()=>i(),n.onerror=l,n.src=e});const r=document.createElement("canvas");r.width=t.width,r.height=t.height;const a=r.getContext("2d");if(!a)throw new Error("Failed to get canvas context");return a.drawImage(n,t.x,t.y,t.width,t.height,0,0,t.width,t.height),new Promise((i,l)=>{r.toBlob(c=>c?i(c):l(new Error("Canvas toBlob failed")),"image/png")})}
5function Cn({imageUrl:e,area:t,natural:n,displayWidth:r,displayHeight:a,className:i,style:l}){if(!t||!n)return s.jsx("div",{className:i,style:{width:r,height:a,background:"#f3f4f6",...l}});const c=r/t.width;return s.jsx("div",{className:i,style:{width:r,height:a,backgroundImage:`url(${e})`,backgroundSize:`${n.w*c}px ${n.h*c}px`,backgroundPosition:`-${t.x*c}px -${t.y*c}px`,backgroundRepeat:"no-repeat",...l}})}const pi=o.forwardRef(function({sourceImageUrl:t,onSelectFile:n,onReplace:r,projectTitle:a,categoryLabel:i,onApply:l,onCancel:c,onReadyChange:u},h){const{t:f}=Ke(),p=a||f("image.default_app_title"),m=i||f("image.default_category"),g=o.useRef(null),[S,b]=o.useState("square"),[y,_]=o.useState({x:0,y:0}),[R,w]=o.useState(1),[j,N]=o.useState(null),[k,C]=o.useState({x:0,y:0}),[D,A]=o.useState(1),[z,M]=o.useState(null),[X,ee]=o.useState(null);o.useEffect(()=>{if(b("square"),_({x:0,y:0}),w(1),C({x:0,y:0}),A(1),ee(null),N(null),M(null),!t)return;let L=!1;const I=new Image;return I.onload=()=>{if(L||I.naturalHeight===0)return;const W=I.naturalWidth,q=I.naturalHeight;ee({w:W,h:q});const ce=Math.min(W,q);N({x:(W-ce)/2,y:(q-ce)/2,width:ce,height:ce});const ye=16/9,Y=W/q,J=Y>=ye?q*ye:W,ge=Y>=ye?q:W/ye;M({x:(W-J)/2,y:(q-ge)/2,width:J,height:ge})},I.src=t,()=>{L=!0}},[t]);const oe=L=>{if(L){if(L.size>5*1024*1024){H.error(f("image.error_file_size"));return}if(!["image/jpeg","image/png","image/webp"].includes(L.type)){H.error(f("image.error_format"));return}n(L)}};if(o.useImperativeHandle(h,()=>({apply:async()=>{if(!t||!j||!z)throw new Error("crop-not-ready");const[L,I]=await Promise.all([_n(t,j),_n(t,z)]),W=5*1024*1024;if(L.size>W||I.size>W)throw H.error(f("image.error_cropped_size")),new Error("cropped-too-large");await l({thumbnailBlob:L,cardBlob:I})},isReady:()=>!!t&&!!j&&!!z}),[t,j,z,l]),o.useEffect(()=>{u?.(!!t&&!!j&&!!z)},[t,j,z,u]),!t)return s.jsxs("div",{className:"border-2 border-dashed border-border rounded-xl p-8 text-center bg-[#FAF9F6] hover:border-[#10B981] transition-colors",children:[s.jsx(tt,{className:"w-10 h-10 mx-auto text-muted-foreground mb-2"}),s.jsx("p",{className:"font-medium",children:f("image.upload_thumbnail")}),s.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:f("image.upload_hint")}),s.jsxs("label",{className:"inline-flex items-center gap-2 px-4 py-2 bg-[#10B981] hover:bg-[#059669] text-white rounded-lg text-sm font-medium cursor-pointer transition-colors",children:[s.jsx(tt,{size:16}),f("image.choose_image"),s.jsx("input",{ref:g,type:"file",accept:"image/png,image/jpeg,image/webp",onChange:L=>{oe(L.target.files?.[0]),L.target.value=""},className:"hidden"})]})]});const $=S==="square";return s.jsxs("div",{className:"space-y-5 border border-border rounded-xl p-5 bg-white",children:[s.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-lg",children:f($?"image.crop_icon_title":"image.crop_card_title")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:f($?"image.crop_icon_desc":"image.crop_card_desc")})]}),s.jsxs("label",{className:"inline-flex items-center gap-2 px-3 py-1.5 bg-gray-100 hover:bg-gray-200 rounded-lg text-sm font-medium cursor-pointer transition-colors whitespace-nowrap",children:[s.jsx(tt,{size:14}),f("image.change_image"),s.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",onChange:L=>{r&&r(),oe(L.target.files?.[0]),L.target.value=""},className:"hidden"})]})]}),$&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"relative w-full max-w-md mx-auto rounded-lg overflow-hidden bg-gray-100 border border-border",style:{height:320},children:s.jsx(cn,{image:t,crop:y,zoom:R,aspect:1,objectFit:"contain",onCropChange:_,onZoomChange:w,onCropComplete:(L,I)=>N(I)})}),s.jsxs("div",{className:"flex items-center gap-2 max-w-md mx-auto",children:[s.jsx("span",{className:"text-xs text-muted-foreground w-10",children:f("image.zoom")}),s.jsx(en,{value:[R],onValueChange:([L])=>w(L),min:1,max:3,step:.05,className:"flex-1"})]}),s.jsxs("div",{className:"bg-white rounded-xl border border-border p-4 shadow-sm max-w-xs mx-auto",children:[s.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-3 text-center",children:f("image.live_preview")}),s.jsxs("div",{className:"flex flex-col items-center text-center",children:[s.jsx("div",{className:"w-20 h-20 rounded-lg overflow-hidden mb-2 bg-gray-100 border border-border",children:s.jsx(Cn,{imageUrl:t,area:j,natural:X,displayWidth:80,displayHeight:80})}),s.jsx("p",{className:"text-sm font-semibold line-clamp-1 w-full",children:p}),s.jsx("p",{className:"text-[11px] text-muted-foreground capitalize line-clamp-1 mb-1",children:m}),s.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[s.jsx(tn,{className:"w-2.5 h-2.5 fill-[#F59
5E0B] text-[#F59E0B]"}),s.jsx("span",{className:"font-semibold text-foreground",children:"4.8"})]})]})]})]}),!$&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"relative w-full max-w-md mx-auto rounded-lg overflow-hidden bg-gray-100 border border-border",style:{height:320},children:s.jsx(cn,{image:t,crop:k,zoom:D,aspect:16/9,objectFit:"contain",onCropChange:C,onZoomChange:A,onCropComplete:(L,I)=>M(I)})}),s.jsxs("div",{className:"flex items-center gap-2 max-w-md mx-auto",children:[s.jsx("span",{className:"text-xs text-muted-foreground w-10",children:f("image.zoom")}),s.jsx(en,{value:[D],onValueChange:([L])=>A(L),min:1,max:3,step:.05,className:"flex-1"})]}),s.jsxs("div",{className:"bg-white rounded-xl border border-border shadow-sm overflow-hidden max-w-sm mx-auto",children:[s.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground px-3 pt-3 text-center",children:f("image.live_preview")}),s.jsx(Cn,{imageUrl:t,area:z,natural:X,displayWidth:384,displayHeight:216,className:"max-w-full mt-2"}),s.jsxs("div",{className:"p-3 space-y-1",children:[s.jsx("p",{className:"text-sm font-semibold line-clamp-1",children:p}),s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 min-h-[2rem]",dir:"auto",children:f("image.preview_tagline")}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(tn,{className:"w-3 h-3 fill-[#F59E0B] text-[#F59E0B]"}),s.jsx("span",{className:"font-medium",children:"4.8"})]}),s.jsx("span",{className:"text-muted-foreground capitalize line-clamp-1",children:m})]})]})]})]}),s.jsxs("div",{className:"flex justify-between gap-2 pt-3 border-t border-border",children:[s.jsxs("div",{className:"flex gap-2",children:[c&&$&&s.jsx(xt,{type:"button",variant:"outline",onClick:c,children:f("image.cancel")}),!$&&s.jsx(xt,{type:"button",variant:"outline",onClick:()=>b("square"),children:f("image.back_to_icon")})]}),$&&s.jsx(xt,{type:"button",onClick:()=>b("wide"),disabled:!j,className:"bg-[#10B981] hover:bg-[#059669] text-white",children:f("image.next_catalog_card")})]})]})});function Nn(e,t){return e==="free"||e==="freemium"||e==="subscription"?e:t>0?"subscription":"free"}function Dn(e){return e==="ILS"?"ILS":"USD"}const Rn=80,En=1e3;function hi(e,t){if(!e)return"";const n=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(n<60)return t("edit.time.just_now");const r=Math.floor(n/60);if(r<60)return t("edit.time.min_ago",{n:r});const a=Math.floor(r/60);if(a<24)return t("edit.time.hours_ago",{n:a});const i=Math.floor(a/24);if(i<30)return t("edit.time.days_ago",{n:i});const l=Math.floor(i/30);return t("edit.time.months_ago",{n:l})}function gi({status:e}){const{t}=Ke("wizard");return e==="approved"?s.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-[#ECFDF5] text-[#065F46] text-[11px] font-medium",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#10B981]"}),t("edit.status_approved")]}):e==="rejected"?s.jsx(dr,{variant:"destructive",children:t("edit.status_rejected")}):s.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-amber-100 text-amber-800 text-[11px] font-medium",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500"}),t("edit.status_pending")]})}function qe({title:e,subtitle:t,step:n,total:r,children:a,rightSlot:i}){const{t:l}=Ke("wizard");return s.jsxs("section",{className:"bg-white rounded-2xl border border-border p-[22px_24px] mb-4",children:[s.jsxs("header",{className:"flex items-baseline justify-between gap-3 mb-[18px]",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-[14.5px] font-semibold tracking-[-0.005em] text-gray-900",children:e}),t&&s.jsx("p",{className:"text-[12px] text-gray-500 mt-1",children:t})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[i,s.jsx("span",{className:"text-[11.5px] text-gray-400 whitespace-nowrap",children:l("edit.section_of",{step:n,total:r})})]})]}),a]})}function Ye(e){return Object.entries(e).filter(([,t])=>typeof t=="string"&&t.trim()!=="").map(([t,n])=>`${t}=${n.trim()}`).sort().join("|")}function Qe(e){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,t])=>typeof t=="string").map(([t,n])=>[t,n]))}function Le({children:e}){return s.jsxs("div",{className:"flex items-center gap-1.5 text-[11.5px] text-gray-400 mt-1.5",children:[s.jsx(zt,{className:"w-[11
5px] h-[11px]"}),s.jsx("span",{children:e})]})}function _i(){const{t:e}=Ke("wizard"),{id:t}=Qn(),{user:n,loading:r,refreshUser:a}=er(),[i,l]=o.useState(null),[c,u]=o.useState([]),[h,f]=o.useState(0),[p,m]=o.useState(null),[g,S]=o.useState(!1),[b,y]=o.useState(null),[_,R]=o.useState(""),[w,j]=o.useState(""),[N,k]=o.useState(""),[C,D]=o.useState(0),[A,z]=o.useState(""),[M,X]=o.useState(""),[ee,oe]=o.useState(!1),[$,L]=o.useState("free"),[I,W]=o.useState("USD"),[q,ce]=o.useState(!1),[ye,Y]=o.useState(!1),[J,ge]=o.useState(""),[Ae,re]=o.useState({}),[He,De]=o.useState({}),[me,O]=o.useState([]),[be,de]=o.useState(""),[Ce,we]=o.useState({}),[Me,Re]=o.useState(!1),[te,Te]=o.useState(null),ze=o.useRef(null),je=o.useRef(null),Pe=o.useRef(""),Be=o.useRef(!1),[Ie,Oe]=o.useState(null),P=o.useRef(null);o.useEffect(()=>{ve.get(`/projects/${t}`).then(d=>{l(d.data),R(d.data.title),j(d.data.card_subtitle||""),k(d.data.description),D(d.data.price_cents),z(d.data.category||""),X(d.data.sub_category||""),ge(d.data.external_url||""),re(Qe(d.data.localized_urls)),oe(!!d.data.is_ai_powered),d.data.external_url&&ve.post("/projects/detect-localized-urls",{url:d.data.external_url}).then(B=>De(Qe(B.data?.alternates))).catch(()=>{});const v=Nn(d.data.pricing_model,d.data.price_cents),x=Dn(d.data.currency);L(v),W(x),ce(!!d.data.hosting_waitlist);const F=Array.isArray(d.data.key_features)?d.data.key_features.filter(B=>typeof B=="string"):[];O(F);const E=d.data.social_links&&typeof d.data.social_links=="object"?Object.fromEntries(Object.entries(d.data.social_links).filter(([,B])=>typeof B=="string").map(([B,ne])=>[B,ne])):{};we(E),n?.phone_number&&de(n.phone_number),P.current={title:d.data.title,cardSubtitle:d.data.card_subtitle||"",description:d.data.description,priceCents:d.data.price_cents,pricingModel:v,currency:x,category:d.data.category||"",subCategory:d.data.sub_category||"",keyFeaturesJoined:F.join(`
6`),externalUrl:d.data.external_url||"",localizedJoined:Ye(Qe(d.data.localized_urls)),socialJoined:Ye(E)}}),ve.get(`/projects/${t}/screenshots`).then(d=>u(d.data)).catch(()=>{})},[t]),o.useEffect(()=>{let d=!1;if(c.length===0){m(null);return}return Promise.all(c.map(v=>an(v.url))).then(v=>{d||m(v.some(x=>on(x.w,x.h)==="wide"))}),()=>{d=!0}},[c]),o.useEffect(()=>{n?.phone_number&&de(d=>d||n.phone_number)},[n?.phone_number]);const Rt=o.useCallback(async d=>{if(!(!d||d===Pe.current)){Pe.current=d,je.current?.abort(),je.current=new AbortController;try{const v=await fetch("/api/ai/classify-project",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")}`},body:JSON.stringify({url:d,title:_,description:N}),signal:je.current.signal});if(!v.ok)return;const x=await v.json();x.main_category&&x.sub_category&&(A!==x.main_category||M!==x.sub_category)&&Oe({main:x.main_category,sub:x.sub_category})}catch{}}},[_,N,A,M,Oe]);if(o.useEffect(()=>{if(!i?.external_url||!J)return;const d=setTimeout(()=>Rt(J),4e3);return()=>clearTimeout(d)},[J]),r)return s.jsx(nn,{});if(!n)return s.jsx(tr,{to:"/auth?returnUrl=%2Fdashboard"});if(!i)return s.jsx(nn,{});const ue=!!i.external_url,xe=6,$e=1,ft=2,Ee=3,pt=4,Et=5,kt=6,Ue=(()=>{if(!P.current)return[];const d=[];return _!==P.current.title&&d.push(e("edit.dirty.title")),w!==P.current.cardSubtitle&&d.push(e("edit.dirty.card_summary")),N!==P.current.description&&d.push(e("edit.dirty.description")),($!==P.current.pricingModel||I!==P.current.currency||C!==P.current.priceCents)&&d.push(e("edit.dirty.pricing")),A!==P.current.category&&d.push(e("edit.dirty.category")),M!==P.current.subCategory&&d.push(e("edit.dirty.subcategory")),me.join(`
7`)!==P.current.keyFeaturesJoined&&d.push(e("edit.dirty.key_features")),te&&d.push(e("edit.dirty.images")),J!==P.current.externalUrl&&d.push(e("edit.dirty.url")),Ye(Ae)!==P.current.localizedJoined&&d.push(e("edit.dirty.lang_urls")),Ye(Ce)!==P.current.socialJoined&&d.push(e("edit.dirty.social")),be.trim()!==(n?.phone_number||"").trim()&&d.push(e("edit.dirty.phone")),d})(),Xe=Ue.length>0,At=()=>{P.current&&(R(P.current.title),j(P.current.cardSubtitle),k(P.current.description),D(P.current.priceCents),L(P.current.pricingModel),W(P.current.currency),z(P.current.category),X(P.current.subCategory),O(P.current.keyFeaturesJoined?P.current.keyFeaturesJoined.split(`
8`):[]),te&&(URL.revokeObjectURL(te),Te(null)),Oe(null))},ht=async d=>{if(!i||ye)return;const v=q;
8ce(d),Y(!0);try{const x=await ve.patch(`/projects/${i.id}`,{hosting_waitlist:d});l(x.data),H.success(e(d?"edit.toast.on_waitlist":"edit.toast.off_waitlist"))}catch(x){ce(v);const F=x?.response?.data?.detail;H.error(typeof F=="string"?F:e("edit.toast.waitlist_failed"))}finally{Y(!1)}},Mt=async()=>{if(i){Re(!0);try{if(te&&ze.current)try{await ze.current.apply()}catch{H.error(e("edit.toast.image_wait")),Re(!1);return}const d=me.map(V=>V.trim()).filter(Boolean),v=$==="subscription"?C:0,x=$==="subscription"?I:"USD",F=Object.fromEntries(Object.entries(Ce).filter(([,V])=>typeof V=="string"&&V.trim()!=="")),E=await ve.put(`/projects/${i.id}`,{title:_,card_subtitle:w.trim()||null,description:N,price_cents:v,pricing_model:$,currency:x,category:A||void 0,sub_category:M||void 0,key_features:d.length>0?d:null,social_links:Object.keys(F).length>0?F:null,...i.external_url!==void 0?{external_url:J||null}:{},...ue?{localized_urls:(()=>{const V=Object.fromEntries(Object.entries(Ae).filter(([,We])=>We&&We.trim()!==""));return Object.keys(V).length>0?V:null})()}:{}});if(be.trim()!==(n?.phone_number||"").trim())try{await ve.post("/auth/me/phone",{phone_number:be.trim()}),await a()}catch(V){const We=V?.response?.data?.detail;H.error(typeof We=="string"?We:e("edit.toast.phone_failed"))}l(E.data);const ne=Array.isArray(E.data.key_features)?E.data.key_features.filter(V=>typeof V=="string"):[];O(ne);const fe=Nn(E.data.pricing_model,E.data.price_cents),K=Dn(E.data.currency);L(fe),W(K),D(E.data.price_cents);const U=E.data.social_links&&typeof E.data.social_links=="object"?Object.fromEntries(Object.entries(E.data.social_links).filter(([,V])=>typeof V=="string").map(([V,We])=>[V,We])):{};P.current={title:E.data.title,cardSubtitle:E.data.card_subtitle||"",description:E.data.description,priceCents:E.data.price_cents,pricingModel:fe,currency:K,category:E.data.category||"",subCategory:E.data.sub_category||"",keyFeaturesJoined:ne.join(`
9`),externalUrl:E.data.external_url||"",localizedJoined:Ye(Qe(E.data.localized_urls)),socialJoined:Ye(U)},re(Qe(E.data.localized_urls)),j(E.data.card_subtitle||""),H.success(e("edit.toast.saved"))}catch(d){const v=d?.response?.data?.detail;H.error(typeof v=="string"?v:e("edit.toast.save_failed"))}finally{Re(!1)}}},gt=d=>{if(d.size>5*1024*1024){H.error(e("edit.toast.file_too_large_5mb"));return}if(!["image/jpeg","image/png","image/webp"].includes(d.type)){H.error(e("edit.toast.unsupported_format"));return}te&&URL.revokeObjectURL(te),Te(URL.createObjectURL(d))},Tt=async(d,v)=>{if(i)try{const x=new FormData;x.append("thumbnail",d,"thumbnail.png"),x.append("card_image",v,"card.png");const F=await ve.post(`/projects/${i.id}/images`,x);l(F.data),te&&URL.revokeObjectURL(te),Te(null)}catch(x){const F=x?.response?.data?.detail;H.error(typeof F=="string"?F:e("edit.toast.images_upload_failed"))}},Z=async d=>{const v=d.target.files;if(!v||v.length===0)return;S(!0);let x="";const F=[];for(const B of Array.from(v)){if(B.size>10*1024*1024){H.error(e("edit.toast.screenshot_too_large"));continue}if(!["image/jpeg","image/png","image/webp"].includes(B.type)){H.error(e("edit.toast.screenshot_bad_format"));continue}F.push(B)}let E=F;if(F.length){const ne=(await Promise.all(c.map(U=>an(U.url)))).filter(U=>on(U.w,U.h)==="wide").length,fe=await Promise.all(F.map(async U=>({file:U,...await vr(U)}))),K=yr(ne,fe);for(const U of K.invalidRatio)H.error(e("edit.toast.screenshot_bad_ratio",{name:U.file.name,w:U.w,h:U.h,ratio:wr(U.w,U.h)}));for(const U of K.extraWide)H.error(e("edit.toast.screenshot_second_wide",{name:U.file.name}));E=K.accepted}for(const B of E)try{const ne=new FormData;ne.append("file",B);const fe=await ve.post(`/projects/${t}/screenshots`,ne);u(K=>[...K,{id:fe.data.id,url:fe.data.url,sort_order:fe.data.sort_order??K.length}]),f(K=>K+1)}catch(ne){x=ne?.response?.data?.detail||e("edit.toast.screenshot_upload_failed"),H.error(x)}S(!1),d.target.value=""},le=async d=>{try{await ve.delete(`/projects/${t}/screenshots/${d}`),u(v=>v.filter(x=>x.id!==d)),f(v=>v+1)}catch{H.error(e("edit.toast.screenshot_delete_failed"))}},se=n.store_name||e("preview.your_store"),Se=rn(A||i.category||"")||(A||i.category||e("preview.category_fallback")).replace(/_/g," "),ie=_||e("preview.your_app_name"),ae=!!(ue&&i.status==="approved");return s.jsxs("div",{className:"flex flex-col",children:[s.jsx("div",{className:"max-w-[1180px] w-full mx-auto px-6 py-8",children:s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_380px] gap-7 items-start",children:[s.jsxs("div",{className:"lg:col-span-2 flex flex-wrap items-end justify-between gap-4 pb-5 border-b border-border",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs(sn,{to:"/dashboard",className:"inline-flex items-center gap-1 text-[12.5px] text-gray-500 hover:text-gray-700",children:[s.jsx(_r,{className:"w-3 h-3 rtl:rotate-180"}),e("edit.back_to_store")]}),s.jsx("h1",{className:"text-[22px] font-bold tracking-[-0.015em] text-gray-900 mt-1.5",children:e("edit.heading")}),i.updated_at&&s.jsxs("p",{className:"text-[12.5px] text-gray-500 mt-0.5",children:[e("edit.last_published")," ",s.jsx("b",{className:"text-gray-700 font-semibold",children:hi(i.updated_at,e)}),e("edit.last_published_suffix")]})]}),s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[s.jsxs(sn,{to:`/app/${i.slug||i.id}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[12.5px] text-gray-600 hover:text-[#059669]",children:[e("edit.view_public")," ",s.jsx(nr,{className:"w-3 h-3"})]}),s.jsx(gi,{status:i.status})]})]}),s.jsxs("div",{children:[s.jsx(qe,{title:e("edit.section_about_title"),subtitle:e("edit.section_about_subtitle"),step:$e,total:xe,children:s.jsxs("div",{className:"space-y-4",children:[ue&&s.jsxs("div",{children:[s.jsx("div",{className:"flex items-baseline justify-between mb-1.5",children:s.jsx("label",{htmlFor:"externalUrl",className:"text-[12.5px] font-medium text-gray-700",children:e("edit.app_url")})}),s.jsx(mt,{id:"externalUrl",type:"url",dir:"auto",value:J,placeholder:"https://your-app.com",onChange:d=>ge(d.target.value),className:"bg-white border border-gray-300 focus-visible:border-emerald-500 focus-visible:ring-emerald-500/15"}),s.jsx(Le,{children:e("edit.app_url_help")})]}),ue&&s.jsx(fr,{value:Ae,onChange:re,detected:Object.fromEntries(Object.entries(He).filter(([,d])=>d.replace(/\/+$/,"")!==J.replace(/\/+$/,"")))}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-baseline justify-between mb-1.5",children:[s.jsx("label",{htmlFor:"title",className:"text-[12.5px] font-medium text-gray-700",children:e("edit.title_label")}),s.jsxs("span",{className:"text-[10.5px] text-gray-400 tabular-nums",children:[_.length," / ",Rn]})]}),s.jsx(mt,{id:"title",value:_,maxLength:Rn,onChange:d=>R(d.target.value),className:"bg-white border border-gray-300 focus-visible:border-emerald-500 focus-visible:ring-emerald-500/15"}),s.jsx(Le,{children:e("edit.title_help")})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-baseline justify-between mb-1.5",children:[s.jsx("label",{htmlFor:"card_subtitle",className:"text-[12.5px] font-medium text-gray-700",children:e("edit.card_summary_label")}),s.jsxs("span",{className:"text-[10.5px] text-gray-400 tabular-nums",children:[w.length," / 160"]})]}),s.jsx(mt,{id:"card_subtitle",value:w,maxLength:160,placeholder:e("edit.card_summary_placeholder"),onChange:d=>j(d.target.value),className:"bg-white border border-gray-300 focus-visible:border-emerald-500 focus-visible:ring-emerald-500/15"}),s.jsx(Le,{children:e("edit.card_summary_help")})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-baseline justify-between mb-1.5",children:[s.jsx("label",{htmlFor:"description",className:"text-[12.5px] font-medium text-gray-700",children:e("edit.description_label")}),s.jsxs("span",{className:"text-[10.5px] text-gray-400 tabular-nums",children:[N.length," / ",En.toLocaleStr
9ing()]})]}),s.jsx(Sr,{id:"description",value:N,maxLength:En,rows:4,onChange:d=>k(d.target.value),className:"bg-white border border-gray-300 focus-visible:border-emerald-500 focus-visible:ring-emerald-500/15"}),s.jsx(Le,{children:e("edit.description_help")})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[12.5px] font-medium text-gray-700 block mb-1.5",children:e("edit.category_label")}),s.jsx(ln,{value:A,onChange:d=>{Be.current=!0,z(d),X("")},items:rr.map(d=>({slug:d.slug,label:d.label,Icon:d.Icon,bgColor:d.bgColor,iconColor:d.iconColor})),placeholder:e("edit.category_placeholder")})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[12.5px] font-medium text-gray-700 block mb-1.5",children:e("edit.subcategory_label")}),s.jsx(ln,{value:M,onChange:d=>{Be.current=!0,X(d)},items:A?sr(A)?.subs.map(d=>({slug:d.slug,label:d.label}))??[]:[],placeholder:e(A?"edit.subcategory_placeholder":"edit.subcategory_placeholder_disabled"),disabled:!A})]}),Ie&&s.jsxs("div",{style:{marginTop:4,padding:"8px 12px",background:"#ECFDF5",color:"#065F46",border:"1px solid #10B981",borderRadius:8,fontSize:12,display:"flex",alignItems:"center",gap:8},children:[s.jsxs("span",{style:{flex:1},children:[e("edit.suggested")," ",rn(Ie.main)," › ",ir(Ie.sub)]}),s.jsx("button",{type:"button",onClick:()=>{z(Ie.main),X(Ie.sub),Oe(null)},style:{padding:"4px 12px",borderRadius:6,background:"#10B981",color:"#fff",fontSize:11.5,fontWeight:500,border:0,cursor:"pointer"},children:e("edit.apply")}),s.jsx("button",{type:"button",onClick:()=>Oe(null),style:{padding:"4px 8px",borderRadius:6,background:"transparent",color:"#065F46",fontSize:16,lineHeight:1,border:0,cursor:"pointer"},"aria-label":e("edit.dismiss_aria"),children:"×"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"flex items-baseline justify-between mb-1.5",children:s.jsx("label",{className:"text-[12.5px] font-medium text-gray-700",children:e("edit.key_features_label")})}),s.jsx(pr,{value:me,onChange:O}),s.jsx(Le,{children:e("edit.key_features_help")})]})]})}),s.jsxs(qe,{title:e("edit.section_pricing_title"),subtitle:e(ue?"edit.section_pricing_subtitle_external":"edit.section_pricing_subtitle_managed"),step:ft,total:xe,children:[s.jsx("div",{className:"flex gap-2 mb-3.5",children:["free","freemium","subscription"].map(d=>{const v=$===d,x={free:e("edit.price_free"),freemium:e("edit.price_freemium"),subscription:e("edit.price_subscription")};return s.jsx("button",{type:"button",onClick:()=>{L(d),d!=="subscription"&&(D(0),W("USD"))},className:v?"inline-flex items-center px-[11px] py-1.5 rounded-full text-[11.5px] font-semibold bg-gray-900 text-white border border-gray-900":"inline-flex items-center px-[11px] py-1.5 rounded-full text-[11.5px] font-medium bg-white text-gray-700 border border-border hover:border-gray-300",children:x[d]},d)})}),$!=="subscription"?s.jsx("p",{className:"text-[12px] text-gray-500",children:e($==="free"?"edit.price_note_free":"edit.price_note_freemium")}):s.jsxs("div",{children:[s.jsx("label",{className:"text-[12.5px] font-medium text-gray-700 block mb-1.5",children:e("edit.monthly_price_label")}),s.jsxs("div",{className:"flex items-stretch border border-border rounded-lg overflow-hidden bg-white focus-within:border-emerald-500 focus-within:ring-2 focus-within:ring-emerald-500/12",children:[s.jsx("span",{className:"flex items-center px-3.5 bg-[#FAFAF7] border-e border-border text-gray-600 font-semibold text-sm",children:I==="ILS"?"₪":"$"}),s.jsx("input",{className:"flex-1 border-none px-3 py-2.5 text-[13.5px] outline-none tabular-nums",placeholder:"0.00",value:(C/100).toFixed(2),onChange:d=>{const v=parseFloat(d.target.value)||0;D(Math.round(v*100))}}),s.jsx("span",{className:"flex items-center px-3 bg-[#FAFAF7] border-s border-border text-gray-500 text-xs",children:e("edit.per_month")}),s.jsxs("select",{className:"border-s border-border bg-[#FAFAF7] px-2 text-[12.5px] text-gray-600 outline-none cursor-pointer",value:I,onChange:d=>W(d.target.value),children:[s.jsx("option",{value:"USD",children:"USD"}),s.jsx("option",{value:"ILS",children:"ILS"})]})]}),s.jsx(Le,{children:e("edit.price_help",{symbol:I==="ILS"?"₪":"$",price:(C/100).toFixed(2)})})]})]}),s.jsx(qe,{title:e("edit.section_visual_title"),subtitle:e("edit.section_visual_subtitle"),step:Ee,total:xe,children:te?s.jsx(pi,{ref:ze,sourceImageUrl:te,projectTitle:ie,categoryLabel:Se,onSelectFile:gt,onReplace:()=>{te&&URL.revokeObjectURL(te),Te(null)},onCancel:()=>{te&&URL.revokeObjectURL(te),Te(null)},onApply:async({thumbnailBlob:d,cardBlob:v})=>{await Tt(d,v)}}):s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[110px_1fr_auto] gap-[18px] items-start",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"relative w-[110px] h-[110px] rounded-[10px] border border-border overflow-hidden bg-gray-100",children:[i.thumbnail_url?s.jsx("img",{src:i.thumbnail_url,alt:e("edit.img_alt_icon"),className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-gray-400 text-[10px]",children:e("edit.no_image")}),s.jsx("span",{className:"absolute bottom-1 start-1 bg-black/65 text-white text-[9.5px] uppercase font-semibold px-1.5 py-0.5 rounded tracking-wider",children:e("edit.thumb_badge")})]}),s.jsx("p",{className:"text-[11.5px] text-gray-500 mt-1.5",children:s.jsx("b",{className:"text-gray-900",children:"192 × 192"})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"relative w-full max-w-[320px] aspect-[16/9] rounded-[10px] border border-border overflow-hidden bg-gray-100",children:[i.card_image_url?s.jsx("img",{src:i.card_image_url,alt:e("edit.img_alt_card"),className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-gray-400 text-[10px]",children:e("edit.no_image")}),s.jsx("span",{className:"absolute bottom-1 start-1 bg-black/65 text-white text-[9.5px] uppercase font-semibold px-1.5 py-0.5 rounded tracking-wider",children:e("edit.card_badge")})]}),s.jsx("p",{className:"text-[11.5px] text-gray-500 mt-1.5",children:s.jsx("b",{className:"text-gray-900",children:"1280 × 720"})})]}),s.jsxs("div",{className:"flex flex-col gap-2 min-w-[140px]",children:[s.jsx("label",{htmlFor:"thumbnail-upload",children:s.jsx(xt,{variant:"outline",size:"sm",asChild:!0,children:s.jsxs("span",{children:[s.jsx(tt,{size:14,className:"me-1.5"}),e("edit.replace_image")]})})}),s.jsx("input",{id:"thumbnail-upload",type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:d=>{const v=d.target.files?.[0];v&&gt(v),d.target.value=""}}),s.jsx("p",{className:"text-[10.5px] text-gray-400 mt-0.5",children:e("edit.image_constraints_5mb")})]})]})}),s.jsxs(qe,{title:e("edit.section_screenshots_title"),subtitle:e("edit.section_screenshots_subt
9itle"),step:pt,total:xe,rightSlot:s.jsxs("span",{className:"inline-flex items-center gap-2.5",children:[s.jsx(hr,{savedTick:h}),s.jsx("span",{className:"text-[11.5px] text-gray-500",children:s.jsx(ar,{i18nKey:"edit.screenshots_used",ns:"wizard",values:{count:c.length},components:{1:s.jsx("b",{className:"text-gray-900"})}})})]}),children:[s.jsx("div",{className:"h-1 bg-gray-100 rounded-full overflow-hidden mb-3",children:s.jsx("div",{className:"bg-emerald-500 h-full transition-all",style:{width:`${c.length/6*100}%`}})}),s.jsx(fi,{projectId:i.id,screenshots:c,onScreenshotsChange:d=>{u(d),f(v=>v+1)},onDelete:le,onAdjust:async d=>{try{const v=await ve.get(`/projects/${i.id}/screenshots/${d.id}/raw`,{responseType:"blob"}),x=URL.createObjectURL(v.data);y({id:d.id,url:x})}catch{H.error(e("edit.toast.screenshot_load_failed"))}}}),c.length<6&&s.jsxs("label",{className:"mt-3 block aspect-[16/10] max-w-[200px] border-[1.5px] border-dashed border-gray-300 rounded-[10px] flex flex-col items-center justify-center gap-1.5 text-gray-500 cursor-pointer bg-[#FAFAF7] hover:border-emerald-500 hover:text-[#059669] hover:bg-emerald-50 transition",children:[s.jsx(tt,{className:"w-[22px] h-[22px]"}),s.jsx("div",{className:"text-[11.5px] font-semibold",children:e(g?"edit.uploading":"edit.add_screenshot")}),s.jsx("div",{className:"text-[10.5px] text-gray-400",children:e("edit.image_constraints_10mb")}),s.jsx("input",{type:"file",multiple:!0,accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:Z,disabled:g})]}),s.jsxs("div",{className:`flex items-center gap-2 mt-3 px-2.5 py-2 rounded-[10px] text-[11.5px] ${p===!1?"bg-amber-50 border border-amber-200 text-amber-800":"text-gray-500"}`,children:[s.jsx(zt,{className:"w-[13px] h-[13px] shrink-0"}),s.jsx("span",{children:e(p===!1?"edit.screenshots_add_banner":"edit.screenshots_ratio_rule")})]}),s.jsx("div",{className:"flex items-center justify-between text-[11.5px] text-gray-500 pt-3 mt-3.5 border-t border-gray-100",children:s.jsx("span",{children:e("edit.screenshots_tip")})})]}),s.jsx(qe,{title:e("edit.section_videos_title"),subtitle:e("edit.section_videos_subtitle"),step:Et,total:xe,children:s.jsx(gr,{projectId:i.id})}),s.jsxs(qe,{title:e("edit.section_contact_title"),subtitle:e("edit.section_contact_subtitle"),step:kt,total:xe,children:[s.jsxs("div",{className:"mb-5",children:[s.jsx("label",{htmlFor:"phone_number",className:"text-[12.5px] font-medium text-gray-700 block mb-1.5",children:e("edit.phone_label")}),s.jsx(mt,{id:"phone_number",type:"tel",dir:"ltr",value:be,onChange:d=>de(d.target.value),placeholder:e("edit.phone_placeholder"),className:"h-[38px] text-[13px]",autoComplete:"tel"}),s.jsx(Le,{children:e("edit.phone_help")})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[12.5px] font-medium text-gray-700 block mb-1.5",children:e("edit.social_label")}),s.jsx(mr,{value:Ce,onChange:we}),s.jsx(Le,{children:e("edit.social_help")})]})]}),s.jsx("section",{className:"bg-white rounded-2xl border border-border px-6 py-4 mb-4",children:s.jsxs(or,{children:[s.jsx(lr,{asChild:!0,children:s.jsxs("label",{className:"inline-flex items-center gap-2 text-[13px] text-gray-600 cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:q,disabled:ye,onChange:d=>ht(d.target.checked),className:"w-4 h-4 cursor-pointer accent-emerald-600"}),s.jsx("span",{children:e("edit.waitlist_label")}),s.jsx(zt,{size:13,className:"text-gray-400","aria-hidden":!0})]})}),s.jsx(cr,{side:"bottom",className:"max-w-[280px]",children:e("edit.waitlist_tooltip")})]})})]}),s.jsx("aside",{className:"hidden lg:block sticky top-6",children:s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx("h3",{className:"text-[11px] font-semibold tracking-[0.14em] uppercase text-gray-500",children:e("edit.live_preview")}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[10.5px] font-medium text-gray-400 uppercase tracking-wider mb-1.5",children:e("edit.preview_listing_page")}),s.jsx(br,{src:i.thumbnail_url||"",rect:{x:0,y:0,width:1,height:1},naturalW:1,naturalH:1,title:ie,category:Se,subCategory:M,isAiPowered:ee,isExternal:ue,showUn
9pwned:ae,storeName:se,verifiedSellerBadge:!!i.verified_seller_badge||be.trim().length>0||!!n?.phone_number,manuallyReviewedBadge:!!i.manually_reviewed_badge,phoneNumber:be,socialLinks:Ce})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[10.5px] font-medium text-gray-400 uppercase tracking-wider mb-1.5",children:e("edit.preview_catalog_card")}),s.jsx(xr,{src:i.card_image_url||"",rect:{x:0,y:0,width:1,height:1},naturalW:1,naturalH:1,title:ie,category:Se,subCategory:M,isAiPowered:ee,description:N,storeName:se,isExternal:ue,showUnpwned:ae,pricingModel:$,currency:I,price:$==="subscription"&&C>0?Number((C/100).toFixed(2)):"free",verifiedSellerBadge:!!i.verified_seller_badge||be.trim().length>0||!!n?.phone_number,manuallyReviewedBadge:!!i.manually_reviewed_badge})]})]})})]})}),s.jsx("div",{className:"sticky bottom-0 bg-white border-t border-border z-30",children:s.jsxs("div",{className:"max-w-[1180px] mx-auto px-6 py-3 flex items-center justify-between gap-3",children:[s.jsx("div",{className:"flex items-center gap-2 text-[12.5px] min-w-0",children:Xe?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse flex-shrink-0"}),s.jsx("span",{className:"font-medium text-gray-900",children:e("edit.unsaved",{count:Ue.length})}),s.jsx("span",{className:"text-gray-300",children:"·"}),s.jsx("span",{className:"text-gray-500 truncate",children:Ue.join(", ")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 flex-shrink-0"}),s.jsx("span",{className:"text-gray-500",children:e("edit.all_saved")})]})}),s.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[s.jsx("button",{type:"button",onClick:At,disabled:!Xe,className:"inline-flex items-center gap-1.5 px-3.5 py-2 rounded-lg text-[13px] font-medium text-gray-500 hover:text-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:e("edit.discard")}),s.jsxs("button",{type:"button",onClick:Mt,disabled:Me||!Xe,className:"inline-flex items-center gap-1.5 px-3.5 py-2 rounded-lg text-[13px] font-medium bg-[#10B981] text-white hover:bg-[#059669] disabled:opacity-50 disabled:cursor-not-allowed",children:[s.jsx(Cr,{className:"w-3 h-3"}),e(Me?"edit.saving":"edit.save_changes")]})]})]})}),b&&s.jsx(jr,{open:!!b,onOpenChange:d=>{d||(URL.revokeObjectURL(b.url),y(null))},imageUrl:b.url,onCropComplete:async d=>{const v=new FormData;v.append("file",d,"screenshot.jpg");try{await ve.delete(`/projects/${i.id}/screenshots/${b.id}`);const x=await ve.post(`/projects/${i.id}/screenshots`,v);u(F=>F.map(E=>E.id===b.id?{id:x.data.id,url:x.data.url,sort_order:x.data.sort_order??E.sort_order}:E))}catch(x){const F=x?.response?.data?.detail;H.error(typeof F=="string"?F:e("edit.toast.screenshot_upload_failed"))}}})]})}export{_i as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.