(()=>{var a={};a.id=50,a.ids=[50],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8681:(a,b,c)=>{Promise.resolve().then(c.bind(c,28061)),Promise.resolve().then(c.bind(c,16279)),Promise.resolve().then(c.t.bind(c,3991,23)),Promise.resolve().then(c.bind(c,11948)),Promise.resolve().then(c.bind(c,46038)),Promise.resolve().then(c.bind(c,65809)),Promise.resolve().then(c.bind(c,44928))},10512:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(75338);function e(){return(0,d.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,d.jsx)("div",{className:"size-8 border-4 border-muted border-t-primary rounded-full animate-spin"})})}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},11948:(a,b,c)=>{"use strict";c.d(b,{PatientAppointmentsList:()=>o});var d=c(21124),e=c(38301),f=c(84464),g=c(62186),h=c(31115),i=c(35326),j=c(99187),k=c(16816);let l={confirmed:"bg-emerald-50 text-emerald-700 border-emerald-200 cursor-pointer hover:bg-emerald-100",completed:"bg-gray-50 text-gray-600 border-gray-200 cursor-pointer hover:bg-gray-100",cancelled:"bg-red-50 text-red-700 border-red-200",reschedule:"bg-yellow-50 text-yellow-700 border-yellow-200"},m={confirmed:"Confirmada",cancelled:"Cancelada",completed:"Completada",reschedule:"Reprogramar"},n=(0,e.memo)(function({slotId:a,status:b,onUpdated:c}){let[g,h]=(0,e.useState)(!1),i=(0,e.useMemo)(()=>(0,f.U)(),[]),n="confirmed"===b||"completed"===b,o=async()=>{if(!n||g)return;h(!0);let{error:d}=await i.from("slots").update({status:"confirmed"===b?"completed":"confirmed"}).eq("id",a);d?console.error("Status update error:",d.message):c(),h(!1)};return(0,d.jsx)("button",{type:"button",onClick:o,disabled:!n||g,className:"border-0 bg-transparent p-0",children:(0,d.jsx)(j.E,{variant:"outline",className:`text-[10px] ${l[b]??""}`,children:g?(0,d.jsx)(k.A,{className:"size-3 animate-spin"}):m[b]??b})})});function o({patientId:a}){let b=(0,e.useMemo)(()=>(0,f.U)(),[]),[c,j]=(0,e.useState)([]),[k,l]=(0,e.useState)(!0),m=(0,e.useCallback)(async()=>{let{data:c}=await b.from("slots").select("*, procedure:procedures(name)").eq("block_type","appointment").eq("patient_id",a).order("start_at",{ascending:!1}).limit(50);c&&j(c),l(!1)},[a,b]);return k?(0,d.jsx)(g.Zp,{className:"border-border",children:(0,d.jsx)(g.Wu,{className:"pt-6",children:(0,d.jsx)("p",{className:"text-muted-foreground text-sm text-center py-8",children:"Cargando citas…"})})}):(0,d.jsx)(g.Zp,{className:"border-border",children:(0,d.jsx)(g.Wu,{className:"pt-6",children:0===c.length?(0,d.jsx)("p",{className:"text-muted-foreground text-sm text-center py-8",children:"No hay citas registradas."}):(0,d.jsx)("div",{className:"space-y-3",children:c.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-[12px] bg-muted/30 border border-border/50",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:a.procedure?.name??"Consulta general"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:a.start_at?(0,h.GP)(new Date(a.start_at),"EEEE dd MMM yyyy \xb7 HH:mm",{locale:i.es}):"—"})]}),(0,d.jsx)(n,{slotId:a.id,status:a.status,onUpdated:m})]},a.id))})})})}},18409:(a,b,c)=>{Promise.resolve().then(c.bind(c,95587)),Promise.resolve().then(c.bind(c,57870)),Promise.resolve().then(c.t.bind(c,65169,23)),Promise.resolve().then(c.bind(c,77337)),Promise.resolve().then(c.bind(c,55732)),Promise.resolve().then(c.bind(c,43248)),Promise.resolve().then(c.bind(c,35822))},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19149:(a,b,c)=>{"use strict";c.d(b,{E:()=>i});var d=c(42005),e=c(61241),f=c(86281),g=c(70673);let h=(0,f.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function i({className:a,variant:b="default",render:c,...f}){return(0,e.C)({defaultTagName:"span",props:(0,d.v6)({className:(0,g.cn)(h({variant:b}),a)},f),render:c,state:{slot:"badge",variant:b}})}},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},35822:(a,b,c)=>{"use strict";c.d(b,{Tabs:()=>e,TabsContent:()=>h,TabsList:()=>f,TabsTrigger:()=>g});var d=c(97954);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call Tabs() from the server but Tabs is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/silvio/Develop/APP-ESTETICA/cirux/src/components/ui/tabs.tsx","Tabs"),f=(0,d.registerClientReference)(function(){throw Error("Attempted to call TabsList() from the server but TabsList is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/silvio/Develop/APP-ESTETICA/cirux/src/components/ui/tabs.tsx","TabsList"),g=(0,d.registerClientReference)(function(){throw Error("Attempted to call TabsTrigger() from the server but TabsTrigger is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/silvio/Develop/APP-ESTETICA/cirux/src/components/ui/tabs.tsx","TabsTrigger"),h=(0,d.registerClientReference)(function(){throw Error("Attempted to call TabsContent() from the server but TabsContent is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/silvio/Develop/APP-ESTETICA/cirux/src/components/ui/tabs.tsx","TabsContent");(0,d.registerClientReference)(function(){throw Error("Attempted to call tabsListVariants() from the server but tabsListVariants is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/silvio/Develop/APP-ESTETICA/cirux/src/components/ui/tabs.tsx","tabsListVariants")},40195:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>D.a,__next_app__:()=>J,handler:()=>L,pages:()=>I,routeModule:()=>K,tree:()=>H});var d=c(49754),e=c(9117),f=c(46595),g=c(32324),h=c(39326),i=c(38928),j=c(20175),k=c(12),l=c(54290),m=c(12696),n=c(82802),o=c(77533),p=c(45229),q=c(32822),r=c(261),s=c(26453),t=c(52474),u=c(26713),v=c(51356),w=c(62685),x=c(36225),y=c(63446),z=c(2762),A=c(45742),B=c(86439),C=c(81170),D=c.n(C),E=c(62506),F=c(91203),G={};for(let a in E)0>["default","tree","pages","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(G[a]=()=>E[a]);c.d(b,G);let H={children:["",{children:["dashboard",{children:["patients",{children:["[id]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,53747)),"/home/silvio/Develop/APP-ESTETICA/cirux/src/app/dashboard/patients/[id]/page.tsx"]}]},{loading:[()=>Promise.resolve().then(c.bind(c,10512)),"/home/silvio/Develop/APP-ESTETICA/cirux/src/app/dashboard/patients/[id]/loading.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(c.bind(c,68895)),"/home/silvio/Develop/APP-ESTETICA/cirux/src/app/dashboard/layout.tsx"],error:[()=>Promise.resolve().then(c.bind(c,56511)),"/home/silvio/Develop/APP-ESTETICA/cirux/src/app/dashboard/error.tsx"],loading:[()=>Promise.resolve().then(c.bind(c,9217)),"/home/silvio/Develop/APP-ESTETICA/cirux/src/app/dashboard/loading.tsx"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,78162))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(c.bind(c,51472)),"/home/silvio/Develop/APP-ESTETICA/cirux/src/app/layout.tsx"],error:[()=>Promise.resolve().then(c.bind(c,5682)),"/home/silvio/Develop/APP-ESTETICA/cirux/src/app/error.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,81170,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,87028,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,90461,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,32768,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,78162))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]}.children,I=["/home/silvio/Develop/APP-ESTETICA/cirux/src/app/dashboard/patients/[id]/page.tsx"],J={require:c,loadChunk:()=>Promise.resolve()},K=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/dashboard/patients/[id]/page",pathname:"/dashboard/patients/[id]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:H},distDir:".next",relativeProjectDir:""});async function L(a,b,d){var C;let G="/dashboard/patients/[id]/page";"/index"===G&&(G="/");let M=(0,h.getRequestMeta)(a,"postponed"),N=(0,h.getRequestMeta)(a,"minimalMode"),O=await K.prepare(a,b,{srcPage:G,multiZoneDraftMode:!1});if(!O)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:P,query:Q,params:R,parsedUrl:S,pageIsDynamic:T,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,serverActionsManifest:X,clientReferenceManifest:Y,subresourceIntegrityManifest:Z,prerenderManifest:$,isDraftMode:_,resolvedPathname:aa,revalidateOnlyGenerated:ab,routerServerContext:ac,nextConfig:ad,interceptionRoutePatterns:ae}=O,af=S.pathname||"/",ag=(0,r.normalizeAppPath)(G),{isOnDemandRevalidate:ah}=O,ai=K.match(af,$),aj=!!$.routes[aa],ak=!!(ai||aj||$.routes[ag]),al=a.headers["user-agent"]||"",am=(0,u.getBotType)(al),an=(0,p.isHtmlBotRequest)(a),ao=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[t.NEXT_ROUTER_PREFETCH_HEADER],ap=(0,h.getRequestMeta)(a,"isRSCRequest")??!!a.headers[t.RSC_HEADER],aq=(0,s.getIsPossibleServerAction)(a),ar=(0,m.checkIsAppPPREnabled)(ad.experimental.ppr)&&(null==(C=$.routes[ag]??$.dynamicRoutes[ag])?void 0:C.renderingMode)==="PARTIALLY_STATIC",as=!1,at=!1,au=ar?M:void 0,av=ar&&ap&&!ao,aw=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),ax=!al||(0,p.shouldServeStreamingMetadata)(al,ad.htmlLimitedBots);an&&ar&&(ak=!1,ax=!1);let ay=!0===K.isDev||!ak||"string"==typeof M||av,az=an&&ar,aA=null;_||!ak||ay||aq||au||av||(aA=aa);let aB=aA;!aB&&K.isDev&&(aB=aa),K.isDev||_||!ak||!ap||av||(0,k.d)(a.headers);let aC={...E,tree:H,pages:I,GlobalError:D(),handler:L,routeModule:K,__next_app__:J};X&&Y&&(0,o.setReferenceManifestsSingleton)({page:G,clientReferenceManifest:Y,serverActionsManifest:X,serverModuleMap:(0,q.createServerModuleMap)({serverActionsManifest:X})});let aD=a.method||"GET",aE=(0,g.getTracer)(),aF=aE.getActiveScopeSpan();try{let f=K.getVaryHeader(aa,ae);b.setHeader("Vary",f);let k=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return K.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=aE.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${aD} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aD} ${a.url}`)})},m=async({span:e,postponed:f,fallbackRouteParams:g})=>{let i={query:Q,params:R,page:ag,sharedContext:{buildId:P},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aC,Component:(0,j.T)(aC),params:R,routeModule:K,page:G,postponed:f,shouldWaitOnAllReady:az,serveStreamingMetadata:ax,supportsDynamicResponse:"string"==typeof f||ay,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,subresourceIntegrityManifest:Z,serverActionsManifest:X,clientReferenceManifest:Y,setIsrStatus:null==ac?void 0:ac.setIsrStatus,dir:c(33873).join(process.cwd(),K.relativeProjectDir),isDraftMode:_,isRevalidate:ak&&!f&&!av,botType:am,isOnDemandRevalidate:ah,isPossibleServerAction:aq,assetPrefix:ad.assetPrefix,nextConfigOutput:ad.output,crossOrigin:ad.crossOrigin,trailingSlash:ad.trailingSlash,previewProps:$.preview,deploymentId:ad.deploymentId,enableTainting:ad.experimental.taint,htmlLimitedBots:ad.htmlLimitedBots,devtoolSegmentExplorer:ad.experimental.devtoolSegmentExplorer,reactMaxHeadersLength:ad.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:ad.experimental.cacheLife,basePath:ad.basePath,serverActions:ad.experimental.serverActions,...as?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isRevalidate:!0,isDebugDynamicAccesses:as}:{},experimental:{isRoutePPREnabled:ar,expireTime:ad.expireTime,staleTimes:ad.experimental.staleTimes,cacheComponents:!!ad.experimental.cacheComponents,clientSegmentCache:!!ad.experimental.clientSegmentCache,clientParamParsing:!!ad.experimental.clientParamParsing,dynamicOnHover:!!ad.experimental.dynamicOnHover,inlineCss:!!ad.experimental.inlineCss,authInterrupts:!!ad.experimental.authInterrupts,clientTraceMetadata:ad.experimental.clientTraceMetadata||[]},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d)=>K.onRequestError(a,b,d,ac),err:(0,h.getRequestMeta)(a,"invokeError"),dev:K.isDev}},l=await k(e,i),{metadata:m}=l,{cacheControl:n,headers:o={},fetchTags:p}=m;if(p&&(o[y.NEXT_CACHE_TAGS_HEADER]=p),a.fetchMetrics=m.fetchMetrics,ak&&(null==n?void 0:n.revalidate)===0&&!K.isDev&&!ar){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${aa}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""} see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:v.CachedRouteKind.APP_PAGE,html:l,headers:o,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:n}},o=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i})=>{let j,k=!1===K.isDev,l=c||b.writableEnded;if(ah&&ab&&!f&&!N)return(null==ac?void 0:ac.render404)?await ac.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(ai&&(j=(0,w.parseFallbackField)(ai.fallback)),j===w.FallbackMode.PRERENDER&&(0,u.isBot)(al)&&(!ar||an)&&(j=w.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ah=!0),ah&&(j!==w.FallbackMode.NOT_FOUND||f)&&(j=w.FallbackMode.BLOCKING_STATIC_RENDER),!N&&j!==w.FallbackMode.BLOCKING_STATIC_RENDER&&aB&&!l&&!_&&T&&(k||!aj)){let b;if((k||ai)&&j===w.FallbackMode.NOT_FOUND)throw new B.NoFallbackError;if(ar&&!ap){let c="string"==typeof(null==ai?void 0:ai.fallback)?ai.fallback:k?ag:null;if(b=await K.handleResponse({cacheKey:c,req:a,nextConfig:ad,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:$,isRoutePPREnabled:ar,responseGenerator:async()=>m({span:i,postponed:void 0,fallbackRouteParams:k||at?(0,n.u)(ag):null}),waitUntil:d.waitUntil}),null===b)return null;if(b)return delete b.cacheControl,b}}let o=ah||g||!au?void 0:au;if(as&&void 0!==o)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:v.CachedRouteKind.PAGES,html:x.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let p=T&&ar&&((0,h.getRequestMeta)(a,"renderFallbackShell")||at)?(0,n.u)(af):null;return m({span:i,postponed:o,fallbackRouteParams:p})},p=async c=>{var f,g,i,j,k;let l,n=await K.handleResponse({cacheKey:aA,responseGenerator:a=>o({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ah,isRoutePPREnabled:ar,req:a,nextConfig:ad,prerenderManifest:$,waitUntil:d.waitUntil});if(_&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),K.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!n){if(aA)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=n.value)?void 0:f.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=n.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let p="string"==typeof n.value.postponed;ak&&!av&&(!p||ao)&&(N||b.setHeader("x-nextjs-cache",ah?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b.setHeader(t.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=n;if(au)l={revalidate:0,expire:void 0};else if(N&&ap&&!ao&&ar)l={revalidate:0,expire:void 0};else if(!K.isDev)if(_)l={revalidate:0,expire:void 0};else if(ak){if(n.cacheControl)if("number"==typeof n.cacheControl.revalidate){if(n.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${n.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:n.cacheControl.revalidate,expire:(null==(j=n.cacheControl)?void 0:j.expire)??ad.expireTime}}else l={revalidate:y.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(n.cacheControl=l,"string"==typeof aw&&(null==q?void 0:q.kind)===v.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[y.NEXT_CACHE_TAGS_HEADER];N&&ak&&c&&"string"==typeof c&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(aw);return void 0!==d?(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:x.default.fromStatic(d,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl}):(b.statusCode=204,(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl}))}let r=(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r({...n,value:{...n.value,kind:"PAGE"}},{url:(0,h.getRequestMeta)(a,"initURL")}))return null;if(p&&au)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(q.headers){let a={...q.headers};for(let[c,d]of(N&&ak||delete a[y.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let s=null==(g=q.headers)?void 0:g[y.NEXT_CACHE_TAGS_HEADER];if(N&&ak&&s&&"string"==typeof s&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,s),!q.status||ap&&ar||(b.statusCode=q.status),!N&&q.status&&F.RedirectStatusCode[q.status]&&ap&&(b.statusCode=200),p&&b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"1"),ap&&!_){if(void 0===q.rscData){if(q.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:q.html,cacheControl:av?{revalidate:0,expire:void 0}:n.cacheControl})}return(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:x.default.fromStatic(q.rscData,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl})}let u=q.html;if(!p||N||ap)return(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:u,cacheControl:n.cacheControl});if(as)return u.push(new ReadableStream({start(a){a.enqueue(z.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:u,cacheControl:{revalidate:0,expire:void 0}});let w=new TransformStream;return u.push(w.readable),m({span:c,postponed:q.postponed,fallbackRouteParams:null}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(w.writable)}).catch(a=>{w.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:u,cacheControl:{revalidate:0,expire:void 0}})};if(!aF)return await aE.withPropagatedContext(a.headers,()=>aE.trace(i.BaseServerSpan.handleRequest,{spanName:`${aD} ${a.url}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aD,"http.target":a.url}},p));await p(aF)}catch(b){throw b instanceof B.NoFallbackError||await K.onRequestError(a,b,{routerKind:"App Router",routePath:G,routeType:"render",revalidateReason:(0,f.c)({isRevalidate:ak,isOnDemandRevalidate:ah})},ac),b}}},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},43248:(a,b,c)=>{"use strict";c.d(b,{PatientNotes:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call PatientNotes() from the server but PatientNotes is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/silvio/Develop/APP-ESTETICA/cirux/src/components/patients/PatientNotes.tsx","PatientNotes")},44928:(a,b,c)=>{"use strict";c.d(b,{Tabs:()=>k,TabsContent:()=>o,TabsList:()=>m,TabsTrigger:()=>n});var d=c(21124),e=c(33495),f=c(70660),g=c(62313),h=c(54505),i=c(26691),j=c(44943);function k({className:a,orientation:b="horizontal",...c}){return(0,d.jsx)(e.p,{"data-slot":"tabs","data-orientation":b,className:(0,j.cn)("group/tabs flex gap-2 data-horizontal:flex-col",a),...c})}let l=(0,i.F)("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function m({className:a,variant:b="default",...c}){return(0,d.jsx)(f.j,{"data-slot":"tabs-list","data-variant":b,className:(0,j.cn)(l({variant:b}),a),...c})}function n({className:a,...b}){return(0,d.jsx)(g.M,{"data-slot":"tabs-trigger",className:(0,j.cn)("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",a),...b})}function o({className:a,...b}){return(0,d.jsx)(h.R,{"data-slot":"tabs-content",className:(0,j.cn)("flex-1 text-sm outline-none",a),...b})}},45608:(a,b,c)=>{"use strict";c.d(b,{bq:()=>x,eb:()=>z,gC:()=>y,l6:()=>v,yv:()=>w});var d=c(21124);c(38301);var e=c(10320),f=c(47657),g=c(46988),h=c(54405),i=c(27698),j=c(8678),k=c(27954),l=c(15299),m=c(15617),n=c(17570),o=c(83444),p=c(69221),q=c(69131),r=c(44943),s=c(7144),t=c(13330),u=c(87423);function v({value:a,onValueChange:b,defaultValue:c,children:f,...g}){return(0,d.jsx)(e.H,{value:a,defaultValue:c,onValueChange:a=>{b&&b(Array.isArray(a)?a[0]??null:a)},...g,children:f})}function w({className:a,...b}){return(0,d.jsx)(f.y,{"data-slot":"select-value",className:(0,r.cn)("flex flex-1 text-left",a),...b})}function x({className:a,size:b="default",children:c,...e}){return(0,d.jsxs)(g.b,{"data-slot":"select-trigger","data-size":b,className:(0,r.cn)("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...e,children:[c,(0,d.jsx)(h.w,{render:(0,d.jsx)(s.A,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function y({className:a,children:b,side:c="bottom",sideOffset:e=4,align:f="center",alignOffset:g=0,alignItemWithTrigger:h=!0,...m}){return(0,d.jsx)(i.V,{children:(0,d.jsx)(j.l,{side:c,sideOffset:e,align:f,alignOffset:g,alignItemWithTrigger:h,className:"isolate z-50",children:(0,d.jsxs)(k.t,{"data-slot":"select-content","data-align-trigger":h,className:(0,r.cn)("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...m,children:[(0,d.jsx)(A,{}),(0,d.jsx)(l.B,{children:b}),(0,d.jsx)(B,{})]})})})}function z({className:a,children:b,...c}){return(0,d.jsxs)(m.e,{"data-slot":"select-item",className:(0,r.cn)("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",a),...c,children:[(0,d.jsx)(n.h,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:b}),(0,d.jsx)(o.h,{render:(0,d.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,d.jsx)(t.A,{className:"pointer-events-none"})})]})}function A({className:a,...b}){return(0,d.jsx)(p.w,{"data-slot":"select-scroll-up-button",className:(0,r.cn)("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",a),...b,children:(0,d.jsx)(u.A,{})})}function B({className:a,...b}){return(0,d.jsx)(q.d,{"data-slot":"select-scroll-down-button",className:(0,r.cn)("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",a),...b,children:(0,d.jsx)(s.A,{})})}},46038:(a,b,c)=>{"use strict";c.d(b,{PatientEditor:()=>w});var d=c(21124),e=c(38301),f=c(42378),g=c(31980),h=c(50937),i=c(17492),j=c(42830),k=c(16816),l=c(97657),m=c(84464),n=c(93758),o=c(68120),p=c(35284),q=c(99187),r=c(62186),s=c(45608);let t=i.Ik({name:i.Yj().min(2,"El nombre debe tener al menos 2 caracteres"),phone:i.Yj().min(1,"El tel\xe9fono es obligatorio"),email:i.Yj().email("Email inv\xe1lido").optional().nullable(),status:i.k5(["prospecto","activo","inactivo"])}),u={activo:"text-emerald-700 bg-emerald-50 border-emerald-200",prospecto:"text-yellow-700 bg-yellow-50 border-yellow-200",inactivo:"text-gray-600 bg-gray-50 border-gray-200"},v={activo:"Activo",prospecto:"Prospecto",inactivo:"Inactivo"};function w({patient:a}){let b=(0,f.useRouter)(),c=(0,e.useMemo)(()=>(0,m.U)(),[]),[i,w]=(0,e.useState)(!1),x=(0,g.mN)({resolver:(0,h.u)(t),defaultValues:{name:a.name,phone:a.phone,email:a.email,status:a.status},mode:"onChange"}),{errors:y,isDirty:z}=x.formState,A=(0,g.FH)({control:x.control,name:"status"}),B=(0,e.useCallback)(async d=>{w(!0);let{error:e}=await c.from("patients").update({name:d.name.trim(),phone:d.phone.trim(),email:d.email?.trim().toLowerCase()??null,status:d.status}).eq("id",a.id);e?(j.o.error("Error al guardar los cambios."),console.error("Patient update error:",e?.message??"unknown")):(j.o.success("Datos del paciente actualizados."),b.refresh()),w(!1)},[a.id,b,c]);return(0,d.jsx)(r.Zp,{className:"border-border",children:(0,d.jsx)(r.Wu,{className:"pt-6",children:(0,d.jsxs)("form",{onSubmit:x.handleSubmit(B),className:"space-y-5",children:[(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(o.J,{htmlFor:"patient-name",className:"text-sm font-medium",children:"Nombre completo"}),(0,d.jsx)(n.p,{id:"patient-name",...x.register("name"),placeholder:"Nombre del paciente",className:"rounded-[12px]"}),y.name&&(0,d.jsx)("p",{className:"text-xs text-destructive",children:y.name.message})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(o.J,{htmlFor:"patient-phone",className:"text-sm font-medium",children:"Tel\xe9fono"}),(0,d.jsx)(n.p,{id:"patient-phone",...x.register("phone"),placeholder:"+57 300 000 0000",className:"rounded-[12px]"}),y.phone&&(0,d.jsx)("p",{className:"text-xs text-destructive",children:y.phone.message})]}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(o.J,{htmlFor:"patient-email",className:"text-sm font-medium",children:"Email"}),(0,d.jsx)(n.p,{id:"patient-email",type:"email",...x.register("email"),placeholder:"paciente@email.com",className:"rounded-[12px]"}),y.email&&(0,d.jsx)("p",{className:"text-xs text-destructive",children:y.email.message})]})]}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(o.J,{className:"text-sm font-medium",children:"Estado del paciente"}),(0,d.jsxs)("div",{className:"flex items-center gap-4",children:[(0,d.jsx)(g.xI,{control:x.control,name:"status",render:({field:a})=>(0,d.jsxs)(s.l6,{value:a.value,onValueChange:b=>{b&&a.onChange(b)},children:[(0,d.jsx)(s.bq,{className:"rounded-[12px] w-48",children:(0,d.jsx)(s.yv,{})}),(0,d.jsxs)(s.gC,{children:[(0,d.jsx)(s.eb,{value:"activo",children:"Activo"}),(0,d.jsx)(s.eb,{value:"prospecto",children:"Prospecto"}),(0,d.jsx)(s.eb,{value:"inactivo",children:"Inactivo"})]})]})}),(0,d.jsx)(q.E,{variant:"outline",className:`capitalize text-xs ${u[A]??""}`,children:v[A]??a.status})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Creado"}),(0,d.jsx)("p",{className:"text-sm font-medium text-foreground",children:new Date(a.created_at).toLocaleDateString("es-CO",{day:"numeric",month:"short",year:"numeric"})})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Actualizado"}),(0,d.jsx)("p",{className:"text-sm font-medium text-foreground",children:new Date(a.updated_at??a.created_at).toLocaleDateString("es-CO",{day:"numeric",month:"short",year:"numeric"})})]})]}),(0,d.jsx)("div",{className:"flex gap-2 pt-2",children:(0,d.jsxs)(p.$,{type:"submit",className:"bg-primary text-[#0D141D] font-semibold rounded-[12px] hover:bg-primary/90",disabled:i||!z,children:[i?(0,d.jsx)(k.A,{className:"size-4 animate-spin mr-2"}):(0,d.jsx)(l.A,{className:"size-4 mr-2"}),"Guardar cambios"]})})]})})})}},53747:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>u,dynamic:()=>r});var d=c(75338),e=c(91010),f=c(82161),g=c(65169),h=c.n(g),i=c(35822),j=c(67480),k=c(19149);let l=(0,c(59740).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var m=c(42103),n=c(12239),o=c(43248),p=c(55732),q=c(77337);let r="force-dynamic";async function s(a){let b=await (0,e.U)(),[{data:c,error:d},{data:f,error:g}]=await Promise.all([b.from("patients").select("*, patient_profile:patient_profiles(*)").eq("id",a).single(),b.from("messages").select("id, patient_id, conversation_id, channel, direction, type, content, transcript, created_at").eq("patient_id",a).order("created_at",{ascending:!1}).limit(50)]);d&&console.error("getPatient: patient error:",d.message),g&&console.error("getPatient: messages error:",g.message);let h=Array.isArray(c?.patient_profile)?c.patient_profile[0]:c?.patient_profile??null;return{patient:c?{...c,patient_profile:h}:null,messages:f??[]}}let t={whatsapp:"\uD83D\uDCAC",messenger:"\uD83D\uDC99",instagram:"\uD83D\uDCF8",tiktok:"\uD83C\uDFB5",web:"\uD83C\uDF10",manual:"✍️"};async function u({params:a}){let{id:b}=await a;/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(b)||(0,f.notFound)();let{patient:c,messages:e}=await s(b);return c||(0,f.notFound)(),(0,d.jsxs)("div",{className:"space-y-6 max-w-4xl",children:[(0,d.jsxs)(h(),{href:"/dashboard/patients",className:"inline-flex items-center gap-1.5 rounded-[12px] text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-muted/50 px-3 py-2 -ml-3 transition-colors",children:[(0,d.jsx)(l,{className:"size-4"}),"Volver a pacientes"]}),(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"font-heading font-bold text-2xl text-foreground",children:c.name}),(0,d.jsxs)("p",{className:"text-muted-foreground text-sm mt-1",children:[c.phone,c.email?` \xb7 ${c.email}`:""]})]}),(0,d.jsx)(k.E,{variant:"outline",className:`capitalize ${"activo"===c.status?"text-emerald-700 bg-emerald-50 border-emerald-200":"prospecto"===c.status?"text-yellow-700 bg-yellow-50 border-yellow-200":"text-gray-600 bg-gray-50 border-gray-200"}`,children:c.status})]}),(0,d.jsxs)(i.Tabs,{defaultValue:"datos",children:[(0,d.jsxs)(i.TabsList,{className:"bg-muted/50 rounded-[12px]",children:[(0,d.jsx)(i.TabsTrigger,{value:"datos",children:"Datos Personales"}),(0,d.jsx)(i.TabsTrigger,{value:"citas",children:"Historial de Citas"}),(0,d.jsxs)(i.TabsTrigger,{value:"conversaciones",children:["Conversaciones (",e.length,")"]}),(0,d.jsx)(i.TabsTrigger,{value:"notas",children:"Notas Cl\xednicas"})]}),(0,d.jsx)(i.TabsContent,{value:"datos",className:"mt-4",children:(0,d.jsx)(p.PatientEditor,{patient:c})}),(0,d.jsx)(i.TabsContent,{value:"citas",className:"mt-4",children:(0,d.jsx)(q.PatientAppointmentsList,{patientId:c.id})}),(0,d.jsx)(i.TabsContent,{value:"conversaciones",className:"mt-4",children:(0,d.jsx)(j.Zp,{className:"border-border",children:(0,d.jsx)(j.Wu,{className:"pt-6",children:0===e.length?(0,d.jsx)("p",{className:"text-muted-foreground text-sm text-center py-8",children:"No hay mensajes registrados."}):(0,d.jsx)("div",{className:"space-y-2 max-h-[400px] overflow-y-auto pr-2",children:e.map(a=>(0,d.jsx)("div",{className:`flex gap-2 ${"out"===a.direction?"justify-end":"justify-start"}`,children:(0,d.jsxs)("div",{className:`max-w-[75%] rounded-[12px] px-3 py-2 text-sm ${"out"===a.direction?"bg-primary/10 text-foreground":"bg-muted text-foreground"}`,children:[(0,d.jsx)("p",{className:"leading-relaxed",children:a.transcript??a.content}),(0,d.jsxs)("p",{className:"text-[10px] text-muted-foreground mt-1",children:[t[a.channel]??"\uD83D\uDCAC"," ",(0,m.GP)(new Date(a.created_at),"HH:mm",{locale:n.es})]})]})},a.id))})})})}),(0,d.jsx)(i.TabsContent,{value:"notas",className:"mt-4",children:(0,d.jsx)(j.Zp,{className:"border-border",children:(0,d.jsx)(j.Wu,{className:"pt-6",children:c.patient_profile?.id?(0,d.jsx)(o.PatientNotes,{profileId:c.patient_profile.id,initialNotes:c.patient_profile.notes??null}):(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"No hay perfil cl\xednico registrado para este paciente."})})})})]})]})}},55732:(a,b,c)=>{"use strict";c.d(b,{PatientEditor:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call PatientEditor() from the server but PatientEditor is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/silvio/Develop/APP-ESTETICA/cirux/src/components/patients/PatientEditor.tsx","PatientEditor")},62186:(a,b,c)=>{"use strict";c.d(b,{BT:()=>i,Wu:()=>j,ZB:()=>h,Zp:()=>f,aR:()=>g});var d=c(21124);c(38301);var e=c(44943);function f({className:a,size:b="default",...c}){return(0,d.jsx)("div",{"data-slot":"card","data-size":b,className:(0,e.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...c})}function g({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-header",className:(0,e.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",a),...b})}function h({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-title",className:(0,e.cn)("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",a),...b})}function i({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-description",className:(0,e.cn)("text-sm text-muted-foreground",a),...b})}function j({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-content",className:(0,e.cn)("px-4 group-data-[size=sm]/card:px-3",a),...b})}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},65809:(a,b,c)=>{"use strict";c.d(b,{PatientNotes:()=>o});var d=c(21124),e=c(38301),f=c(42830);let g=(0,c(65751).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);var h=c(90386),i=c(16816),j=c(97657),k=c(84464),l=c(35284),m=c(44943);function n({className:a,...b}){return(0,d.jsx)("textarea",{"data-slot":"textarea",className:(0,m.cn)("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...b})}let o=(0,e.memo)(function({profileId:a,initialNotes:b}){let c=(0,e.useMemo)(()=>(0,k.U)(),[]),[m,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(b??""),[r,s]=(0,e.useState)(b??""),[t,u]=(0,e.useState)(!1),v=async()=>{u(!0);let b=r.trim(),{error:d}=await c.from("patient_profiles").update({notes:b||null}).eq("id",a);d?f.o.error("Error al guardar las notas."):(q(b),o(!1),f.o.success("Notas guardadas.")),u(!1)};return m?(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wide",children:"Editando notas"}),(0,d.jsx)(n,{value:r,onChange:a=>s(a.target.value),placeholder:"Escribe las notas cl\xednicas del paciente…",className:"min-h-[120px] rounded-[12px] text-sm resize-y",autoFocus:!0}),(0,d.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,d.jsxs)(l.$,{variant:"outline",size:"sm",className:"h-8 rounded-[10px] text-xs gap-1",onClick:()=>{s(p),o(!1)},children:[(0,d.jsx)(h.A,{className:"size-3"}),"Cancelar"]}),(0,d.jsxs)(l.$,{size:"sm",className:"h-8 rounded-[10px] text-xs gap-1 bg-primary text-[#0D141D] font-semibold hover:bg-primary/90",onClick:v,disabled:t,children:[t?(0,d.jsx)(i.A,{className:"size-3 animate-spin"}):(0,d.jsx)(j.A,{className:"size-3"}),"Guardar"]})]})]}):(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wide",children:"Notas Cl\xednicas"}),(0,d.jsxs)(l.$,{variant:"ghost",size:"sm",className:"h-7 rounded-[8px] text-xs gap-1",onClick:()=>{s(p),o(!0)},children:[(0,d.jsx)(g,{className:"size-3"}),"Editar"]})]}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap min-h-[60px]",children:p||"No hay notas cl\xednicas registradas."})]})})},67480:(a,b,c)=>{"use strict";c.d(b,{BT:()=>i,Wu:()=>j,ZB:()=>h,Zp:()=>f,aR:()=>g});var d=c(75338);c(74515);var e=c(70673);function f({className:a,size:b="default",...c}){return(0,d.jsx)("div",{"data-slot":"card","data-size":b,className:(0,e.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...c})}function g({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-header",className:(0,e.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",a),...b})}function h({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-title",className:(0,e.cn)("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",a),...b})}function i({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-description",className:(0,e.cn)("text-sm text-muted-foreground",a),...b})}function j({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-content",className:(0,e.cn)("px-4 group-data-[size=sm]/card:px-3",a),...b})}},70673:(a,b,c)=>{"use strict";c.d(b,{cn:()=>f});var d=c(81171),e=c(11167);function f(...a){return(0,e.QP)((0,d.$)(a))}},77337:(a,b,c)=>{"use strict";c.d(b,{PatientAppointmentsList:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call PatientAppointmentsList() from the server but PatientAppointmentsList is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/silvio/Develop/APP-ESTETICA/cirux/src/components/patients/PatientAppointmentsList.tsx","PatientAppointmentsList")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[331,304,21,669,61,528,622,686,241,260,837,797],()=>b(b.s=40195));module.exports=c})();