1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b364f179-8a79-4ae6-889b-c33019b0e8dd",e._sentryDebugIdIdentifier="sentry-dbid-b364f179-8a79-4ae6-889b-c33019b0e8dd")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5826],{55452:function(e,t,r){"use strict";r.d(t,{Z:function(){return p}});var n=r(84913),l=r(67294),i=["variant","color","size"],a=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"m2.58 19.011-.02.02c-.27-.59-.44-1.26-.51-2 .07.73.26 1.39.53 1.98ZM9.001 10.381a2.38 2.38 0 1 0 0-4.76 2.38 2.38 0 0 0 0 4.76Z",fill:t}),l.createElement("path",{d:"M16.19 2H7.81C4.17 2 2 4.17 2 7.81v8.38c0 1.09.19 2.04.56 2.84.86 1.9 2.7 2.97 5.25 2.97h8.38c3.64 0 5.81-2.17 5.81-5.81V7.81C22 4.17 19.83 2 16.19 2Zm4.18 10.5c-.78-.67-2.04-.67-2.82 0l-4.16 3.57c-.78.67-2.04.67-2.82 0l-.34-.28c-.71-.62-1.84-.68-2.64-.14l-3.74 2.51c-.22-.56-.35-1.21-.35-1.97V7.81c0-2.82 1.49-4.31 4.31-4.31h8.38c2.82 0 4.31 1.49 4.31 4.31v4.8l-.13-.11Z",fill:t}))},o=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"M2 12.99V15c0 5 2 7 7 7h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.createElement("path",{d:"M11 8c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2M2.672 18.949l4.93-3.31c.79-.53 1.93-.47 2.64.14l.33.29c.78.67 2.04.67 2.82 0l4.16-3.57c.78-.67 2.04-.67 2.82 0l1.63 1.4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))},c=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{opacity:".4",d:"M22 7.81v6.09l-1.63-1.4c-.78-.67-2.04-.67-2.82 0l-4.16 3.57c-.78.67-2.04.67-2.82 0l-.34-.28c-.71-.62-1.84-.68-2.64-.14l-4.92 3.3-.11.08c-.37-.8-.56-1.75-.56-2.84V7.81C2 4.17 4.17 2 7.81 2h8.38C19.83 2 22 4.17 22 7.81Z",fill:t}),l.createElement("path",{d:"M9.001 10.381a2.38 2.38 0 1 0 0-4.76 2.38 2.38 0 0 0 0 4.76ZM21.999 13.899v2.29c0 3.64-2.17 5.81-5.81 5.81h-8.38c-2.55 0-4.39-1.07-5.25-2.97l.11-.08 4.92-3.3c.8-.54 1.93-.48 2.64.14l.34.28c.78.67 2.04.67 2.82 0l4.16-3.57c.78-.67 2.04-.67 2.82 0l1.63 1.4Z",fill:t}))},s=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"M9 22h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9v6c0 5 2 7 7 7Z",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.createElement("path",{d:"M9 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM2.67 18.95l4.93-3.31c.79-.53 1.93-.47 2.64.14l.33.29c.78.67 2.04.67 2.82 0l4.16-3.57c.78-.67 2.04-.67 2.82 0L22 13.9",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))},d=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"M15 22.75H9c-5.43 0-7.75-2.32-7.75-7.75V9c0-5.43 2.32-7.75 7.75-7.75h6c5.43 0 7.75 2.32 7.75 7.75v6c0 5.43-2.32 7.75-7.75 7.75Zm-6-20C4.39 2.75 2.75 4.39 2.75 9v6c0 4.61 1.64 6.25 6.25 6.25h6c4.61 0 6.25-1.64 6.25-6.25V9c0-4.61-1.64-6.25-6.25-6.25H9Z",fill:t}),l.createElement("path",{d:"M9 10.75c-1.52 0-2.75-1.23-2.75-2.75S7.48 5.25 9 5.25 11.75 6.48 11.75 8 10.52 10.75 9 10.75Zm0-4a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5ZM2.669 19.699a.746.746 0 0 1-.41-1.37l4.93-3.31c1.08-.73 2.57-.64 3.55.19l.33.29c.5.43 1.35.43 1.84 0l4.16-3.57c1.06-.91 2.73-.91 3.8 0l1.63 1.4c.31.27.35.74.08 1.06-.27.31-.74.35-1.06.08l-1.63-1.4c-.5-.43-1.35-.43-1.85 0l-4.16 3.57c-1.06.91-2.73.91-3.8 0l-.33-.29c-.46-.39-1.22-.43-1.73-.08l-4.93 3.31c-.13.08-.28.12-.42.12Z",fill:t}))},u=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"M9 22h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9v6c0 5 2 7 7 7Z",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.createElement("path",{opacity:".4",d:"M9 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM2.672 18.949l4.93-3.31c.79-.53 1.93-.47 2.64.14l.33.29c.78.67 2.04.67 2.82 0l4.16-3.57c.78-.67 2.04-.67 2.82 0l1.63 1.4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))},h=function(e,t){switch(e){case"Bold":return l.createElement(a,{color:t});case"Broken":return l.createElement(o,{color:t});case"Bulk":return l.createElement(c,{color:t});case"Linear":default:return l.createElement(s,{color:t});case"Outline":return l.createElement(d,{color:t});case"TwoTone":return l.createElement(u,{color:t})}},p=(0,l.forwardRef)(function(e,t){var r=e.variant,a=e.color,o=e.size,c=void 0===o?"24":o,s=(0,n._)(e,i);return l.createElement("svg",(0,n.a)({},s,{xmlns:"http://www.w3.org/2000/svg",ref:t,width:c,height:c,viewBox:"0 0 24 24",fill:"none"}),h(void 0===r?"Linear":r,void 0===a?"currentColor":a))});p.displayName="Gallery"},80791:function(e,t,r){"use strict";r.d(t,{Z:function(){return p}});var n=r(84913),l=r(67294),i=["variant","color","size"],a=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"M16.19 2H7.81C4.17 2 2 4.17 2 7.81v8.37C2 19.83 4.17 22 7.81 22h8.37c3.64 0 5.81-2.17 5.81-5.81V7.81C22 4.17 19.83 2 16.19 2ZM7 13.31c-.72 0-1.31-.59-1.31-1.31 0-.72.59-1.31 1.31-1.31.72 0 1.31.59 1.31 1.31 0 .72-.59
11.31-1.31 1.31Zm5 0c-.72 0-1.31-.59-1.31-1.31 0-.72.59-1.31 1.31-1.31.72 0 1.31.59 1.31 1.31 0 .72-.59 1.31-1.31 1.31Zm5 0c-.72 0-1.31-.59-1.31-1.31 0-.72.59-1.31 1.31-1.31.72 0 1.31.59 1.31 1.31 0 .72-.59 1.31-1.31 1.31Z",fill:t}))},o=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"M5 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2ZM19 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Z",stroke:t,strokeWidth:"1.5"}),l.createElement("path",{d:"M10 12c0 1.1.9 2 2 2s2-.9 2-2-.9-2-2-2",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))},c=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{opacity:".4",d:"M16.19 2H7.81C4.17 2 2 4.17 2 7.81v8.37C2 19.83 4.17 22 7.81 22h8.37c3.64 0 5.81-2.17 5.81-5.81V7.81C22 4.17 19.83 2 16.19 2Z",fill:t}),l.createElement("path",{d:"M12 10.691c-.72 0-1.31.59-1.31 1.31 0 .72.59 1.31 1.31 1.31.72 0 1.31-.59 1.31-1.31 0-.72-.59-1.31-1.31-1.31ZM7 10.691c-.72 0-1.31.59-1.31 1.31 0 .72.59 1.31 1.31 1.31.72 0 1.31-.59 1.31-1.31 0-.72-.59-1.31-1.31-1.31ZM17 10.691c-.72 0-1.31.59-1.31 1.31 0 .72.59 1.31 1.31 1.31.72 0 1.31-.59 1.31-1.31 0-.72-.59-1.31-1.31-1.31Z",fill:t}))},s=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"M5 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2ZM19 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2ZM12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Z",stroke:t,strokeWidth:"1.5"}))},d=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"M5 14.75c-1.52 0-2.75-1.23-2.75-2.75S3.48 9.25 5 9.25 7.75 10.48 7.75 12 6.52 14.75 5 14.75Zm0-4a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5ZM19 14.75c-1.52 0-2.75-1.23-2.75-2.75S17.48 9.25 19 9.25s2.75 1.23 2.75 2.75-1.23 2.75-2.75 2.75Zm0-4a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5ZM12 14.75c-1.52 0-2.75-1.23-2.75-2.75S10.48 9.25 12 9.25s2.75 1.23 2.75 2.75-1.23 2.75-2.75 2.75Zm0-4a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5Z",fill:t}))},u=function(e){var t=e.color;return l.createElement(l.Fragment,null,l.createElement("path",{d:"M5 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2ZM19 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Z",stroke:t,strokeWidth:"1.5"}),l.createElement("path",{opacity:".4",d:"M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Z",stroke:t,strokeWidth:"1.5"}))},h=function(e,t){switch(e){case"Bold":return l.createElement(a,{color:t});case"Broken":return l.createElement(o,{color:t});case"Bulk":return l.createElement(c,{color:t});case"Linear":default:return l.createElement(s,{color:t});case"Outline":return l.createElement(d,{color:t});case"TwoTone":return l.createElement(u,{color:t})}},p=(0,l.forwardRef)(function(e,t){var r=e.variant,a=e.color,o=e.size,c=void 0===o?"24":o,s=(0,n._)(e,i);return l.createElement("svg",(0,n.a)({},s,{xmlns:"http://www.w3.org/2000/svg",ref:t,width:c,height:c,viewBox:"0 0 24 24",fill:"none"}),h(void 0===r?"Linear":r,void 0===a?"currentColor":a))});p.displayName="More"},95557:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mesh/[meshId]/catalog/[catalogId]",function(){return r(90909)}])},35270:function(e,t){"use strict";t.Z={src:"/_next/static/media/gallery icon.c18527ba.jpg",height:500,width:750,blurDataURL:"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoKCgoKCgsMDAsPEA4QDxYUExMUFiIYGhgaGCIzICUgICUgMy03LCksNy1RQDg4QFFeT0pPXnFlZXGPiI+7u/sBCgoKCgoKCwwMCw8QDhAPFhQTExQWIhgaGBoYIjMgJSAgJSAzLTcsKSw3LVFAODhAUV5PSk9ecWVlcY+Ij7u7+//CABEIAAUACAMBIgACEQEDEQH/xAAnAAEBAAAAAAAAAAAAAAAAAAAABwEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEAMQAAAAsAP/xAAbEAABBAMAAAAAAAAAAAAAAAATAQIDEgARQv/aAAgBAQABPwAb0nIk7600PnP/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oACAECAQE/AH//xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oACAEDAQE/AH//2Q==",blurWidth:8,blurHeight:5}},55604:function(e,t){"use strict";t.Z={src:"/_next/static/media/video-thumbnail.fe1b6867.png",height:1152,width:1600,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAGCAYAAAD+Bd/7AAAAsElEQVR42i2OQQuCQBCFpyAiokBIIi3QTrkWpmQjBv0Vjx67Rmeha4dAd4X1tvgvt1np8A7zvfd4AzAB9PdeBgAX0oEUkK7O1kGYAYLnD2ZaVdW9aRrVtu23KIqUGNprGyFgwc206rqWfd/rrus05/xFLIyTOAd2ZDkdTAjxUUppKaXmgj+InaJzlIPjbtBslmWJFHrTxDOhKrFsaS3ImwK6O3cI/Z8MjWmtLBzPR/gDX8sut57XL28AAAAASUVORK5CYII=",blurWidth:8,blurHeight:6}},90909:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSP:function(){return Y}});var n=r(85893),l=r(31529),i=r(85105),a=r(46941),o=r(83658),c=r(8186),s=r(37945),d=r(68029),u=r(12519),h=r(90092),p=r(73636),m=r(8328),g=r(24801),f=r(72970),x=r(90608),A=r(12095),j=r(38491),b=r(34302),v=r(63162),w=r(88329),y=r(5490),E=r(34614),k=r(26840),C=r(57391),F=r(21360),Z=r(70010),M=r
1(54506),I=r(30980),S=r(82206),L=r(54795),_=r(73244),U=r(16610),B=r(59099),z=r(45443),R=r(55452),O=r(80791),W=r(39332),D=r(67294),N=r(45007),P=r(18471),T=r(57012),Q=r(54299),V=r(16310),G=r(78268),H=r(35270),X=r(55678),K=r(55604),q=r(37734);let J=e=>e.filename&&e.url?{filename:e.filename,url:e.url,type:e.type||"image",status:e.status||"completed"}:null;var Y=!0;t.default=e=>{let{serverCatalog:t}=e,r=(0,W.useParams)(),Y=null==r?void 0:r.meshId,$=null==r?void 0:r.catalogId,ee=(0,W.useRouter)(),et=(0,N.I0)(),er=(0,P.$V)(),[en,el]=(0,D.useState)(0),[ei,ea]=(0,D.useState)(!1),[eo,ec]=(0,D.useState)(!1),[es,ed]=(0,D.useState)(!1),eu=(null==er?void 0:er.id)===Y,{isOpen:eh,onOpen:ep,onClose:em}=(0,o.q)(),{isOpen:eg,onOpen:ef,onClose:ex}=(0,o.q)(),[eA,ej]=(0,D.useState)([]),[eb,ev]=(0,D.useState)([]),ew=(0,D.useRef)([]),ey=V.Ry({title:V.Z_().max(100,"Title must be 100 characters or less").required("Title is required"),description:V.Z_().required("Description is required")});(0,D.useEffect)(()=>{if(t){let e=t.media.map(J).filter(e=>null!==e),r=e.length;ej([...e,...Array(Math.max(0,(0===r?3:Math.min(r+1,16))-r)).fill(null)]),ea(!1)}},[t]),(0,D.useEffect)(()=>()=>{eA.forEach(e=>{e&&"previewUrl"in e&&e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})},[eA]);let eE=(e,t)=>{let r=e.target.files;if(!r||0===r.length)return;let n=[...eA],l=t;Array.from(r).forEach(e=>{if(n.filter(e=>null!==e).length>=15)return;if(!["image/jpeg","image/png","image/heic","image/heif","video/mp4"].includes(e.type)){console.error("Unsupported file type for ".concat(e.name,": ").concat(e.type)),X.Am.error("Unsupported file type: ".concat(e.name));return}for(;l<n.length&&null!==n[l];)l++;l>=n.length&&n.length<15&&n.push(null);let t=URL.createObjectURL(e),r=e.type.startsWith("video/");n[l]={file:e,previewUrl:t,type:r?"video":"image"},l++}),n.filter(e=>null!==e).length<15&&!n.includes(null)&&n.push(null),ej(n),e.target.value=""},ek=e=>{let t=new RegExp("https://storage.googleapis.com/".concat("handymesh","/(.+)")),r=e.match(t);if(!r)throw Error("Invalid GCS file URL");return r[1]},eC=e=>{let t=[...eA],r=t[e];r&&"filename"in r&&ev(e=>[...e,r.filename]),r&&"previewUrl"in r&&r.previewUrl&&URL.revokeObjectURL(r.previewUrl),t[e]=null;let n=t.filter(e=>null!==e).length,l=0===n?3:Math.min(n+1,15);for(;t.length>l&&null===t[t.length-1];)t.pop();t.length>l?t.length=l:t.length<l&&t.push(...Array(l-t.length).fill(null)),ej(t)},eF=e=>{var t;null===(t=ew.current[e])||void 0===t||t.click()},eZ=(e,t)=>(0,n.jsxs)(c.g,{borderRadius:"16px",p:e?"0":"16px",border:"1px solid rgba(40, 167, 69, 0.12)",bg:"#F9FAFB",gap:"12px",cursor:e?"default":"pointer",onClick:()=>!e&&eF(t),position:"relative",overflow:"hidden",h:"180px",justify:"center",children:[(0,n.jsx)("input",{type:"file",accept:"image/jpeg,image/png,image/heic,image/heif,video/mp4",multiple:!0,style:{display:"none"},ref:e=>{ew.current[t]=e},onChange:e=>eE(e,t)}),e?(0,n.jsxs)(n.Fragment,{children:["image"===e.type?(0,n.jsx)(s.E,{src:"previewUrl"in e?e.previewUrl:e.url,alt:"filename"in e?e.filename:"Media ".concat(t),objectFit:"cover",height:"100%",width:"100%"}):(0,n.jsx)(d.x,{as:"video",src:"previewUrl"in e?e.previewUrl:e.url,controls:!0,width:"100%",height:"100%"}),(0,n.jsx)(u.h,{"aria-label":"Remove media",icon:(0,n.jsx)(G.Z,{size:"14px",color:"#FFFFFF"}),borderRadius:"full",variant:"outline",size:"xs",position:"absolute",bgColor:"#FF4C4C",top:"8px",right:"8px",onClick:e=>{e.stopPropagation(),eC(t)}})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.x,{border:"1px dashed rgba(40, 167, 69, 0.12)",rounded:"full",p:"14px",bg:"#28A7450A",children:(0,n.jsx)(R.Z,{size:"24px",color:"#28A745"})}),(0,n.jsxs)(c.g,{textAlign:"center",gap:"4px",children:[(0,n.jsx)(h.x,{fontSize:"14px",children:"Upload media"}),(0,n.jsx)(h.x,{fontSize:"12px",color:"#828282",children:"JPEG, PNG, HEIC or MP4"})]})]})]}),eM=async(e,t,r,n)=>{if(!t)throw Error("Missing ".concat(n," ID"));if(!r)throw Error("Missing authentication token");if(0===e.length)return[];try{let l=e.map(e=>({filename:e.filename,contentType:e.type})),i=await et((0,T.KC)({files:l,resourceType:n,resourceId:t,userAuthToken:r,imageType:n})).unwrap(),a=[];for(let l=0;l<e.length;l++){let o=e[l],c=i.presignedUrls[l],s=await fetch(c.url,{method:"PUT",headers:{"Content-Type":o.type,"x-goog-meta-resource-type":n,"x-goog-meta-resource-id":t,"x-goog-meta-user_auth_token":r,"x-goog-meta-image-type":n},body:o.file});if(!s.ok)throw Error("Failed to upload ".concat(o.filename,". Status: ").concat(s.status));
1a.push({filename:c.filename,url:"https://storage.googleapis.com/handymesh/".concat(c.filename),type:o.type.startsWith("video/")?"video":"image",status:"pending"})}return a}catch(t){let e=t instanceof Error?t.message:String(t);throw Error("Failed to upload media: ".concat(e))}},eI=async(e,r)=>{let{resetForm:n}=r;if(!(null==t?void 0:t.id)){X.Am.error("Catalog ID is missing");return}ec(!0);try{let r=localStorage.getItem("token");if(!r)throw Error("Authentication token is missing");let l=eA.filter(e=>null!==e&&"file"in e).map(e=>({file:e.file,type:e.file.type,filename:e.file.name})),i=await eM(l,t.id,r,"catalog"),a=[...eA.filter(e=>null!==e&&"filename"in e&&!eb.includes(e.filename)).map(e=>({filename:e.filename,url:e.url,type:e.type,status:e.status})),...i.map(e=>({filename:e.filename,url:e.url,type:e.type,status:e.status}))];for(let e of eb)try{let t="https://storage.googleapis.com/handymesh/".concat(e),r=ek(t);await et((0,T.zf)({data:{filename:r}})).unwrap()}catch(t){console.warn("Failed to delete media from GCS: ".concat(e),t)}let o=await et((0,P.CO)({formData:{title:e.title,description:e.description,media:a},id:t.id})).unwrap();el(0),ej(o.media),ev([]),em(),n(),ee.push("/mesh/".concat(null==er?void 0:er.id,"/catalog/").concat($)),X.Am.info("Catalog updated successfully")}catch(t){let e=t instanceof Error?t.message:String(t);console.error("Catalog update failed:",e),X.Am.error("Failed to update catalog"),e.includes("401")&&(localStorage.removeItem("token"),ee.replace("/login"))}finally{ec(!1)}},eS=async()=>{if(null==t?void 0:t.id){ed(!0);try{if(!localStorage.getItem("token"))throw Error("Authentication token is missing");for(let e of t.media)try{let t=ek(e.url);await et((0,T.zf)({data:{filename:t}})).unwrap()}catch(t){console.warn("Failed to delete media from GCS: ".concat(e.filename),t)}await et((0,P.r$)({id:t.id})).unwrap(),X.Am.info("Catalog deleted successfully"),ex(),ee.push("/mesh/".concat(Y))}catch(t){let e=t instanceof Error?t.message:String(t);console.error("Catalog deletion failed:",e),X.Am.error("Failed to delete catalog"),e.includes("401")&&(localStorage.removeItem("token"),ee.replace("/login"))}finally{ed(!1)}}};return ei||!t?(0,n.jsx)(q.Z,{}):(0,n.jsx)(l.Z,{children:(0,n.jsxs)(d.x,{maxW:"596px",p:{base:5},mx:"auto",position:"relative",children:[(0,n.jsxs)(p.U,{justifyContent:"space-between",children:[(0,n.jsxs)(m.a,{spacing:"8px",separator:(0,n.jsx)(i.X,{color:"gray.500"}),children:[(0,n.jsx)(g.g,{children:(0,n.jsx)(f.A,{href:"/mesh/".concat(Y),children:"Profile"})}),(0,n.jsx)(g.g,{display:eu?"block":"none",children:(0,n.jsx)(f.A,{href:"/mesh/".concat(Y,"/catalog/upload"),children:"Upload Catalogue"})})]}),eu?(0,n.jsx)(p.U,{gap:"12px",children:(0,n.jsxs)(x.v,{children:[(0,n.jsx)(A.j,{as:j.z,rounded:"full",w:"unset",minH:"unset",bg:"#F8F8F8",alignItems:"center",children:(0,n.jsx)(d.x,{transform:"rotate(90deg)",children:(0,n.jsx)(O.Z,{size:"20px",color:"black"})})}),(0,n.jsxs)(b.q,{children:[(0,n.jsx)(v.s,{onClick:ep,children:"Edit Catalog"}),(0,n.jsx)(v.s,{onClick:ef,children:"Delete Catalog"})]})]})}):(0,n.jsx)(n.Fragment,{})]}),(0,n.jsxs)(c.g,{gap:"24px",my:"21px",children:[(0,n.jsx)(w.k,{w:{base:"90vw",md:"100%",lg:"100%"},textAlign:"left",children:(0,n.jsx)(h.x,{fontSize:"xl",children:t.title})}),(0,n.jsx)(w.k,{h:"377px",bg:"lightgrey",borderRadius:"8px",w:{base:"90vw",md:"100%",lg:"100%"},position:"relative",children:t.media.length>0?(0,n.jsxs)(n.Fragment,{children:["image"===t.media[en].type?(0,n.jsx)(s.E,{src:t.media[en].url,alt:t.media[en].filename,objectFit:"contain",height:"100%",width:"100%",borderRadius:"8px",onError:()=>console.error("Failed to load media: ".concat(t.media[en].url))}):(0,n.jsx)(d.x,{as:"video",src:t.media[en].url,controls:!0,width:"100%",height:"100%",borderRadius:"8px"}),(0,n.jsxs)(p.U,{justifyContent:"space-between",w:"100%",alignSelf:"center",px:"22px",position:"absolute",children:[(0,n.jsx)(j.z,{w:"unset",minH:"unset",bg:"#1212127A",rounded:"full",p:"9px",onClick:()=>{t&&t.media.length>0&&el((en-1+t.media.length)%t.media.length)},isDisabled:t.media.length<=1,"aria-label":"Previous media",children:(0,n.jsx)(a.w,{height:"24px",width:"24px",color:"white"})}),(0,n.jsx)(j.z,{w:"unset",minH:"unset",bg:"#1212127A",rounded:"full",p:"9px",onClick:()=>{t&&t.media.length>0&&el((en+1)%t.media.length)},isDisabled:t.media.length<=1,"aria-label":"Next media",children:(0,n.jsx)(i.X,{height:"24px",width:"24px",color:"white"})})]})]}):(0,n.jsx)(s.E,{src:H.Z.src,alt:"No media available",objectFit:"cover",height:"100%",width:"100%",borderRadius:"8px"})}),(0,n.jsx)(p.U,{borderTop:"1px solid #E0E0E0",w:"100%",py:"16px",gap:"9px",overflowX:"auto",css:{"&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#c1c1c1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:"#a8a8a8"}},children:t.media.map((e,t)=>(0,n.jsx)(d.x,{width:"92px",height:"92px",minWidth:"92px",flexShrink:0,borderRadius:"8px",overflow:"hidden",cursor:"pointer",border:en===t?"2px solid #28A745":"none",onClick:()=>{el(t)},children:"image"===e.type?(0,n.jsx)(s.E,{src:e.url,alt:e.filename,objectFit:"cover",width:"100%",height:"100%",onError:()=>console.error("Failed to load thumbnail: ".concat(e.url))}):(0,n.jsx)(d.x,{as:"video",src:e.url,width:"100%",height:"100%",poster:K.Z.src,objectFit:"cover",muted:!0}
1)},t))}),(0,n.jsxs)(d.x,{w:"100%",children:[(0,n.jsx)(h.x,{mb:"8px",fontSize:"24px",fontWeight:"500",textColor:"#101828",children:t.title}),(0,n.jsx)(h.x,{mb:"16px",fontSize:"16px",textColor:"#828282",children:"Description"}),(0,n.jsx)(h.x,{fontSize:"16px",textColor:"#4F4F4F",children:t.description})]})]}),(0,n.jsxs)(y.u_,{isOpen:eh,onClose:em,size:"xl",children:[(0,n.jsx)(E.Z,{}),(0,n.jsxs)(k.h,{children:[(0,n.jsx)(C.x,{children:"Edit Catalog"}),(0,n.jsx)(F.o,{}),(0,n.jsx)(Z.f,{children:(0,n.jsx)(Q.J9,{initialValues:{title:t.title,description:t.description},validationSchema:ey,onSubmit:eI,children:e=>{let{errors:t,touched:r,isSubmitting:l}=e;return(0,n.jsx)(Q.l0,{children:(0,n.jsxs)(c.g,{gap:"24px",align:"stretch",children:[(0,n.jsx)(Q.gN,{name:"title",children:e=>{let{field:l}=e;return(0,n.jsxs)(M.NI,{isInvalid:!!t.title&&r.title,children:[(0,n.jsxs)(p.U,{justifyContent:"space-between",mb:"8px",children:[(0,n.jsx)(I.l,{htmlFor:"title",children:(0,n.jsx)(h.x,{color:"#4F4F4F",fontWeight:"400",fontSize:"16px",children:"Catalogue Title"})}),(0,n.jsxs)(h.x,{fontSize:"14px",fontWeight:"400",color:"#828282",children:[l.value.length,"/100"]})]}),(0,n.jsx)(S.I,{...l,id:"title",placeholder:"Enter catalogue title"}),(0,n.jsx)(L.J1,{children:t.title})]})}}),(0,n.jsx)(Q.gN,{name:"description",children:e=>{let{field:l}=e;return(0,n.jsxs)(M.NI,{isInvalid:!!t.description&&r.description,children:[(0,n.jsx)(p.U,{justifyContent:"space-between",mb:"8px",children:(0,n.jsx)(I.l,{htmlFor:"description",children:(0,n.jsx)(h.x,{color:"#4F4F4F",fontWeight:"400",fontSize:"16px",children:"Description"})})}),(0,n.jsx)(_.g,{...l,id:"description",height:"200px",placeholder:"Write a brief about the work",resize:"vertical"}),(0,n.jsx)(L.J1,{children:t.description})]})}}),(0,n.jsx)(U.r,{templateColumns:"repeat(3, 1fr)",gap:"12px",children:eA.map((e,t)=>(0,n.jsx)(B.P,{colSpan:1,children:eZ(e,t)},t))}),(0,n.jsx)(j.z,{bg:"#222E50",width:"100%",borderRadius:"85px",mt:"40px",type:"submit",isLoading:l||eo,isDisabled:l||eo,children:(0,n.jsx)(h.x,{color:"white",children:"Save Changes"})})]})})}})})]})]}),(0,n.jsxs)(y.u_,{isOpen:eg,onClose:ex,size:"sm",children:[(0,n.jsx)(E.Z,{}),(0,n.jsxs)(k.h,{children:[(0,n.jsx)(C.x,{children:"Delete Catalog"}),(0,n.jsx)(F.o,{}),(0,n.jsx)(Z.f,{children:(0,n.jsx)(h.x,{children:"Are you sure you want to delete this catalog? This action cannot be undone."})}),(0,n.jsxs)(z.m,{children:[(0,n.jsx)(j.z,{variant:"ghost",onClick:ex,mr:3,children:"Cancel"}),(0,n.jsx)(j.z,{colorScheme:"red",onClick:eS,isLoading:es,children:"Delete"})]})]})]})]})})}},78268:function(e,t,r){"use strict";var n=r(67294),l=r(45697),i=r.n(l);function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var o=(0,n.forwardRef)(function(e,t){var r=e.color,l=e.size,i=void 0===l?24:l,o=function(e,t){if(null==e)return{};var r,n,l=function(e,t){if(null==e)return{};var r,n,l={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(l[r]=e[r]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r])}return l}(e,["color","size"]);return n.createElement("svg",a({ref:t,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),n.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))});o.propTypes={color:i().string,size:i().oneOfType([i().string,i().number])},o.displayName="X",t.Z=o},46941:function(e,t,r){"use strict";r.d(t,{w:function(){return n}});let n=(0,r(24278).I)({d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z",displayName:"ChevronLeftIcon"})},85105:function(e,t,r){"use strict";r.d(t,{X:function(){return n}});let n=(0,r(24278).I)({d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",displayName:"ChevronRightIcon"})},95840:function(e,t,r){"use strict";r.d(t,{W:function(){return n},w:function(){return l}});let[n,l]=(0,r(52110).k)({name:"BreadcrumbStylesContext",errorMessage:"useBreadcrumbStyles returned is 'undefined'. Seems you forgot to wrap the components in \"<Breadcrumb />\" "})},24801:function(e,t,r){"use strict";r.d(t,{g:function(){return p}});var n=r(85893),l=r(83695),i=r(90911),a=r(34926),o=r(67294),c=r(95840),s=r(72970),d=r(49381),u=r(32519);let h=(0,d.G)(function(e,t){let{spacing:r,...i}=e,a=(0,c.w)(),o=(0,l.k0)({mx:r,...a.separator});return(0,n.jsx)(u.m.span,{ref:t,role:"presentation",...i,__css:o})});h.displayName="BreadcrumbSeparator";let p=(0,d.G)(function(e,t){let{isCurrentPage:r,separator:d,isLastChild:p,spacing:m,children:g,className:f,...x}=e,A=(0,i.W)(g).map(e=>e.type===s.A?(0,o.cloneElement)(e,{isCurrentPage:r}):e.type===h?(0,o.cloneElement)(e,{spacing:m,children:e.props.children||d}):e),j=(0,c.w)(),b=(0,l.k0)({display:"inline-flex",alignItems:"center",...j.item}),v=(0,a.cx)("chakra-breadcrumb__list-item",f);return(0,n.jsxs)(u.m.li,{ref:t,className:v,...x,__css:b,children:[A,!p&&(0,n.jsx)(h,{spacing:m,children:d})]})});p.displayName="BreadcrumbItem"},72970:function(e,t,r){"use strict";r.d(t,{A:function(){return c}});var n=r(85893),l=r(34926),i=r(95840),a=r(49381),o=r(32519);let c=(0,a.G)(function(e,t){let{isCurrentPage:r,as:a,className:c,href:s,...d}=e,u=(0,i.w)(),h={ref:t,as:a,className:(0,l.cx)("chakra-breadcrumb__link",c),...d};return r?(0,n.jsx)(o.m.span,{"aria-current":"page",__css:u.link,...h}):(0,n.jsx)(o.m.a,{__css:u.link,href:s,...h})});c.displayName="BreadcrumbLink"},8328:function(e,t,r){"use strict";r.d(t,{a:function(){return h}});var n=r(85893),l=r(65544),i=r(90911),a=r(34926),o=r(67294),c=r(95840),s=r(49381),d=r(73035),u=r(32519);let h=(0,s.G)(function(e,t){let r=(0,d.j)("Breadcrumb",e),{children:s,spacing:h="0.5rem",separator:p="/",className:m,listProps:g,...f}=(0,l.L)(e),x=(0,i.W)(s),A=x.length,j=x.map((e,t)=>(0,o.cloneElement)(e,{separator:p,spacing:h,isLastChild:A===t+1})),b=(0,a.cx)("chakra-breadcrumb",m);return(0,n.jsx)(u.m.nav,{ref:t,"aria-label":"breadcrumb",className:b,__css:r.container,...f,children:(0,n.jsx)(c.W,{value:r,children:(0,n.jsx)(u.m.ol,{className:"chakra-breadcrumb__list",...g,__css:{display:"flex",alignItems:"center",...r.list},children:j})})})});h.displayName="Breadcrumb"}},function(e){e.O(0,[5443,4838,1664,1657,2775,6714,9203,1529,2888,9774,179],function(){return e(e.s=95557)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.