138 lines
260 KiB
JavaScript
138 lines
260 KiB
JavaScript
var mr=Object.defineProperty;var gr=(t,a,r)=>a in t?mr(t,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[a]=r;var ke=(t,a,r)=>gr(t,typeof a!="symbol"?a+"":a,r);import{r as n,a as xr,j as e,g as Pt,R as je,c as hr}from"./client-Cv0X-2PX.js";/**
|
||
* react-router v7.13.1
|
||
*
|
||
* Copyright (c) Remix Software Inc.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/var Qt="popstate";function Yt(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function pr(t={}){function a(l,s){var c;let i=(c=s.state)==null?void 0:c.masked,{pathname:o,search:u,hash:d}=i||l.location;return St("",{pathname:o,search:u,hash:d},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:l.location.pathname,search:l.location.search,hash:l.location.hash}:void 0)}function r(l,s){return typeof s=="string"?s:Be(s)}return yr(a,r,null,t)}function ee(t,a){if(t===!1||t===null||typeof t>"u")throw new Error(a)}function xe(t,a){if(!t){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function br(){return Math.random().toString(36).substring(2,10)}function Xt(t,a){return{usr:t.state,key:t.key,idx:a,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function St(t,a,r=null,l,s){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof a=="string"?Ie(a):a,state:r,key:a&&a.key||l||br(),unstable_mask:s}}function Be({pathname:t="/",search:a="",hash:r=""}){return a&&a!=="?"&&(t+=a.charAt(0)==="?"?a:"?"+a),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Ie(t){let a={};if(t){let r=t.indexOf("#");r>=0&&(a.hash=t.substring(r),t=t.substring(0,r));let l=t.indexOf("?");l>=0&&(a.search=t.substring(l),t=t.substring(0,l)),t&&(a.pathname=t)}return a}function yr(t,a,r,l={}){let{window:s=document.defaultView,v5Compat:i=!1}=l,o=s.history,u="POP",d=null,c=m();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function m(){return(o.state||{idx:null}).idx}function g(){u="POP";let j=m(),x=j==null?null:j-c;c=j,d&&d({action:u,location:R.location,delta:x})}function h(j,x){u="PUSH";let k=Yt(j)?j:St(R.location,j,x);c=m()+1;let D=Xt(k,c),E=R.createHref(k.unstable_mask||k);try{o.pushState(D,"",E)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;s.location.assign(E)}i&&d&&d({action:u,location:R.location,delta:1})}function y(j,x){u="REPLACE";let k=Yt(j)?j:St(R.location,j,x);c=m();let D=Xt(k,c),E=R.createHref(k.unstable_mask||k);o.replaceState(D,"",E),i&&d&&d({action:u,location:R.location,delta:0})}function _(j){return fr(j)}let R={get action(){return u},get location(){return t(s,o)},listen(j){if(d)throw new Error("A history only accepts one active listener");return s.addEventListener(Qt,g),d=j,()=>{s.removeEventListener(Qt,g),d=null}},createHref(j){return a(s,j)},createURL:_,encodeLocation(j){let x=_(j);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:h,replace:y,go(j){return o.go(j)}};return R}function fr(t,a=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),ee(r,"No window.location.(origin|href) available to create URL");let l=typeof t=="string"?t:Be(t);return l=l.replace(/ $/,"%20"),!a&&l.startsWith("//")&&(l=r+l),new URL(l,r)}function fa(t,a,r="/"){return kr(t,a,r,!1)}function kr(t,a,r,l){let s=typeof a=="string"?Ie(a):a,i=ve(s.pathname||"/",r);if(i==null)return null;let o=ka(t);jr(o);let u=null;for(let d=0;u==null&&d<o.length;++d){let c=Pr(i);u=Tr(o[d],c,l)}return u}function ka(t,a=[],r=[],l="",s=!1){let i=(o,u,d=s,c)=>{let m={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:u,route:o};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(l)&&d)return;ee(m.relativePath.startsWith(l),`Absolute route path "${m.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(l.length)}let g=ge([l,m.relativePath]),h=r.concat(m);o.children&&o.children.length>0&&(ee(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),ka(o.children,a,h,g,d)),!(o.path==null&&!o.index)&&a.push({path:g,score:Er(g,o.index),routesMeta:h})};return t.forEach((o,u)=>{var d;if(o.path===""||!((d=o.path)!=null&&d.includes("?")))i(o,u);else for(let c of ja(o.path))i(o,u,!0,c)}),a}function ja(t){let a=t.split("/");if(a.length===0)return[];let[r,...l]=a,s=r.endsWith("?"),i=r.replace(/\?$/,"");if(l.length===0)return s?[i,""]:[i];let o=ja(l.join("/")),u=[];return u.push(...o.map(d=>d===""?i:[i,d].join("/"))),s&&u.push(...o),u.map(d=>t.startsWith("/")&&d===""?"/":d)}function jr(t){t.sort((a,r)=>a.score!==r.score?r.score-a.score:Rr(a.routesMeta.map(l=>l.childrenIndex),r.routesMeta.map(l=>l.childrenIndex)))}var vr=/^:[\w-]+$/,wr=3,Nr=2,Cr=1,Sr=10,_r=-2,ea=t=>t==="*";function Er(t,a){let r=t.split("/"),l=r.length;return r.some(ea)&&(l+=_r),a&&(l+=Nr),r.filter(s=>!ea(s)).reduce((s,i)=>s+(vr.test(i)?wr:i===""?Cr:Sr),l)}function Rr(t,a){return t.length===a.length&&t.slice(0,-1).every((l,s)=>l===a[s])?t[t.length-1]-a[a.length-1]:0}function Tr(t,a,r=!1){let{routesMeta:l}=t,s={},i="/",o=[];for(let u=0;u<l.length;++u){let d=l[u],c=u===l.length-1,m=i==="/"?a:a.slice(i.length)||"/",g=tt({path:d.relativePath,caseSensitive:d.caseSensitive,end:c},m),h=d.route;if(!g&&c&&r&&!l[l.length-1].route.index&&(g=tt({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},m)),!g)return null;Object.assign(s,g.params),o.push({params:s,pathname:ge([i,g.pathname]),pathnameBase:Dr(ge([i,g.pathnameBase])),route:h}),g.pathnameBase!=="/"&&(i=ge([i,g.pathnameBase]))}return o}function tt(t,a){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,l]=Lr(t.path,t.caseSensitive,t.end),s=a.match(r);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),u=s.slice(1);return{params:l.reduce((c,{paramName:m,isOptional:g},h)=>{if(m==="*"){let _=u[h]||"";o=i.slice(0,i.length-_.length).replace(/(.)\/+$/,"$1")}const y=u[h];return g&&!y?c[m]=void 0:c[m]=(y||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:o,pattern:t}}function Lr(t,a=!1,r=!0){xe(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let l=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,u,d,c,m)=>{if(l.push({paramName:u,isOptional:d!=null}),d){let g=m.charAt(c+o.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(l.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,a?void 0:"i"),l]}function Pr(t){try{return t.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return xe(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),t}}function ve(t,a){if(a==="/")return t;if(!t.toLowerCase().startsWith(a.toLowerCase()))return null;let r=a.endsWith("/")?a.length-1:a.length,l=t.charAt(r);return l&&l!=="/"?null:t.slice(r)||"/"}var Mr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function $r(t,a="/"){let{pathname:r,search:l="",hash:s=""}=typeof t=="string"?Ie(t):t,i;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?i=ta(r.substring(1),"/"):i=ta(r,a)):i=a,{pathname:i,search:Ar(l),hash:Hr(s)}}function ta(t,a){let r=a.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function ht(t,a,r,l){return`Cannot include a '${t}' character in a manually specified \`to.${a}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ir(t){return t.filter((a,r)=>r===0||a.route.path&&a.route.path.length>0)}function va(t){let a=Ir(t);return a.map((r,l)=>l===a.length-1?r.pathname:r.pathnameBase)}function Mt(t,a,r,l=!1){let s;typeof t=="string"?s=Ie(t):(s={...t},ee(!s.pathname||!s.pathname.includes("?"),ht("?","pathname","search",s)),ee(!s.pathname||!s.pathname.includes("#"),ht("#","pathname","hash",s)),ee(!s.search||!s.search.includes("#"),ht("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,u;if(o==null)u=r;else{let g=a.length-1;if(!l&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),g-=1;s.pathname=h.join("/")}u=g>=0?a[g]:"/"}let d=$r(s,u),c=o&&o!=="/"&&o.endsWith("/"),m=(i||o===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(c||m)&&(d.pathname+="/"),d}var ge=t=>t.join("/").replace(/\/\/+/g,"/"),Dr=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Ar=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Hr=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Or=class{constructor(t,a,r,l=!1){this.status=t,this.statusText=a||"",this.internal=l,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Ur(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Vr(t){return t.map(a=>a.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var wa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Na(t,a){let r=t;if(typeof r!="string"||!Mr.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let l=r,s=!1;if(wa)try{let i=new URL(window.location.href),o=r.startsWith("//")?new URL(i.protocol+r):new URL(r),u=ve(o.pathname,a);o.origin===i.origin&&u!=null?r=u+o.search+o.hash:s=!0}catch{xe(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ca=["POST","PUT","PATCH","DELETE"];new Set(Ca);var Fr=["GET",...Ca];new Set(Fr);var De=n.createContext(null);De.displayName="DataRouter";var at=n.createContext(null);at.displayName="DataRouterState";var Br=n.createContext(!1),Sa=n.createContext({isTransitioning:!1});Sa.displayName="ViewTransition";var Gr=n.createContext(new Map);Gr.displayName="Fetchers";var Kr=n.createContext(null);Kr.displayName="Await";var de=n.createContext(null);de.displayName="Navigation";var Ge=n.createContext(null);Ge.displayName="Location";var be=n.createContext({outlet:null,matches:[],isDataRoute:!1});be.displayName="Route";var $t=n.createContext(null);$t.displayName="RouteError";var _a="REACT_ROUTER_ERROR",qr="REDIRECT",Zr="ROUTE_ERROR_RESPONSE";function zr(t){if(t.startsWith(`${_a}:${qr}:{`))try{let a=JSON.parse(t.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function Wr(t){if(t.startsWith(`${_a}:${Zr}:{`))try{let a=JSON.parse(t.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new Or(a.status,a.statusText,a.data)}catch{}}function Jr(t,{relative:a}={}){ee(Ke(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:l}=n.useContext(de),{hash:s,pathname:i,search:o}=qe(t,{relative:a}),u=i;return r!=="/"&&(u=i==="/"?r:ge([r,i])),l.createHref({pathname:u,search:o,hash:s})}function Ke(){return n.useContext(Ge)!=null}function ye(){return ee(Ke(),"useLocation() may be used only in the context of a <Router> component."),n.useContext(Ge).location}var Ea="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ra(t){n.useContext(de).static||n.useLayoutEffect(t)}function Qr(){let{isDataRoute:t}=n.useContext(be);return t?ms():Yr()}function Yr(){ee(Ke(),"useNavigate() may be used only in the context of a <Router> component.");let t=n.useContext(De),{basename:a,navigator:r}=n.useContext(de),{matches:l}=n.useContext(be),{pathname:s}=ye(),i=JSON.stringify(va(l)),o=n.useRef(!1);return Ra(()=>{o.current=!0}),n.useCallback((d,c={})=>{if(xe(o.current,Ea),!o.current)return;if(typeof d=="number"){r.go(d);return}let m=Mt(d,JSON.parse(i),s,c.relative==="path");t==null&&a!=="/"&&(m.pathname=m.pathname==="/"?a:ge([a,m.pathname])),(c.replace?r.replace:r.push)(m,c.state,c)},[a,r,i,s,t])}var Xr=n.createContext(null);function es(t){let a=n.useContext(be).outlet;return n.useMemo(()=>a&&n.createElement(Xr.Provider,{value:t},a),[a,t])}function qe(t,{relative:a}={}){let{matches:r}=n.useContext(be),{pathname:l}=ye(),s=JSON.stringify(va(r));return n.useMemo(()=>Mt(t,JSON.parse(s),l,a==="path"),[t,s,l,a])}function ts(t,a){return Ta(t,a)}function Ta(t,a,r){var j;ee(Ke(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=n.useContext(de),{matches:s}=n.useContext(be),i=s[s.length-1],o=i?i.params:{},u=i?i.pathname:"/",d=i?i.pathnameBase:"/",c=i&&i.route;{let x=c&&c.path||"";Pa(u,!c||x.endsWith("*")||x.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${x}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
||
|
||
Please change the parent <Route path="${x}"> to <Route path="${x==="/"?"*":`${x}/*`}">.`)}let m=ye(),g;if(a){let x=typeof a=="string"?Ie(a):a;ee(d==="/"||((j=x.pathname)==null?void 0:j.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${x.pathname}" was given in the \`location\` prop.`),g=x}else g=m;let h=g.pathname||"/",y=h;if(d!=="/"){let x=d.replace(/^\//,"").split("/");y="/"+h.replace(/^\//,"").split("/").slice(x.length).join("/")}let _=fa(t,{pathname:y});xe(c||_!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),xe(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let R=ls(_&&_.map(x=>Object.assign({},x,{params:Object.assign({},o,x.params),pathname:ge([d,l.encodeLocation?l.encodeLocation(x.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?d:ge([d,l.encodeLocation?l.encodeLocation(x.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathnameBase])})),s,r);return a&&R?n.createElement(Ge.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},R):R}function as(){let t=us(),a=Ur(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,l="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:l},i={padding:"2px 4px",backgroundColor:l},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=n.createElement(n.Fragment,null,n.createElement("p",null,"💿 Hey developer 👋"),n.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",n.createElement("code",{style:i},"ErrorBoundary")," or"," ",n.createElement("code",{style:i},"errorElement")," prop on your route.")),n.createElement(n.Fragment,null,n.createElement("h2",null,"Unexpected Application Error!"),n.createElement("h3",{style:{fontStyle:"italic"}},a),r?n.createElement("pre",{style:s},r):null,o)}var rs=n.createElement(as,null),La=class extends n.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,a){return a.location!==t.location||a.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:a.error,location:a.location,revalidation:t.revalidation||a.revalidation}}componentDidCatch(t,a){this.props.onError?this.props.onError(t,a):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const r=Wr(t.digest);r&&(t=r)}let a=t!==void 0?n.createElement(be.Provider,{value:this.props.routeContext},n.createElement($t.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?n.createElement(ss,{error:t},a):a}};La.contextType=Br;var pt=new WeakMap;function ss({children:t,error:a}){let{basename:r}=n.useContext(de);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let l=zr(a.digest);if(l){let s=pt.get(a);if(s)throw s;let i=Na(l.location,r);if(wa&&!pt.get(a))if(i.isExternal||l.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:l.replace}));throw pt.set(a,o),o}return n.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return t}function ns({routeContext:t,match:a,children:r}){let l=n.useContext(De);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),n.createElement(be.Provider,{value:t},r)}function ls(t,a=[],r){let l=r==null?void 0:r.state;if(t==null){if(!l)return null;if(l.errors)t=l.matches;else if(a.length===0&&!l.initialized&&l.matches.length>0)t=l.matches;else return null}let s=t,i=l==null?void 0:l.errors;if(i!=null){let m=s.findIndex(g=>g.route.id&&(i==null?void 0:i[g.route.id])!==void 0);ee(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,m+1))}let o=!1,u=-1;if(r&&l){o=l.renderFallback;for(let m=0;m<s.length;m++){let g=s[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=m),g.route.id){let{loaderData:h,errors:y}=l,_=g.route.loader&&!h.hasOwnProperty(g.route.id)&&(!y||y[g.route.id]===void 0);if(g.route.lazy||_){r.isStatic&&(o=!0),u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}}let d=r==null?void 0:r.onError,c=l&&d?(m,g)=>{var h,y;d(m,{location:l.location,params:((y=(h=l.matches)==null?void 0:h[0])==null?void 0:y.params)??{},unstable_pattern:Vr(l.matches),errorInfo:g})}:void 0;return s.reduceRight((m,g,h)=>{let y,_=!1,R=null,j=null;l&&(y=i&&g.route.id?i[g.route.id]:void 0,R=g.route.errorElement||rs,o&&(u<0&&h===0?(Pa("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,j=null):u===h&&(_=!0,j=g.route.hydrateFallbackElement||null)));let x=a.concat(s.slice(0,h+1)),k=()=>{let D;return y?D=R:_?D=j:g.route.Component?D=n.createElement(g.route.Component,null):g.route.element?D=g.route.element:D=m,n.createElement(ns,{match:g,routeContext:{outlet:m,matches:x,isDataRoute:l!=null},children:D})};return l&&(g.route.ErrorBoundary||g.route.errorElement||h===0)?n.createElement(La,{location:l.location,revalidation:l.revalidation,component:R,error:y,children:k(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:c}):k()},null)}function It(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function is(t){let a=n.useContext(De);return ee(a,It(t)),a}function os(t){let a=n.useContext(at);return ee(a,It(t)),a}function ds(t){let a=n.useContext(be);return ee(a,It(t)),a}function Dt(t){let a=ds(t),r=a.matches[a.matches.length-1];return ee(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}function cs(){return Dt("useRouteId")}function us(){var l;let t=n.useContext($t),a=os("useRouteError"),r=Dt("useRouteError");return t!==void 0?t:(l=a.errors)==null?void 0:l[r]}function ms(){let{router:t}=is("useNavigate"),a=Dt("useNavigate"),r=n.useRef(!1);return Ra(()=>{r.current=!0}),n.useCallback(async(s,i={})=>{xe(r.current,Ea),r.current&&(typeof s=="number"?await t.navigate(s):await t.navigate(s,{fromRouteId:a,...i}))},[t,a])}var aa={};function Pa(t,a,r){!a&&!aa[t]&&(aa[t]=!0,xe(!1,r))}n.memo(gs);function gs({routes:t,future:a,state:r,isStatic:l,onError:s}){return Ta(t,void 0,{state:r,isStatic:l,onError:s})}function xs(t){return es(t.context)}function te(t){ee(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function hs({basename:t="/",children:a=null,location:r,navigationType:l="POP",navigator:s,static:i=!1,unstable_useTransitions:o}){ee(!Ke(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=t.replace(/^\/*/,"/"),d=n.useMemo(()=>({basename:u,navigator:s,static:i,unstable_useTransitions:o,future:{}}),[u,s,i,o]);typeof r=="string"&&(r=Ie(r));let{pathname:c="/",search:m="",hash:g="",state:h=null,key:y="default",unstable_mask:_}=r,R=n.useMemo(()=>{let j=ve(c,u);return j==null?null:{location:{pathname:j,search:m,hash:g,state:h,key:y,unstable_mask:_},navigationType:l}},[u,c,m,g,h,y,l,_]);return xe(R!=null,`<Router basename="${u}"> is not able to match the URL "${c}${m}${g}" because it does not start with the basename, so the <Router> won't render anything.`),R==null?null:n.createElement(de.Provider,{value:d},n.createElement(Ge.Provider,{children:a,value:R}))}function ps({children:t,location:a}){return ts(_t(t),a)}function _t(t,a=[]){let r=[];return n.Children.forEach(t,(l,s)=>{if(!n.isValidElement(l))return;let i=[...a,s];if(l.type===n.Fragment){r.push.apply(r,_t(l.props.children,i));return}ee(l.type===te,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ee(!l.props.index||!l.props.children,"An index route cannot have child routes.");let o={id:l.props.id||i.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(o.children=_t(l.props.children,i)),r.push(o)}),r}var Ye="get",Xe="application/x-www-form-urlencoded";function rt(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function bs(t){return rt(t)&&t.tagName.toLowerCase()==="button"}function ys(t){return rt(t)&&t.tagName.toLowerCase()==="form"}function fs(t){return rt(t)&&t.tagName.toLowerCase()==="input"}function ks(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function js(t,a){return t.button===0&&(!a||a==="_self")&&!ks(t)}var We=null;function vs(){if(We===null)try{new FormData(document.createElement("form"),0),We=!1}catch{We=!0}return We}var ws=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function bt(t){return t!=null&&!ws.has(t)?(xe(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Xe}"`),null):t}function Ns(t,a){let r,l,s,i,o;if(ys(t)){let u=t.getAttribute("action");l=u?ve(u,a):null,r=t.getAttribute("method")||Ye,s=bt(t.getAttribute("enctype"))||Xe,i=new FormData(t)}else if(bs(t)||fs(t)&&(t.type==="submit"||t.type==="image")){let u=t.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=t.getAttribute("formaction")||u.getAttribute("action");if(l=d?ve(d,a):null,r=t.getAttribute("formmethod")||u.getAttribute("method")||Ye,s=bt(t.getAttribute("formenctype"))||bt(u.getAttribute("enctype"))||Xe,i=new FormData(u,t),!vs()){let{name:c,type:m,value:g}=t;if(m==="image"){let h=c?`${c}.`:"";i.append(`${h}x`,"0"),i.append(`${h}y`,"0")}else c&&i.append(c,g)}}else{if(rt(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Ye,l=null,s=Xe,o=t}return i&&s==="text/plain"&&(o=i,i=void 0),{action:l,method:r.toLowerCase(),encType:s,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function At(t,a){if(t===!1||t===null||typeof t>"u")throw new Error(a)}function Cs(t,a,r,l){let s=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${l}`:s.pathname=`${s.pathname}.${l}`:s.pathname==="/"?s.pathname=`_root.${l}`:a&&ve(s.pathname,a)==="/"?s.pathname=`${a.replace(/\/$/,"")}/_root.${l}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${l}`,s}async function Ss(t,a){if(t.id in a)return a[t.id];try{let r=await import(t.module);return a[t.id]=r,r}catch(r){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function _s(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function Es(t,a,r){let l=await Promise.all(t.map(async s=>{let i=a.routes[s.route.id];if(i){let o=await Ss(i,r);return o.links?o.links():[]}return[]}));return Ps(l.flat(1).filter(_s).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function ra(t,a,r,l,s,i){let o=(d,c)=>r[c]?d.route.id!==r[c].route.id:!0,u=(d,c)=>{var m;return r[c].pathname!==d.pathname||((m=r[c].route.path)==null?void 0:m.endsWith("*"))&&r[c].params["*"]!==d.params["*"]};return i==="assets"?a.filter((d,c)=>o(d,c)||u(d,c)):i==="data"?a.filter((d,c)=>{var g;let m=l.routes[d.route.id];if(!m||!m.hasLoader)return!1;if(o(d,c)||u(d,c))return!0;if(d.route.shouldRevalidate){let h=d.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(t,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function Rs(t,a,{includeHydrateFallback:r}={}){return Ts(t.map(l=>{let s=a.routes[l.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function Ts(t){return[...new Set(t)]}function Ls(t){let a={},r=Object.keys(t).sort();for(let l of r)a[l]=t[l];return a}function Ps(t,a){let r=new Set;return new Set(a),t.reduce((l,s)=>{let i=JSON.stringify(Ls(s));return r.has(i)||(r.add(i),l.push({key:i,link:s})),l},[])}function Ma(){let t=n.useContext(De);return At(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Ms(){let t=n.useContext(at);return At(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Ht=n.createContext(void 0);Ht.displayName="FrameworkContext";function $a(){let t=n.useContext(Ht);return At(t,"You must render this element inside a <HydratedRouter> element"),t}function $s(t,a){let r=n.useContext(Ht),[l,s]=n.useState(!1),[i,o]=n.useState(!1),{onFocus:u,onBlur:d,onMouseEnter:c,onMouseLeave:m,onTouchStart:g}=a,h=n.useRef(null);n.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let R=x=>{x.forEach(k=>{o(k.isIntersecting)})},j=new IntersectionObserver(R,{threshold:.5});return h.current&&j.observe(h.current),()=>{j.disconnect()}}},[t]),n.useEffect(()=>{if(l){let R=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(R)}}},[l]);let y=()=>{s(!0)},_=()=>{s(!1),o(!1)};return r?t!=="intent"?[i,h,{}]:[i,h,{onFocus:Ue(u,y),onBlur:Ue(d,_),onMouseEnter:Ue(c,y),onMouseLeave:Ue(m,_),onTouchStart:Ue(g,y)}]:[!1,h,{}]}function Ue(t,a){return r=>{t&&t(r),r.defaultPrevented||a(r)}}function Is({page:t,...a}){let{router:r}=Ma(),l=n.useMemo(()=>fa(r.routes,t,r.basename),[r.routes,t,r.basename]);return l?n.createElement(As,{page:t,matches:l,...a}):null}function Ds(t){let{manifest:a,routeModules:r}=$a(),[l,s]=n.useState([]);return n.useEffect(()=>{let i=!1;return Es(t,a,r).then(o=>{i||s(o)}),()=>{i=!0}},[t,a,r]),l}function As({page:t,matches:a,...r}){let l=ye(),{future:s,manifest:i,routeModules:o}=$a(),{basename:u}=Ma(),{loaderData:d,matches:c}=Ms(),m=n.useMemo(()=>ra(t,a,c,i,l,"data"),[t,a,c,i,l]),g=n.useMemo(()=>ra(t,a,c,i,l,"assets"),[t,a,c,i,l]),h=n.useMemo(()=>{if(t===l.pathname+l.search+l.hash)return[];let R=new Set,j=!1;if(a.forEach(k=>{var E;let D=i.routes[k.route.id];!D||!D.hasLoader||(!m.some(T=>T.route.id===k.route.id)&&k.route.id in d&&((E=o[k.route.id])!=null&&E.shouldRevalidate)||D.hasClientLoader?j=!0:R.add(k.route.id))}),R.size===0)return[];let x=Cs(t,u,s.unstable_trailingSlashAwareDataRequests,"data");return j&&R.size>0&&x.searchParams.set("_routes",a.filter(k=>R.has(k.route.id)).map(k=>k.route.id).join(",")),[x.pathname+x.search]},[u,s.unstable_trailingSlashAwareDataRequests,d,l,i,m,a,t,o]),y=n.useMemo(()=>Rs(g,i),[g,i]),_=Ds(g);return n.createElement(n.Fragment,null,h.map(R=>n.createElement("link",{key:R,rel:"prefetch",as:"fetch",href:R,...r})),y.map(R=>n.createElement("link",{key:R,rel:"modulepreload",href:R,...r})),_.map(({key:R,link:j})=>n.createElement("link",{key:R,nonce:r.nonce,...j,crossOrigin:j.crossOrigin??r.crossOrigin})))}function Hs(...t){return a=>{t.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}var Os=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Os&&(window.__reactRouterVersion="7.13.1")}catch{}function Us({basename:t,children:a,unstable_useTransitions:r,window:l}){let s=n.useRef();s.current==null&&(s.current=pr({window:l,v5Compat:!0}));let i=s.current,[o,u]=n.useState({action:i.action,location:i.location}),d=n.useCallback(c=>{r===!1?u(c):n.startTransition(()=>u(c))},[r]);return n.useLayoutEffect(()=>i.listen(d),[i,d]),n.createElement(hs,{basename:t,children:a,location:o.location,navigationType:o.action,navigator:i,unstable_useTransitions:r})}var Ia=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ce=n.forwardRef(function({onClick:a,discover:r="render",prefetch:l="none",relative:s,reloadDocument:i,replace:o,unstable_mask:u,state:d,target:c,to:m,preventScrollReset:g,viewTransition:h,unstable_defaultShouldRevalidate:y,..._},R){let{basename:j,navigator:x,unstable_useTransitions:k}=n.useContext(de),D=typeof m=="string"&&Ia.test(m),E=Na(m,j);m=E.to;let T=Jr(m,{relative:s}),M=ye(),$=null;if(u){let A=Mt(u,[],M.unstable_mask?M.unstable_mask.pathname:"/",!0);j!=="/"&&(A.pathname=A.pathname==="/"?j:ge([j,A.pathname])),$=x.createHref(A)}let[v,N,I]=$s(l,_),V=Gs(m,{replace:o,unstable_mask:u,state:d,target:c,preventScrollReset:g,relative:s,viewTransition:h,unstable_defaultShouldRevalidate:y,unstable_useTransitions:k});function f(A){a&&a(A),A.defaultPrevented||V(A)}let O=!(E.isExternal||i),C=n.createElement("a",{..._,...I,href:(O?$:void 0)||E.absoluteURL||T,onClick:O?f:a,ref:Hs(R,N),target:c,"data-discover":!D&&r==="render"?"true":void 0});return v&&!D?n.createElement(n.Fragment,null,C,n.createElement(Is,{page:T})):C});Ce.displayName="Link";var Vs=n.forwardRef(function({"aria-current":a="page",caseSensitive:r=!1,className:l="",end:s=!1,style:i,to:o,viewTransition:u,children:d,...c},m){let g=qe(o,{relative:c.relative}),h=ye(),y=n.useContext(at),{navigator:_,basename:R}=n.useContext(de),j=y!=null&&Ws(g)&&u===!0,x=_.encodeLocation?_.encodeLocation(g).pathname:g.pathname,k=h.pathname,D=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;r||(k=k.toLowerCase(),D=D?D.toLowerCase():null,x=x.toLowerCase()),D&&R&&(D=ve(D,R)||D);const E=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let T=k===x||!s&&k.startsWith(x)&&k.charAt(E)==="/",M=D!=null&&(D===x||!s&&D.startsWith(x)&&D.charAt(x.length)==="/"),$={isActive:T,isPending:M,isTransitioning:j},v=T?a:void 0,N;typeof l=="function"?N=l($):N=[l,T?"active":null,M?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let I=typeof i=="function"?i($):i;return n.createElement(Ce,{...c,"aria-current":v,className:N,ref:m,style:I,to:o,viewTransition:u},typeof d=="function"?d($):d)});Vs.displayName="NavLink";var Fs=n.forwardRef(({discover:t="render",fetcherKey:a,navigate:r,reloadDocument:l,replace:s,state:i,method:o=Ye,action:u,onSubmit:d,relative:c,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:h,...y},_)=>{let{unstable_useTransitions:R}=n.useContext(de),j=Zs(),x=zs(u,{relative:c}),k=o.toLowerCase()==="get"?"get":"post",D=typeof u=="string"&&Ia.test(u),E=T=>{if(d&&d(T),T.defaultPrevented)return;T.preventDefault();let M=T.nativeEvent.submitter,$=(M==null?void 0:M.getAttribute("formmethod"))||o,v=()=>j(M||T.currentTarget,{fetcherKey:a,method:$,navigate:r,replace:s,state:i,relative:c,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:h});R&&r!==!1?n.startTransition(()=>v()):v()};return n.createElement("form",{ref:_,method:k,action:x,onSubmit:l?d:E,...y,"data-discover":!D&&t==="render"?"true":void 0})});Fs.displayName="Form";function Bs(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Da(t){let a=n.useContext(De);return ee(a,Bs(t)),a}function Gs(t,{target:a,replace:r,unstable_mask:l,state:s,preventScrollReset:i,relative:o,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:c}={}){let m=Qr(),g=ye(),h=qe(t,{relative:o});return n.useCallback(y=>{if(js(y,a)){y.preventDefault();let _=r!==void 0?r:Be(g)===Be(h),R=()=>m(t,{replace:_,unstable_mask:l,state:s,preventScrollReset:i,relative:o,viewTransition:u,unstable_defaultShouldRevalidate:d});c?n.startTransition(()=>R()):R()}},[g,m,h,r,l,s,a,t,i,o,u,d,c])}var Ks=0,qs=()=>`__${String(++Ks)}__`;function Zs(){let{router:t}=Da("useSubmit"),{basename:a}=n.useContext(de),r=cs(),l=t.fetch,s=t.navigate;return n.useCallback(async(i,o={})=>{let{action:u,method:d,encType:c,formData:m,body:g}=Ns(i,a);if(o.navigate===!1){let h=o.fetcherKey||qs();await l(h,r,o.action||u,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:m,body:g,formMethod:o.method||d,formEncType:o.encType||c,flushSync:o.flushSync})}else await s(o.action||u,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:m,body:g,formMethod:o.method||d,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:r,flushSync:o.flushSync,viewTransition:o.viewTransition})},[l,s,a,r])}function zs(t,{relative:a}={}){let{basename:r}=n.useContext(de),l=n.useContext(be);ee(l,"useFormAction must be used inside a RouteContext");let[s]=l.matches.slice(-1),i={...qe(t||".",{relative:a})},o=ye();if(t==null){i.search=o.search;let u=new URLSearchParams(i.search),d=u.getAll("index");if(d.some(m=>m==="")){u.delete("index"),d.filter(g=>g).forEach(g=>u.append("index",g));let m=u.toString();i.search=m?`?${m}`:""}}return(!t||t===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:ge([r,i.pathname])),Be(i)}function Ws(t,{relative:a}={}){let r=n.useContext(Sa);ee(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=Da("useViewTransitionState"),s=qe(t,{relative:a});if(!r.isTransitioning)return!1;let i=ve(r.currentLocation.pathname,l)||r.currentLocation.pathname,o=ve(r.nextLocation.pathname,l)||r.nextLocation.pathname;return tt(s.pathname,o)!=null||tt(s.pathname,i)!=null}var Js=xr();const Aa=n.createContext(void 0);function Qs({children:t}){const[a,r]=n.useState("light"),[l,s]=n.useState(!1);n.useEffect(()=>{const d=localStorage.getItem("theme");r(d??"light"),s(!0)},[]),n.useEffect(()=>{l&&(localStorage.setItem("theme",a),a==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))},[a,l]);const i=d=>r(d),o=()=>r(d=>d==="dark"?"light":"dark"),u=n.useMemo(()=>({theme:a,setTheme:i,toggleTheme:o,isInitialized:l}),[a,l]);return e.jsx(Aa.Provider,{value:u,children:t})}function Ys(){const t=n.useContext(Aa);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}const Ha=n.createContext(void 0),st=()=>{const t=n.useContext(Ha);if(!t)throw new Error("useSidebar must be used within a SidebarProvider");return t},Oa=({children:t})=>{const[a,r]=n.useState(!0),[l,s]=n.useState(!1),[i,o]=n.useState(!1),[u,d]=n.useState(!1),[c,m]=n.useState(null),[g,h]=n.useState(null);n.useEffect(()=>{const j=()=>{const x=window.innerWidth<768;o(x),x||s(!1)};return j(),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[]);const y=()=>{r(j=>!j)},_=()=>{s(j=>!j)},R=j=>{h(x=>x===j?null:j)};return e.jsx(Ha.Provider,{value:{isExpanded:i?!1:a,isMobileOpen:l,isHovered:u,activeItem:c,openSubmenu:g,toggleSidebar:y,toggleMobileSidebar:_,setIsHovered:d,setActiveItem:m,toggleSubmenu:R},children:t})};var yt,sa;function Xs(){if(sa)return yt;sa=1;var t=typeof Element<"u",a=typeof Map=="function",r=typeof Set=="function",l=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function s(i,o){if(i===o)return!0;if(i&&o&&typeof i=="object"&&typeof o=="object"){if(i.constructor!==o.constructor)return!1;var u,d,c;if(Array.isArray(i)){if(u=i.length,u!=o.length)return!1;for(d=u;d--!==0;)if(!s(i[d],o[d]))return!1;return!0}var m;if(a&&i instanceof Map&&o instanceof Map){if(i.size!==o.size)return!1;for(m=i.entries();!(d=m.next()).done;)if(!o.has(d.value[0]))return!1;for(m=i.entries();!(d=m.next()).done;)if(!s(d.value[1],o.get(d.value[0])))return!1;return!0}if(r&&i instanceof Set&&o instanceof Set){if(i.size!==o.size)return!1;for(m=i.entries();!(d=m.next()).done;)if(!o.has(d.value[0]))return!1;return!0}if(l&&ArrayBuffer.isView(i)&&ArrayBuffer.isView(o)){if(u=i.length,u!=o.length)return!1;for(d=u;d--!==0;)if(i[d]!==o[d])return!1;return!0}if(i.constructor===RegExp)return i.source===o.source&&i.flags===o.flags;if(i.valueOf!==Object.prototype.valueOf&&typeof i.valueOf=="function"&&typeof o.valueOf=="function")return i.valueOf()===o.valueOf();if(i.toString!==Object.prototype.toString&&typeof i.toString=="function"&&typeof o.toString=="function")return i.toString()===o.toString();if(c=Object.keys(i),u=c.length,u!==Object.keys(o).length)return!1;for(d=u;d--!==0;)if(!Object.prototype.hasOwnProperty.call(o,c[d]))return!1;if(t&&i instanceof Element)return!1;for(d=u;d--!==0;)if(!((c[d]==="_owner"||c[d]==="__v"||c[d]==="__o")&&i.$$typeof)&&!s(i[c[d]],o[c[d]]))return!1;return!0}return i!==i&&o!==o}return yt=function(o,u){try{return s(o,u)}catch(d){if((d.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw d}},yt}var en=Xs();const tn=Pt(en);var ft,na;function an(){if(na)return ft;na=1;var t=function(a,r,l,s,i,o,u,d){if(!a){var c;if(r===void 0)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var m=[l,s,i,o,u,d],g=0;c=new Error(r.replace(/%s/g,function(){return m[g++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};return ft=t,ft}var rn=an();const la=Pt(rn);var kt,ia;function sn(){return ia||(ia=1,kt=function(a,r,l,s){var i=l?l.call(s,a,r):void 0;if(i!==void 0)return!!i;if(a===r)return!0;if(typeof a!="object"||!a||typeof r!="object"||!r)return!1;var o=Object.keys(a),u=Object.keys(r);if(o.length!==u.length)return!1;for(var d=Object.prototype.hasOwnProperty.bind(r),c=0;c<o.length;c++){var m=o[c];if(!d(m))return!1;var g=a[m],h=r[m];if(i=l?l.call(s,g,h,m):void 0,i===!1||i===void 0&&g!==h)return!1}return!0}),kt}var nn=sn();const ln=Pt(nn);var Ua=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(Ua||{}),jt={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},oa=Object.values(Ua),Ot={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},on=Object.entries(Ot).reduce((t,[a,r])=>(t[r]=a,t),{}),ce="data-rh",Me={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},$e=(t,a)=>{for(let r=t.length-1;r>=0;r-=1){const l=t[r];if(Object.prototype.hasOwnProperty.call(l,a))return l[a]}return null},dn=t=>{let a=$e(t,"title");const r=$e(t,Me.TITLE_TEMPLATE);if(Array.isArray(a)&&(a=a.join("")),r&&a)return r.replace(/%s/g,()=>a);const l=$e(t,Me.DEFAULT_TITLE);return a||l||void 0},cn=t=>$e(t,Me.ON_CHANGE_CLIENT_STATE)||(()=>{}),vt=(t,a)=>a.filter(r=>typeof r[t]<"u").map(r=>r[t]).reduce((r,l)=>({...r,...l}),{}),un=(t,a)=>a.filter(r=>typeof r.base<"u").map(r=>r.base).reverse().reduce((r,l)=>{if(!r.length){const s=Object.keys(l);for(let i=0;i<s.length;i+=1){const u=s[i].toLowerCase();if(t.indexOf(u)!==-1&&l[u])return r.concat(l)}}return r},[]),mn=t=>console&&typeof console.warn=="function"&&console.warn(t),Ve=(t,a,r)=>{const l={};return r.filter(s=>Array.isArray(s[t])?!0:(typeof s[t]<"u"&&mn(`Helmet: ${t} should be of type "Array". Instead found type "${typeof s[t]}"`),!1)).map(s=>s[t]).reverse().reduce((s,i)=>{const o={};i.filter(d=>{let c;const m=Object.keys(d);for(let h=0;h<m.length;h+=1){const y=m[h],_=y.toLowerCase();a.indexOf(_)!==-1&&!(c==="rel"&&d[c].toLowerCase()==="canonical")&&!(_==="rel"&&d[_].toLowerCase()==="stylesheet")&&(c=_),a.indexOf(y)!==-1&&(y==="innerHTML"||y==="cssText"||y==="itemprop")&&(c=y)}if(!c||!d[c])return!1;const g=d[c].toLowerCase();return l[c]||(l[c]={}),o[c]||(o[c]={}),l[c][g]?!1:(o[c][g]=!0,!0)}).reverse().forEach(d=>s.push(d));const u=Object.keys(o);for(let d=0;d<u.length;d+=1){const c=u[d],m={...l[c],...o[c]};l[c]=m}return s},[]).reverse()},gn=(t,a)=>{if(Array.isArray(t)&&t.length){for(let r=0;r<t.length;r+=1)if(t[r][a])return!0}return!1},xn=t=>({baseTag:un(["href"],t),bodyAttributes:vt("bodyAttributes",t),defer:$e(t,Me.DEFER),encode:$e(t,Me.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:vt("htmlAttributes",t),linkTags:Ve("link",["rel","href"],t),metaTags:Ve("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:Ve("noscript",["innerHTML"],t),onChangeClientState:cn(t),scriptTags:Ve("script",["src","innerHTML"],t),styleTags:Ve("style",["cssText"],t),title:dn(t),titleAttributes:vt("titleAttributes",t),prioritizeSeoTags:gn(t,Me.PRIORITIZE_SEO_TAGS)}),Va=t=>Array.isArray(t)?t.join(""):t,hn=(t,a)=>{const r=Object.keys(t);for(let l=0;l<r.length;l+=1)if(a[r[l]]&&a[r[l]].includes(t[r[l]]))return!0;return!1},wt=(t,a)=>Array.isArray(t)?t.reduce((r,l)=>(hn(l,a)?r.priority.push(l):r.default.push(l),r),{priority:[],default:[]}):{default:t,priority:[]},da=(t,a)=>({...t,[a]:void 0}),pn=["noscript","script","style"],Et=(t,a=!0)=>a===!1?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Fa=t=>Object.keys(t).reduce((a,r)=>{const l=typeof t[r]<"u"?`${r}="${t[r]}"`:`${r}`;return a?`${a} ${l}`:l},""),bn=(t,a,r,l)=>{const s=Fa(r),i=Va(a);return s?`<${t} ${ce}="true" ${s}>${Et(i,l)}</${t}>`:`<${t} ${ce}="true">${Et(i,l)}</${t}>`},yn=(t,a,r=!0)=>a.reduce((l,s)=>{const i=s,o=Object.keys(i).filter(c=>!(c==="innerHTML"||c==="cssText")).reduce((c,m)=>{const g=typeof i[m]>"u"?m:`${m}="${Et(i[m],r)}"`;return c?`${c} ${g}`:g},""),u=i.innerHTML||i.cssText||"",d=pn.indexOf(t)===-1;return`${l}<${t} ${ce}="true" ${o}${d?"/>":`>${u}</${t}>`}`},""),Ba=(t,a={})=>Object.keys(t).reduce((r,l)=>{const s=Ot[l];return r[s||l]=t[l],r},a),fn=(t,a,r)=>{const l={key:a,[ce]:!0},s=Ba(r,l);return[je.createElement("title",s,a)]},et=(t,a)=>a.map((r,l)=>{const s={key:l,[ce]:!0};return Object.keys(r).forEach(i=>{const u=Ot[i]||i;if(u==="innerHTML"||u==="cssText"){const d=r.innerHTML||r.cssText;s.dangerouslySetInnerHTML={__html:d}}else s[u]=r[i]}),je.createElement(t,s)}),oe=(t,a,r=!0)=>{switch(t){case"title":return{toComponent:()=>fn(t,a.title,a.titleAttributes),toString:()=>bn(t,a.title,a.titleAttributes,r)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Ba(a),toString:()=>Fa(a)};default:return{toComponent:()=>et(t,a),toString:()=>yn(t,a,r)}}},kn=({metaTags:t,linkTags:a,scriptTags:r,encode:l})=>{const s=wt(t,jt.meta),i=wt(a,jt.link),o=wt(r,jt.script);return{priorityMethods:{toComponent:()=>[...et("meta",s.priority),...et("link",i.priority),...et("script",o.priority)],toString:()=>`${oe("meta",s.priority,l)} ${oe("link",i.priority,l)} ${oe("script",o.priority,l)}`},metaTags:s.default,linkTags:i.default,scriptTags:o.default}},jn=t=>{const{baseTag:a,bodyAttributes:r,encode:l=!0,htmlAttributes:s,noscriptTags:i,styleTags:o,title:u="",titleAttributes:d,prioritizeSeoTags:c}=t;let{linkTags:m,metaTags:g,scriptTags:h}=t,y={toComponent:()=>{},toString:()=>""};return c&&({priorityMethods:y,linkTags:m,metaTags:g,scriptTags:h}=kn(t)),{priority:y,base:oe("base",a,l),bodyAttributes:oe("bodyAttributes",r,l),htmlAttributes:oe("htmlAttributes",s,l),link:oe("link",m,l),meta:oe("meta",g,l),noscript:oe("noscript",i,l),script:oe("script",h,l),style:oe("style",o,l),title:oe("title",{title:u,titleAttributes:d},l)}},Rt=jn,Je=[],Ga=!!(typeof window<"u"&&window.document&&window.document.createElement),Tt=class{constructor(t,a){ke(this,"instances",[]);ke(this,"canUseDOM",Ga);ke(this,"context");ke(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?Je:this.instances,add:t=>{(this.canUseDOM?Je:this.instances).push(t)},remove:t=>{const a=(this.canUseDOM?Je:this.instances).indexOf(t);(this.canUseDOM?Je:this.instances).splice(a,1)}}});this.context=t,this.canUseDOM=a||!1,a||(t.helmet=Rt({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},vn={},Ka=je.createContext(vn),Re,qa=(Re=class extends n.Component{constructor(r){super(r);ke(this,"helmetData");this.helmetData=new Tt(this.props.context||{},Re.canUseDOM)}render(){return je.createElement(Ka.Provider,{value:this.helmetData.value},this.props.children)}},ke(Re,"canUseDOM",Ga),Re),Pe=(t,a)=>{const r=document.head||document.querySelector("head"),l=r.querySelectorAll(`${t}[${ce}]`),s=[].slice.call(l),i=[];let o;return a&&a.length&&a.forEach(u=>{const d=document.createElement(t);for(const c in u)if(Object.prototype.hasOwnProperty.call(u,c))if(c==="innerHTML")d.innerHTML=u.innerHTML;else if(c==="cssText")d.styleSheet?d.styleSheet.cssText=u.cssText:d.appendChild(document.createTextNode(u.cssText));else{const m=c,g=typeof u[m]>"u"?"":u[m];d.setAttribute(c,g)}d.setAttribute(ce,"true"),s.some((c,m)=>(o=m,d.isEqualNode(c)))?s.splice(o,1):i.push(d)}),s.forEach(u=>{var d;return(d=u.parentNode)==null?void 0:d.removeChild(u)}),i.forEach(u=>r.appendChild(u)),{oldTags:s,newTags:i}},Lt=(t,a)=>{const r=document.getElementsByTagName(t)[0];if(!r)return;const l=r.getAttribute(ce),s=l?l.split(","):[],i=[...s],o=Object.keys(a);for(const u of o){const d=a[u]||"";r.getAttribute(u)!==d&&r.setAttribute(u,d),s.indexOf(u)===-1&&s.push(u);const c=i.indexOf(u);c!==-1&&i.splice(c,1)}for(let u=i.length-1;u>=0;u-=1)r.removeAttribute(i[u]);s.length===i.length?r.removeAttribute(ce):r.getAttribute(ce)!==o.join(",")&&r.setAttribute(ce,o.join(","))},wn=(t,a)=>{typeof t<"u"&&document.title!==t&&(document.title=Va(t)),Lt("title",a)},ca=(t,a)=>{const{baseTag:r,bodyAttributes:l,htmlAttributes:s,linkTags:i,metaTags:o,noscriptTags:u,onChangeClientState:d,scriptTags:c,styleTags:m,title:g,titleAttributes:h}=t;Lt("body",l),Lt("html",s),wn(g,h);const y={baseTag:Pe("base",r),linkTags:Pe("link",i),metaTags:Pe("meta",o),noscriptTags:Pe("noscript",u),scriptTags:Pe("script",c),styleTags:Pe("style",m)},_={},R={};Object.keys(y).forEach(j=>{const{newTags:x,oldTags:k}=y[j];x.length&&(_[j]=x),k.length&&(R[j]=y[j].oldTags)}),a&&a(),d(t,_,R)},Fe=null,Nn=t=>{Fe&&cancelAnimationFrame(Fe),t.defer?Fe=requestAnimationFrame(()=>{ca(t,()=>{Fe=null})}):(ca(t),Fe=null)},Cn=Nn,ua=class extends n.Component{constructor(){super(...arguments);ke(this,"rendered",!1)}shouldComponentUpdate(a){return!ln(a,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:a}=this.props.context;a.remove(this),this.emitChange()}emitChange(){const{helmetInstances:a,setHelmet:r}=this.props.context;let l=null;const s=xn(a.get().map(i=>{const o={...i.props};return delete o.context,o}));qa.canUseDOM?Cn(s):Rt&&(l=Rt(s)),r(l)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:a}=this.props.context;a.add(this),this.emitChange()}render(){return this.init(),null}},Ct,Sn=(Ct=class extends n.Component{shouldComponentUpdate(t){return!tn(da(this.props,"helmetData"),da(t,"helmetData"))}mapNestedChildrenToProps(t,a){if(!a)return null;switch(t.type){case"script":case"noscript":return{innerHTML:a};case"style":return{cssText:a};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,a,r,l){return{...a,[t.type]:[...a[t.type]||[],{...r,...this.mapNestedChildrenToProps(t,l)}]}}mapObjectTypeChildren(t,a,r,l){switch(t.type){case"title":return{...a,[t.type]:l,titleAttributes:{...r}};case"body":return{...a,bodyAttributes:{...r}};case"html":return{...a,htmlAttributes:{...r}};default:return{...a,[t.type]:{...r}}}}mapArrayTypeChildrenToProps(t,a){let r={...a};return Object.keys(t).forEach(l=>{r={...r,[l]:t[l]}}),r}warnOnInvalidChildren(t,a){return la(oa.some(r=>t.type===r),typeof t.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${oa.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),la(!a||typeof a=="string"||Array.isArray(a)&&!a.some(r=>typeof r!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`}</${t.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(t,a){let r={};return je.Children.forEach(t,l=>{if(!l||!l.props)return;const{children:s,...i}=l.props,o=Object.keys(i).reduce((d,c)=>(d[on[c]||c]=i[c],d),{});let{type:u}=l;switch(typeof u=="symbol"?u=u.toString():this.warnOnInvalidChildren(l,s),u){case"Symbol(react.fragment)":a=this.mapChildrenToProps(s,a);break;case"link":case"meta":case"noscript":case"script":case"style":r=this.flattenArrayTypeChildren(l,r,o,s);break;default:a=this.mapObjectTypeChildren(l,a,o,s);break}}),this.mapArrayTypeChildrenToProps(r,a)}render(){const{children:t,...a}=this.props;let r={...a},{helmetData:l}=a;if(t&&(r=this.mapChildrenToProps(t,r)),l&&!(l instanceof Tt)){const s=l;l=new Tt(s.context,!0),delete r.helmetData}return l?je.createElement(ua,{...r,context:l.value}):je.createElement(Ka.Consumer,null,s=>je.createElement(ua,{...r,context:s}))}},ke(Ct,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),Ct);function _n(){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute right-0 top-0 -z-1 w-full max-w-[250px] xl:max-w-[450px]",children:e.jsx("img",{src:"/images/shape/grid-01.svg",alt:"grid"})}),e.jsx("div",{className:"absolute bottom-0 left-0 -z-1 w-full max-w-[250px] rotate-180 xl:max-w-[450px]",children:e.jsx("img",{src:"/images/shape/grid-01.svg",alt:"grid"})})]})}function nt(){var t;return((t=document.querySelector('meta[name="app-base"]'))==null?void 0:t.getAttribute("content"))||""}function Ut(){var t;return((t=document.querySelector('meta[name="csrf-token"]'))==null?void 0:t.getAttribute("content"))||""}async function Z(t){const a=nt(),r=await fetch(`${a}${t}`,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json"}});if(!r.ok){const l=await lt(r);throw new Error(l)}return await r.json()}async function ue(t,a){const r=nt(),l=Ut(),s=await fetch(`${r}${t}`,{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json","X-CSRF-TOKEN":l},body:JSON.stringify(a)});if(!s.ok){const i=await lt(s);throw new Error(i)}return await s.json()}async function he(t,a){const r=nt(),l=Ut(),s=await fetch(`${r}${t}`,{method:"PUT",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json","X-CSRF-TOKEN":l},body:JSON.stringify(a)});if(!s.ok){const i=await lt(s);throw new Error(i)}return await s.json()}async function Vt(t){const a=nt(),r=Ut(),l=await fetch(`${a}${t}`,{method:"DELETE",credentials:"same-origin",headers:{Accept:"application/json","X-CSRF-TOKEN":r}});if(!l.ok){const s=await lt(l);throw new Error(s)}return await l.json()}async function lt(t){let a="";try{a=await t.text()}catch{}let r=a||"";if(r.trim().startsWith("{")||r.trim().startsWith("["))try{const s=JSON.parse(r);s!=null&&s.message?r=s.message:s!=null&&s.error?r=s.error:s!=null&&s.errors&&(r=Object.values(s.errors).flat().join(" "))}catch{}return r=r.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),r||`Permintaan gagal (${t.status})`}let Ee=null,Qe=null;async function En(){return Ee!==null?Ee:(Qe||(Qe=Z("/admin-api/pengaturan").then(t=>{var r,l,s;const a=(s=(l=(r=t==null?void 0:t.data)==null?void 0:r.toko)==null?void 0:l.nama)==null?void 0:s.trim();return Ee=a||null,Ee}).catch(()=>(Ee=null,null)).finally(()=>{Qe=null})),Qe)}const se=({title:t,description:a})=>{const[r,l]=n.useState(Ee);n.useEffect(()=>{let i=!0;if(Ee===null)return En().then(o=>{i&&l(o)}),()=>{i=!1}},[]);const s=r?`${r} - ${t}`:t;return e.jsxs(Sn,{children:[e.jsx("title",{children:s}),e.jsx("meta",{name:"description",content:a})]})};function Rn(){return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"React.js 404 Dashboard | TailAdmin - React.js Admin Dashboard Template",description:"This is React.js 404 Dashboard page for TailAdmin - React.js Tailwind CSS Admin Dashboard Template"}),e.jsxs("div",{className:"relative flex flex-col items-center justify-center min-h-screen p-6 overflow-hidden z-1",children:[e.jsx(_n,{}),e.jsxs("div",{className:"mx-auto w-full max-w-[242px] text-center sm:max-w-[472px]",children:[e.jsx("h1",{className:"mb-8 font-bold text-gray-800 text-title-md dark:text-white/90 xl:text-title-2xl",children:"ERROR"}),e.jsx("img",{src:"/images/error/404.svg",alt:"404",className:"dark:hidden"}),e.jsx("img",{src:"/images/error/404-dark.svg",alt:"404",className:"hidden dark:block"}),e.jsx("p",{className:"mt-10 mb-6 text-base text-gray-700 dark:text-gray-400 sm:text-lg",children:"We can’t seem to find the page you are looking for!"}),e.jsx(Ce,{to:"/",className:"inline-flex items-center justify-center rounded-lg border border-gray-300 bg-white px-5 py-3.5 text-sm font-medium text-gray-700 shadow-theme-xs hover:bg-gray-50 hover:text-gray-800 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03] dark:hover:text-gray-200",children:"Back to Home Page"})]}),e.jsxs("p",{className:"absolute text-sm text-center text-gray-500 -translate-x-1/2 bottom-6 left-1/2 dark:text-gray-400",children:["© ",new Date().getFullYear()," - TailAdmin"]})]})]})}const Tn=()=>{const{toggleTheme:t}=Ys();return e.jsxs("button",{onClick:t,className:"relative flex items-center justify-center text-gray-500 transition-colors bg-white border border-gray-200 rounded-full hover:text-dark-900 h-11 w-11 hover:bg-gray-100 hover:text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",children:[e.jsx("svg",{className:"hidden dark:block",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.99998 1.5415C10.4142 1.5415 10.75 1.87729 10.75 2.2915V3.5415C10.75 3.95572 10.4142 4.2915 9.99998 4.2915C9.58577 4.2915 9.24998 3.95572 9.24998 3.5415V2.2915C9.24998 1.87729 9.58577 1.5415 9.99998 1.5415ZM10.0009 6.79327C8.22978 6.79327 6.79402 8.22904 6.79402 10.0001C6.79402 11.7712 8.22978 13.207 10.0009 13.207C11.772 13.207 13.2078 11.7712 13.2078 10.0001C13.2078 8.22904 11.772 6.79327 10.0009 6.79327ZM5.29402 10.0001C5.29402 7.40061 7.40135 5.29327 10.0009 5.29327C12.6004 5.29327 14.7078 7.40061 14.7078 10.0001C14.7078 12.5997 12.6004 14.707 10.0009 14.707C7.40135 14.707 5.29402 12.5997 5.29402 10.0001ZM15.9813 5.08035C16.2742 4.78746 16.2742 4.31258 15.9813 4.01969C15.6884 3.7268 15.2135 3.7268 14.9207 4.01969L14.0368 4.90357C13.7439 5.19647 13.7439 5.67134 14.0368 5.96423C14.3297 6.25713 14.8045 6.25713 15.0974 5.96423L15.9813 5.08035ZM18.4577 10.0001C18.4577 10.4143 18.1219 10.7501 17.7077 10.7501H16.4577C16.0435 10.7501 15.7077 10.4143 15.7077 10.0001C15.7077 9.58592 16.0435 9.25013 16.4577 9.25013H17.7077C18.1219 9.25013 18.4577 9.58592 18.4577 10.0001ZM14.9207 15.9806C15.2135 16.2735 15.6884 16.2735 15.9813 15.9806C16.2742 15.6877 16.2742 15.2128 15.9813 14.9199L15.0974 14.036C14.8045 13.7431 14.3297 13.7431 14.0368 14.036C13.7439 14.3289 13.7439 14.8038 14.0368 15.0967L14.9207 15.9806ZM9.99998 15.7088C10.4142 15.7088 10.75 16.0445 10.75 16.4588V17.7088C10.75 18.123 10.4142 18.4588 9.99998 18.4588C9.58577 18.4588 9.24998 18.123 9.24998 17.7088V16.4588C9.24998 16.0445 9.58577 15.7088 9.99998 15.7088ZM5.96356 15.0972C6.25646 14.8043 6.25646 14.3295 5.96356 14.0366C5.67067 13.7437 5.1958 13.7437 4.9029 14.0366L4.01902 14.9204C3.72613 15.2133 3.72613 15.6882 4.01902 15.9811C4.31191 16.274 4.78679 16.274 5.07968 15.9811L5.96356 15.0972ZM4.29224 10.0001C4.29224 10.4143 3.95645 10.7501 3.54224 10.7501H2.29224C1.87802 10.7501 1.54224 10.4143 1.54224 10.0001C1.54224 9.58592 1.87802 9.25013 2.29224 9.25013H3.54224C3.95645 9.25013 4.29224 9.58592 4.29224 10.0001ZM4.9029 5.9637C5.1958 6.25659 5.67067 6.25659 5.96356 5.9637C6.25646 5.6708 6.25646 5.19593 5.96356 4.90303L5.07968 4.01915C4.78679 3.72626 4.31191 3.72626 4.01902 4.01915C3.72613 4.31204 3.72613 4.78692 4.01902 5.07981L4.9029 5.9637Z",fill:"currentColor"})}),e.jsx("svg",{className:"dark:hidden",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M17.4547 11.97L18.1799 12.1611C18.265 11.8383 18.1265 11.4982 17.8401 11.3266C17.5538 11.1551 17.1885 11.1934 16.944 11.4207L17.4547 11.97ZM8.0306 2.5459L8.57989 3.05657C8.80718 2.81209 8.84554 2.44682 8.67398 2.16046C8.50243 1.8741 8.16227 1.73559 7.83948 1.82066L8.0306 2.5459ZM12.9154 13.0035C9.64678 13.0035 6.99707 10.3538 6.99707 7.08524H5.49707C5.49707 11.1823 8.81835 14.5035 12.9154 14.5035V13.0035ZM16.944 11.4207C15.8869 12.4035 14.4721 13.0035 12.9154 13.0035V14.5035C14.8657 14.5035 16.6418 13.7499 17.9654 12.5193L16.944 11.4207ZM16.7295 11.7789C15.9437 14.7607 13.2277 16.9586 10.0003 16.9586V18.4586C13.9257 18.4586 17.2249 15.7853 18.1799 12.1611L16.7295 11.7789ZM10.0003 16.9586C6.15734 16.9586 3.04199 13.8433 3.04199 10.0003H1.54199C1.54199 14.6717 5.32892 18.4586 10.0003 18.4586V16.9586ZM3.04199 10.0003C3.04199 6.77289 5.23988 4.05695 8.22173 3.27114L7.83948 1.82066C4.21532 2.77574 1.54199 6.07486 1.54199 10.0003H3.04199ZM6.99707 7.08524C6.99707 5.52854 7.5971 4.11366 8.57989 3.05657L7.48132 2.03522C6.25073 3.35885 5.49707 5.13487 5.49707 7.08524H6.99707Z",fill:"currentColor"})})]})},ma=({tag:t="button",to:a,href:r,onClick:l,onItemClick:s,baseClassName:i="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900",className:o="",children:u})=>{const d=`${i} ${o}`.trim(),c=m=>{t==="button"&&m.preventDefault(),l&&l(),s&&s()};return t==="a"&&r?e.jsx("a",{href:r,className:d,onClick:c,children:u}):t==="a"&&a?e.jsx(Ce,{to:a,className:d,onClick:c,children:u}):e.jsx("button",{onClick:c,className:d,children:u})},Ln=({isOpen:t,onClose:a,children:r,className:l=""})=>{const s=n.useRef(null);return n.useEffect(()=>{const i=o=>{s.current&&!s.current.contains(o.target)&&!o.target.closest(".dropdown-toggle")&&a()};return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[a]),t?e.jsx("div",{ref:s,className:`absolute z-40 right-0 mt-2 rounded-xl border border-gray-200 bg-white shadow-theme-lg dark:border-gray-800 dark:bg-gray-900 ${l}`,children:r}):null},Pn=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 3.25C4.25736 3.25 3.25 4.25736 3.25 5.5V8.99998C3.25 10.2426 4.25736 11.25 5.5 11.25H9C10.2426 11.25 11.25 10.2426 11.25 8.99998V5.5C11.25 4.25736 10.2426 3.25 9 3.25H5.5ZM4.75 5.5C4.75 5.08579 5.08579 4.75 5.5 4.75H9C9.41421 4.75 9.75 5.08579 9.75 5.5V8.99998C9.75 9.41419 9.41421 9.74998 9 9.74998H5.5C5.08579 9.74998 4.75 9.41419 4.75 8.99998V5.5ZM5.5 12.75C4.25736 12.75 3.25 13.7574 3.25 15V18.5C3.25 19.7426 4.25736 20.75 5.5 20.75H9C10.2426 20.75 11.25 19.7427 11.25 18.5V15C11.25 13.7574 10.2426 12.75 9 12.75H5.5ZM4.75 15C4.75 14.5858 5.08579 14.25 5.5 14.25H9C9.41421 14.25 9.75 14.5858 9.75 15V18.5C9.75 18.9142 9.41421 19.25 9 19.25H5.5C5.08579 19.25 4.75 18.9142 4.75 18.5V15ZM12.75 5.5C12.75 4.25736 13.7574 3.25 15 3.25H18.5C19.7426 3.25 20.75 4.25736 20.75 5.5V8.99998C20.75 10.2426 19.7426 11.25 18.5 11.25H15C13.7574 11.25 12.75 10.2426 12.75 8.99998V5.5ZM15 4.75C14.5858 4.75 14.25 5.08579 14.25 5.5V8.99998C14.25 9.41419 14.5858 9.74998 15 9.74998H18.5C18.9142 9.74998 19.25 9.41419 19.25 8.99998V5.5C19.25 5.08579 18.9142 4.75 18.5 4.75H15ZM15 12.75C13.7574 12.75 12.75 13.7574 12.75 15V18.5C12.75 19.7426 13.7574 20.75 15 20.75H18.5C19.7426 20.75 20.75 19.7427 20.75 18.5V15C20.75 13.7574 19.7426 12.75 18.5 12.75H15ZM14.25 15C14.25 14.5858 14.5858 14.25 15 14.25H18.5C18.9142 14.25 19.25 14.5858 19.25 15V18.5C19.25 18.9142 18.9142 19.25 18.5 19.25H15C14.5858 19.25 14.25 18.9142 14.25 18.5V15Z",fill:"currentColor"})),Mn=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.80443 5.60156C7.59109 5.60156 6.60749 6.58517 6.60749 7.79851C6.60749 9.01185 7.59109 9.99545 8.80443 9.99545C10.0178 9.99545 11.0014 9.01185 11.0014 7.79851C11.0014 6.58517 10.0178 5.60156 8.80443 5.60156ZM5.10749 7.79851C5.10749 5.75674 6.76267 4.10156 8.80443 4.10156C10.8462 4.10156 12.5014 5.75674 12.5014 7.79851C12.5014 9.84027 10.8462 11.4955 8.80443 11.4955C6.76267 11.4955 5.10749 9.84027 5.10749 7.79851ZM4.86252 15.3208C4.08769 16.0881 3.70377 17.0608 3.51705 17.8611C3.48384 18.0034 3.5211 18.1175 3.60712 18.2112C3.70161 18.3141 3.86659 18.3987 4.07591 18.3987H13.4249C13.6343 18.3987 13.7992 18.3141 13.8937 18.2112C13.9797 18.1175 14.017 18.0034 13.9838 17.8611C13.7971 17.0608 13.4132 16.0881 12.6383 15.3208C11.8821 14.572 10.6899 13.955 8.75042 13.955C6.81096 13.955 5.61877 14.572 4.86252 15.3208ZM3.8071 14.2549C4.87163 13.2009 6.45602 12.455 8.75042 12.455C11.0448 12.455 12.6292 13.2009 13.6937 14.2549C14.7397 15.2906 15.2207 16.5607 15.4446 17.5202C15.7658 18.8971 14.6071 19.8987 13.4249 19.8987H4.07591C2.89369 19.8987 1.73504 18.8971 2.05628 17.5202C2.28015 16.5607 2.76117 15.2906 3.8071 14.2549ZM15.3042 11.4955C14.4702 11.4955 13.7006 11.2193 13.0821 10.7533C13.3742 10.3314 13.6054 9.86419 13.7632 9.36432C14.1597 9.75463 14.7039 9.99545 15.3042 9.99545C16.5176 9.99545 17.5012 9.01185 17.5012 7.79851C17.5012 6.58517 16.5176 5.60156 15.3042 5.60156C14.7039 5.60156 14.1597 5.84239 13.7632 6.23271C13.6054 5.73284 13.3741 5.26561 13.082 4.84371C13.7006 4.37777 14.4702 4.10156 15.3042 4.10156C17.346 4.10156 19.0012 5.75674 19.0012 7.79851C19.0012 9.84027 17.346 11.4955 15.3042 11.4955ZM19.9248 19.8987H16.3901C16.7014 19.4736 16.9159 18.969 16.9827 18.3987H19.9248C20.1341 18.3987 20.2991 18.3141 20.3936 18.2112C20.4796 18.1175 20.5169 18.0034 20.4837 17.861C20.2969 17.0607 19.913 16.088 19.1382 15.3208C18.4047 14.5945 17.261 13.9921 15.4231 13.9566C15.2232 13.6945 14.9995 13.437 14.7491 13.1891C14.5144 12.9566 14.262 12.7384 13.9916 12.5362C14.3853 12.4831 14.8044 12.4549 15.2503 12.4549C17.5447 12.4549 19.1291 13.2008 20.1936 14.2549C21.2395 15.2906 21.7206 16.5607 21.9444 17.5202C22.2657 18.8971 21.107 19.8987 19.9248 19.8987Z",fill:"currentColor"})),$n=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{d:"M4.79175 7.396L10.0001 12.6043L15.2084 7.396",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),In=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.0254 6.17845C8.0254 4.90629 9.05669 3.875 10.3289 3.875C11.601 3.875 12.6323 4.90629 12.6323 6.17845C12.6323 7.45061 11.601 8.48191 10.3289 8.48191C9.05669 8.48191 8.0254 7.45061 8.0254 6.17845ZM10.3289 2.375C8.22827 2.375 6.5254 4.07786 6.5254 6.17845C6.5254 8.27904 8.22827 9.98191 10.3289 9.98191C12.4294 9.98191 14.1323 8.27904 14.1323 6.17845C14.1323 4.07786 12.4294 2.375 10.3289 2.375ZM8.92286 11.03C5.7669 11.03 3.2085 13.5884 3.2085 16.7444V17.0333C3.2085 17.4475 3.54428 17.7833 3.9585 17.7833C4.37271 17.7833 4.7085 17.4475 4.7085 17.0333V16.7444C4.7085 14.4169 6.59533 12.53 8.92286 12.53H11.736C14.0635 12.53 15.9504 14.4169 15.9504 16.7444V17.0333C15.9504 17.4475 16.2861 17.7833 16.7004 17.7833C17.1146 17.7833 17.4504 17.4475 17.4504 17.0333V16.7444C17.4504 13.5884 14.8919 11.03 11.736 11.03H8.92286Z",fill:"currentColor"})),Za=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 14.1526 4.3002 16.1184 5.61936 17.616C6.17279 15.3096 8.24852 13.5955 10.7246 13.5955H13.2746C15.7509 13.5955 17.8268 15.31 18.38 17.6167C19.6996 16.119 20.5 14.153 20.5 12C20.5 7.30558 16.6944 3.5 12 3.5ZM17.0246 18.8566V18.8455C17.0246 16.7744 15.3457 15.0955 13.2746 15.0955H10.7246C8.65354 15.0955 6.97461 16.7744 6.97461 18.8455V18.856C8.38223 19.8895 10.1198 20.5 12 20.5C13.8798 20.5 15.6171 19.8898 17.0246 18.8566ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM11.9991 7.25C10.8847 7.25 9.98126 8.15342 9.98126 9.26784C9.98126 10.3823 10.8847 11.2857 11.9991 11.2857C13.1135 11.2857 14.0169 10.3823 14.0169 9.26784C14.0169 8.15342 13.1135 7.25 11.9991 7.25ZM8.48126 9.26784C8.48126 7.32499 10.0563 5.75 11.9991 5.75C13.9419 5.75 15.5169 7.32499 15.5169 9.26784C15.5169 11.2107 13.9419 12.7857 11.9991 12.7857C10.0563 12.7857 8.48126 11.2107 8.48126 9.26784Z",fill:"currentColor"})),ga=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 3.25C4.25736 3.25 3.25 4.25736 3.25 5.5V18.5C3.25 19.7426 4.25736 20.75 5.5 20.75H18.5001C19.7427 20.75 20.7501 19.7426 20.7501 18.5V5.5C20.7501 4.25736 19.7427 3.25 18.5001 3.25H5.5ZM4.75 5.5C4.75 5.08579 5.08579 4.75 5.5 4.75H18.5001C18.9143 4.75 19.2501 5.08579 19.2501 5.5V18.5C19.2501 18.9142 18.9143 19.25 18.5001 19.25H5.5C5.08579 19.25 4.75 18.9142 4.75 18.5V5.5ZM6.25005 9.7143C6.25005 9.30008 6.58583 8.9643 7.00005 8.9643L17 8.96429C17.4143 8.96429 17.75 9.30008 17.75 9.71429C17.75 10.1285 17.4143 10.4643 17 10.4643L7.00005 10.4643C6.58583 10.4643 6.25005 10.1285 6.25005 9.7143ZM6.25005 14.2857C6.25005 13.8715 6.58583 13.5357 7.00005 13.5357H17C17.4143 13.5357 17.75 13.8715 17.75 14.2857C17.75 14.6999 17.4143 15.0357 17 15.0357H7.00005C6.58583 15.0357 6.25005 14.6999 6.25005 14.2857Z",fill:"currentColor"})),xa=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.25 5.5C3.25 4.25736 4.25736 3.25 5.5 3.25H18.5C19.7426 3.25 20.75 4.25736 20.75 5.5V18.5C20.75 19.7426 19.7426 20.75 18.5 20.75H5.5C4.25736 20.75 3.25 19.7426 3.25 18.5V5.5ZM5.5 4.75C5.08579 4.75 4.75 5.08579 4.75 5.5V8.58325L19.25 8.58325V5.5C19.25 5.08579 18.9142 4.75 18.5 4.75H5.5ZM19.25 10.0833H15.416V13.9165H19.25V10.0833ZM13.916 10.0833L10.083 10.0833V13.9165L13.916 13.9165V10.0833ZM8.58301 10.0833H4.75V13.9165H8.58301V10.0833ZM4.75 18.5V15.4165H8.58301V19.25H5.5C5.08579 19.25 4.75 18.9142 4.75 18.5ZM10.083 19.25V15.4165L13.916 15.4165V19.25H10.083ZM15.416 19.25V15.4165H19.25V18.5C19.25 18.9142 18.9142 19.25 18.5 19.25H15.416Z",fill:"currentColor"})),Dn=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C11.5858 2 11.25 2.33579 11.25 2.75V12C11.25 12.4142 11.5858 12.75 12 12.75H21.25C21.6642 12.75 22 12.4142 22 12C22 6.47715 17.5228 2 12 2ZM12.75 11.25V3.53263C13.2645 3.57761 13.7659 3.66843 14.25 3.80098V3.80099C15.6929 4.19606 16.9827 4.96184 18.0104 5.98959C19.0382 7.01734 19.8039 8.30707 20.199 9.75C20.3316 10.2341 20.4224 10.7355 20.4674 11.25H12.75ZM2 12C2 7.25083 5.31065 3.27489 9.75 2.25415V3.80099C6.14748 4.78734 3.5 8.0845 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5C15.9155 20.5 19.2127 17.8525 20.199 14.25H21.7459C20.7251 18.6894 16.7492 22 12 22C6.47715 22 2 17.5229 2 12Z",fill:"currentColor"})),An=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.665 3.75618C11.8762 3.65061 12.1247 3.65061 12.3358 3.75618L18.7807 6.97853L12.3358 10.2009C12.1247 10.3064 11.8762 10.3064 11.665 10.2009L5.22014 6.97853L11.665 3.75618ZM4.29297 8.19199V16.0946C4.29297 16.3787 4.45347 16.6384 4.70757 16.7654L11.25 20.0365V11.6512C11.1631 11.6205 11.0777 11.5843 10.9942 11.5425L4.29297 8.19199ZM12.75 20.037L19.2933 16.7654C19.5474 16.6384 19.7079 16.3787 19.7079 16.0946V8.19199L13.0066 11.5425C12.9229 11.5844 12.8372 11.6207 12.75 11.6515V20.037ZM13.0066 2.41453C12.3732 2.09783 11.6277 2.09783 10.9942 2.41453L4.03676 5.89316C3.27449 6.27429 2.79297 7.05339 2.79297 7.90563V16.0946C2.79297 16.9468 3.27448 17.7259 4.03676 18.1071L10.9942 21.5857L11.3296 20.9149L10.9942 21.5857C11.6277 21.9024 12.3732 21.9024 13.0066 21.5857L19.9641 18.1071C20.7264 17.7259 21.2079 16.9468 21.2079 16.0946V7.90563C21.2079 7.05339 20.7264 6.27429 19.9641 5.89316L13.0066 2.41453Z",fill:"currentColor"})),Hn=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14 2.75C14 2.33579 14.3358 2 14.75 2C15.1642 2 15.5 2.33579 15.5 2.75V5.73291L17.75 5.73291H19C19.4142 5.73291 19.75 6.0687 19.75 6.48291C19.75 6.89712 19.4142 7.23291 19 7.23291H18.5L18.5 12.2329C18.5 15.5691 15.9866 18.3183 12.75 18.6901V21.25C12.75 21.6642 12.4142 22 12 22C11.5858 22 11.25 21.6642 11.25 21.25V18.6901C8.01342 18.3183 5.5 15.5691 5.5 12.2329L5.5 7.23291H5C4.58579 7.23291 4.25 6.89712 4.25 6.48291C4.25 6.0687 4.58579 5.73291 5 5.73291L6.25 5.73291L8.5 5.73291L8.5 2.75C8.5 2.33579 8.83579 2 9.25 2C9.66421 2 10 2.33579 10 2.75L10 5.73291L14 5.73291V2.75ZM7 7.23291L7 12.2329C7 14.9943 9.23858 17.2329 12 17.2329C14.7614 17.2329 17 14.9943 17 12.2329L17 7.23291L7 7.23291Z",fill:"currentColor"})),ha=t=>n.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99915 10.2451C6.96564 10.2451 7.74915 11.0286 7.74915 11.9951V12.0051C7.74915 12.9716 6.96564 13.7551 5.99915 13.7551C5.03265 13.7551 4.24915 12.9716 4.24915 12.0051V11.9951C4.24915 11.0286 5.03265 10.2451 5.99915 10.2451ZM17.9991 10.2451C18.9656 10.2451 19.7491 11.0286 19.7491 11.9951V12.0051C19.7491 12.9716 18.9656 13.7551 17.9991 13.7551C17.0326 13.7551 16.2491 12.9716 16.2491 12.0051V11.9951C16.2491 11.0286 17.0326 10.2451 17.9991 10.2451ZM13.7491 11.9951C13.7491 11.0286 12.9656 10.2451 11.9991 10.2451C11.0326 10.2451 10.2491 11.0286 10.2491 11.9951V12.0051C10.2491 12.9716 11.0326 13.7551 11.9991 13.7551C12.9656 13.7551 13.7491 12.9716 13.7491 12.0051V11.9951Z",fill:"currentColor"}));function On(){const[t,a]=n.useState(!1),[r,l]=n.useState(null);function s(){a(!t)}function i(){a(!1)}function o(){const d=document.querySelector('meta[name="csrf-token"]');return d?d.content:""}async function u(){try{await fetch("/logout",{method:"POST",credentials:"same-origin",headers:{"X-CSRF-TOKEN":o(),Accept:"application/json"}})}finally{i(),window.location.href="/login"}}return n.useEffect(()=>{let d=!0;return Z("/admin-api/me").then(c=>{var h,y;if(!d)return;const m=((h=c==null?void 0:c.data)==null?void 0:h.name)||"User",g=((y=c==null?void 0:c.data)==null?void 0:y.email)||"";l({name:m,email:g})}).catch(()=>{}),()=>{d=!1}},[]),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:s,className:"flex items-center text-gray-700 dropdown-toggle dark:text-gray-400",children:[e.jsx("span",{className:"mr-3 flex h-11 w-11 items-center justify-center rounded-full bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:e.jsx(Za,{className:"h-6 w-6"})}),e.jsx("span",{className:"block mr-1 font-medium text-theme-sm",children:(r==null?void 0:r.name)||"User"}),e.jsx("svg",{className:`stroke-gray-500 dark:stroke-gray-400 transition-transform duration-200 ${t?"rotate-180":""}`,width:"18",height:"20",viewBox:"0 0 18 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4.3125 8.65625L9 13.3437L13.6875 8.65625",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsxs(Ln,{isOpen:t,onClose:i,className:"absolute right-0 mt-[17px] flex w-[260px] flex-col rounded-2xl border border-gray-200 bg-white p-3 shadow-theme-lg dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block font-medium text-gray-700 text-theme-sm dark:text-gray-400",children:(r==null?void 0:r.name)||"User"}),e.jsx("span",{className:"mt-0.5 block text-theme-xs text-gray-500 dark:text-gray-400",children:(r==null?void 0:r.email)||""})]}),e.jsxs("ul",{className:"flex flex-col gap-1 pt-4 pb-3 border-b border-gray-200 dark:border-gray-800",children:[e.jsx("li",{children:e.jsxs(ma,{onItemClick:i,tag:"a",to:"/profile",className:"flex items-center gap-3 px-3 py-2 font-medium text-gray-700 rounded-lg group text-theme-sm hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-white/5 dark:hover:text-gray-300",children:[e.jsx("svg",{className:"fill-gray-500 group-hover:fill-gray-700 dark:fill-gray-400 dark:group-hover:fill-gray-300",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 14.1526 4.3002 16.1184 5.61936 17.616C6.17279 15.3096 8.24852 13.5955 10.7246 13.5955H13.2746C15.7509 13.5955 17.8268 15.31 18.38 17.6167C19.6996 16.119 20.5 14.153 20.5 12C20.5 7.30558 16.6944 3.5 12 3.5ZM17.0246 18.8566V18.8455C17.0246 16.7744 15.3457 15.0955 13.2746 15.0955H10.7246C8.65354 15.0955 6.97461 16.7744 6.97461 18.8455V18.856C8.38223 19.8895 10.1198 20.5 12 20.5C13.8798 20.5 15.6171 19.8898 17.0246 18.8566ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM11.9991 7.25C10.8847 7.25 9.98126 8.15342 9.98126 9.26784C9.98126 10.3823 10.8847 11.2857 11.9991 11.2857C13.1135 11.2857 14.0169 10.3823 14.0169 9.26784C14.0169 8.15342 13.1135 7.25 11.9991 7.25ZM8.48126 9.26784C8.48126 7.32499 10.0563 5.75 11.9991 5.75C13.9419 5.75 15.5169 7.32499 15.5169 9.26784C15.5169 11.2107 13.9419 12.7857 11.9991 12.7857C10.0563 12.7857 8.48126 11.2107 8.48126 9.26784Z",fill:""})}),"Edit profile"]})}),e.jsx("li",{children:e.jsxs(ma,{onItemClick:i,tag:"a",to:"/profile",className:"flex items-center gap-3 px-3 py-2 font-medium text-gray-700 rounded-lg group text-theme-sm hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-white/5 dark:hover:text-gray-300",children:[e.jsx("svg",{className:"fill-gray-500 group-hover:fill-gray-700 dark:fill-gray-400 dark:group-hover:fill-gray-300",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.4858 3.5L13.5182 3.5C13.9233 3.5 14.2518 3.82851 14.2518 4.23377C14.2518 5.9529 16.1129 7.02795 17.602 6.1682C17.9528 5.96567 18.4014 6.08586 18.6039 6.43667L20.1203 9.0631C20.3229 9.41407 20.2027 9.86286 19.8517 10.0655C18.3625 10.9253 18.3625 13.0747 19.8517 13.9345C20.2026 14.1372 20.3229 14.5859 20.1203 14.9369L18.6039 17.5634C18.4013 17.9142 17.9528 18.0344 17.602 17.8318C16.1129 16.9721 14.2518 18.0471 14.2518 19.7663C14.2518 20.1715 13.9233 20.5 13.5182 20.5H10.4858C10.0804 20.5 9.75182 20.1714 9.75182 19.766C9.75182 18.0461 7.88983 16.9717 6.40067 17.8314C6.04945 18.0342 5.60037 17.9139 5.39767 17.5628L3.88167 14.937C3.67903 14.586 3.79928 14.1372 4.15026 13.9346C5.63949 13.0748 5.63946 10.9253 4.15025 10.0655C3.79926 9.86282 3.67901 9.41401 3.88165 9.06303L5.39764 6.43725C5.60034 6.08617 6.04943 5.96581 6.40065 6.16858C7.88982 7.02836 9.75182 5.9539 9.75182 4.23399C9.75182 3.82862 10.0804 3.5 10.4858 3.5ZM13.5182 2L10.4858 2C9.25201 2 8.25182 3.00019 8.25182 4.23399C8.25182 4.79884 7.64013 5.15215 7.15065 4.86955C6.08213 4.25263 4.71559 4.61859 4.0986 5.68725L2.58261 8.31303C1.96575 9.38146 2.33183 10.7477 3.40025 11.3645C3.88948 11.647 3.88947 12.3531 3.40026 12.6355C2.33184 13.2524 1.96578 14.6186 2.58263 15.687L4.09863 18.3128C4.71562 19.3814 6.08215 19.7474 7.15067 19.1305C7.64015 18.8479 8.25182 19.2012 8.25182 19.766C8.25182 20.9998 9.25201 22 10.4858 22H13.5182C14.7519 22 15.7518 20.9998 15.7518 19.7663C15.7518 19.2015 16.3632 18.8487 16.852 19.1309C17.9202 19.7476 19.2862 19.3816 19.9029 18.3134L21.4193 15.6869C22.0361 14.6185 21.6701 13.2523 20.6017 12.6355C20.1125 12.3531 20.1125 11.647 20.6017 11.3645C21.6701 10.7477 22.0362 9.38152 21.4193 8.3131L19.903 5.68667C19.2862 4.61842 17.9202 4.25241 16.852 4.86917C16.3632 5.15138 15.7518 4.79856 15.7518 4.23377C15.7518 3.00024 14.7519 2 13.5182 2ZM9.6659 11.9999C9.6659 10.7103 10.7113 9.66493 12.0009 9.66493C13.2905 9.66493 14.3359 10.7103 14.3359 11.9999C14.3359 13.2895 13.2905 14.3349 12.0009 14.3349C10.7113 14.3349 9.6659 13.2895 9.6659 11.9999ZM12.0009 8.16493C9.88289 8.16493 8.1659 9.88191 8.1659 11.9999C8.1659 14.1179 9.88289 15.8349 12.0009 15.8349C14.1189 15.8349 15.8359 14.1179 15.8359 11.9999C15.8359 9.88191 14.1189 8.16493 12.0009 8.16493Z",fill:""})}),"Account settings"]})})]}),e.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-3 px-3 py-2 mt-3 w-full text-left font-medium text-gray-700 rounded-lg group text-theme-sm hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-white/5 dark:hover:text-gray-300",children:[e.jsx("svg",{className:"fill-gray-500 group-hover:fill-gray-700 dark:group-hover:fill-gray-300",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.1007 19.247C14.6865 19.247 14.3507 18.9112 14.3507 18.497L14.3507 14.245H12.8507V18.497C12.8507 19.7396 13.8581 20.747 15.1007 20.747H18.5007C19.7434 20.747 20.7507 19.7396 20.7507 18.497L20.7507 5.49609C20.7507 4.25345 19.7433 3.24609 18.5007 3.24609H15.1007C13.8581 3.24609 12.8507 4.25345 12.8507 5.49609V9.74501L14.3507 9.74501V5.49609C14.3507 5.08188 14.6865 4.74609 15.1007 4.74609L18.5007 4.74609C18.9149 4.74609 19.2507 5.08188 19.2507 5.49609L19.2507 18.497C19.2507 18.9112 18.9149 19.247 18.5007 19.247H15.1007ZM3.25073 11.9984C3.25073 12.2144 3.34204 12.4091 3.48817 12.546L8.09483 17.1556C8.38763 17.4485 8.86251 17.4487 9.15549 17.1559C9.44848 16.8631 9.44863 16.3882 9.15583 16.0952L5.81116 12.7484L16.0007 12.7484C16.4149 12.7484 16.7507 12.4127 16.7507 11.9984C16.7507 11.5842 16.4149 11.2484 16.0007 11.2484L5.81528 11.2484L9.15585 7.90554C9.44864 7.61255 9.44847 7.13767 9.15547 6.84488C8.86248 6.55209 8.3876 6.55226 8.09481 6.84525L3.52309 11.4202C3.35673 11.5577 3.25073 11.7657 3.25073 11.9984Z",fill:""})}),"Sign out"]})]})]})}const Un=()=>{const[t,a]=n.useState(!1),[r,l]=n.useState("POS"),[s,i]=n.useState(""),{isMobileOpen:o,toggleSidebar:u,toggleMobileSidebar:d}=st(),c=()=>{window.innerWidth>=1024?u():d()},m=()=>{a(!t)},g=n.useRef(null);return n.useEffect(()=>{const h=y=>{var _;(y.metaKey||y.ctrlKey)&&y.key==="k"&&(y.preventDefault(),(_=g.current)==null||_.focus())};return document.addEventListener("keydown",h),()=>{document.removeEventListener("keydown",h)}},[]),n.useEffect(()=>{let h=!0;return Z("/admin-api/pengaturan").then(y=>{var j,x,k,D,E;const _=(k=(x=(j=y==null?void 0:y.data)==null?void 0:j.toko)==null?void 0:x.nama)==null?void 0:k.trim(),R=((E=(D=y==null?void 0:y.data)==null?void 0:D.toko)==null?void 0:E.logo)||"";h&&_&&l(_),h&&i(R)}).catch(()=>{}),()=>{h=!1}},[]),e.jsx("header",{className:"sticky top-0 flex w-full bg-white border-gray-200 z-99999 dark:border-gray-800 dark:bg-gray-900 lg:border-b",children:e.jsxs("div",{className:"flex flex-col items-center justify-between grow lg:flex-row lg:px-6",children:[e.jsxs("div",{className:"flex items-center justify-between w-full gap-2 px-3 py-3 border-b border-gray-200 dark:border-gray-800 sm:gap-4 lg:justify-normal lg:border-b-0 lg:px-0 lg:py-4",children:[e.jsx("button",{className:"items-center justify-center w-10 h-10 text-gray-500 border-gray-200 rounded-lg z-99999 dark:border-gray-800 lg:flex dark:text-gray-400 lg:h-11 lg:w-11 lg:border",onClick:c,"aria-label":"Toggle Sidebar",children:o?e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.21967 7.28131C5.92678 6.98841 5.92678 6.51354 6.21967 6.22065C6.51256 5.92775 6.98744 5.92775 7.28033 6.22065L11.999 10.9393L16.7176 6.22078C17.0105 5.92789 17.4854 5.92788 17.7782 6.22078C18.0711 6.51367 18.0711 6.98855 17.7782 7.28144L13.0597 12L17.7782 16.7186C18.0711 17.0115 18.0711 17.4863 17.7782 17.7792C17.4854 18.0721 17.0105 18.0721 16.7176 17.7792L11.999 13.0607L7.28033 17.7794C6.98744 18.0722 6.51256 18.0722 6.21967 17.7794C5.92678 17.4865 5.92678 17.0116 6.21967 16.7187L10.9384 12L6.21967 7.28131Z",fill:"currentColor"})}):e.jsx("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.583252 1C0.583252 0.585788 0.919038 0.25 1.33325 0.25H14.6666C15.0808 0.25 15.4166 0.585786 15.4166 1C15.4166 1.41421 15.0808 1.75 14.6666 1.75L1.33325 1.75C0.919038 1.75 0.583252 1.41422 0.583252 1ZM0.583252 11C0.583252 10.5858 0.919038 10.25 1.33325 10.25L14.6666 10.25C15.0808 10.25 15.4166 10.5858 15.4166 11C15.4166 11.4142 15.0808 11.75 14.6666 11.75L1.33325 11.75C0.919038 11.75 0.583252 11.4142 0.583252 11ZM1.33325 5.25C0.919038 5.25 0.583252 5.58579 0.583252 6C0.583252 6.41421 0.919038 6.75 1.33325 6.75L7.99992 6.75C8.41413 6.75 8.74992 6.41421 8.74992 6C8.74992 5.58579 8.41413 5.25 7.99992 5.25L1.33325 5.25Z",fill:"currentColor"})})}),e.jsx(Ce,{to:"/",className:"lg:hidden",children:e.jsxs("span",{className:"flex items-center gap-2",children:[s?e.jsx("img",{src:s,alt:"Logo",className:"h-7 w-7 rounded-md border border-gray-200 bg-white object-contain dark:border-gray-800"}):null,e.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:r})]})}),e.jsx("button",{onClick:m,className:"flex items-center justify-center w-10 h-10 text-gray-700 rounded-lg z-99999 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800 lg:hidden",children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99902 10.4951C6.82745 10.4951 7.49902 11.1667 7.49902 11.9951V12.0051C7.49902 12.8335 6.82745 13.5051 5.99902 13.5051C5.1706 13.5051 4.49902 12.8335 4.49902 12.0051V11.9951C4.49902 11.1667 5.1706 10.4951 5.99902 10.4951ZM17.999 10.4951C18.8275 10.4951 19.499 11.1667 19.499 11.9951V12.0051C19.499 12.8335 18.8275 13.5051 17.999 13.5051C17.1706 13.5051 16.499 12.8335 16.499 12.0051V11.9951C16.499 11.1667 17.1706 10.4951 17.999 10.4951ZM13.499 11.9951C13.499 11.1667 12.8275 10.4951 11.999 10.4951C11.1706 10.4951 10.499 11.1667 10.499 11.9951V12.0051C10.499 12.8335 11.1706 13.5051 11.999 13.5051C12.8275 13.5051 13.499 12.8335 13.499 12.0051V11.9951Z",fill:"currentColor"})})}),e.jsx("div",{className:"hidden lg:block",children:e.jsx("form",{children:e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute -translate-y-1/2 pointer-events-none left-4 top-1/2",children:e.jsx("svg",{className:"fill-gray-500 dark:fill-gray-400",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.04175 9.37363C3.04175 5.87693 5.87711 3.04199 9.37508 3.04199C12.8731 3.04199 15.7084 5.87693 15.7084 9.37363C15.7084 12.8703 12.8731 15.7053 9.37508 15.7053C5.87711 15.7053 3.04175 12.8703 3.04175 9.37363ZM9.37508 1.54199C5.04902 1.54199 1.54175 5.04817 1.54175 9.37363C1.54175 13.6991 5.04902 17.2053 9.37508 17.2053C11.2674 17.2053 13.003 16.5344 14.357 15.4176L17.177 18.238C17.4699 18.5309 17.9448 18.5309 18.2377 18.238C18.5306 17.9451 18.5306 17.4703 18.2377 17.1774L15.418 14.3573C16.5365 13.0033 17.2084 11.2669 17.2084 9.37363C17.2084 5.04817 13.7011 1.54199 9.37508 1.54199Z",fill:""})})}),e.jsx("input",{ref:g,type:"text",placeholder:"Search or type command...",className:"dark:bg-dark-900 h-11 w-full rounded-lg border border-gray-200 bg-transparent py-2.5 pl-12 pr-14 text-sm text-gray-800 shadow-theme-xs placeholder:text-gray-400 focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:border-gray-800 dark:bg-gray-900 dark:bg-white/[0.03] dark:text-white/90 dark:placeholder:text-white/30 dark:focus:border-brand-800 xl:w-[430px]"}),e.jsxs("button",{className:"absolute right-2.5 top-1/2 inline-flex -translate-y-1/2 items-center gap-0.5 rounded-lg border border-gray-200 bg-gray-50 px-[7px] py-[4.5px] text-xs -tracking-[0.2px] text-gray-500 dark:border-gray-800 dark:bg-white/[0.03] dark:text-gray-400",children:[e.jsx("span",{children:" ⌘ "}),e.jsx("span",{children:" K "})]})]})})})]}),e.jsxs("div",{className:`${t?"flex":"hidden"} items-center justify-between w-full gap-4 px-5 py-4 lg:flex shadow-theme-md lg:justify-end lg:px-0 lg:shadow-none`,children:[e.jsx("div",{className:"flex items-center gap-2 2xsm:gap-3",children:e.jsx(Tn,{})}),e.jsx(On,{})]})]})})},Vn=()=>{const{isMobileOpen:t,toggleMobileSidebar:a}=st();return t?e.jsx("div",{className:"fixed inset-0 z-40 bg-gray-900/50 lg:hidden",onClick:a}):null},pa=[{icon:e.jsx(Pn,{}),name:"Dashboard",path:"/"},{icon:e.jsx(An,{}),name:"Produk",path:"/produk"},{name:"Stok",icon:e.jsx(xa,{}),subItems:[{name:"Stok Gudang",path:"/stok-gudang"},{name:"Stok Toko",path:"/stok-toko"},{name:"Penerimaan Barang",path:"/penerimaan-barang"},{name:"Transfer Gudang → Toko",path:"/transfer-stok"}]},{name:"Transaksi",icon:e.jsx(ga,{}),path:"/transaksi"},{name:"Piutang",icon:e.jsx(ga,{}),path:"/piutang"},{name:"Voucher",icon:e.jsx(xa,{}),path:"/voucher"},{name:"Laporan",icon:e.jsx(Dn,{}),subItems:[{name:"Laporan Harian",path:"/laporan-harian"},{name:"Laporan Bulanan",path:"/laporan-bulanan"}]},{icon:e.jsx(Mn,{}),name:"Pegawai",path:"/pegawai"},{icon:e.jsx(Za,{}),name:"Distributor",path:"/distributor"},{icon:e.jsx(In,{}),name:"User",path:"/users"},{icon:e.jsx(Hn,{}),name:"Pengaturan",path:"/pengaturan"}],Nt=[],Fn=()=>{const{isExpanded:t,isMobileOpen:a,isHovered:r,setIsHovered:l}=st(),s=ye(),[i,o]=n.useState("POS"),[u,d]=n.useState(""),[c,m]=n.useState(null),[g,h]=n.useState(null),[y,_]=n.useState({}),R=n.useRef({}),j=n.useCallback(E=>s.pathname===E,[s.pathname]),x=n.useMemo(()=>{if(!c||c==="admin")return pa;const E=c==="kasir"?new Set(["/","/transaksi","/piutang","/laporan-harian","/laporan-bulanan"]):new Set(["/","/produk","/stok-gudang","/transfer-stok","/penerimaan-barang"]);return pa.map(T=>{if(T.path)return E.has(T.path)?T:null;if(T.subItems){const M=T.subItems.filter($=>E.has($.path));return M.length===0?null:{...T,subItems:M}}return null}).filter(Boolean)},[c]);n.useEffect(()=>{let E=!1;["main","others"].forEach(T=>{(T==="main"?x:Nt).forEach(($,v)=>{$.subItems&&$.subItems.forEach(N=>{j(N.path)&&(h({type:T,index:v}),E=!0)})})}),E||h(null)},[s,j,x]),n.useEffect(()=>{let E=!0;return Promise.all([Z("/admin-api/pengaturan"),Z("/admin-api/me")]).then(([T,M])=>{var I,V,f,O,C,A;const $=(f=(V=(I=T==null?void 0:T.data)==null?void 0:I.toko)==null?void 0:V.nama)==null?void 0:f.trim(),v=((C=(O=T==null?void 0:T.data)==null?void 0:O.toko)==null?void 0:C.logo)||"",N=((A=M==null?void 0:M.data)==null?void 0:A.role)??null;E&&$&&o($),E&&d(v),E&&m(N||"admin")}).catch(()=>{E&&m("admin")}),()=>{E=!1}},[]),n.useEffect(()=>{if(g!==null){const E=`${g.type}-${g.index}`;R.current[E]&&_(T=>{var M;return{...T,[E]:((M=R.current[E])==null?void 0:M.scrollHeight)||0}})}},[g]);const k=(E,T)=>{h(M=>M&&M.type===T&&M.index===E?null:{type:T,index:E})},D=(E,T)=>e.jsx("ul",{className:"flex flex-col gap-4",children:E.map((M,$)=>e.jsxs("li",{children:[M.subItems?e.jsxs("button",{onClick:()=>k($,T),className:`menu-item group ${(g==null?void 0:g.type)===T&&(g==null?void 0:g.index)===$?"menu-item-active":"menu-item-inactive"} cursor-pointer ${!t&&!r?"lg:justify-center":"lg:justify-start"}`,children:[e.jsx("span",{className:`menu-item-icon-size ${(g==null?void 0:g.type)===T&&(g==null?void 0:g.index)===$?"menu-item-icon-active":"menu-item-icon-inactive"}`,children:M.icon}),(t||r||a)&&e.jsx("span",{className:"menu-item-text",children:M.name}),(t||r||a)&&e.jsx($n,{className:`ml-auto w-5 h-5 transition-transform duration-200 ${(g==null?void 0:g.type)===T&&(g==null?void 0:g.index)===$?"rotate-180 text-brand-500":""}`})]}):M.path&&e.jsxs(Ce,{to:M.path,className:`menu-item group ${j(M.path)?"menu-item-active":"menu-item-inactive"}`,children:[e.jsx("span",{className:`menu-item-icon-size ${j(M.path)?"menu-item-icon-active":"menu-item-icon-inactive"}`,children:M.icon}),(t||r||a)&&e.jsx("span",{className:"menu-item-text",children:M.name})]}),M.subItems&&(t||r||a)&&e.jsx("div",{ref:v=>{R.current[`${T}-${$}`]=v},className:"overflow-hidden transition-all duration-300",style:{height:(g==null?void 0:g.type)===T&&(g==null?void 0:g.index)===$?`${y[`${T}-${$}`]}px`:"0px"},children:e.jsx("ul",{className:"mt-2 space-y-1 ml-9",children:M.subItems.map(v=>e.jsx("li",{children:e.jsxs(Ce,{to:v.path,className:`menu-dropdown-item ${j(v.path)?"menu-dropdown-item-active":"menu-dropdown-item-inactive"}`,children:[v.name,e.jsxs("span",{className:"flex items-center gap-1 ml-auto",children:[v.new&&e.jsx("span",{className:`ml-auto ${j(v.path)?"menu-dropdown-badge-active":"menu-dropdown-badge-inactive"} menu-dropdown-badge`,children:"new"}),v.pro&&e.jsx("span",{className:`ml-auto ${j(v.path)?"menu-dropdown-badge-active":"menu-dropdown-badge-inactive"} menu-dropdown-badge`,children:"pro"})]})]})},v.name))})})]},M.name))});return e.jsxs("aside",{className:`fixed mt-16 flex flex-col lg:mt-0 top-0 px-5 left-0 bg-white dark:bg-gray-900 dark:border-gray-800 text-gray-900 h-screen transition-all duration-300 ease-in-out z-50 border-r border-gray-200
|
||
${t||a||r?"w-[290px]":"w-[90px]"}
|
||
${a?"translate-x-0":"-translate-x-full"}
|
||
lg:translate-x-0`,onMouseEnter:()=>!t&&l(!0),onMouseLeave:()=>l(!1),children:[e.jsx("div",{className:`py-8 flex ${!t&&!r?"lg:justify-center":"justify-start"}`,children:e.jsx(Ce,{to:"/",children:t||r||a?e.jsxs("div",{className:"flex items-center gap-3",children:[u?e.jsx("img",{src:u,alt:"Logo",className:"h-9 w-9 rounded-lg border border-gray-200 bg-white object-contain dark:border-gray-800"}):null,e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:i}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Point of Sale"})]})]}):u?e.jsx("img",{src:u,alt:"Logo",className:"h-8 w-8 rounded-lg border border-gray-200 bg-white object-contain dark:border-gray-800"}):e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-gray-100 text-xs font-semibold text-gray-600 dark:bg-gray-800 dark:text-gray-300",children:i.trim().charAt(0)||"P"})})}),e.jsxs("div",{className:"flex flex-col overflow-y-auto duration-300 ease-linear no-scrollbar",children:[e.jsx("nav",{className:"mb-6",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:`mb-4 text-xs uppercase flex leading-[20px] text-gray-400 ${!t&&!r?"lg:justify-center":"justify-start"}`,children:t||r||a?"Menu":e.jsx(ha,{className:"size-6"})}),D(x,"main")]}),Nt.length>0?e.jsxs("div",{className:"",children:[e.jsx("h2",{className:`mb-4 text-xs uppercase flex leading-[20px] text-gray-400 ${!t&&!r?"lg:justify-center":"justify-start"}`,children:t||r||a?"Others":e.jsx(ha,{})}),D(Nt,"others")]}):null]})}),t||r||a]})]})},Bn=()=>{const{isExpanded:t,isHovered:a,isMobileOpen:r}=st();return e.jsxs("div",{className:"min-h-screen xl:flex",children:[e.jsxs("div",{children:[e.jsx(Fn,{}),e.jsx(Vn,{})]}),e.jsxs("div",{className:`flex-1 transition-all duration-300 ease-in-out ${t||a?"lg:ml-[290px]":"lg:ml-[90px]"} ${r?"ml-0":""}`,children:[e.jsx(Un,{}),e.jsx("div",{className:"p-4 mx-auto max-w-(--breakpoint-2xl) md:p-6",children:e.jsx(xs,{})})]})]})},Gn=()=>e.jsx(Oa,{children:e.jsx(Bn,{})});function Kn(){const{pathname:t}=ye();return n.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"smooth"})},[t]),null}function qn(t){typeof window>"u"||window.dispatchEvent(new CustomEvent("app-toast",{detail:t}))}function Zn(t,a="Gagal"){qn({variant:"error",title:a,message:t})}function le(t){n.useEffect(()=>{t&&Zn(t)},[t])}function zn(){const[t,a]=n.useState(!0),[r,l]=n.useState(null),[s,i]=n.useState(null),[o,u]=n.useState("toko");le(r);const d=async()=>{a(!0),l(null);try{const m=await Z("/admin-api/dashboard/overview");i(m)}catch(m){l((m==null?void 0:m.message)||"Gagal memuat dashboard")}finally{a(!1)}};n.useEffect(()=>{d()},[]);const c=n.useMemo(()=>{var m;return(m=s==null?void 0:s.chart_7d)!=null&&m.length?Math.max(...s.chart_7d.map(g=>g.total),1):1},[s]);return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Dashboard POS",description:"Ringkasan operasional POS"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Dashboard"}),e.jsx("button",{type:"button",onClick:d,className:"h-9 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900",children:"Refresh"})]}),r&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:r}),t||!s?e.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 text-sm text-gray-600 shadow-sm dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:"Memuat dashboard..."}):e.jsxs(e.Fragment,{children:[(()=>{const m=s.summary.margin!==null;return e.jsxs("div",{className:`grid gap-3 sm:grid-cols-2 ${m?"lg:grid-cols-4":"lg:grid-cols-3"}`,children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Pendapatan Hari Ini"}),e.jsxs("div",{className:"mt-1 text-xl font-semibold text-gray-800 dark:text-white/90",children:["Rp ",s.summary.pendapatan.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Transaksi"}),e.jsx("div",{className:"mt-1 text-xl font-semibold text-gray-800 dark:text-white/90",children:s.summary.transaksi})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Item Terjual"}),e.jsx("div",{className:"mt-1 text-xl font-semibold text-gray-800 dark:text-white/90",children:s.summary.item_terjual})]}),m&&e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Margin Kotor"}),e.jsxs("div",{className:"mt-1 text-xl font-semibold text-gray-800 dark:text-white/90",children:["Rp ",(s.summary.margin||0).toLocaleString("id-ID")]})]})]})})(),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Penjualan 7 Hari Terakhir"}),e.jsx("div",{className:"text-xs text-gray-500",children:s.date})]}),e.jsx("div",{className:"mt-4 flex items-end gap-2",children:s.chart_7d.map(m=>e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("div",{className:"w-full rounded-lg bg-blue-500/80",style:{height:`${Math.max(8,m.total/c*140)}px`},title:`Rp ${m.total.toLocaleString("id-ID")}`}),e.jsx("div",{className:"text-[10px] text-gray-500",children:m.tanggal.slice(5)})]},m.tanggal))})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Perhatian Data"}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 text-sm dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Produk tanpa barcode"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-gray-800 dark:text-white/90",children:s.data_issues.tanpa_barcode})]}),e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 text-sm dark:border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Produk tanpa harga jual"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-gray-800 dark:text-white/90",children:s.data_issues.tanpa_harga_jual})]})]})]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Produk Terlaris Hari Ini"}),e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Nama"}),e.jsx("th",{className:"py-2 pr-4",children:"Barcode"}),e.jsx("th",{className:"py-2 pr-4",children:"Qty"}),e.jsx("th",{className:"py-2 pr-4",children:"Total"})]})}),e.jsxs("tbody",{children:[s.top_products.map(m=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-2 pr-4 text-gray-800 dark:text-white/90",children:m.nama}),e.jsx("td",{className:"py-2 pr-4 text-gray-500 dark:text-gray-400",children:m.barcode}),e.jsx("td",{className:"py-2 pr-4 text-gray-700 dark:text-gray-200",children:m.qty}),e.jsxs("td",{className:"py-2 pr-4 text-gray-800 dark:text-white/90",children:["Rp ",m.total.toLocaleString("id-ID")]})]},m.id)),s.top_products.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Belum ada penjualan hari ini."})})]})]})})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:["Stok Rendah",o==="toko"&&s.low_stock_toko.lokasi?e.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",s.low_stock_toko.lokasi.kode,")"]}):null,o==="gudang"&&s.low_stock_gudang.lokasi?e.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",s.low_stock_gudang.lokasi.kode,")"]}):null]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>u("toko"),className:`h-8 rounded-lg px-3 text-xs font-semibold ${o==="toko"?"bg-blue-600 text-white":"border border-gray-200 bg-white text-gray-600 hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300"}`,children:"Toko"}),e.jsx("button",{type:"button",onClick:()=>u("gudang"),className:`h-8 rounded-lg px-3 text-xs font-semibold ${o==="gudang"?"bg-blue-600 text-white":"border border-gray-200 bg-white text-gray-600 hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300"}`,children:"Gudang"})]})]}),e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Nama"}),e.jsx("th",{className:"py-2 pr-4",children:"SKU"}),e.jsx("th",{className:"py-2 pr-4",children:"Stok"})]})}),e.jsxs("tbody",{children:[(o==="toko"?s.low_stock_toko.data:s.low_stock_gudang.data).map(m=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-2 pr-4 text-gray-800 dark:text-white/90",children:m.nama}),e.jsx("td",{className:"py-2 pr-4 text-gray-500 dark:text-gray-400",children:m.sku||"-"}),e.jsx("td",{className:"py-2 pr-4",children:e.jsx("span",{className:"inline-flex rounded-full bg-red-50 px-3 py-1 text-xs font-semibold text-red-700 dark:bg-red-500/10 dark:text-red-300",children:m.stok})})]},m.id)),(o==="toko"?s.low_stock_toko.data:s.low_stock_gudang.data).length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada stok rendah."})})]})]})}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:["Ambang batas:"," ",o==="toko"?s.low_stock_toko.threshold:s.low_stock_gudang.threshold]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Transaksi Terakhir"}),e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Waktu"}),e.jsx("th",{className:"py-2 pr-4",children:"No"}),e.jsx("th",{className:"py-2 pr-4",children:"Total"}),e.jsx("th",{className:"py-2 pr-4",children:"Metode"})]})}),e.jsxs("tbody",{children:[s.recent.map(m=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-2 pr-4 text-gray-500 dark:text-gray-400",children:new Date(m.waktu).toLocaleString("id-ID")}),e.jsx("td",{className:"py-2 pr-4 text-gray-800 dark:text-white/90",children:m.nomor_penjualan}),e.jsxs("td",{className:"py-2 pr-4 text-gray-800 dark:text-white/90",children:["Rp ",m.total.toLocaleString("id-ID")]}),e.jsx("td",{className:"py-2 pr-4 text-gray-600 dark:text-gray-300",children:m.metode_pembayaran})]},m.id)),s.recent.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Belum ada transaksi."})})]})]})})]})]})]})]})}const Wn=n.createContext(void 0),Jn={success:"Berhasil",error:"Gagal",warning:"Perhatian",info:"Info"},ba={success:{container:"border-success-500 bg-success-50 text-success-700 dark:border-success-500/30 dark:bg-success-500/15 dark:text-success-300",dot:"bg-success-500"},error:{container:"border-error-500 bg-error-50 text-error-700 dark:border-error-500/30 dark:bg-error-500/15 dark:text-error-300",dot:"bg-error-500"},warning:{container:"border-warning-500 bg-warning-50 text-warning-700 dark:border-warning-500/30 dark:bg-warning-500/15 dark:text-warning-300",dot:"bg-warning-500"},info:{container:"border-blue-light-500 bg-blue-light-50 text-blue-light-700 dark:border-blue-light-500/30 dark:bg-blue-light-500/15 dark:text-blue-light-300",dot:"bg-blue-light-500"}};function Qn(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function Yn(t){return String(t||"").trim()||"Terjadi kesalahan."}function Xn({children:t}){const[a,r]=n.useState([]),l=o=>{const u=o.variant??"info",d=o.title??Jn[u],c=Yn(o.message),m=o.durationMs??4e3,g=Qn();r(h=>[...h,{id:g,variant:u,title:d,message:c,durationMs:m}]),window.setTimeout(()=>{r(h=>h.filter(y=>y.id!==g))},m)};n.useEffect(()=>{const o=d=>{const c=d.detail;!c||!c.message||l(c)},u=d=>{const c=d.reason,m=typeof c=="string"?c:(c==null?void 0:c.message)||"Terjadi kesalahan.";l({variant:"error",title:"Gagal",message:m})};return window.addEventListener("app-toast",o),window.addEventListener("unhandledrejection",u),()=>{window.removeEventListener("app-toast",o),window.removeEventListener("unhandledrejection",u)}},[]);const s=n.useMemo(()=>({notify:l}),[]),i=e.jsx("div",{className:"fixed right-4 top-4 z-[100000] flex w-[min(380px,calc(100vw-32px))] flex-col gap-3",children:a.map(o=>e.jsx("div",{className:`rounded-xl border p-4 shadow-theme-lg ${ba[o.variant].container}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:`mt-1 h-2.5 w-2.5 shrink-0 rounded-full ${ba[o.variant].dot}`}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white/90",children:o.title}),e.jsx("button",{type:"button",onClick:()=>r(u=>u.filter(d=>d.id!==o.id)),className:"rounded-md px-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","aria-label":"Tutup",children:"×"})]}),e.jsx("p",{className:"mt-1 text-sm text-gray-700 dark:text-gray-300",children:o.message})]})]})},o.id))});return e.jsxs(Wn.Provider,{value:s,children:[t,typeof document<"u"?Js.createPortal(i,document.body):i]})}const pe=({isOpen:t,onClose:a,children:r,className:l,showCloseButton:s=!0,isFullscreen:i=!1})=>{const o=n.useRef(null);if(n.useEffect(()=>{const d=c=>{c.key==="Escape"&&a()};return t&&document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[t,a]),n.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset"}),[t]),!t)return null;const u=i?"w-full h-full":"relative w-full rounded-3xl bg-white dark:bg-gray-900";return e.jsxs("div",{className:"fixed inset-0 flex items-center justify-center overflow-y-auto modal z-99999",children:[!i&&e.jsx("div",{className:"fixed inset-0 h-full w-full bg-gray-400/50 backdrop-blur-[32px]",onClick:a}),e.jsxs("div",{ref:o,className:`${u} ${l}`,onClick:d=>d.stopPropagation(),children:[s&&e.jsx("button",{onClick:a,className:"absolute right-3 top-3 z-999 flex h-9.5 w-9.5 items-center justify-center rounded-full bg-gray-100 text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white sm:right-6 sm:top-6 sm:h-11 sm:w-11",children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.04289 16.5413C5.65237 16.9318 5.65237 17.565 6.04289 17.9555C6.43342 18.346 7.06658 18.346 7.45711 17.9555L11.9987 13.4139L16.5408 17.956C16.9313 18.3466 17.5645 18.3466 17.955 17.956C18.3455 17.5655 18.3455 16.9323 17.955 16.5418L13.4129 11.9997L17.955 7.4576C18.3455 7.06707 18.3455 6.43391 17.955 6.04338C17.5645 5.65286 16.9313 5.65286 16.5408 6.04338L11.9987 10.5855L7.45711 6.0439C7.06658 5.65338 6.43342 5.65338 6.04289 6.0439C5.65237 6.43442 5.65237 7.06759 6.04289 7.45811L10.5845 11.9997L6.04289 16.5413Z",fill:"currentColor"})})}),e.jsx("div",{children:r})]})]})},we=(t=!1)=>{const[a,r]=n.useState(t),l=n.useCallback(()=>r(!0),[]),s=n.useCallback(()=>r(!1),[]),i=n.useCallback(()=>r(o=>!o),[]);return{isOpen:a,openModal:l,closeModal:s,toggleModal:i}};function el(){const[t,a]=n.useState([]),[r,l]=n.useState(!0),[s,i]=n.useState(null),[o,u]=n.useState(""),{isOpen:d,openModal:c,closeModal:m}=we();le(s);const[g,h]=n.useState(null),[y,_]=n.useState({sku:"",nama:"",barcode:"",harga_beli:"",harga_jual:"",kategori_kemasan:"",isi_kemasan:"",is_aktif:!0}),[R,j]=n.useState(!1),[x,k]=n.useState(null),D=()=>{h(null),_({sku:"",nama:"",barcode:"",harga_beli:"",harga_jual:"",kategori_kemasan:"",isi_kemasan:"",is_aktif:!0})},E=()=>{l(!0),i(null),Z("/admin-api/produk?with_stock=1&with_units=1").then(N=>a(N.data)).catch(N=>i((N==null?void 0:N.message)||"Gagal memuat produk")).finally(()=>l(!1))};n.useEffect(()=>{E()},[]);const T=n.useMemo(()=>{const N=o.trim().toLowerCase();return N?t.filter(I=>[I.nama,I.barcode,I.sku||""].some(V=>V.toLowerCase().includes(N))):t},[t,o]),M=()=>{D(),k(null),i(null)},$=async N=>{h(N),k(null),i(null);const I=C=>(C||"").toUpperCase(),V=C=>{const A=C.find(S=>I(S.name)==="DUS"&&S.multiplier>1);if(A)return{kategori:"DUS",isi:String(A.multiplier)};const W=C.find(S=>I(S.name)==="BOX"&&S.multiplier>1);if(W)return{kategori:"BOX",isi:String(W.multiplier)};const U=C.find(S=>I(S.name)==="PACK"&&S.multiplier>1);return U?{kategori:"PACK",isi:String(U.multiplier)}:{kategori:"",isi:""}};let f=N;if(!N.units||N.units.length===0)try{f=(await Z(`/admin-api/produk/${N.id}?with_units=1`)).data}catch{f=N}const O=V(f.units||[]);_({sku:f.sku||"",nama:f.nama,barcode:f.barcode,harga_beli:f.harga_beli?String(f.harga_beli):"",harga_jual:String(f.harga_jual||0),kategori_kemasan:O.kategori,isi_kemasan:O.isi,is_aktif:f.is_aktif??!0})},v=async()=>{if(k(null),i(null),!y.nama.trim())return i("Nama wajib diisi.");if(!y.barcode.trim())return i("Barcode wajib diisi.");if(!y.harga_jual.trim())return i("Harga jual wajib diisi.");const N={sku:y.sku.trim()||null,nama:y.nama.trim(),barcode:y.barcode.trim(),harga_beli:y.harga_beli.trim()?Number(y.harga_beli):null,harga_jual:Number(y.harga_jual),is_aktif:y.is_aktif},I=y.isi_kemasan.trim()?Number(y.isi_kemasan):null;if(y.kategori_kemasan){if(!I||I<2)return i(`Isi per ${y.kategori_kemasan} minimal 2.`);N.isi_pack=y.kategori_kemasan==="PACK"?I:null,N.isi_dus=y.kategori_kemasan==="DUS"?I:null,N.isi_box=y.kategori_kemasan==="BOX"?I:null}else N.isi_pack=null,N.isi_dus=null,N.isi_box=null;j(!0);try{g?(await he(`/admin-api/produk/${g.id}`,N),k("Produk berhasil diperbarui.")):(await ue("/admin-api/produk",N),k("Produk berhasil ditambahkan.")),D(),E()}catch(V){i((V==null?void 0:V.message)||"Gagal menyimpan")}finally{j(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Produk",description:"Manajemen produk"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Produk"}),e.jsx("button",{type:"button",onClick:()=>{M(),c()},className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700",children:"Tambah Produk"})]}),!d&&x&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:x}),!d&&s&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:s}),e.jsx(pe,{isOpen:d,onClose:m,className:"max-w-[900px] p-6 lg:p-8",children:e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:g?`Edit Produk #${g.id}`:"Tambah Produk"}),e.jsx("button",{type:"button",onClick:M,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Reset Form"})]}),x&&e.jsx("div",{className:"mt-4 rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:x}),s&&e.jsx("div",{className:"mt-4 rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:s}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:[e.jsx("input",{value:y.sku,onChange:N=>_(I=>({...I,sku:N.target.value})),placeholder:"SKU (otomatis jika kosong)",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:y.nama,onChange:N=>_(I=>({...I,nama:N.target.value})),placeholder:"Nama produk",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:y.barcode,onChange:N=>_(I=>({...I,barcode:N.target.value})),placeholder:"Barcode",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:y.harga_beli,onChange:N=>_(I=>({...I,harga_beli:N.target.value})),placeholder:"Harga beli (opsional)",type:"number",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:y.harga_jual,onChange:N=>_(I=>({...I,harga_jual:N.target.value})),placeholder:"Harga jual",type:"number",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("select",{value:y.kategori_kemasan,onChange:N=>_(I=>({...I,kategori_kemasan:N.target.value,isi_kemasan:N.target.value?I.isi_kemasan:""})),className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Kategori Kemasan (opsional)"}),e.jsx("option",{value:"PACK",children:"PACK"}),e.jsx("option",{value:"DUS",children:"DUS"}),e.jsx("option",{value:"BOX",children:"BOX"})]}),e.jsx("input",{value:y.isi_kemasan,onChange:N=>_(I=>({...I,isi_kemasan:N.target.value})),placeholder:y.kategori_kemasan?`Isi per ${y.kategori_kemasan}`:"Isi per Kemasan",type:"number",min:2,disabled:!y.kategori_kemasan,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm disabled:opacity-50 dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx("input",{type:"checkbox",checked:!y.is_aktif,onChange:N=>_(I=>({...I,is_aktif:!N.target.checked}))}),"Nonaktif"]}),e.jsx("button",{type:"button",onClick:v,disabled:R,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:R?"Menyimpan…":g?"Simpan Perubahan":"Tambah"})]})]})}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Daftar Produk"}),e.jsx("input",{value:o,onChange:N=>u(N.target.value),placeholder:"Cari nama / barcode / SKU…",className:"h-10 w-full sm:w-[320px] rounded-xl border border-gray-200 bg-white px-4 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-950"})]}),r?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat…"}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"SKU"}),e.jsx("th",{className:"py-2 pr-4",children:"Nama"}),e.jsx("th",{className:"py-2 pr-4",children:"Barcode"}),e.jsx("th",{className:"py-2 pr-4",children:"Stok"}),e.jsx("th",{className:"py-2 pr-4",children:"Harga Jual"}),e.jsx("th",{className:"py-2 pr-4",children:"Status"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[T.map(N=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 font-medium text-gray-800 dark:text-white/90",children:N.sku||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:N.nama}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-400",children:N.barcode}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("span",{className:"inline-flex rounded-full bg-slate-100 px-3 py-1 text-xs font-semibold text-slate-700 dark:bg-white/10 dark:text-slate-200",children:N.stok_total})}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(N.harga_jual||0).toLocaleString("id-ID")]}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("span",{className:`inline-flex rounded-full px-3 py-1 text-xs font-semibold ${N.is_aktif??!0?"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300":"bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300"}`,children:N.is_aktif??!0?"Aktif":"Nonaktif"})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("button",{type:"button",onClick:async()=>{await $(N),c()},className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Edit"})})]},N.id)),T.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada data."})})]})]})})]})]})]})}function tl(){var V;const[t,a]=n.useState(!0),[r,l]=n.useState(null),[s,i]=n.useState(""),[o,u]=n.useState([]),[d,c]=n.useState(null);le(r);const[m,g]=n.useState(!1),[h,y]=n.useState(null),[_,R]=n.useState("IN"),[j,x]=n.useState("1"),[k,D]=n.useState("PCS"),[E,T]=n.useState(""),[M,$]=n.useState(!1);n.useEffect(()=>{let f=!0;return a(!0),l(null),Z("/admin-api/stok?kode=GUDANG").then(O=>{f&&(c(O.lokasi),u(O.data))}).catch(O=>f&&l((O==null?void 0:O.message)||"Gagal memuat stok")).finally(()=>f&&a(!1)),()=>{f=!1}},[]);const v=n.useMemo(()=>{const f=s.trim().toLowerCase();return f?o.filter(O=>[O.nama,O.barcode,O.sku||""].some(C=>C.toLowerCase().includes(f))):o},[o,s]),N=f=>{var O,C;y(f),R("IN"),x("1"),D(((C=(O=f.units)==null?void 0:O.find(A=>A.is_base))==null?void 0:C.name)||"PCS"),T(""),g(!0)},I=async()=>{if(!h||!d)return;const f=Number(j);if(!Number.isFinite(f)||f<1)return l("Qty minimal 1.");$(!0),l(null);try{await ue("/admin-api/stok-adjust",{produk_id:h.id,lokasi_id:d.id,tipe:_,qty:f,unit:k,catatan:(E==null?void 0:E.trim())||null});const O=await Z("/admin-api/stok?kode=GUDANG");c(O.lokasi),u(O.data),g(!1)}catch(O){l((O==null?void 0:O.message)||"Gagal menyimpan stok")}finally{$(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Stok Gudang",description:"Stok di gudang"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Stok Gudang"}),e.jsx("input",{value:s,onChange:f=>i(f.target.value),placeholder:"Cari nama / barcode / SKU…",className:"w-full sm:w-[320px] rounded-xl border border-gray-200 bg-white px-4 py-2 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-900"})]}),e.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:t?e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Memuat…"}):r?e.jsx("div",{className:"text-sm text-red-600",children:r}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"SKU"}),e.jsx("th",{className:"py-2 pr-4",children:"Nama"}),e.jsx("th",{className:"py-2 pr-4",children:"Barcode"}),e.jsx("th",{className:"py-2 pr-4",children:"Stok"}),e.jsx("th",{className:"py-2 pr-4",children:"Harga Jual"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[v.map(f=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 font-medium text-gray-800 dark:text-white/90",children:f.sku||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:f.nama}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-400",children:f.barcode}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("span",{className:`inline-flex rounded-full px-3 py-1 text-xs font-semibold ${f.stok<=0?"bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300":"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300"}`,children:f.stok})}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(f.harga_jual||0).toLocaleString("id-ID")]}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("button",{type:"button",onClick:()=>N(f),className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Stok Masuk/Keluar"})})]},f.id)),v.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada data."})})]})]})})}),m&&h&&e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-gray-200 bg-white p-5 shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Update Stok Gudang"}),e.jsxs("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[h.nama," • ",h.barcode]})]}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Tutup"})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("select",{value:_,onChange:f=>R(f.target.value),className:"h-11 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"IN",children:"Masuk (Tambah)"}),e.jsx("option",{value:"OUT",children:"Keluar (Kurangi)"}),e.jsx("option",{value:"ADJUST",children:"Set ke jumlah"})]}),e.jsx("input",{value:j,onChange:f=>x(f.target.value),type:"number",min:1,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",placeholder:"Qty"}),e.jsx("select",{value:k,onChange:f=>D(f.target.value),className:"h-11 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950",children:((V=h.units)!=null&&V.length?h.units:[{name:"PCS",multiplier:1,is_base:!0,id:0}]).map(f=>e.jsxs("option",{value:f.name,children:[f.name," ",f.multiplier>1?`(x${f.multiplier})`:""]},f.name))})]}),e.jsx("textarea",{value:E,onChange:f=>T(f.target.value),placeholder:"Catatan (opsional)",className:"mt-3 min-h-[80px] w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>g(!1),className:"h-11 rounded-xl border border-gray-200 bg-white px-5 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Batal"}),e.jsx("button",{type:"button",onClick:I,disabled:M,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:M?"Menyimpan…":"Simpan"})]})]})})]})]})}function al(){var V;const[t,a]=n.useState(!0),[r,l]=n.useState(null),[s,i]=n.useState(""),[o,u]=n.useState([]),[d,c]=n.useState(null);le(r);const[m,g]=n.useState(!1),[h,y]=n.useState(null),[_,R]=n.useState("IN"),[j,x]=n.useState("1"),[k,D]=n.useState("PCS"),[E,T]=n.useState(""),[M,$]=n.useState(!1);n.useEffect(()=>{let f=!0;return a(!0),l(null),Z("/admin-api/stok?kode=TOKO").then(O=>{f&&(c(O.lokasi),u(O.data))}).catch(O=>f&&l((O==null?void 0:O.message)||"Gagal memuat stok")).finally(()=>f&&a(!1)),()=>{f=!1}},[]);const v=n.useMemo(()=>{const f=s.trim().toLowerCase();return f?o.filter(O=>[O.nama,O.barcode,O.sku||""].some(C=>C.toLowerCase().includes(f))):o},[o,s]),N=f=>{var O,C;y(f),R("IN"),x("1"),D(((C=(O=f.units)==null?void 0:O.find(A=>A.is_base))==null?void 0:C.name)||"PCS"),T(""),g(!0)},I=async()=>{if(!h||!d)return;const f=Number(j);if(!Number.isFinite(f)||f<1)return l("Qty minimal 1.");$(!0),l(null);try{await ue("/admin-api/stok-adjust",{produk_id:h.id,lokasi_id:d.id,tipe:_,qty:f,unit:k,catatan:(E==null?void 0:E.trim())||null});const O=await Z("/admin-api/stok?kode=TOKO");c(O.lokasi),u(O.data),g(!1)}catch(O){l((O==null?void 0:O.message)||"Gagal menyimpan stok")}finally{$(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Stok Toko",description:"Stok di toko"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Stok Toko"}),e.jsx("input",{value:s,onChange:f=>i(f.target.value),placeholder:"Cari nama / barcode / SKU…",className:"w-full sm:w-[320px] rounded-xl border border-gray-200 bg-white px-4 py-2 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-900"})]}),e.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:t?e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Memuat…"}):r?e.jsx("div",{className:"text-sm text-red-600",children:r}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"SKU"}),e.jsx("th",{className:"py-2 pr-4",children:"Nama"}),e.jsx("th",{className:"py-2 pr-4",children:"Barcode"}),e.jsx("th",{className:"py-2 pr-4",children:"Stok"}),e.jsx("th",{className:"py-2 pr-4",children:"Harga Jual"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[v.map(f=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 font-medium text-gray-800 dark:text-white/90",children:f.sku||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:f.nama}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-400",children:f.barcode}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("span",{className:`inline-flex rounded-full px-3 py-1 text-xs font-semibold ${f.stok<=0?"bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300":"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300"}`,children:f.stok})}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(f.harga_jual||0).toLocaleString("id-ID")]}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("button",{type:"button",onClick:()=>N(f),className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Stok Masuk/Keluar"})})]},f.id)),v.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada data."})})]})]})})}),m&&h&&e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-gray-200 bg-white p-5 shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Update Stok Toko"}),e.jsxs("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[h.nama," • ",h.barcode]})]}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Tutup"})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("select",{value:_,onChange:f=>R(f.target.value),className:"h-11 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"IN",children:"Masuk (Tambah)"}),e.jsx("option",{value:"OUT",children:"Keluar (Kurangi)"}),e.jsx("option",{value:"ADJUST",children:"Set ke jumlah"})]}),e.jsx("input",{value:j,onChange:f=>x(f.target.value),type:"number",min:1,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",placeholder:"Qty"}),e.jsx("select",{value:k,onChange:f=>D(f.target.value),className:"h-11 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950",children:((V=h.units)!=null&&V.length?h.units:[{name:"PCS",multiplier:1,is_base:!0,id:0}]).map(f=>e.jsxs("option",{value:f.name,children:[f.name," ",f.multiplier>1?`(x${f.multiplier})`:""]},f.name))})]}),e.jsx("textarea",{value:E,onChange:f=>T(f.target.value),placeholder:"Catatan (opsional)",className:"mt-3 min-h-[80px] w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>g(!1),className:"h-11 rounded-xl border border-gray-200 bg-white px-5 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Batal"}),e.jsx("button",{type:"button",onClick:I,disabled:M,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:M?"Menyimpan…":"Simpan"})]})]})})]})]})}function rl(){const[t,a]=n.useState([]),[r,l]=n.useState([]),[s,i]=n.useState(""),[o,u]=n.useState(""),[d,c]=n.useState(""),[m,g]=n.useState(1),[h,y]=n.useState(""),[_,R]=n.useState(""),[j,x]=n.useState(!0),[k,D]=n.useState(!1),[E,T]=n.useState(null),[M,$]=n.useState(null),[v,N]=n.useState([]),[I,V]=n.useState(!1),{isOpen:f,openModal:O,closeModal:C}=we();le(M);const A=async()=>{V(!0);try{const S=await Z("/admin-api/stok-transfer-history?limit=30");N(S.data)}finally{V(!1)}};n.useEffect(()=>{A();let S=!0;return x(!0),Promise.all([Z("/admin-api/lokasi"),Z("/admin-api/produk")]).then(([z,J])=>{var Y,p;if(!S)return;a(z.data),l(J.data);const P=(Y=z.data.find(B=>B.kode==="GUDANG"))==null?void 0:Y.id,F=(p=z.data.find(B=>B.kode==="TOKO"))==null?void 0:p.id;P&&u(P),F&&c(F)}).catch(z=>S&&$((z==null?void 0:z.message)||"Gagal memuat data")).finally(()=>S&&x(!1)),()=>{S=!1}},[]);const W=n.useMemo(()=>{const S=r.find(J=>J.id===s);if(!S)return"";const z=S.sku?` • ${S.sku}`:"";return`${S.nama}${z} • ${S.barcode}`},[r,s]),U=async()=>{var S;if(T(null),$(null),!s||!o||!d){$("Pilih produk, lokasi asal, dan lokasi tujuan.");return}if(!Number.isFinite(m)||m<=0){$("Jumlah harus lebih dari 0.");return}if(o===d){$("Lokasi asal dan tujuan tidak boleh sama.");return}D(!0);try{const z=await ue("/admin-api/transfer-stok",{produk_id:s,dari_lokasi_id:o,ke_lokasi_id:d,jumlah:m,referensi_tipe:h||null,catatan:_||null}),J=(S=z==null?void 0:z.data)!=null&&S.referensi_tipe?` • Ref: ${z.data.referensi_tipe}`:"";T(`Transfer berhasil: ${W} (${m})${J}`),i(""),g(1),y(""),R(""),await A()}catch(z){$((z==null?void 0:z.message)||"Transfer gagal")}finally{D(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Transfer Stok",description:"Pindah stok Gudang ke Toko"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Transfer Stok"}),e.jsx("button",{type:"button",onClick:O,className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700",children:"Transfer Stok"})]}),e.jsx(pe,{isOpen:f,onClose:C,className:"max-w-[900px] p-6 lg:p-8",children:e.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:j?e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Memuat…"}):e.jsxs("div",{className:"space-y-4",children:[E&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:E}),M&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:M}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-600 dark:text-gray-400",children:"Produk"}),e.jsxs("select",{value:s,onChange:S=>i(S.target.value?Number(S.target.value):""),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Pilih produk…"}),r.map(S=>e.jsxs("option",{value:S.id,children:[S.nama," ",S.sku?`(${S.sku})`:""," • ",S.barcode]},S.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-600 dark:text-gray-400",children:"Jumlah"}),e.jsx("input",{type:"number",min:1,value:m,onChange:S=>g(Number(S.target.value||0)),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-gray-800 dark:bg-gray-950"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-600 dark:text-gray-400",children:"Dari lokasi"}),e.jsxs("select",{value:o,onChange:S=>u(S.target.value?Number(S.target.value):""),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Pilih lokasi…"}),t.map(S=>e.jsxs("option",{value:S.id,children:[S.nama," (",S.kode,")"]},S.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-600 dark:text-gray-400",children:"Ke lokasi"}),e.jsxs("select",{value:d,onChange:S=>c(S.target.value?Number(S.target.value):""),className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Pilih lokasi…"}),t.map(S=>e.jsxs("option",{value:S.id,children:[S.nama," (",S.kode,")"]},S.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-600 dark:text-gray-400",children:"Referensi (opsional)"}),e.jsx("input",{value:h,onChange:S=>y(S.target.value),placeholder:"Otomatis jika kosong",className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-gray-800 dark:bg-gray-950"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-600 dark:text-gray-400",children:"Catatan (opsional)"}),e.jsx("input",{value:_,onChange:S=>R(S.target.value),placeholder:"Catatan singkat…",className:"w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-gray-800 dark:bg-gray-950"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:U,disabled:k,className:"inline-flex h-11 items-center justify-center rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:k?"Menyimpan…":"Transfer"}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Tips: pastikan stok di lokasi asal cukup."})]})]})})})]}),e.jsxs("div",{className:"mt-6 rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white/90",children:"History Transfer Gudang → Toko"}),e.jsx("button",{type:"button",onClick:A,className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Refresh"})]}),I?e.jsx("div",{className:"mt-3 text-sm text-gray-600 dark:text-gray-400",children:"Memuat…"}):v.length===0?e.jsx("div",{className:"mt-3 text-sm text-gray-600 dark:text-gray-400",children:"Belum ada history transfer."}):e.jsx("div",{className:"mt-3 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Waktu"}),e.jsx("th",{className:"py-2 pr-4",children:"Ref"}),e.jsx("th",{className:"py-2 pr-4",children:"Produk"}),e.jsx("th",{className:"py-2 pr-4",children:"Dari"}),e.jsx("th",{className:"py-2 pr-4",children:"Ke"}),e.jsx("th",{className:"py-2 pr-4",children:"Qty"}),e.jsx("th",{className:"py-2 pr-4",children:"Catatan"})]})}),e.jsx("tbody",{children:v.map(S=>{var z,J,P;return e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:new Date(S.waktu).toLocaleString("id-ID")}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:S.referensi_tipe||"-"}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:[e.jsx("div",{className:"font-medium",children:(z=S.produk)==null?void 0:z.nama}),e.jsxs("div",{className:"text-xs text-gray-500",children:[((J=S.produk)==null?void 0:J.sku)||"-"," • ",((P=S.produk)==null?void 0:P.barcode)||"-"]})]}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:S.dari?`${S.dari.kode} - ${S.dari.nama}`:"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:S.ke?`${S.ke.kode} - ${S.ke.nama}`:"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:S.qty_input&&S.unit?`${S.qty_input} ${S.unit} (${S.jumlah_pcs} PCS)`:`${S.jumlah_pcs} PCS`}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-400",children:S.catatan||"-"})]},S.id)})})]})})]})]})}function sl(){const[t,a]=n.useState(!0),[r,l]=n.useState(!1),[s,i]=n.useState(null),[o,u]=n.useState(null);le(s);const[d,c]=n.useState([]),[m,g]=n.useState(null),[h,y]=n.useState([]),[_,R]=n.useState(""),[j,x]=n.useState(""),k=n.useRef(null),D=n.useRef(null),E=n.useRef(""),T=n.useRef(null),M=n.useRef(null),$=n.useRef(null),[v,N]=n.useState([]),[I,V]=n.useState([]),[f,O]=n.useState(!1),[C,A]=n.useState(null),[W,U]=n.useState(!1),[S,z]=n.useState(!1),[J,P]=n.useState("0"),[F,Y]=n.useState("0"),[p,B]=n.useState("CASH"),[w,H]=n.useState("0"),[Q,fe]=n.useState(""),[ne,me]=n.useState([]),[Te,Ae]=n.useState(""),[it,za]=n.useState({diskon:0,pajak:0,metode:"CASH"}),[Wa,Ft]=n.useState(!1),ot=b=>b==="CASH"?"TUNAI":b==="VOUCHER_CASH"?"VOUCHER + TUNAI":b,Ja=()=>{var L;return`${((L=document.querySelector('meta[name="app-base"]'))==null?void 0:L.getAttribute("content"))||""}/admin`},Qa=async()=>{const b=await Z("/admin-api/lokasi");c(b.data);const L=b.data.find(K=>K.kode==="TOKO")||b.data[0]||null;L?await dt(L.kode):a(!1)},dt=async b=>{a(!0),i(null);const L=await Z(`/admin-api/stok?kode=${encodeURIComponent(b)}`);g(L.lokasi),y(L.data),a(!1)},ct=async()=>{O(!0);try{const b=await Z("/admin-api/transaksi?limit=20");V(b.data)}catch(b){i((b==null?void 0:b.message)||"Gagal memuat transaksi")}finally{O(!1)}},Ya=async()=>{var b;try{const K=((b=(await Z("/admin-api/pengaturan")).data)==null?void 0:b.transaksi)||{},G={diskon:Number(K.diskon_default??0),pajak:Number(K.pajak_default??0),metode:K.metode_default||"CASH"};za(G),P(String(G.diskon)),Y(String(G.pajak)),B(G.metode),Ft(!0)}catch{Ft(!0)}};n.useEffect(()=>{let b=!0;return a(!0),i(null),Qa().catch(L=>b&&i((L==null?void 0:L.message)||"Gagal memuat")),ct().catch(()=>{}),Ya().catch(()=>{}),()=>{b=!1}},[]),n.useEffect(()=>{W||requestAnimationFrame(()=>{var b;return(b=k.current)==null?void 0:b.focus()})},[W]);const Bt=n.useMemo(()=>{const b=_.trim().toLowerCase();return b?h.filter(L=>[L.nama,L.barcode,L.sku||""].some(K=>K.toLowerCase().includes(b))):h},[h,_]),Se=n.useMemo(()=>v.reduce((b,L)=>b+L.harga*L.qty,0),[v]),He=n.useMemo(()=>{const b=Number(F)||0;return Math.max(0,Math.round(Se*(b/100)))},[Se,F]),ae=n.useMemo(()=>{const b=Number(J)||0;return Math.max(0,Se-b+He)},[Se,J,He]),_e=n.useMemo(()=>ne.reduce((b,L)=>b+(Number(L.amount)||0),0),[ne]),ut=n.useMemo(()=>{const b=Number(w)||0;if(p==="VOUCHER_CASH"){const L=Math.max(0,ae-_e);return Math.max(0,b-L)}return p==="VOUCHER"?0:Math.max(0,b-ae)},[w,ae,p,_e]),Xa=n.useMemo(()=>p==="VOUCHER"||p==="VOUCHER_CASH"?Math.max(0,ae-_e):0,[p,ae,_e]),er=n.useMemo(()=>{if(p!=="PIUTANG")return 0;const b=Number(w)||0;return Math.max(0,ae-b)},[p,w,ae]),mt=C?Number(C.voucher_amount||(C.voucher_kode?C.total:0)):0,tr=C?mt>0?"Bayar Tunai":`Bayar (${ot(C.metode_pembayaran)})`:"Bayar";n.useEffect(()=>{p!=="VOUCHER"&&p!=="VOUCHER_CASH"&&(me([]),fe(""))},[p]),n.useEffect(()=>{p!=="PIUTANG"&&Ae("")},[p]),n.useEffect(()=>{(p==="VOUCHER"||p==="VOUCHER_CASH")&&requestAnimationFrame(()=>{var b,L;(b=D.current)==null||b.focus(),(L=D.current)==null||L.select()})},[p]),n.useEffect(()=>{ne.length>0&&(p==="VOUCHER"||p==="VOUCHER_CASH")&>(ne)},[ae]);const Gt=(b,L=1)=>{i(null),u(null),N(K=>{const G=K.find(X=>X.produk_id===b.id),q=((G==null?void 0:G.qty)??0)+L;return q>b.stok?(i(`Stok tidak cukup untuk ${b.nama}. Stok: ${b.stok}`),K):G?K.map(X=>X.produk_id===b.id?{...X,qty:q}:X):[...K,{produk_id:b.id,nama:b.nama,barcode:b.barcode,harga:b.harga_jual,qty:L,stok:b.stok}]})},ar=(b,L)=>{N(K=>K.map(G=>{if(G.produk_id!==b)return G;const re=Math.max(1,Math.min(L,G.stok));return{...G,qty:re}}))},rr=(b,L)=>{N(K=>K.map(G=>G.produk_id===b?{...G,harga:Math.max(0,L)}:G))},sr=b=>{N(L=>L.filter(K=>K.produk_id!==b))},gt=(b,L=!0)=>{const K=b.reduce((re,q)=>re+(Number(q.amount)||0),0),G=Math.max(0,ae-K);K>=ae?(B("VOUCHER"),H("0")):(B("VOUCHER_CASH"),L&&H(String(G)))},Kt=async b=>{var G,re;const L=b.trim();if(!L)return;if(ne.length>=3){i("Maksimal 3 voucher per transaksi.");return}if(ne.some(q=>q.kode===L)){i("Voucher sudah ditambahkan.");return}const K=Math.max(0,ae-_e);if(K<=0){i("Total sudah tertutup oleh voucher.");return}try{const q=await Z(`/admin-api/vouchers/lookup?kode=${encodeURIComponent(L)}`),X=Number(((G=q==null?void 0:q.data)==null?void 0:G.saldo)||0);if(!!!((re=q==null?void 0:q.data)!=null&&re.aktif)){i("Voucher tidak aktif.");return}if(X<=0){i("Saldo voucher tidak mencukupi.");return}const Le=Math.min(X,K),ie=[...ne,{kode:L,saldo:X,amount:Le}];me(ie),fe(""),u("Voucher ditambahkan."),gt(ie,!0)}catch(q){i((q==null?void 0:q.message)||"Voucher tidak ditemukan.")}},nr=b=>{const L=ne.filter(K=>K.kode!==b);me(L),gt(L,!0)},lr=b=>{const L=b.trim();if(!L)return;const K=h.find(G=>G.barcode===L)||h.find(G=>G.sku===L)||h.find(G=>G.nama.toLowerCase()===L.toLowerCase());if(!K){i(`Produk dengan barcode/SKU "${L}" tidak ditemukan.`);return}Gt(K,1)},Oe=b=>{M.current&&(window.clearTimeout(M.current),M.current=null),lr(b),x(""),requestAnimationFrame(()=>{var L;return(L=k.current)==null?void 0:L.focus()})},qt=3,Zt=350;n.useEffect(()=>{"BroadcastChannel"in window&&($.current=new BroadcastChannel("pos-customer-display"));const b=L=>{var q;const K=L.target,G=(q=K==null?void 0:K.tagName)==null?void 0:q.toLowerCase();if(!(G==="input"||G==="textarea"||G==="select"||K!=null&&K.isContentEditable)){if(L.key==="Enter"){E.current&&(L.preventDefault(),Oe(E.current),E.current="");return}L.key.length===1&&(E.current+=L.key,T.current&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{const X=E.current;E.current="",T.current=null,X.trim().length>=qt&&Oe(X)},Zt))}};return window.addEventListener("keydown",b),()=>{var L;window.removeEventListener("keydown",b),T.current&&window.clearTimeout(T.current),M.current&&window.clearTimeout(M.current),(L=$.current)==null||L.close()}},[Oe]),n.useEffect(()=>{var K;const b=v.length===0,L={waktu:new Date().toISOString(),lokasi:(m==null?void 0:m.nama)||null,items:v.map(G=>({nama:G.nama,qty:G.qty,harga:G.harga,total:G.harga*G.qty})),subtotal:b?0:Se,diskon:b?0:Number(J)||0,pajak:b?0:He,total:b?0:ae,bayar:b?0:Number(w)||0,kembalian:b?0:ut,metode:p};try{localStorage.setItem("pos-display-state",JSON.stringify(L))}catch{}(K=$.current)==null||K.postMessage(L)},[v,Se,J,He,ae,w,ut,p,m]);const ir=async()=>{var G,re;if(!m)return i("Lokasi belum dipilih.");if(v.length===0)return i("Keranjang masih kosong.");const b=p==="VOUCHER"||p==="VOUCHER_CASH",L=_e,K=Number(w)||0;if(b&&ne.length===0)return i("Tambahkan minimal 1 voucher.");if(ne.length>3)return i("Maksimal 3 voucher per transaksi.");if(b&&L<=0)return i("Nominal voucher wajib diisi.");if(L>ae)return i("Nominal voucher tidak boleh melebihi total.");if(p==="VOUCHER"&&L<ae)return i("Saldo voucher tidak mencukupi untuk menutup total.");if(p==="VOUCHER_CASH"){const q=Math.max(0,ae-L);if(K<q)return i("Bayar tunai harus sama atau lebih besar dari sisa.")}if(p==="PIUTANG"&&!Te.trim())return i("Unit piutang wajib diisi.");l(!0),i(null),u(null);try{const q=p==="VOUCHER"?ae:p==="VOUCHER_CASH"?L:0,X=p==="VOUCHER"?0:K,Ne=await ue("/admin-api/transaksi",{lokasi_id:m.id,items:v.map(ie=>({produk_id:ie.produk_id,qty:ie.qty,harga:ie.harga})),diskon:Number(J)||0,pajak:He,metode_pembayaran:p,jumlah_bayar:X,voucher_kode:((G=ne[0])==null?void 0:G.kode)||null,voucher_amount:q,vouchers:ne.map(ie=>({kode:ie.kode,amount:ie.amount})),unit_piutang:Te||null});u("Transaksi berhasil disimpan."),N([]),H("0"),fe(""),me([]),Ae(""),Wa&&(P(String(it.diskon)),Y(String(it.pajak)),B(it.metode));const Le=(re=Ne==null?void 0:Ne.data)==null?void 0:re.id;Le&&zt(Le),await dt(m.kode),await ct()}catch(q){i((q==null?void 0:q.message)||"Gagal menyimpan transaksi")}finally{l(!1)}},zt=async b=>{var L,K;try{const[G,re]=await Promise.all([Z(`/admin-api/transaksi/${b}`),Z("/admin-api/pengaturan")]),q=G.data,X=((L=re==null?void 0:re.data)==null?void 0:L.toko)||{},Ne=((K=re==null?void 0:re.data)==null?void 0:K.struk)||{},Le=(X==null?void 0:X.nama)||"Toko",ie=(X==null?void 0:X.alamat)||"",Wt=(X==null?void 0:X.telepon)||"",Jt=(X==null?void 0:X.logo)||"",dr=(Ne==null?void 0:Ne.footer)||"Terima kasih telah berbelanja.",xt=Number(q.voucher_amount||(q.voucher_kode?q.total:0)),cr=xt>0?"Bayar Tunai":`Bayar (${ot(q.metode_pembayaran)})`,Ze=window.open("","_blank","width=520,height=640");if(!Ze){i("Popup diblokir. Izinkan popup untuk mencetak.");return}const ur=`
|
||
<!doctype html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>Struk ${q.nomor_penjualan}</title>
|
||
<style>
|
||
@page { margin: 6mm; }
|
||
body { font-family: "Courier New", monospace; padding: 0; color: #111; }
|
||
.receipt { width: 58mm; }
|
||
h1 { font-size: 13px; margin: 0 0 4px; text-align: center; }
|
||
.muted { color: #666; font-size: 10px; text-align: center; }
|
||
.center { text-align: center; }
|
||
.logo { display: block; margin: 0 auto 6px; max-height: 48px; max-width: 90px; object-fit: contain; }
|
||
.divider { border-top: 1px dashed #666; margin: 6px 0; }
|
||
.row { display: flex; justify-content: space-between; font-size: 11px; }
|
||
.item-name { font-size: 11px; margin: 4px 0 2px; }
|
||
.item-sub { display: flex; justify-content: space-between; font-size: 10px; color: #333; }
|
||
.total { font-weight: bold; }
|
||
.footer { font-size: 10px; text-align: center; margin-top: 6px; color: #666; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="receipt">
|
||
${Jt?`<img src="${Jt}" class="logo" alt="Logo">`:""}
|
||
<h1>${Le}</h1>
|
||
${ie?`<div class="muted">${ie}</div>`:""}
|
||
${Wt?`<div class="muted">Telp: ${Wt}</div>`:""}
|
||
<div class="divider"></div>
|
||
<div class="center muted">No: ${q.nomor_penjualan}</div>
|
||
<div class="center muted">${new Date(q.waktu).toLocaleString("id-ID")}</div>
|
||
<div class="divider"></div>
|
||
|
||
${q.items.map(ze=>`
|
||
<div class="item-name">${ze.nama||"-"}</div>
|
||
<div class="item-sub">
|
||
<div>${ze.jumlah} x ${ze.harga.toLocaleString("id-ID")}</div>
|
||
<div>Rp ${ze.total.toLocaleString("id-ID")}</div>
|
||
</div>`).join("")}
|
||
|
||
<div class="divider"></div>
|
||
<div class="row"><div>Subtotal</div><div>Rp ${q.subtotal.toLocaleString("id-ID")}</div></div>
|
||
<div class="row"><div>Diskon</div><div>Rp ${q.diskon.toLocaleString("id-ID")}</div></div>
|
||
<div class="row"><div>Pajak</div><div>Rp ${q.pajak.toLocaleString("id-ID")}</div></div>
|
||
${xt>0?`<div class="row"><div>Voucher</div><div>Rp ${xt.toLocaleString("id-ID")}</div></div>`:""}
|
||
<div class="row total"><div>Total</div><div>Rp ${q.total.toLocaleString("id-ID")}</div></div>
|
||
<div class="row"><div>${cr}</div><div>Rp ${q.jumlah_bayar.toLocaleString("id-ID")}</div></div>
|
||
<div class="row"><div>Kembalian</div><div>Rp ${q.kembalian.toLocaleString("id-ID")}</div></div>
|
||
<div class="divider"></div>
|
||
<div class="footer">${dr}</div>
|
||
</div>
|
||
<script>
|
||
window.print();
|
||
<\/script>
|
||
</body>
|
||
</html>`;Ze.document.open(),Ze.document.write(ur),Ze.document.close()}catch(G){i((G==null?void 0:G.message)||"Gagal mencetak transaksi")}},or=async b=>{z(!0),U(!0);try{const L=await Z(`/admin-api/transaksi/${b}`);A(L.data)}catch(L){i((L==null?void 0:L.message)||"Gagal memuat detail transaksi"),U(!1)}finally{z(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Transaksi",description:"Transaksi penjualan"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Transaksi"}),e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row",children:[e.jsx("button",{type:"button",onClick:()=>{const b=`${Ja()}/customer-display`;window.open(b,"_blank","noopener,noreferrer")},className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900",children:"Buka Layar Pembeli"}),e.jsx("select",{value:(m==null?void 0:m.id)||"",onChange:b=>{const L=Number(b.target.value),K=d.find(G=>G.id===L)||null;K&&dt(K.kode)},className:"h-10 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-900",children:d.map(b=>e.jsxs("option",{value:b.id,children:[b.nama," (",b.kode,")"]},b.id))}),e.jsx("input",{value:_,onChange:b=>R(b.target.value),placeholder:"Cari nama / barcode / SKU",className:"h-10 w-full sm:w-[280px] rounded-xl border border-gray-200 bg-white px-4 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-900"})]})]}),o&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:o}),s&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:s}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Daftar Produk"}),e.jsx("input",{ref:k,autoFocus:!0,value:j,onChange:b=>{const L=b.target.value;x(L),M.current&&window.clearTimeout(M.current),!(L.trim().length<qt)&&(M.current=window.setTimeout(()=>{Oe(L)},Zt))},onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),Oe(j))},placeholder:"Scan barcode lalu Enter",className:"h-10 w-full sm:w-[220px] rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"})]}),t?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat"}):e.jsx("div",{className:"mt-4 max-h-[420px] overflow-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-3",children:"Nama"}),e.jsx("th",{className:"py-2 pr-3",children:"Barcode"}),e.jsx("th",{className:"py-2 pr-3",children:"Stok"}),e.jsx("th",{className:"py-2 pr-3",children:"Harga"}),e.jsx("th",{className:"py-2 pr-3",children:"Aksi"})]})}),e.jsxs("tbody",{children:[Bt.map(b=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-2 pr-3 text-gray-800 dark:text-white/90",children:b.nama}),e.jsx("td",{className:"py-2 pr-3 text-gray-500 dark:text-gray-400",children:b.barcode}),e.jsx("td",{className:"py-2 pr-3",children:e.jsx("span",{className:`inline-flex rounded-full px-3 py-1 text-xs font-semibold ${b.stok<=0?"bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300":"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300"}`,children:b.stok})}),e.jsxs("td",{className:"py-2 pr-3 text-gray-700 dark:text-gray-200",children:["Rp ",Number(b.harga_jual||0).toLocaleString("id-ID")]}),e.jsx("td",{className:"py-2 pr-3",children:e.jsx("button",{type:"button",onClick:()=>Gt(b,1),className:"h-8 rounded-lg border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Tambah"})})]},b.id)),Bt.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada data."})})]})]})})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Keranjang"}),v.length===0?e.jsx("div",{className:"mt-4 text-sm text-gray-500 dark:text-gray-400",children:"Keranjang masih kosong."}):e.jsx("div",{className:"mt-4 space-y-3",children:v.map(b=>e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:b.nama}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:b.barcode})]}),e.jsx("button",{type:"button",onClick:()=>sr(b.produk_id),className:"text-xs text-red-600 hover:underline",children:"Hapus"})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[e.jsx("input",{value:b.qty,onChange:L=>ar(b.produk_id,Number(L.target.value)),type:"number",min:1,max:b.stok,className:"h-10 rounded-lg border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:b.harga,onChange:L=>rr(b.produk_id,Number(L.target.value)),type:"number",min:0,className:"h-10 rounded-lg border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("div",{className:"flex items-center justify-end text-sm font-semibold text-gray-800 dark:text-white/90",children:["Rp ",(b.harga*b.qty).toLocaleString("id-ID")]})]})]},b.produk_id))}),e.jsxs("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 text-sm dark:border-gray-800",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Subtotal"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",Se.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-xs text-gray-500",children:"Diskon"}),e.jsx("input",{value:J,onChange:b=>P(b.target.value),type:"number",min:0,className:"h-9 w-[140px] rounded-lg border border-gray-200 bg-white px-3 text-xs dark:border-gray-800 dark:bg-gray-950"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-xs text-gray-500",children:"Pajak (%)"}),e.jsx("input",{value:F,onChange:b=>Y(b.target.value),type:"number",min:0,className:"h-9 w-[140px] rounded-lg border border-gray-200 bg-white px-3 text-xs dark:border-gray-800 dark:bg-gray-950"})]}),e.jsxs("div",{className:"mt-3 flex justify-between",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",ae.toLocaleString("id-ID")]})]})]}),e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 text-sm dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-xs text-gray-500",children:"Metode"}),e.jsxs("select",{value:p,onChange:b=>B(b.target.value),className:"h-9 w-[140px] rounded-lg border border-gray-200 bg-white px-3 text-xs dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"CASH",children:"TUNAI"}),e.jsx("option",{value:"QRIS",children:"QRIS"}),e.jsx("option",{value:"PIUTANG",children:"PIUTANG"}),e.jsx("option",{value:"VOUCHER",children:"VOUCHER"}),e.jsx("option",{value:"VOUCHER_CASH",children:"VOUCHER + TUNAI"})]})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-xs text-gray-500",children:"Bayar"}),e.jsx("input",{value:w,onChange:b=>H(b.target.value),type:"number",min:0,disabled:p==="VOUCHER",className:"h-9 w-[140px] rounded-lg border border-gray-200 bg-white px-3 text-xs dark:border-gray-800 dark:bg-gray-950"})]}),(p==="VOUCHER"||p==="VOUCHER_CASH")&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-xs text-gray-500",children:"Voucher"}),e.jsxs("div",{className:"flex w-[140px] gap-1",children:[e.jsx("input",{ref:D,value:Q,onChange:b=>fe(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),Kt(Q))},placeholder:"Kode",className:"h-9 w-full rounded-lg border border-gray-200 bg-white px-2 text-xs dark:border-gray-800 dark:bg-gray-950"}),e.jsx("button",{type:"button",onClick:()=>Kt(Q),className:"h-9 rounded-lg border border-gray-200 bg-white px-2 text-[10px] font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"+"})]})]}),ne.length>0&&e.jsx("div",{className:"space-y-1",children:ne.map(b=>e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500",children:[e.jsx("span",{className:"truncate",children:b.kode}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{children:["Rp ",Number(b.amount).toLocaleString("id-ID")]}),e.jsx("button",{type:"button",onClick:()=>nr(b.kode),className:"text-red-600 hover:underline",children:"Hapus"})]})]},b.kode))}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500",children:[e.jsx("span",{children:"Total voucher"}),e.jsxs("span",{children:["Rp ",_e.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500",children:[e.jsx("span",{children:"Sisa bayar"}),e.jsxs("span",{children:["Rp ",Xa.toLocaleString("id-ID")]})]})]}),p==="PIUTANG"&&e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-xs text-gray-500",children:"Unit Piutang"}),e.jsx("input",{value:Te,onChange:b=>Ae(b.target.value),placeholder:"Contoh: Farmasi",className:"h-9 w-[140px] rounded-lg border border-gray-200 bg-white px-3 text-xs dark:border-gray-800 dark:bg-gray-950"})]}),e.jsxs("div",{className:"mt-3 flex justify-between",children:[e.jsx("span",{children:p==="PIUTANG"?"Sisa Piutang":"Kembalian"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",(p==="PIUTANG"?er:ut).toLocaleString("id-ID")]})]})]})]}),e.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>N([]),className:"h-11 rounded-xl border border-gray-200 bg-white px-5 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Kosongkan"}),e.jsx("button",{type:"button",onClick:ir,disabled:r||v.length===0,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:r?"Menyimpan…":"Simpan Transaksi"})]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Transaksi Terakhir"}),e.jsx("button",{type:"button",onClick:ct,className:"h-8 rounded-lg border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Refresh"})]}),f?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Waktu"}),e.jsx("th",{className:"py-2 pr-4",children:"No"}),e.jsx("th",{className:"py-2 pr-4",children:"Item"}),e.jsx("th",{className:"py-2 pr-4",children:"Total"}),e.jsx("th",{className:"py-2 pr-4",children:"Metode"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[I.map(b=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-2 pr-4 text-gray-500 dark:text-gray-400",children:new Date(b.waktu).toLocaleString("id-ID")}),e.jsx("td",{className:"py-2 pr-4 font-medium text-gray-800 dark:text-white/90",children:b.nomor_penjualan}),e.jsx("td",{className:"py-2 pr-4 text-gray-600 dark:text-gray-300",children:b.items_count}),e.jsxs("td",{className:"py-2 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(b.total||0).toLocaleString("id-ID")]}),e.jsx("td",{className:"py-2 pr-4 text-gray-600 dark:text-gray-300",children:ot(b.metode_pembayaran)}),e.jsxs("td",{className:"py-2 pr-4",children:[e.jsx("button",{type:"button",onClick:()=>or(b.id),className:"mr-2 h-8 rounded-lg border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Detail"}),e.jsx("button",{type:"button",onClick:()=>zt(b.id),className:"h-8 rounded-lg border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Print"})]})]},b.id)),I.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Belum ada transaksi."})})]})]})})]}),W&&e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{className:"w-full max-w-2xl rounded-2xl border border-gray-200 bg-white p-5 shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Detail Transaksi"}),C&&e.jsxs("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[C.nomor_penjualan," - "," ",new Date(C.waktu).toLocaleString("id-ID")]})]}),e.jsx("button",{type:"button",onClick:()=>U(!1),className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Tutup"})]}),S?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat detail..."}):C?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Item"}),e.jsx("th",{className:"py-2 pr-4",children:"Barcode"}),e.jsx("th",{className:"py-2 pr-4",children:"Qty"}),e.jsx("th",{className:"py-2 pr-4",children:"Harga"}),e.jsx("th",{className:"py-2 pr-4",children:"Total"})]})}),e.jsx("tbody",{children:C.items.map((b,L)=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-2 pr-4 text-gray-800 dark:text-white/90",children:b.nama||"-"}),e.jsx("td",{className:"py-2 pr-4 text-gray-500 dark:text-gray-400",children:b.barcode||"-"}),e.jsx("td",{className:"py-2 pr-4 text-gray-700 dark:text-gray-200",children:b.jumlah}),e.jsxs("td",{className:"py-2 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",b.harga.toLocaleString("id-ID")]}),e.jsxs("td",{className:"py-2 pr-4 text-gray-800 dark:text-white/90",children:["Rp ",b.total.toLocaleString("id-ID")]})]},`${b.produk_id}-${L}`))})]})}),e.jsxs("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 text-sm dark:border-gray-800",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Subtotal"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",C.subtotal.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"mt-1 flex justify-between",children:[e.jsx("span",{children:"Diskon"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",C.diskon.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"mt-1 flex justify-between",children:[e.jsx("span",{children:"Pajak"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",C.pajak.toLocaleString("id-ID")]})]}),mt>0&&e.jsxs("div",{className:"mt-1 flex justify-between",children:[e.jsx("span",{children:"Voucher"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",mt.toLocaleString("id-ID")]})]})]}),e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 text-sm dark:border-gray-800",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",C.total.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"mt-1 flex justify-between",children:[e.jsx("span",{children:tr}),e.jsxs("span",{className:"font-semibold",children:["Rp ",C.jumlah_bayar.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"mt-1 flex justify-between",children:[e.jsx("span",{children:"Kembalian"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",C.kembalian.toLocaleString("id-ID")]})]})]})]})]}):null]})})]})]})}function nl(){const t=new Date,a=t.toISOString().slice(0,10),r=new Date(t.getTime()-14*864e5).toISOString().slice(0,10),[l,s]=n.useState(r),[i,o]=n.useState(a),[u,d]=n.useState([]),[c,m]=n.useState({pendapatan:0,transaksi:0,item_terjual:0}),[g,h]=n.useState(!0),[y,_]=n.useState(null);le(y);const R=async()=>{h(!0),_(null);try{const j=await Z(`/admin-api/laporan/harian?from=${l}&to=${i}`);d(j.data),m(j.summary)}catch(j){_((j==null?void 0:j.message)||"Gagal memuat laporan")}finally{h(!1)}};return n.useEffect(()=>{R()},[]),e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Laporan Harian",description:"Ringkasan pendapatan harian"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Laporan Harian"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{type:"date",value:l,onChange:j=>s(j.target.value),className:"h-10 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-900"}),e.jsx("input",{type:"date",value:i,onChange:j=>o(j.target.value),className:"h-10 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-900"}),e.jsx("button",{type:"button",onClick:R,className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700",children:"Tampilkan"}),e.jsx("button",{type:"button",onClick:()=>{const j=`/admin-api/laporan/harian/export?from=${encodeURIComponent(l)}&to=${encodeURIComponent(i)}`;window.location.href=j},className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900",children:"Export Excel"})]})]}),y&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:y}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Pendapatan"}),e.jsxs("div",{className:"mt-1 text-lg font-semibold text-gray-800 dark:text-white/90",children:["Rp ",c.pendapatan.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Transaksi"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-gray-800 dark:text-white/90",children:c.transaksi})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Item Terjual"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-gray-800 dark:text-white/90",children:c.item_terjual})]})]}),e.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:g?e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Tanggal"}),e.jsx("th",{className:"py-2 pr-4",children:"Transaksi"}),e.jsx("th",{className:"py-2 pr-4",children:"Item"}),e.jsx("th",{className:"py-2 pr-4",children:"Pendapatan"})]})}),e.jsxs("tbody",{children:[u.map(j=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:j.tanggal}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:j.transaksi}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:j.item_terjual}),e.jsxs("td",{className:"py-3 pr-4 text-gray-800 dark:text-white/90",children:["Rp ",j.pendapatan.toLocaleString("id-ID")]})]},j.tanggal)),u.length===0&&!g&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada data."})})]})]})})})]})]})}function ll(){const t=new Date().getFullYear(),[a,r]=n.useState(String(t)),[l,s]=n.useState([]),[i,o]=n.useState({pendapatan:0,transaksi:0,item_terjual:0}),[u,d]=n.useState(!0),[c,m]=n.useState(null);le(c);const g=async()=>{d(!0),m(null);try{const h=await Z(`/admin-api/laporan/bulanan?year=${a}`);s(h.data),o(h.summary)}catch(h){m((h==null?void 0:h.message)||"Gagal memuat laporan")}finally{d(!1)}};return n.useEffect(()=>{g()},[]),e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Laporan Bulanan",description:"Ringkasan pendapatan bulanan"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Laporan Bulanan"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{type:"number",value:a,onChange:h=>r(h.target.value),className:"h-10 w-[140px] rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-900",min:2e3,max:2100}),e.jsx("button",{type:"button",onClick:g,className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700",children:"Tampilkan"}),e.jsx("button",{type:"button",onClick:()=>{const h=`/admin-api/laporan/bulanan/export?year=${encodeURIComponent(a)}`;window.location.href=h},className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900",children:"Export Excel"})]})]}),c&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:c}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Pendapatan"}),e.jsxs("div",{className:"mt-1 text-lg font-semibold text-gray-800 dark:text-white/90",children:["Rp ",i.pendapatan.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Transaksi"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-gray-800 dark:text-white/90",children:i.transaksi})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Item Terjual"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-gray-800 dark:text-white/90",children:i.item_terjual})]})]}),e.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:u?e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Bulan"}),e.jsx("th",{className:"py-2 pr-4",children:"Transaksi"}),e.jsx("th",{className:"py-2 pr-4",children:"Item"}),e.jsx("th",{className:"py-2 pr-4",children:"Pendapatan"})]})}),e.jsxs("tbody",{children:[l.map(h=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:h.bulan}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:h.transaksi}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:h.item_terjual}),e.jsxs("td",{className:"py-3 pr-4 text-gray-800 dark:text-white/90",children:["Rp ",h.pendapatan.toLocaleString("id-ID")]})]},h.bulan)),l.length===0&&!u&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada data."})})]})]})})})]})]})}function il(){const[t,a]=n.useState(!0),[r,l]=n.useState(!1),[s,i]=n.useState(null),[o,u]=n.useState(null);le(s);const[d,c]=n.useState({toko_nama:"",toko_telepon:"",toko_alamat:"",toko_logo:"",transaksi_pajak:"0",transaksi_diskon:"0",transaksi_metode:"CASH",stok_low_threshold_toko:"5",stok_low_threshold_gudang:"5",struk_footer:""}),[m,g]=n.useState(null),[h,y]=n.useState(!1),_=async()=>{var x,k,D,E,T,M,$,v,N,I;a(!0),i(null);try{const f=(await Z("/admin-api/pengaturan")).data;c({toko_nama:((x=f==null?void 0:f.toko)==null?void 0:x.nama)||"",toko_telepon:((k=f==null?void 0:f.toko)==null?void 0:k.telepon)||"",toko_alamat:((D=f==null?void 0:f.toko)==null?void 0:D.alamat)||"",toko_logo:((E=f==null?void 0:f.toko)==null?void 0:E.logo)||"",transaksi_pajak:String(((T=f==null?void 0:f.transaksi)==null?void 0:T.pajak_default)??0),transaksi_diskon:String(((M=f==null?void 0:f.transaksi)==null?void 0:M.diskon_default)??0),transaksi_metode:(($=f==null?void 0:f.transaksi)==null?void 0:$.metode_default)||"CASH",stok_low_threshold_toko:String(((v=f==null?void 0:f.stok)==null?void 0:v.low_threshold_toko)??5),stok_low_threshold_gudang:String(((N=f==null?void 0:f.stok)==null?void 0:N.low_threshold_gudang)??5),struk_footer:((I=f==null?void 0:f.struk)==null?void 0:I.footer)||""})}catch(V){const f=(V==null?void 0:V.message)||"Gagal memuat pengaturan";i(f)}finally{a(!1)}};n.useEffect(()=>{_()},[]);const R=async()=>{l(!0),i(null),u(null);try{await he("/admin-api/pengaturan",{toko:{nama:d.toko_nama,telepon:d.toko_telepon,alamat:d.toko_alamat,logo:d.toko_logo},transaksi:{pajak_default:Number(d.transaksi_pajak)||0,diskon_default:Number(d.transaksi_diskon)||0,metode_default:d.transaksi_metode},stok:{low_threshold_toko:Number(d.stok_low_threshold_toko)||0,low_threshold_gudang:Number(d.stok_low_threshold_gudang)||0},struk:{footer:d.struk_footer}}),u("Pengaturan berhasil disimpan.")}catch(x){const k=(x==null?void 0:x.message)||"Gagal menyimpan pengaturan";i(k)}finally{l(!1)}},j=async()=>{var x,k;if(m){y(!0),i(null),u(null);try{const D=new FormData;D.append("logo",m);const E=await fetch("/admin-api/pengaturan/logo",{method:"POST",body:D,credentials:"same-origin",headers:{"X-CSRF-TOKEN":((x=document.querySelector('meta[name="csrf-token"]'))==null?void 0:x.getAttribute("content"))||"",Accept:"application/json"}});if(!E.ok){const $=await E.text();throw new Error($||`Upload gagal (${E.status})`)}const T=await E.json(),M=((k=T==null?void 0:T.data)==null?void 0:k.logo)||"";c($=>({...$,toko_logo:M})),g(null),u("Logo berhasil diunggah.")}catch(D){const E=(D==null?void 0:D.message)||"Gagal upload logo";i(E)}finally{y(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Pengaturan",description:"Pengaturan aplikasi"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Pengaturan"}),e.jsx("button",{type:"button",onClick:R,disabled:r||t,className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:r?"Menyimpan...":"Simpan"})]}),o&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:o}),s&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:s}),t?e.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 text-sm text-gray-600 shadow-sm dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:"Memuat pengaturan..."}):e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Profil Toko"}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"text-xs text-gray-500",children:"Logo Toko"}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[d.toko_logo?e.jsx("img",{src:d.toko_logo,alt:"Logo",className:"h-12 w-12 rounded-lg border border-gray-200 bg-white object-contain dark:border-gray-800"}):e.jsx("div",{className:"h-12 w-12 rounded-lg border border-dashed border-gray-200 dark:border-gray-800"}),e.jsx("input",{type:"file",accept:"image/*",onChange:x=>{var k;return g(((k=x.target.files)==null?void 0:k[0])||null)},className:"text-sm"}),e.jsx("button",{type:"button",onClick:j,disabled:h||!m,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 disabled:opacity-60 dark:border-gray-800 dark:bg-gray-950",children:h?"Mengunggah...":"Upload Logo"})]}),e.jsx("div",{className:"text-xs text-gray-500",children:"Maks 2MB. Format PNG/JPG."})]}),e.jsx("input",{value:d.toko_nama,onChange:x=>c(k=>({...k,toko_nama:x.target.value})),placeholder:"Nama toko",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:d.toko_telepon,onChange:x=>c(k=>({...k,toko_telepon:x.target.value})),placeholder:"Telepon/WhatsApp",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("textarea",{value:d.toko_alamat,onChange:x=>c(k=>({...k,toko_alamat:x.target.value})),placeholder:"Alamat",className:"min-h-[100px] rounded-xl border border-gray-200 bg-white px-4 py-3 text-sm dark:border-gray-800 dark:bg-gray-950"})]})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Transaksi"}),e.jsxs("div",{className:"mt-4 grid gap-4 sm:grid-cols-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"block text-xs text-gray-500",children:"Pajak Default"}),e.jsx("input",{value:d.transaksi_pajak,onChange:x=>c(k=>({...k,transaksi_pajak:x.target.value})),placeholder:"0",type:"number",min:0,className:"h-11 w-full rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"block text-xs text-gray-500",children:"Diskon Default"}),e.jsx("input",{value:d.transaksi_diskon,onChange:x=>c(k=>({...k,transaksi_diskon:x.target.value})),placeholder:"0",type:"number",min:0,className:"h-11 w-full rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"block text-xs text-gray-500",children:"Metode Default"}),e.jsxs("select",{value:d.transaksi_metode,onChange:x=>c(k=>({...k,transaksi_metode:x.target.value})),className:"h-11 w-full rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"CASH",children:"TUNAI"}),e.jsx("option",{value:"QRIS",children:"QRIS"}),e.jsx("option",{value:"PIUTANG",children:"PIUTANG"}),e.jsx("option",{value:"VOUCHER",children:"VOUCHER"}),e.jsx("option",{value:"VOUCHER_CASH",children:"VOUCHER + TUNAI"})]})]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Stok & Dashboard"}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"block text-xs text-gray-500",children:"Ambang Stok (Toko)"}),e.jsx("input",{value:d.stok_low_threshold_toko,onChange:x=>c(k=>({...k,stok_low_threshold_toko:x.target.value})),placeholder:"Contoh: 5",type:"number",min:0,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"block text-xs text-gray-500",children:"Ambang Stok (Gudang)"}),e.jsx("input",{value:d.stok_low_threshold_gudang,onChange:x=>c(k=>({...k,stok_low_threshold_gudang:x.target.value})),placeholder:"Contoh: 10",type:"number",min:0,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"})]})]}),e.jsx("div",{className:"mt-2 text-xs text-gray-500",children:"Ambang toko dipakai pada widget “Stok Rendah” di dashboard. Ambang gudang untuk stok gudang."})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Struk"}),e.jsx("div",{className:"mt-4 grid gap-3",children:e.jsx("textarea",{value:d.struk_footer,onChange:x=>c(k=>({...k,struk_footer:x.target.value})),placeholder:"Footer struk (opsional)",className:"min-h-[120px] rounded-xl border border-gray-200 bg-white px-4 py-3 text-sm dark:border-gray-800 dark:bg-gray-950"})})]})]})]})]})}function ol(){const[t,a]=n.useState([]),[r,l]=n.useState(!0),[s,i]=n.useState(!1),[o,u]=n.useState(null),[d,c]=n.useState(null),[m,g]=n.useState(null),[h,y]=n.useState([]),{isOpen:_,openModal:R,closeModal:j}=we();le(o);const[x,k]=n.useState({pegawai_id:"",name:"",email:"",password:"",role:"kasir"}),D=async()=>{l(!0),u(null);try{const[v,N]=await Promise.all([Z("/admin-api/users"),Z("/admin-api/pegawai")]);a(v.data),y((N.data||[]).filter(I=>I.is_aktif))}catch(v){u((v==null?void 0:v.message)||"Gagal memuat user")}finally{l(!1)}};n.useEffect(()=>{D()},[]);const E=()=>{g(null),k({pegawai_id:"",name:"",email:"",password:"",role:"kasir"}),c(null),u(null)},T=v=>{g(v),k({pegawai_id:v.pegawai_id?String(v.pegawai_id):"",name:v.name||"",email:v.email||"",password:"",role:v.role||"kasir"}),c(null),u(null)},M=async()=>{i(!0),u(null),c(null);try{if(!m&&!x.pegawai_id)throw new Error("Pilih pegawai terlebih dahulu.");if(m){const v={...x};v.pegawai_id||delete v.pegawai_id,v.password||delete v.password,await he(`/admin-api/users/${m.id}`,v),c("User berhasil diperbarui.")}else{const v={...x};v.pegawai_id||delete v.pegawai_id,await ue("/admin-api/users",v),c("User berhasil ditambahkan.")}E(),await D()}catch(v){u((v==null?void 0:v.message)||"Gagal menyimpan user")}finally{i(!1)}},$=async v=>{if(v.role==="admin"){u("User admin tidak bisa dihapus.");return}if(confirm(`Hapus user "${v.name}"?`)){u(null),c(null);try{await Vt(`/admin-api/users/${v.id}`),c("User berhasil dihapus."),await D()}catch(N){u((N==null?void 0:N.message)||"Gagal menghapus user")}}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"User",description:"Manajemen user"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"User"}),e.jsx("button",{type:"button",onClick:()=>{E(),R()},className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700",children:"Tambah User"})]}),!_&&d&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:d}),!_&&o&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:o}),e.jsx(pe,{isOpen:_,onClose:j,className:"max-w-[900px] p-6 lg:p-8",children:e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:m?`Edit User #${m.id}`:"Form User Baru"}),m?e.jsx("button",{type:"button",onClick:E,className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Batal Edit"}):null]}),d&&e.jsx("div",{className:"mt-4 rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:d}),o&&e.jsx("div",{className:"mt-4 rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:o}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:[e.jsxs("select",{value:x.pegawai_id,onChange:v=>{const N=v.target.value,I=h.find(V=>String(V.id)===N);k(V=>({...V,pegawai_id:N,name:(I==null?void 0:I.nama)||(N?V.name:"")}))},className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Pilih Pegawai"}),h.map(v=>e.jsxs("option",{value:v.id,children:[v.nama," ",v.nip?`(${v.nip})`:""]},v.id))]}),e.jsx("input",{value:x.name,onChange:v=>k(N=>({...N,name:v.target.value})),placeholder:"Nama",readOnly:!!x.pegawai_id,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:x.email,onChange:v=>k(N=>({...N,email:v.target.value})),placeholder:"Email (opsional)",type:"email",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:x.password,onChange:v=>k(N=>({...N,password:v.target.value})),placeholder:m?"Password baru (opsional)":"Password",type:"password",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("select",{value:x.role,onChange:v=>k(N=>({...N,role:v.target.value})),className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"kasir",children:"Kasir"}),e.jsx("option",{value:"gudang",children:"Gudang"})]})]}),e.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:j,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Tutup"}),e.jsx("button",{type:"button",onClick:M,disabled:s,className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:s?"Menyimpan...":m?"Simpan Perubahan":"Tambah User"})]})]})}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Daftar User"}),r?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"NIP"}),e.jsx("th",{className:"py-2 pr-4",children:"Nama"}),e.jsx("th",{className:"py-2 pr-4",children:"Email"}),e.jsx("th",{className:"py-2 pr-4",children:"Role"}),e.jsx("th",{className:"py-2 pr-4",children:"Pegawai"}),e.jsx("th",{className:"py-2 pr-4",children:"Dibuat"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[t.map(v=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:v.nip||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-800 dark:text-white/90",children:v.name}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:v.email}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:(v.role||"-").toUpperCase()}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:v.pegawai_nama||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-500 dark:text-gray-400",children:new Date(v.created_at).toLocaleString("id-ID")}),e.jsxs("td",{className:"py-3 pr-4",children:[e.jsx("button",{type:"button",onClick:()=>{T(v),R()},className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Edit"}),v.role==="admin"?e.jsx("span",{className:"ml-2 text-xs text-gray-400",children:"Admin"}):e.jsx("button",{type:"button",onClick:()=>$(v),className:"ml-2 h-9 rounded-xl border border-red-200 bg-white px-3 text-xs font-semibold text-red-700 hover:bg-red-50 dark:border-red-900 dark:bg-gray-950 dark:text-red-300 dark:hover:bg-red-500/10",children:"Hapus"})]})]},v.id)),t.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Belum ada user."})})]})]})})]})]})]})}function dl(){const[t,a]=n.useState(!0),[r,l]=n.useState(!1),[s,i]=n.useState(!1),[o,u]=n.useState(null),[d,c]=n.useState(null);le(o);const[m,g]=n.useState({name:"",email:""}),[h,y]=n.useState({current_password:"",password:"",password_confirmation:""}),_=async()=>{a(!0),u(null);try{const x=await Z("/admin-api/me");g({name:x.data.name||"",email:x.data.email||""})}catch(x){u((x==null?void 0:x.message)||"Gagal memuat profil")}finally{a(!1)}};n.useEffect(()=>{_()},[]);const R=async()=>{l(!0),u(null),c(null);try{await he("/admin-api/me",{name:m.name,email:m.email}),c("Profil berhasil disimpan.")}catch(x){u((x==null?void 0:x.message)||"Gagal menyimpan profil")}finally{l(!1)}},j=async()=>{i(!0),u(null),c(null);try{await he("/admin-api/me/password",h),c("Password berhasil diperbarui."),y({current_password:"",password:"",password_confirmation:""})}catch(x){u((x==null?void 0:x.message)||"Gagal mengganti password")}finally{i(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Profil",description:"Profil pengguna"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Profil"})}),d&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:d}),o&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:o}),t?e.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 text-sm text-gray-600 shadow-sm dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:"Memuat profil..."}):e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Informasi Profil"}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsx("input",{value:m.name,onChange:x=>g(k=>({...k,name:x.target.value})),placeholder:"Nama",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:m.email,onChange:x=>g(k=>({...k,email:x.target.value})),placeholder:"Email",type:"email",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("button",{type:"button",onClick:R,disabled:r,className:"h-10 w-[180px] rounded-xl bg-blue-600 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:r?"Menyimpan...":"Simpan Profil"})]})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Ganti Password"}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsx("input",{value:h.current_password,onChange:x=>y(k=>({...k,current_password:x.target.value})),placeholder:"Password sekarang",type:"password",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:h.password,onChange:x=>y(k=>({...k,password:x.target.value})),placeholder:"Password baru",type:"password",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:h.password_confirmation,onChange:x=>y(k=>({...k,password_confirmation:x.target.value})),placeholder:"Konfirmasi password baru",type:"password",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("button",{type:"button",onClick:j,disabled:s,className:"h-10 w-[200px] rounded-xl bg-blue-600 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:s?"Menyimpan...":"Ganti Password"})]})]})]})]})]})}function cl(){const[t,a]=n.useState([]),[r,l]=n.useState(!0),[s,i]=n.useState(!1),[o,u]=n.useState(null),[d,c]=n.useState(null),[m,g]=n.useState(""),{isOpen:h,openModal:y,closeModal:_}=we();le(o);const[R,j]=n.useState(null),[x,k]=n.useState({nip:"",nama:"",jabatan:"",telepon:"",alamat:"",tempat_lahir:"",tanggal_lahir:"",jenis_kelamin:"",kota:"",nik:"",foto:"",is_aktif:!0}),[D,E]=n.useState(null),[T,M]=n.useState(!1),$=async()=>{l(!0),u(null);try{const C=await Z(`/admin-api/pegawai${m.trim()?`?q=${encodeURIComponent(m.trim())}`:""}`);a(C.data)}catch(C){u((C==null?void 0:C.message)||"Gagal memuat pegawai")}finally{l(!1)}};n.useEffect(()=>{$()},[]);const v=n.useMemo(()=>{const C=m.trim().toLowerCase();return C?t.filter(A=>[A.nip||"",A.nik||"",A.nama,A.jabatan||"",A.telepon||""].some(W=>W.toLowerCase().includes(C))):t},[t,m]),N=()=>{j(null),k({nip:"",nama:"",jabatan:"",telepon:"",alamat:"",tempat_lahir:"",tanggal_lahir:"",jenis_kelamin:"",kota:"",nik:"",foto:"",is_aktif:!0}),E(null),c(null),u(null)},I=C=>{j(C),c(null),u(null),k({nip:C.nip||"",nama:C.nama||"",jabatan:C.jabatan||"",telepon:C.telepon||"",alamat:C.alamat||"",tempat_lahir:C.tempat_lahir||"",tanggal_lahir:C.tanggal_lahir||"",jenis_kelamin:C.jenis_kelamin||"",kota:C.kota||"",nik:C.nik||"",foto:C.foto||"",is_aktif:C.is_aktif??!0}),E(null)},V=async()=>{var C,A;if(D){M(!0),u(null),c(null);try{const W=new FormData;W.append("foto",D);const U=await fetch("/admin-api/pegawai/foto",{method:"POST",body:W,credentials:"same-origin",headers:{"X-CSRF-TOKEN":((C=document.querySelector('meta[name="csrf-token"]'))==null?void 0:C.getAttribute("content"))||"",Accept:"application/json"}});if(!U.ok){const J=await U.text();throw new Error(J||`Upload gagal (${U.status})`)}const S=await U.json(),z=((A=S==null?void 0:S.data)==null?void 0:A.foto)||"";k(J=>({...J,foto:z})),E(null),c("Foto berhasil diunggah.")}catch(W){u((W==null?void 0:W.message)||"Gagal upload foto")}finally{M(!1)}}},f=async()=>{i(!0),u(null),c(null);try{R?(await he(`/admin-api/pegawai/${R.id}`,x),c("Pegawai berhasil diperbarui.")):(await ue("/admin-api/pegawai",x),c("Pegawai berhasil ditambahkan.")),N(),await $()}catch(C){u((C==null?void 0:C.message)||"Gagal menyimpan pegawai")}finally{i(!1)}},O=async C=>{if(confirm(`Hapus pegawai "${C.nama}"?`)){u(null),c(null);try{await Vt(`/admin-api/pegawai/${C.id}`),c("Pegawai berhasil dihapus."),await $()}catch(A){u((A==null?void 0:A.message)||"Gagal menghapus pegawai")}}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Pegawai",description:"Manajemen pegawai"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Pegawai"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{N(),y()},className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700",children:"Tambah Pegawai"}),e.jsx("input",{value:m,onChange:C=>g(C.target.value),placeholder:"Cari nama / nip / jabatan / telepon",className:"h-10 w-[260px] rounded-xl border border-gray-200 bg-white px-4 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-900"}),e.jsx("button",{type:"button",onClick:$,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900",children:"Cari"})]})]}),!h&&d&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:d}),!h&&o&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:o}),e.jsx(pe,{isOpen:h,onClose:_,className:"max-w-[980px] p-6 lg:p-8",children:e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:R?`Edit Pegawai #${R.id}`:"Tambah Pegawai"}),e.jsx("button",{type:"button",onClick:N,className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Reset Form"})]}),d&&e.jsx("div",{className:"mt-4 rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:d}),o&&e.jsx("div",{className:"mt-4 rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:o}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:[e.jsx("input",{value:x.nip,onChange:C=>k(A=>({...A,nip:C.target.value})),placeholder:"NIP",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:x.nama,onChange:C=>k(A=>({...A,nama:C.target.value})),placeholder:"Nama",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:x.jabatan,onChange:C=>k(A=>({...A,jabatan:C.target.value})),placeholder:"Jabatan",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:x.telepon,onChange:C=>k(A=>({...A,telepon:C.target.value})),placeholder:"Telepon",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:x.kota,onChange:C=>k(A=>({...A,kota:C.target.value})),placeholder:"Kota",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:x.tempat_lahir,onChange:C=>k(A=>({...A,tempat_lahir:C.target.value})),placeholder:"Tempat Lahir",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:x.tanggal_lahir,onChange:C=>k(A=>({...A,tanggal_lahir:C.target.value})),type:"date",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("select",{value:x.jenis_kelamin,onChange:C=>k(A=>({...A,jenis_kelamin:C.target.value})),className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Jenis Kelamin"}),e.jsx("option",{value:"L",children:"Laki-laki"}),e.jsx("option",{value:"P",children:"Perempuan"})]}),e.jsx("input",{value:x.nik,onChange:C=>k(A=>({...A,nik:C.target.value})),placeholder:"NIK",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:x.alamat,onChange:C=>k(A=>({...A,alamat:C.target.value})),placeholder:"Alamat",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950 md:col-span-2"}),e.jsx("div",{className:"md:col-span-3",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"text-xs text-gray-500",children:"Foto Pegawai"}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[x.foto?e.jsx("img",{src:x.foto,alt:"Foto",className:"h-12 w-12 rounded-lg border border-gray-200 bg-white object-cover dark:border-gray-800"}):e.jsx("div",{className:"h-12 w-12 rounded-lg border border-dashed border-gray-200 dark:border-gray-800"}),e.jsx("input",{type:"file",accept:"image/*",onChange:C=>{var A;return E(((A=C.target.files)==null?void 0:A[0])||null)},className:"text-sm"}),e.jsx("button",{type:"button",onClick:V,disabled:T||!D,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 disabled:opacity-60 dark:border-gray-800 dark:bg-gray-950",children:T?"Mengunggah...":"Upload Foto"})]}),e.jsx("div",{className:"text-xs text-gray-500",children:"Maks 2MB. Format PNG/JPG."})]})}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx("input",{type:"checkbox",checked:x.is_aktif,onChange:C=>k(A=>({...A,is_aktif:C.target.checked}))}),"Aktif"]}),e.jsx("button",{type:"button",onClick:f,disabled:s,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:s?"Menyimpan...":R?"Simpan Perubahan":"Tambah"})]})]})}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Daftar Pegawai"}),r?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"NIP"}),e.jsx("th",{className:"py-2 pr-4",children:"Nama"}),e.jsx("th",{className:"py-2 pr-4",children:"Jabatan"}),e.jsx("th",{className:"py-2 pr-4",children:"Telepon"}),e.jsx("th",{className:"py-2 pr-4",children:"Status"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[v.map(C=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:C.nip||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-800 dark:text-white/90",children:C.nama}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:C.jabatan||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:C.telepon||"-"}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("span",{className:`inline-flex rounded-full px-3 py-1 text-xs font-semibold ${C.is_aktif?"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300":"bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300"}`,children:C.is_aktif?"Aktif":"Nonaktif"})}),e.jsxs("td",{className:"py-3 pr-4",children:[e.jsx("button",{type:"button",onClick:()=>{I(C),y()},className:"mr-2 h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Edit"}),e.jsx("button",{type:"button",onClick:()=>O(C),className:"h-9 rounded-xl border border-red-200 bg-white px-3 text-xs font-semibold text-red-700 hover:bg-red-50 dark:border-red-900 dark:bg-gray-950 dark:text-red-300 dark:hover:bg-red-500/10",children:"Hapus"})]})]},C.id)),v.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada data."})})]})]})})]})]})]})}function ul(){const[t,a]=n.useState([]),[r,l]=n.useState(!0),[s,i]=n.useState(!1),[o,u]=n.useState(null),[d,c]=n.useState(null),[m,g]=n.useState(""),{isOpen:h,openModal:y,closeModal:_}=we(),{isOpen:R,openModal:j,closeModal:x}=we();le(o);const[k,D]=n.useState(null),[E,T]=n.useState({nama:"",alamat:"",telepon:""}),[M,$]=n.useState(null),[v,N]=n.useState(!1),I=async()=>{l(!0),u(null);try{const U=await Z(`/admin-api/distributor${m.trim()?`?q=${encodeURIComponent(m.trim())}`:""}`);a(U.data)}catch(U){u((U==null?void 0:U.message)||"Gagal memuat distributor")}finally{l(!1)}};n.useEffect(()=>{I()},[]);const V=n.useMemo(()=>{const U=m.trim().toLowerCase();return U?t.filter(S=>[S.nama,S.alamat||"",S.telepon||""].some(z=>z.toLowerCase().includes(U))):t},[t,m]),f=()=>{D(null),T({nama:"",alamat:"",telepon:""}),c(null),u(null)},O=U=>{D(U),c(null),u(null),T({nama:U.nama||"",alamat:U.alamat||"",telepon:U.telepon||""})},C=async()=>{if(!E.nama.trim()){u("Nama distributor wajib diisi.");return}i(!0),u(null),c(null);try{k?(await he(`/admin-api/distributor/${k.id}`,{nama:E.nama.trim(),alamat:E.alamat.trim()||null,telepon:E.telepon.trim()||null}),c("Distributor berhasil diperbarui.")):(await ue("/admin-api/distributor",{nama:E.nama.trim(),alamat:E.alamat.trim()||null,telepon:E.telepon.trim()||null}),c("Distributor berhasil ditambahkan.")),f(),await I()}catch(U){u((U==null?void 0:U.message)||"Gagal menyimpan distributor")}finally{i(!1)}},A=async U=>{if(confirm(`Hapus distributor "${U.nama}"?`)){u(null),c(null);try{await Vt(`/admin-api/distributor/${U.id}`),c("Distributor berhasil dihapus."),await I()}catch(S){u((S==null?void 0:S.message)||"Gagal menghapus distributor")}}},W=async()=>{var U;if(!M){u("Pilih file Excel/CSV terlebih dulu.");return}N(!0),u(null),c(null);try{const S=new FormData;S.append("file",M);const z=await fetch("/admin-api/distributor/import",{method:"POST",body:S,credentials:"same-origin",headers:{"X-CSRF-TOKEN":((U=document.querySelector('meta[name="csrf-token"]'))==null?void 0:U.getAttribute("content"))||"",Accept:"application/json"}});if(!z.ok){const P=await z.text();throw new Error(P||`Import gagal (${z.status})`)}const J=await z.json();c((J==null?void 0:J.message)||"Import berhasil."),$(null),await I()}catch(S){u((S==null?void 0:S.message)||"Import gagal")}finally{N(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Distributor",description:"Manajemen distributor"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Distributor"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{f(),y()},className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700",children:"Tambah Distributor"}),e.jsx("button",{type:"button",onClick:()=>{$(null),u(null),c(null),j()},className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900",children:"Import Excel"}),e.jsx("input",{value:m,onChange:U=>g(U.target.value),placeholder:"Cari nama / alamat / telepon",className:"h-10 w-[260px] rounded-xl border border-gray-200 bg-white px-4 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-900"}),e.jsx("button",{type:"button",onClick:I,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900",children:"Cari"})]})]}),!h&&d&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:d}),!h&&o&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:o}),e.jsx(pe,{isOpen:h,onClose:_,className:"max-w-[720px] p-6 lg:p-8",children:e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:k?`Edit Distributor #${k.id}`:"Tambah Distributor"}),e.jsx("button",{type:"button",onClick:f,className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Reset Form"})]}),d&&e.jsx("div",{className:"mt-4 rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:d}),o&&e.jsx("div",{className:"mt-4 rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:o}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[e.jsx("input",{value:E.nama,onChange:U=>T(S=>({...S,nama:U.target.value})),placeholder:"Nama distributor",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:E.telepon,onChange:U=>T(S=>({...S,telepon:U.target.value})),placeholder:"Telepon",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:E.alamat,onChange:U=>T(S=>({...S,alamat:U.target.value})),placeholder:"Alamat",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950 md:col-span-2"}),e.jsx("button",{type:"button",onClick:C,disabled:s,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:s?"Menyimpan...":k?"Simpan Perubahan":"Tambah"})]})]})}),e.jsx(pe,{isOpen:R,onClose:x,className:"max-w-[560px] p-6 lg:p-8",children:e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Import Distributor"}),e.jsxs("div",{className:"mt-3 text-xs text-gray-500",children:["Format kolom:"," ",e.jsx("span",{className:"font-semibold",children:"nama, alamat, telepon"}),". Baris pertama boleh header."]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[e.jsx("a",{href:"/admin-api/distributor/template",className:"inline-flex h-10 items-center justify-center rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Download Template"}),e.jsx("input",{type:"file",accept:".xlsx,.xls,.csv",onChange:U=>{var S;return $(((S=U.target.files)==null?void 0:S[0])||null)},className:"text-sm"}),e.jsx("button",{type:"button",onClick:W,disabled:v,className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:v?"Mengimpor...":"Import"})]})]})}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Daftar Distributor"}),r?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Nama"}),e.jsx("th",{className:"py-2 pr-4",children:"Alamat"}),e.jsx("th",{className:"py-2 pr-4",children:"Telepon"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[V.map(U=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-800 dark:text-white/90",children:U.nama}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:U.alamat||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:U.telepon||"-"}),e.jsxs("td",{className:"py-3 pr-4",children:[e.jsx("button",{type:"button",onClick:()=>{O(U),y()},className:"mr-2 h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Edit"}),e.jsx("button",{type:"button",onClick:()=>A(U),className:"h-9 rounded-xl border border-red-200 bg-white px-3 text-xs font-semibold text-red-700 hover:bg-red-50 dark:border-red-900 dark:bg-gray-950 dark:text-red-300 dark:hover:bg-red-500/10",children:"Hapus"})]})]},U.id)),V.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada data."})})]})]})})]})]})]})}const ml=["DRAFT","SELESAI","SEBAGIAN","BATAL"];function gl(){const[t,a]=n.useState([]),[r,l]=n.useState([]),[s,i]=n.useState([]),[o,u]=n.useState([]),[d,c]=n.useState(!0),[m,g]=n.useState(!1),[h,y]=n.useState(null),[_,R]=n.useState(null),[j,x]=n.useState(""),{isOpen:k,openModal:D,closeModal:E}=we();le(h);const[T,M]=n.useState(null),[$,v]=n.useState({no_faktur:"",tanggal_faktur:"",tanggal_datang:"",distributor_id:"",lokasi_id:"",status:"DRAFT",catatan:""}),[N,I]=n.useState([]),V=!!(T!=null&&T.applied_at),f=P=>P?String(P).slice(0,10):"",O=async()=>{c(!0),y(null);try{const P=await Z(`/admin-api/penerimaan-barang${j.trim()?`?q=${encodeURIComponent(j.trim())}`:""}`);a(P.data)}catch(P){y((P==null?void 0:P.message)||"Gagal memuat penerimaan")}finally{c(!1)}},C=async()=>{const[P,F,Y]=await Promise.all([Z("/admin-api/lokasi"),Z("/admin-api/distributor"),Z("/admin-api/produk?with_units=1")]);l(P.data),i(F.data),u(Y.data)};n.useEffect(()=>{O(),C().catch(()=>{})},[]);const A=n.useMemo(()=>{const P=j.trim().toLowerCase();return P?t.filter(F=>[F.nomor_penerimaan,F.no_faktur||"",F.distributor||"",F.lokasi||""].some(Y=>Y.toLowerCase().includes(P))):t},[t,j]),W=()=>{M(null),v({no_faktur:"",tanggal_faktur:"",tanggal_datang:"",distributor_id:"",lokasi_id:"",status:"DRAFT",catatan:""}),I([{produk_id:"",qty:1,harga:"",unit_id:""}]),R(null),y(null)},U=async P=>{R(null),y(null);const Y=(await Z(`/admin-api/penerimaan-barang/${P.id}`)).data;M(Y),v({no_faktur:Y.no_faktur||"",tanggal_faktur:f(Y.tanggal_faktur),tanggal_datang:f(Y.tanggal_datang),distributor_id:String(Y.distributor_id||""),lokasi_id:String(Y.lokasi_id||""),status:Y.status||"DRAFT",catatan:Y.catatan||""}),I(Y.items.map(p=>({produk_id:p.produk_id,qty:p.qty_input??p.qty,harga:p.harga??"",unit_id:p.unit_id??""})))},S=()=>{I(P=>[...P,{produk_id:"",qty:1,harga:"",unit_id:""}])},z=P=>{I(F=>F.filter((Y,p)=>p!==P))},J=async()=>{if(!$.distributor_id||!$.lokasi_id)return y("Distributor dan lokasi wajib dipilih.");if(N.length===0||N.some(F=>!F.produk_id||F.qty<=0))return y("Item produk belum lengkap.");g(!0),y(null),R(null);const P={no_faktur:$.no_faktur.trim()||null,tanggal_faktur:$.tanggal_faktur||null,tanggal_datang:$.tanggal_datang||null,distributor_id:Number($.distributor_id),lokasi_id:Number($.lokasi_id),status:$.status,catatan:$.catatan.trim()||null,items:N.map(F=>({produk_id:Number(F.produk_id),qty:Number(F.qty)||1,harga:F.harga===""?null:Number(F.harga),unit_id:F.unit_id===""?null:Number(F.unit_id)}))};try{T?(await he(`/admin-api/penerimaan-barang/${T.id}`,P),R("Penerimaan diperbarui.")):(await ue("/admin-api/penerimaan-barang",P),R("Penerimaan tersimpan.")),E(),await O()}catch(F){y((F==null?void 0:F.message)||"Gagal menyimpan penerimaan")}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Penerimaan Barang",description:"Penerimaan barang masuk"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Penerimaan Barang"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{W(),D()},className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700",children:"Tambah Penerimaan"}),e.jsx("input",{value:j,onChange:P=>x(P.target.value),placeholder:"Cari nomor / faktur / distributor",className:"h-10 w-[260px] rounded-xl border border-gray-200 bg-white px-4 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-900"}),e.jsx("button",{type:"button",onClick:O,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900",children:"Cari"})]})]}),!k&&_&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:_}),!k&&h&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:h}),e.jsx(pe,{isOpen:k,onClose:E,className:"max-w-[1100px] p-6 lg:p-8",children:e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:T?`Edit Penerimaan #${T.id}`:"Tambah Penerimaan"}),e.jsx("button",{type:"button",onClick:W,className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Reset Form"})]}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:[e.jsx("input",{value:$.no_faktur,onChange:P=>v(F=>({...F,no_faktur:P.target.value})),placeholder:"No Faktur",disabled:V,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{type:"date",value:$.tanggal_faktur,onChange:P=>v(F=>({...F,tanggal_faktur:P.target.value})),disabled:V,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{type:"date",value:$.tanggal_datang,onChange:P=>v(F=>({...F,tanggal_datang:P.target.value})),disabled:V,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("select",{value:$.distributor_id,onChange:P=>v(F=>({...F,distributor_id:P.target.value})),disabled:V,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Pilih distributor"}),s.map(P=>e.jsx("option",{value:P.id,children:P.nama},P.id))]}),e.jsxs("select",{value:$.lokasi_id,onChange:P=>v(F=>({...F,lokasi_id:P.target.value})),disabled:V,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Pilih lokasi"}),r.map(P=>e.jsxs("option",{value:P.id,children:[P.nama," (",P.kode,")"]},P.id))]}),e.jsx("select",{value:$.status,onChange:P=>v(F=>({...F,status:P.target.value})),disabled:V,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",children:ml.map(P=>e.jsx("option",{value:P,children:P},P))}),e.jsx("input",{value:$.catatan,onChange:P=>v(F=>({...F,catatan:P.target.value})),placeholder:"Catatan (opsional)",disabled:V,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950 md:col-span-3"})]}),e.jsx("div",{className:"mt-4 text-sm font-semibold text-gray-800 dark:text-white/90",children:"Item Barang"}),e.jsx("div",{className:"mt-3 space-y-2",children:N.map((P,F)=>{var Y;return e.jsxs("div",{className:"grid gap-2 md:grid-cols-[2fr_1fr_1fr_1fr_auto]",children:[e.jsxs("select",{value:P.produk_id,onChange:p=>{var fe,ne;const B=p.target.value?Number(p.target.value):"",w=o.find(me=>me.id===B),H=((fe=w==null?void 0:w.units)==null?void 0:fe.find(me=>me.is_base))||((ne=w==null?void 0:w.units)==null?void 0:ne[0]),Q=P.harga===""?(w==null?void 0:w.harga_beli)??"":P.harga;I(me=>me.map((Te,Ae)=>Ae===F?{...Te,produk_id:B,unit_id:(H==null?void 0:H.id)??"",harga:Q}:Te))},disabled:V,className:"h-10 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Pilih produk"}),o.map(p=>e.jsxs("option",{value:p.id,children:[p.nama," ",p.sku?`(${p.sku})`:""," • ",p.barcode]},p.id))]}),e.jsx("input",{type:"number",min:1,value:P.qty,onChange:p=>{const B=Number(p.target.value||0);I(w=>w.map((H,Q)=>Q===F?{...H,qty:B}:H))},disabled:V,className:"h-10 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("select",{value:P.unit_id,onChange:p=>{const B=p.target.value?Number(p.target.value):"";I(w=>w.map((H,Q)=>Q===F?{...H,unit_id:B}:H))},disabled:V||!P.produk_id,className:"h-10 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Satuan"}),(((Y=o.find(p=>p.id===P.produk_id))==null?void 0:Y.units)||[]).map(p=>e.jsxs("option",{value:p.id,children:[p.nama_unit," (x",p.multiplier,")"]},p.id))]}),e.jsx("input",{type:"number",min:0,value:P.harga,onChange:p=>{const B=p.target.value===""?"":Number(p.target.value);I(w=>w.map((H,Q)=>Q===F?{...H,harga:B}:H))},placeholder:"Harga (opsional)",disabled:V,className:"h-10 rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("button",{type:"button",onClick:()=>z(F),disabled:V,className:"h-10 rounded-xl border border-red-200 bg-white px-3 text-xs font-semibold text-red-700 hover:bg-red-50 dark:border-red-900 dark:bg-gray-950 dark:text-red-300 dark:hover:bg-red-500/10",children:"Hapus"})]},`item-${F}`)})}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:S,disabled:V,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"+ Tambah Item"}),T!=null&&T.applied_at?e.jsx("span",{className:"text-xs text-gray-500",children:"Penerimaan sudah diproses, item tidak dapat diubah."}):null]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("button",{type:"button",onClick:J,disabled:m||V,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:m?"Menyimpan...":T?"Simpan Perubahan":"Simpan"}),V&&e.jsx("div",{className:"mt-2 text-xs text-gray-500",children:"Penerimaan sudah diproses, data tidak bisa diubah."})]})]})}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Daftar Penerimaan"}),d?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Tanggal Datang"}),e.jsx("th",{className:"py-2 pr-4",children:"No Penerimaan"}),e.jsx("th",{className:"py-2 pr-4",children:"No Faktur"}),e.jsx("th",{className:"py-2 pr-4",children:"Distributor"}),e.jsx("th",{className:"py-2 pr-4",children:"Lokasi"}),e.jsx("th",{className:"py-2 pr-4",children:"Status"}),e.jsx("th",{className:"py-2 pr-4",children:"Item"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[A.map(P=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:P.tanggal_datang||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-800 dark:text-white/90",children:P.nomor_penerimaan}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:P.no_faktur||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:P.distributor||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:P.lokasi||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:P.status}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-300",children:P.items_count||0}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("button",{type:"button",onClick:async()=>{await U(P),D()},className:"h-9 rounded-xl border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Detail / Edit"})})]},P.id)),A.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada data."})})]})]})})]})]})]})}function xl(){const[t,a]=n.useState("POS"),[r,l]=n.useState(""),[s,i]=n.useState(null);n.useEffect(()=>{Z("/admin-api/pengaturan").then(m=>{var y,_,R,j,x;const g=(R=(_=(y=m==null?void 0:m.data)==null?void 0:y.toko)==null?void 0:_.nama)==null?void 0:R.trim(),h=((x=(j=m==null?void 0:m.data)==null?void 0:j.toko)==null?void 0:x.logo)||"";g&&a(g),l(h)}).catch(()=>{})},[]),n.useEffect(()=>{const m=localStorage.getItem("pos-display-state");if(m)try{i(JSON.parse(m))}catch{}let g=null;"BroadcastChannel"in window&&(g=new BroadcastChannel("pos-customer-display"),g.onmessage=y=>{i(y.data)});const h=y=>{if(!(y.key!=="pos-display-state"||!y.newValue))try{i(JSON.parse(y.newValue))}catch{}};return window.addEventListener("storage",h),()=>{window.removeEventListener("storage",h),g==null||g.close()}},[]);const o=(s==null?void 0:s.items)||[],u=o.length===0,d=m=>m?m==="CASH"?"TUNAI":m==="VOUCHER_CASH"?"VOUCHER + TUNAI":m:"-",c=n.useMemo(()=>o.reduce((m,g)=>m+g.qty,0),[o]);return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Layar Pembeli",description:"Tampilan transaksi untuk pembeli"}),e.jsx("div",{className:"min-h-screen bg-slate-50 text-slate-900 dark:bg-slate-950 dark:text-white",children:e.jsxs("div",{className:"mx-auto flex min-h-screen max-w-[1400px] flex-col px-6 py-6",children:[e.jsxs("header",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[r?e.jsx("img",{src:r,alt:"Logo",className:"h-12 w-12 rounded-xl bg-white object-contain p-2 shadow-sm"}):e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-slate-900/10 text-lg font-semibold dark:bg-white/10",children:t.trim().charAt(0)||"P"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-semibold",children:t}),e.jsx("div",{className:"text-xs text-slate-500 dark:text-white/60",children:s!=null&&s.lokasi?`Lokasi: ${s.lokasi}`:"Kasir"})]})]}),e.jsx("div",{className:"text-right text-xs text-slate-500 dark:text-white/60",children:s!=null&&s.waktu?new Date(s.waktu).toLocaleString("id-ID"):new Date().toLocaleString("id-ID")})]}),e.jsxs("div",{className:"mt-6 grid flex-1 gap-6 lg:grid-cols-[2fr_1fr]",children:[e.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-white p-5 shadow-sm dark:border-white/10 dark:bg-white/5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold uppercase tracking-wide text-slate-500 dark:text-white/70",children:"Daftar Belanja"}),e.jsxs("div",{className:"text-sm text-slate-500 dark:text-white/60",children:[c," item"]})]}),u?e.jsx("div",{className:"flex h-[420px] items-center justify-center rounded-xl border border-dashed border-slate-200 text-lg text-slate-500 dark:border-white/10 dark:text-white/60",children:"Silakan berbelanja"}):e.jsx("div",{className:"max-h-[520px] overflow-auto pr-2",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{className:"sticky top-0 bg-white/90 text-slate-500 backdrop-blur dark:bg-slate-950/80 dark:text-white/60",children:e.jsxs("tr",{className:"text-left",children:[e.jsx("th",{className:"py-2 pr-3",children:"Produk"}),e.jsx("th",{className:"py-2 pr-3",children:"Qty"}),e.jsx("th",{className:"py-2 pr-3",children:"Harga"}),e.jsx("th",{className:"py-2 pr-3 text-right",children:"Total"})]})}),e.jsx("tbody",{children:o.map((m,g)=>e.jsxs("tr",{className:"border-b border-slate-100 dark:border-white/10",children:[e.jsx("td",{className:"py-3 pr-3 text-slate-900 dark:text-white/90",children:m.nama}),e.jsx("td",{className:"py-3 pr-3 text-slate-600 dark:text-white/70",children:m.qty}),e.jsxs("td",{className:"py-3 pr-3 text-slate-600 dark:text-white/70",children:["Rp ",m.harga.toLocaleString("id-ID")]}),e.jsxs("td",{className:"py-3 pr-3 text-right text-slate-900 dark:text-white/90",children:["Rp ",m.total.toLocaleString("id-ID")]})]},`${m.nama}-${g}`))})]})})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-2xl bg-blue-600 p-5 text-white shadow-sm",children:[e.jsx("div",{className:"text-sm uppercase tracking-wide text-white/80",children:"Total Bayar"}),e.jsxs("div",{className:"mt-2 text-4xl font-semibold",children:["Rp ",((u?0:s==null?void 0:s.total)||0).toLocaleString("id-ID")]}),e.jsxs("div",{className:"mt-2 text-xs text-white/80",children:["Metode: ",d(s==null?void 0:s.metode)]})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-white p-5 text-sm shadow-sm dark:border-white/10 dark:bg-white/5",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-100 pb-3 text-slate-600 dark:border-white/10 dark:text-white/70",children:[e.jsx("span",{children:"Subtotal"}),e.jsxs("span",{children:["Rp ",((u?0:s==null?void 0:s.subtotal)||0).toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-100 py-3 text-slate-600 dark:border-white/10 dark:text-white/70",children:[e.jsx("span",{children:"Diskon"}),e.jsxs("span",{children:["Rp ",((u?0:s==null?void 0:s.diskon)||0).toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-100 py-3 text-slate-600 dark:border-white/10 dark:text-white/70",children:[e.jsx("span",{children:"Pajak"}),e.jsxs("span",{children:["Rp ",((u?0:s==null?void 0:s.pajak)||0).toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 text-slate-900 dark:text-white",children:[e.jsx("span",{className:"font-semibold",children:"Bayar"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",((u?0:s==null?void 0:s.bayar)||0).toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-xl bg-emerald-500/10 px-3 py-3 text-emerald-700 dark:text-emerald-200",children:[e.jsx("span",{className:"font-semibold",children:"Kembalian"}),e.jsxs("span",{className:"font-semibold",children:["Rp ",((u?0:s==null?void 0:s.kembalian)||0).toLocaleString("id-ID")]})]})]}),e.jsx("div",{className:"rounded-2xl border border-slate-200 bg-white p-5 text-center text-sm text-slate-500 shadow-sm dark:border-white/10 dark:bg-white/5 dark:text-white/70",children:"Terima kasih telah berbelanja"})]})]})]})})]})}function hl(){const[t,a]=n.useState([]),[r,l]=n.useState([]),[s,i]=n.useState({nama:"Toko",alamat:"",telepon:"",logo:""}),[o,u]=n.useState(!0),[d,c]=n.useState(null),[m,g]=n.useState(null),[h,y]=n.useState(""),[_,R]=n.useState([]),[j,x]=n.useState(!1),[k,D]=n.useState(""),{isOpen:E,openModal:T,closeModal:M}=we(),[$,v]=n.useState(!1),[N,I]=n.useState({pegawaiId:"",kode:"",saldo:"",catatan:"",aktif:!0}),[V,f]=n.useState(!1),[O,C]=n.useState(!1),[A,W]=n.useState({id:0,kode:"",amount:""});le(d);const U=()=>{u(!0),c(null),Z("/admin-api/vouchers").then(w=>a(w.data)).catch(w=>c((w==null?void 0:w.message)||"Gagal memuat voucher")).finally(()=>u(!1))},S=w=>{x(!0);const H=w?`?limit=100&tipe=USE&q=${encodeURIComponent(w)}`:"?limit=100&tipe=USE";Z(`/admin-api/vouchers/history${H}`).then(Q=>R(Q.data)).catch(Q=>c((Q==null?void 0:Q.message)||"Gagal memuat riwayat")).finally(()=>x(!1))};n.useEffect(()=>{U(),S(),Z("/admin-api/pegawai").then(w=>l(w.data||[])).catch(()=>{}),Z("/admin-api/pengaturan").then(w=>{var Q;const H=((Q=w==null?void 0:w.data)==null?void 0:Q.toko)||{};i({nama:(H==null?void 0:H.nama)||"Toko",alamat:(H==null?void 0:H.alamat)||"",telepon:(H==null?void 0:H.telepon)||"",logo:(H==null?void 0:H.logo)||""})}).catch(()=>{})},[]);const z=n.useMemo(()=>{const w=h.trim().toLowerCase();return w?t.filter(H=>[H.kode,H.catatan||"",H.pegawai_nama||"",H.pegawai_nip||""].some(Q=>Q.toLowerCase().includes(w))):t},[t,h]),J=()=>{I({pegawaiId:"",kode:"",saldo:"",catatan:"",aktif:!0})},P=async()=>{var w;if(!N.pegawaiId){c("Pegawai wajib dipilih.");return}v(!0),c(null),g(null);try{const H=await ue("/admin-api/vouchers",{pegawai_id:Number(N.pegawaiId),kode:N.kode.trim()||null,saldo:N.saldo.trim()?Number(N.saldo):0,catatan:N.catatan.trim()||null,aktif:N.aktif}),Q=((w=H==null?void 0:H.data)==null?void 0:w.kode)||"";g(Q?`Voucher berhasil dibuat: ${Q}`:"Voucher berhasil dibuat."),H!=null&&H.data&&B(H.data,"Pembuatan Voucher"),J(),M(),U(),S(k)}catch(H){c((H==null?void 0:H.message)||"Gagal menyimpan voucher")}finally{v(!1)}},F=async w=>{c(null),g(null);try{await he(`/admin-api/vouchers/${w.id}`,{aktif:!w.aktif}),g("Status voucher diperbarui."),U()}catch(H){c((H==null?void 0:H.message)||"Gagal memperbarui status")}},Y=w=>{W({id:w.id,kode:w.kode,amount:""}),f(!0)},p=async()=>{if(!A.amount||Number(A.amount)<=0)return c("Nominal top up harus lebih dari 0.");C(!0),c(null),g(null);try{const w=await he(`/admin-api/vouchers/${A.id}`,{add_saldo:Number(A.amount)});g("Saldo voucher berhasil ditambahkan."),w!=null&&w.data&&B(w.data,"Top Up Voucher"),f(!1),W({id:0,kode:"",amount:""}),U(),S(k)}catch(w){c((w==null?void 0:w.message)||"Gagal top up saldo")}finally{C(!1)}},B=(w,H)=>{const Q=window.open("","_blank","width=520,height=640");if(!Q){c("Popup diblokir. Izinkan popup untuk mencetak.");return}const fe=`
|
||
<!doctype html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>${H}</title>
|
||
<style>
|
||
@page { margin: 6mm; }
|
||
body { font-family: "Courier New", monospace; padding: 0; color: #111; }
|
||
.receipt { width: 58mm; }
|
||
h1 { font-size: 13px; margin: 0 0 4px; text-align: center; }
|
||
.muted { color: #666; font-size: 10px; text-align: center; }
|
||
.logo { display: block; margin: 0 auto 6px; max-height: 48px; max-width: 90px; object-fit: contain; }
|
||
.divider { border-top: 1px dashed #666; margin: 6px 0; }
|
||
.row { display: flex; justify-content: space-between; font-size: 11px; }
|
||
.bold { font-weight: bold; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="receipt">
|
||
${s.logo?`<img src="${s.logo}" class="logo" alt="Logo">`:""}
|
||
<h1>${s.nama}</h1>
|
||
${s.alamat?`<div class="muted">${s.alamat}</div>`:""}
|
||
${s.telepon?`<div class="muted">Telp: ${s.telepon}</div>`:""}
|
||
<div class="divider"></div>
|
||
<div class="muted">${H}</div>
|
||
<div class="divider"></div>
|
||
<div class="row bold"><div>Kode</div><div>${w.kode}</div></div>
|
||
${w.pegawai_nama?`<div class="row"><div>Pegawai</div><div>${w.pegawai_nama}${w.pegawai_nip?` (${w.pegawai_nip})`:""}</div></div>`:""}
|
||
<div class="row"><div>Saldo</div><div>Rp ${Number(w.saldo||0).toLocaleString("id-ID")}</div></div>
|
||
<div class="row"><div>Status</div><div>${w.aktif?"Aktif":"Nonaktif"}</div></div>
|
||
${w.catatan?`<div class="row"><div>Catatan</div><div>${w.catatan}</div></div>`:""}
|
||
<div class="divider"></div>
|
||
<div class="muted">${new Date().toLocaleString("id-ID")}</div>
|
||
</div>
|
||
<script>window.print();<\/script>
|
||
</body>
|
||
</html>`;Q.document.open(),Q.document.write(fe),Q.document.close()};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Voucher",description:"Voucher deposit"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Voucher (Deposit)"}),e.jsx("button",{type:"button",onClick:()=>{J(),T()},className:"h-10 rounded-xl bg-blue-600 px-4 text-sm font-semibold text-white hover:bg-blue-700",children:"Tambah Voucher"})]}),m&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:m}),d&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:d}),e.jsx(pe,{isOpen:E,onClose:M,className:"max-w-[700px] p-6 lg:p-8",children:e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Tambah Voucher"}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[e.jsxs("select",{value:N.pegawaiId,onChange:w=>I(H=>({...H,pegawaiId:w.target.value})),className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"",children:"Pilih pegawai"}),r.map(w=>e.jsxs("option",{value:w.id,children:[w.nama," ",w.nip?`(${w.nip})`:""]},w.id))]}),e.jsx("input",{value:N.kode,onChange:w=>I(H=>({...H,kode:w.target.value})),placeholder:"Kode voucher (kosongkan untuk otomatis)",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:N.saldo,onChange:w=>I(H=>({...H,saldo:w.target.value})),placeholder:"Saldo awal",type:"number",min:0,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:N.catatan,onChange:w=>I(H=>({...H,catatan:w.target.value})),placeholder:"Catatan (opsional)",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx("input",{type:"checkbox",checked:!N.aktif,onChange:w=>I(H=>({...H,aktif:!w.target.checked}))}),"Nonaktif"]}),e.jsx("button",{type:"button",onClick:P,disabled:$,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:$?"Menyimpan...":"Simpan Voucher"})]})]})}),e.jsx(pe,{isOpen:V,onClose:()=>f(!1),className:"max-w-[520px] p-6 lg:p-8",children:e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Top Up Voucher"}),e.jsxs("div",{className:"mt-3 text-xs text-gray-500",children:["Kode: ",e.jsx("span",{className:"font-semibold",children:A.kode})]}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsx("input",{value:A.amount,onChange:w=>W(H=>({...H,amount:w.target.value})),placeholder:"Nominal top up",type:"number",min:1,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("button",{type:"button",onClick:p,disabled:O,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:O?"Menyimpan...":"Tambah Saldo"})]})]})}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Daftar Voucher"}),e.jsx("input",{value:h,onChange:w=>y(w.target.value),placeholder:"Cari kode / catatan...",className:"h-10 w-full sm:w-[320px] rounded-xl border border-gray-200 bg-white px-4 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-950"})]}),o?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Kode"}),e.jsx("th",{className:"py-2 pr-4",children:"Pegawai"}),e.jsx("th",{className:"py-2 pr-4",children:"Saldo"}),e.jsx("th",{className:"py-2 pr-4",children:"Status"}),e.jsx("th",{className:"py-2 pr-4",children:"Catatan"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[z.map(w=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 font-medium text-gray-800 dark:text-white/90",children:w.kode}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:w.pegawai_nama?`${w.pegawai_nama}${w.pegawai_nip?` (${w.pegawai_nip})`:""}`:"-"}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(w.saldo||0).toLocaleString("id-ID")]}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("span",{className:`inline-flex rounded-full px-3 py-1 text-xs font-semibold ${w.aktif?"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300":"bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300"}`,children:w.aktif?"Aktif":"Nonaktif"})}),e.jsx("td",{className:"py-3 pr-4 text-gray-600 dark:text-gray-400",children:w.catatan||"-"}),e.jsxs("td",{className:"py-3 pr-4",children:[e.jsx("button",{type:"button",onClick:()=>Y(w),className:"mr-2 h-8 rounded-lg border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Top Up"}),e.jsx("button",{type:"button",onClick:()=>B(w,"Cetak Voucher"),className:"mr-2 h-8 rounded-lg border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Print"}),e.jsx("button",{type:"button",onClick:()=>F(w),className:"h-8 rounded-lg border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:w.aktif?"Nonaktifkan":"Aktifkan"})]})]},w.id)),z.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada voucher."})})]})]})})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Riwayat Pemakaian Voucher"}),e.jsxs("div",{className:"flex w-full gap-2 sm:w-auto",children:[e.jsx("input",{value:k,onChange:w=>D(w.target.value),placeholder:"Cari kode voucher...",className:"h-10 w-full sm:w-[240px] rounded-xl border border-gray-200 bg-white px-4 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-950"}),e.jsx("button",{type:"button",onClick:()=>S(k),className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Cari"})]})]}),j?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):_.length===0?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Belum ada riwayat."}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Waktu"}),e.jsx("th",{className:"py-2 pr-4",children:"Kode"}),e.jsx("th",{className:"py-2 pr-4",children:"Tipe"}),e.jsx("th",{className:"py-2 pr-4",children:"Jumlah"}),e.jsx("th",{className:"py-2 pr-4",children:"Saldo Sebelum"}),e.jsx("th",{className:"py-2 pr-4",children:"Saldo Sesudah"}),e.jsx("th",{className:"py-2 pr-4",children:"No Transaksi"})]})}),e.jsx("tbody",{children:_.map(w=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:w.created_at?new Date(w.created_at).toLocaleString("id-ID"):"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:w.kode}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:w.tipe==="USE"?"Pemakaian":w.tipe==="TOPUP"?"Top Up":w.tipe}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(w.jumlah||0).toLocaleString("id-ID")]}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(w.saldo_before||0).toLocaleString("id-ID")]}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(w.saldo_after||0).toLocaleString("id-ID")]}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:w.nomor_penjualan||"-"})]},w.id))})]})})]})]})]})}function pl(){const[t,a]=n.useState([]),[r,l]=n.useState([]),[s,i]=n.useState(!0),[o,u]=n.useState(!1),[d,c]=n.useState(null),[m,g]=n.useState(null),[h,y]=n.useState(""),[_,R]=n.useState(""),[j,x]=n.useState(""),[k,D]=n.useState(""),[E,T]=n.useState(""),[M,$]=n.useState(""),[v,N]=n.useState({id:0,nomor:"",sisa:0,jumlah:"",metode:"CASH",catatan:""}),[I,V]=n.useState(!1),{isOpen:f,openModal:O,closeModal:C}=we();le(d);const A=p=>p?p==="CASH"?"TUNAI":p==="VOUCHER_CASH"?"VOUCHER + TUNAI":p:"-",W=()=>{i(!0),c(null);const p=new URLSearchParams;p.set("limit","200"),h.trim()&&p.set("q",h.trim()),_&&p.set("from",_),j&&p.set("to",j),Z(`/admin-api/piutang?${p.toString()}`).then(B=>a(B.data)).catch(B=>c((B==null?void 0:B.message)||"Gagal memuat piutang")).finally(()=>i(!1))},U=()=>{u(!0);const p=new URLSearchParams;p.set("limit","200"),k.trim()&&p.set("q",k.trim()),E&&p.set("from",E),M&&p.set("to",M),Z(`/admin-api/piutang/history?${p.toString()}`).then(B=>l(B.data)).catch(B=>c((B==null?void 0:B.message)||"Gagal memuat riwayat")).finally(()=>u(!1))};n.useEffect(()=>{W(),U()},[]);const S=n.useMemo(()=>{const p=h.trim().toLowerCase();return p?t.filter(B=>B.nomor_penjualan.toLowerCase().includes(p)):t},[t,h]),z=p=>{N({id:p.id,nomor:p.nomor_penjualan,sisa:p.sisa_piutang,jumlah:"",metode:"CASH",catatan:""}),O()},J=async()=>{var B;c(null),g(null);const p=Number(v.jumlah||0);if(!p||p<=0)return c("Jumlah bayar wajib diisi.");V(!0);try{const w=await ue(`/admin-api/piutang/${v.id}/pay`,{jumlah:p,metode:v.metode,catatan:v.catatan||null});g(`Pembayaran piutang berhasil untuk ${v.nomor}`),C(),W(),U();const H=(B=w==null?void 0:w.data)==null?void 0:B.payment;H&&Y({nomor:v.nomor,jumlah:p,metode:v.metode,sisa_after:H.sisa_after??Math.max(0,v.sisa-p),waktu:H.created_at})}catch(w){c((w==null?void 0:w.message)||"Gagal menyimpan pembayaran")}finally{V(!1)}},P=()=>{const p=new URLSearchParams;h.trim()&&p.set("q",h.trim()),_&&p.set("from",_),j&&p.set("to",j);const B=`/admin-api/piutang/export?${p.toString()}`;window.open(B,"_blank")},F=()=>{const p=new URLSearchParams;k.trim()&&p.set("q",k.trim()),E&&p.set("from",E),M&&p.set("to",M);const B=`/admin-api/piutang/history/export?${p.toString()}`;window.open(B,"_blank")},Y=p=>{const B=window.open("","_blank","width=520,height=640");if(!B){c("Popup diblokir. Izinkan popup untuk mencetak.");return}const w=p.waktu?new Date(p.waktu).toLocaleString("id-ID"):new Date().toLocaleString("id-ID"),H=`
|
||
<!doctype html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>Bukti Pelunasan</title>
|
||
<style>
|
||
@page { margin: 6mm; }
|
||
body { font-family: "Courier New", monospace; padding: 0; color: #111; }
|
||
.receipt { width: 58mm; }
|
||
h1 { font-size: 13px; margin: 0 0 4px; text-align: center; }
|
||
.muted { color: #666; font-size: 10px; text-align: center; }
|
||
.divider { border-top: 1px dashed #666; margin: 6px 0; }
|
||
.row { display: flex; justify-content: space-between; font-size: 11px; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="receipt">
|
||
<h1>Bukti Pelunasan Piutang</h1>
|
||
<div class="muted">No: ${p.nomor}</div>
|
||
<div class="muted">${w}</div>
|
||
<div class="divider"></div>
|
||
<div class="row"><div>Metode</div><div>${A(p.metode)}</div></div>
|
||
<div class="row"><div>Bayar</div><div>Rp ${p.jumlah.toLocaleString("id-ID")}</div></div>
|
||
<div class="row"><div>Sisa</div><div>Rp ${p.sisa_after.toLocaleString("id-ID")}</div></div>
|
||
<div class="divider"></div>
|
||
<div class="muted">Terima kasih</div>
|
||
</div>
|
||
<script>window.print();<\/script>
|
||
</body>
|
||
</html>`;B.document.open(),B.document.write(H),B.document.close()};return e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Piutang",description:"Daftar dan pembayaran piutang"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-white/90",children:"Piutang"}),e.jsx("button",{type:"button",onClick:P,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Export Excel"})]}),m&&e.jsx("div",{className:"rounded-xl bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:m}),d&&e.jsx("div",{className:"rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300",children:d}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Daftar Piutang"}),e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row",children:[e.jsx("input",{type:"date",value:_,onChange:p=>R(p.target.value),className:"h-10 w-full sm:w-[160px] rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{type:"date",value:j,onChange:p=>x(p.target.value),className:"h-10 w-full sm:w-[160px] rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:h,onChange:p=>y(p.target.value),placeholder:"Cari no transaksi...",className:"h-10 w-full sm:w-[240px] rounded-xl border border-gray-200 bg-white px-4 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-950"}),e.jsx("button",{type:"button",onClick:W,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Cari"})]})]}),s?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Waktu"}),e.jsx("th",{className:"py-2 pr-4",children:"No"}),e.jsx("th",{className:"py-2 pr-4",children:"Unit"}),e.jsx("th",{className:"py-2 pr-4",children:"Kasir"}),e.jsx("th",{className:"py-2 pr-4",children:"Total"}),e.jsx("th",{className:"py-2 pr-4",children:"Bayar"}),e.jsx("th",{className:"py-2 pr-4",children:"Sisa"}),e.jsx("th",{className:"py-2 pr-4",children:"Status"}),e.jsx("th",{className:"py-2 pr-4",children:"Aksi"})]})}),e.jsxs("tbody",{children:[S.map(p=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:new Date(p.waktu).toLocaleString("id-ID")}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:p.nomor_penjualan}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:p.unit_piutang||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:p.kasir||"-"}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(p.total||0).toLocaleString("id-ID")]}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(p.jumlah_bayar||0).toLocaleString("id-ID")]}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(p.sisa_piutang||0).toLocaleString("id-ID")]}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("span",{className:"inline-flex rounded-full bg-amber-50 px-3 py-1 text-xs font-semibold text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",children:p.status_pembayaran||"PIUTANG"})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx("button",{type:"button",onClick:()=>z(p),className:"h-8 rounded-lg border border-gray-200 bg-white px-3 text-xs font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Bayar"})})]},p.id)),S.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:9,className:"py-6 text-center text-gray-500 dark:text-gray-400",children:"Tidak ada piutang."})})]})]})})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Riwayat Pembayaran Piutang"}),e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row",children:[e.jsx("input",{type:"date",value:E,onChange:p=>T(p.target.value),className:"h-10 w-full sm:w-[160px] rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{type:"date",value:M,onChange:p=>$(p.target.value),className:"h-10 w-full sm:w-[160px] rounded-xl border border-gray-200 bg-white px-3 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("input",{value:k,onChange:p=>D(p.target.value),placeholder:"Cari no transaksi...",className:"h-10 w-full sm:w-[240px] rounded-xl border border-gray-200 bg-white px-4 text-sm outline-none focus:ring-2 focus:ring-blue-500/30 dark:border-gray-800 dark:bg-gray-950"}),e.jsx("button",{type:"button",onClick:U,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Cari"}),e.jsx("button",{type:"button",onClick:F,className:"h-10 rounded-xl border border-gray-200 bg-white px-4 text-sm font-semibold hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950",children:"Export Excel"})]})]}),o?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Memuat..."}):r.length===0?e.jsx("div",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"Belum ada riwayat pembayaran."}):e.jsx("div",{className:"mt-4 overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[e.jsx("th",{className:"py-2 pr-4",children:"Waktu"}),e.jsx("th",{className:"py-2 pr-4",children:"No"}),e.jsx("th",{className:"py-2 pr-4",children:"Unit"}),e.jsx("th",{className:"py-2 pr-4",children:"Kasir"}),e.jsx("th",{className:"py-2 pr-4",children:"Metode"}),e.jsx("th",{className:"py-2 pr-4",children:"Jumlah"}),e.jsx("th",{className:"py-2 pr-4",children:"Sisa Sebelum"}),e.jsx("th",{className:"py-2 pr-4",children:"Sisa Sesudah"}),e.jsx("th",{className:"py-2 pr-4",children:"Catatan"})]})}),e.jsx("tbody",{children:r.map(p=>e.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:new Date(p.created_at).toLocaleString("id-ID")}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:p.nomor_penjualan||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:p.unit_piutang||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:p.kasir||"-"}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:A(p.metode)}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(p.jumlah||0).toLocaleString("id-ID")]}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(p.sisa_before||0).toLocaleString("id-ID")]}),e.jsxs("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:["Rp ",Number(p.sisa_after||0).toLocaleString("id-ID")]}),e.jsx("td",{className:"py-3 pr-4 text-gray-700 dark:text-gray-200",children:p.catatan||"-"})]},p.id))})]})})]})]}),e.jsx(pe,{isOpen:f,onClose:C,className:"max-w-[520px] p-6 lg:p-8",children:e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Pembayaran Piutang"}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:["No: ",e.jsx("span",{className:"font-semibold",children:v.nomor})]}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:["Sisa: ",e.jsxs("span",{className:"font-semibold",children:["Rp ",v.sisa.toLocaleString("id-ID")]})]}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsx("input",{value:v.jumlah,onChange:p=>N(B=>({...B,jumlah:p.target.value})),placeholder:"Jumlah bayar",type:"number",min:1,className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsxs("select",{value:v.metode,onChange:p=>N(B=>({...B,metode:p.target.value})),className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950",children:[e.jsx("option",{value:"CASH",children:"TUNAI"}),e.jsx("option",{value:"TRANSFER",children:"TRANSFER"}),e.jsx("option",{value:"QRIS",children:"QRIS"}),e.jsx("option",{value:"KARTU",children:"KARTU"})]}),e.jsx("input",{value:v.catatan,onChange:p=>N(B=>({...B,catatan:p.target.value})),placeholder:"Catatan (opsional)",className:"h-11 rounded-xl border border-gray-200 bg-white px-4 text-sm dark:border-gray-800 dark:bg-gray-950"}),e.jsx("button",{type:"button",onClick:J,disabled:I,className:"h-11 rounded-xl bg-blue-600 px-5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-60",children:I?"Menyimpan...":"Simpan Pembayaran"})]})]})})]})}function bl(){return e.jsx(qa,{children:e.jsx(Qs,{children:e.jsx(Xn,{children:e.jsxs(Oa,{children:[e.jsx(Kn,{}),e.jsxs(ps,{children:[e.jsx(te,{path:"/customer-display",element:e.jsx(xl,{})}),e.jsxs(te,{element:e.jsx(Gn,{}),children:[e.jsx(te,{index:!0,path:"/",element:e.jsx(zn,{})}),e.jsx(te,{path:"/produk",element:e.jsx(el,{})}),e.jsx(te,{path:"/stok-gudang",element:e.jsx(tl,{})}),e.jsx(te,{path:"/stok-toko",element:e.jsx(al,{})}),e.jsx(te,{path:"/transfer-stok",element:e.jsx(rl,{})}),e.jsx(te,{path:"/transaksi",element:e.jsx(sl,{})}),e.jsx(te,{path:"/piutang",element:e.jsx(pl,{})}),e.jsx(te,{path:"/laporan-harian",element:e.jsx(nl,{})}),e.jsx(te,{path:"/laporan-bulanan",element:e.jsx(ll,{})}),e.jsx(te,{path:"/pegawai",element:e.jsx(cl,{})}),e.jsx(te,{path:"/distributor",element:e.jsx(ul,{})}),e.jsx(te,{path:"/penerimaan-barang",element:e.jsx(gl,{})}),e.jsx(te,{path:"/users",element:e.jsx(ol,{})}),e.jsx(te,{path:"/profile",element:e.jsx(dl,{})}),e.jsx(te,{path:"/voucher",element:e.jsx(hl,{})}),e.jsx(te,{path:"/pengaturan",element:e.jsx(il,{})})]}),e.jsx(te,{path:"*",element:e.jsx(Rn,{})})]})]})})})})}var ya;const yl=((ya=document.querySelector('meta[name="app-base"]'))==null?void 0:ya.getAttribute("content"))||"",fl=`${yl}/admin`;hr.createRoot(document.getElementById("app")).render(e.jsx(je.StrictMode,{children:e.jsx(Us,{basename:fl,children:e.jsx(bl,{})})}));
|