vendor: 8,527 bytes, line 1
1"use strict";(self.webpackChunknestseekers=self.webpackChunknestseekers||[]).push([["react_components_pages_EditMediaPageComponent_tsx"],{"./react/components/pages/EditMediaPageComponent.tsx"(e,t,r){r.d(t,{A:()=>se});var n=r("./node_modules/react/index.js"),a=r("./react/api/staffAPI.ts"),o=r("./node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js"),i=[".jpg",".jpeg",".png",".bmp",".tiff",".webp"],l={aptpicture:{acceptedAspectRatios:["3:2"],acceptedFileTypes:i,titleEditable:!0,thumbDimensions:{width:300,height:200}},aptfloorplan:{acceptedAspectRatios:["3:2"],acceptedFileTypes:i,titleEditable:!0,thumbDimensions:{width:300,height:200}},aptfloorplanpdf:{acceptedAspectRatios:[],acceptedFileTypes:[".pdf"],titleEditable:!0,thumbDimensions:{width:300,height:200}},bldgpicture:{acceptedAspectRatios:["3:2"],acceptedFileTypes:i,titleEditable:!0,thumbDimensions:{width:300,height:200}},agentphoto:{acceptedAspectRatios:["3:4"],acceptedFileTypes:i,titleEditable:!1,thumbDimensions:{width:300,height:400}},agentcarouselphoto:{acceptedAspectRatios:["3:1"],acceptedFileTypes:i,titleEditable:!1,thumbDimensions:{width:450,height:150}},yachtpicture:{acceptedAspectRatios:["3:2"],acceptedFileTypes:i,titleEditable:!0,thumbDimensions:{width:300,height:200}},imagecarouselslide:{acceptedAspectRatios:["3:2"],acceptedFileTypes:i,titleEditable:!0,thumbDimensions:{width:300,height:200}}};function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t,r,n,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,a)}function s(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){u(o,n,a,i,l,"next",e)}function l(e){u(o,n,a,i,l,"throw",e)}i(void 0)})}}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){d(e,t,r[t])})}return e}function m(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function v(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}var g=r("./react/components/ui/MultipleFileDropZone.tsx"),w=r("./node_modules/react-dnd/dist/hooks/useDrag/useDrag.js"),x=r("./node_modules/react-dnd/dist/hooks/useDrop/useDrop.js"),E=r("./node_modules/react-dnd/dist/core/DndProvider.js"),j=r("./node_modules/react-dnd-html5-backend/dist/index.js"),k=r("./react/components/ui/image/ResponsiveImage.tsx"),O=r("./react/components/ui/LoadingSpinner.tsx"),S=r("./react/utils/shadcn.ts"),N=r("./react/components/shadcn/ui/button.tsx"),A=r("./node_modules/lucide-react/dist/esm/icons/file-text.mjs"),P=r("./node_modules/lucide-react/dist/esm/icons/pen.mjs"),C=r("./node_modules/lucide-react/dist/esm/icons/circle-alert.mjs"),I=r("./node_modules/lucide-react/dist/esm/icons/crop.mjs"),D=r("./node_modules/lucide-react/dist/esm/icons/x.mjs"),F=r("./react/components/shadcn/ui/input.tsx"),R=r("./node_modules/@radix-ui/react-icons/dist/react-icons.esm.js"),T=r("./react/components/shadcn/ui/alert.tsx"),_=r("./node_modules/react-easy-crop/index.module.js"),L=r("./react/components/shadcn/ui/dialog.tsx");function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function M(e,t,r,n,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,a)}function $(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){M(o,n,a,i,l,"next",e)}function l(e){M(o,n,a,i,l,"throw",e)}i(void 0)})}}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return U(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?U(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}
1if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function q(e){var t=e.file,r=e.aspectRatio,a=e.onCropComplete,o=e.onClose,i=e.open,l=z((0,n.useState)({x:0,y:0}),2),c=l[0],u=l[1],s=z((0,n.useState)(1),2),d=s[0],f=s[1],p=z((0,n.useState)(null),2),m=p[0],h=p[1],y=(0,n.useMemo)(function(){return URL.createObjectURL(t)},[t]);(0,n.useEffect)(function(){return function(){URL.revokeObjectURL(y)}},[y]);var b=(0,n.useCallback)(function(e){u(e)},[]),v=(0,n.useCallback)(function(e){f(e)},[]),g=(0,n.useCallback)(function(e,t){h(t)},[]),w=(0,n.useCallback)(function(){return $(function(){var e,r;return H(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),m?[4,(i=y,l=m,c=t.name,$(function(){var e,t,r;return H(this,function(n){switch(n.label){case 0:return[4,(a=i,new Promise(function(e,t){var r=new Image;r.addEventListener("load",function(){return e(r)}),r.addEventListener("error",function(e){return t(e)}),r.src=a}))];case 1:if(e=n.sent(),t=document.createElement("canvas"),!(r=t.getContext("2d")))throw new Error("No 2d context");return t.width=l.width,t.height=l.height,r.drawImage(e,l.x,l.y,l.width,l.height,0,0,l.width,l.height),[2,new Promise(function(e,r){t.toBlob(function(t){if(t){var n=c.split("."),a=n.pop(),o="".concat(n.join("."),"_cropped.").concat(a);e(new File([t],o,{type:"image/jpeg"}))}else r(new Error("Canvas is empty"))},"image/jpeg")})]}var a})})())]:[2];case 1:return e=n.sent(),a(e),o(),[3,3];case 2:return r=n.sent(),console.error(r),[3,3];case 3:return[2]}var i,l,c})})()},[m,t,a,o,y]);return n.createElement(L.lG,{open:i,onOpenChange:o},n.createElement(L.Cf,{className:"sm:max-w-[800px]"},n.createElement(L.c7,null,n.createElement(L.L3,null,"Crop Image"),n.createElement(L.rr,null,"Adjust the crop area to match the required aspect ratio.")),n.createElement("div",{className:"relative h-[400px] w-full"},n.createElement(_.Ay,{image:y,crop:c,zoom:d,aspect:r,onCropChange:b,onZoomChange:v,onCropComplete:g})),n.createElement(L.Es,null,n.createElement(N.$,{variant:"outline",onClick:o},"Cancel"),n.createElement(N.$,{onClick:w},"Crop & Upload"))))}function G(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Q(e,t,r,n,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,a)}function B(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){Q(o,n,a,i,l,"next",e)}function l(e){Q(o,n,a,i,l,"throw",e)}i(void 0)})}}function K(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||X(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e){return function(e){if(Array.isArray(e))return G(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||X(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e,t){if(e){if("string"==typeof e)return G(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?G(e,t):void 0}}function Z(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}
1if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}var J="media_item",Y=function(e){var t=e.file,r=e.index,a=e.onDelete,o=e.onEditTitle,i=e.moveItem,l=e.thumbWidth,c=e.thumbHeight,u=e.hasPrimaryPhoto,s=void 0!==u&&u,d=e.titleEditable,f=void 0!==d&&d,p=W((0,n.useState)(!0),2),m=p[0],h=p[1],y=W((0,n.useState)(!1),2),b=y[0],v=y[1],g=W((0,n.useState)(t.title),2),E=g[0],j=g[1],C=n.useRef(null),I=n.useRef(null),D=W((0,w.i)({type:J,item:{index:r},collect:function(e){return{isDragging:e.isDragging()}},end:function(e,t){t.didDrop()&&i(e.index,r,!0)}}),2),T=D[0].isDragging,_=D[1],L=W((0,x.H)({accept:J,collect:function(e){return{handlerId:e.getHandlerId(),isOver:e.isOver()}},hover:function(e,t){var n;if(C.current){var a=e.index,o=r;if(a!==o){var l=null===(n=C.current)||void 0===n?void 0:n.getBoundingClientRect(),c=(l.bottom-l.top)/2,u=(l.right-l.left)/2,s=t.getClientOffset();if(s){var d=s.y-l.top,f=s.x-l.left;if(Math.abs(d-c)>Math.abs(f-u)){if(a<o&&d<.1*c)return;if(a>o&&d>1.9*c)return}else{if(a<o&&f<.1*u)return;if(a>o&&f>1.9*u)return}i(a,o,!1),e.index=o}}}}}),2),U=L[0],M=U.handlerId,$=U.isOver,z=L[1],H=0===r&&s;_(z(C));var q=function(){E!==t.title&&o(t.id,E),v(!1)};return n.createElement("div",{ref:C,className:(0,S.cn)("group relative rounded-lg p-3 text-center cursor-move transition-all duration-200 min-h-[220px] min-w-[200px] flex flex-col touch-none bg-gray-50 dark:bg-gray-800",{"opacity-40 scale-102 shadow-md z-10":T,"bg-gray-200 dark:bg-gray-700 ring-2 ring-slate-500":$,"bg-linear-to-b from-slate-50 to-white dark:from-slate-900 dark:to-gray-800 ring-2 ring-slate-500 hover:from-slate-100 dark:hover:from-slate-800":H,"hover:bg-gray-100 dark:hover:bg-gray-700":!H,loading:m}),"data-handler-id":M},n.createElement("div",{className:"top-3 left-3 dark:text-gray-400 bg-white/90 dark:bg-black/90 group-hover:opacity-100 absolute z-20 px-2 py-1 text-gray-600 transition-opacity duration-200 rounded opacity-0 pointer-events-none"},"â®â®"),H&&n.createElement("div",{className:"-top-4 left-1/2 whitespace-nowrap ring-2 ring-white bg-slate-900 dark:bg-slate-900 dark:ring-gray-800 absolute z-20 px-6 py-2 text-sm font-bold text-white transform -translate-x-1/2 rounded-full shadow-lg"},"Primary Photo"),t.pdf?n.createElement("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"flex flex-col items-center justify-center w-full h-full group hover:no-underline break-words"},n.createElement(A.A,{className:"w-20 h-20 text-gray-400 dark:text-gray-500 transition-colors group-hover:text-gray-600 dark:group-hover:text-gray-300"}),n.createElement("span",{className:"mt-2 text-sm text-gray-500 dark:text-gray-400 truncate max-w-full px-4 transition-colors group-hover:text-gray-600 dark:group-hover:text-gray-300"},ee(t.url))):n.createElement("div",{className:"relative flex items-center justify-center flex-1 mt-4"},m&&n.createElement("div",{className:"bg-white/80 dark:bg-black/80 absolute inset-0 flex items-center justify-center"},n.createElement(O.A,null)),n.createElement(k.A,{src:t.url,height:c||200,width:l||200,alt:t.title,onLoad:function(){return h(!1)},className:(0,S.cn)("w-full h-full object-cover rounded pointer-events-none",{"shadow-lg":H})})),n.createElement(N.$,{variant:"destructive",className:"top-3 right-3 group-hover:opacity-50 absolute z-20 text-sm transition-all duration-200 rounded opacity-0",onClick:function(e){e.stopPropagation(),a(t.id)}},n.createElement(R.ucK,null)),f?n.createElement("div",{className:"absolute bottom-3 left-0 right-0 px-3"},b?n.createElement("div",{className:"flex items-center justify-center space-x-2 bg-white/95 dark:bg-black/95 p-2 rounded shadow-lg",onClick:function(e){return e.stopPropagation()}},n.createElement(F.p,{ref:I,type:"text",value:E,onChange:function(e){return j(e.target.value)},onBlur:q,onKeyDown:function(e){"Enter"===e.key?q():"Escape"===e.key&&(j(t.title),v(!1))},className:"text-sm w-full",placeholder:"Add caption..."})):n.createElement("div",{className:(0,S.cn)("flex items-center justify-center space-x-2 transition-opacity duration-200 bg-white/90 dark:bg-black/90 px-2 py-1 rounded cursor-pointer group/caption",{"opacity-0 group-hover:opacity-100":!t.title,"group-hover:opacity-100":t.title}),onClick:function(e){e.stopPropagation(),v(!0),setTimeout(function(){var e;return null===(e=I.current)||void 0===e?void 0:e.focus()},0)}},n.createElement("span",{className:"text-gray-600 dark:text-gray-400 text-sm"},t.title||"Add caption..."),n.createElement(P.A,{className:"opacity-0 group-hover:opacity-100 w-4 h-4 text-gray-400"}))):t.title?n.createElement("div",{className:"absolute bottom-3 left-0 right-0 px-3"},n.createElement("div",{className:"flex items-center justify-center bg-white/90 dark:bg-black/90 px-2 py-1 rounded"},n.createElement("span",{className:"text-gray-600 dark:text-gray-400 text-sm"},t.title))):null)},ee=function(e){return(e.split("/").pop()||"").replace(/^\d+-\d+-/,"")};function te(e){var t=e.files,r=e.onCreate,a=e.onDelete,o=e.onReorder,l=e.onEditTitle,c=e.hasPrimaryPhoto,u=void 0!==c&&c,s=e.thumbWidth,d=e.thumbHeight,f=e.message,p=void 0===f?"":f,m=e.titleEditable,h=void 0===m||m,y=e.isRequesting,b=void 0!==y&&y,v=e.acceptedFileTypes,w=void 0===v?i:v,x=W((0,n.use
1State)(t),2),k=x[0],A=x[1],P=W((0,n.useState)([]),2),F=P[0],R=P[1],_=W((0,n.useState)(null),2),L=_[0],U=_[1];(0,n.useEffect)(function(){A(t)},[t]);var M=function(e){return B(function(){var t,n,a,o;return Z(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,r([e])];case 1:return i.sent(),[3,3];case 2:return t=i.sent(),console.error("Failed to upload file:",t),o=(null===(a=t.response)||void 0===a||null===(n=a.data)||void 0===n?void 0:n.error)||"Failed to upload file",R(function(t){return V(t).concat([{file:e,message:o}])}),[3,3];case 3:return[2]}})})()},$=function(e){R(function(t){return t.filter(function(t){return t.file!==e})})},z=(0,n.useCallback)(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];A(function(n){var a=V(n),i=a[e];a.splice(e,1),a.splice(t,0,i);var l=a.map(function(e,t){return r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){K(e,t,r[t])})}return e}({},e),n=null!=(n={order:t})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}),r;var r,n});return r&&o(l),l})},[o]),H=(0,n.useCallback)(function(e){A(function(t){return t.filter(function(t){return t.id!==e})}),a(e)},[a]);return n.createElement("div",{className:"space-y-12"},n.createElement("div",{className:"group md:ml-64 flex max-w-5xl"},n.createElement(g.A,{handleUpload:M,acceptedFileTypes:w},n.createElement("p",{className:"group-hover:text-gray-800 dark:group-hover:text-gray-100 m-0 text-base text-gray-600"},"Drag and drop files here, or click to upload"))),F.length>0&&n.createElement("div",{className:"space-y-4"},F.map(function(e,t){return n.createElement(T.Fc,{key:t,variant:"default",className:"flex items-start gap-4 bg-gray-50/50 dark:bg-gray-800/50 border-gray-200 dark:border-gray-700"},n.createElement("div",{className:"w-20 h-20 shrink-0 rounded overflow-hidden"},n.createElement("img",{src:URL.createObjectURL(e.file),alt:"Failed upload preview",className:"w-full h-full object-cover",onLoad:function(e){return function(){return URL.revokeObjectURL(e.target.src)}}})),n.createElement("div",{className:"grow"},n.createElement("div",{className:"flex items-center gap-2"},n.createElement(C.A,{className:"h-4 w-4 text-gray-500 dark:text-gray-400"}),n.createElement(T.XL,{className:"text-gray-700 dark:text-gray-300"},e.file.name)),n.createElement(T.TN,{className:"text-gray-600 dark:text-gray-400"},e.message),n.createElement("div",{className:"mt-2"},n.createElement(N.$,{variant:"outline",size:"sm",onClick:function(){return U(e.file)},className:"text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"},n.createElement(I.A,{className:"h-4 w-4 mr-2"}),"Crop"))),n.createElement(N.$,{variant:"ghost",size:"sm",onClick:function(){return $(e.file)},className:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"},n.createElement(D.A,{className:"h-4 w-4"})))})),p&&n.createElement("div",{className:"p-4"},n.createElement("p",{className:"text-muted-foreground"},p)),n.createElement("div",{className:(0,S.cn)("relative min-h-40",{"opacity-70":b})},b&&n.createElement("div",{className:"absolute inset-0 flex items-center justify-center"},n.createElement(O.A,null)),k&&k.length>0&&n.createElement(E.Q,{backend:j.t2},n.createElement("div",{className:"flex flex-wrap gap-4 p-4"},k.map(function(e,t){return n.createElement(Y,{key:e.id,file:e,index:t,onDelete:H,onEditTitle:l,moveItem:z,thumbWidth:s,thumbHeight:d,hasPrimaryPhoto:u,titleEditable:h})})))),L&&n.createElement(q,{file:L,aspectRatio:s&&d?s/d:1.5,onCropComplete:function(e){return B(function(){var t,r;return Z(this,function(n){switch(n.label){case 0:t=F.find(function(e){return e.file===L}),t&&$(t.file),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,M(e)];case 2:return n.sent(),[3,4];case 3:return r=n.sent(),console.error("Failed to upload cropped file:",r),[3,4];case 4:return[2]}})})()},onClose:function(){return U(null)},open:!0}))}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ne=function(e,t){return new Promise(function(r,n){var a,o,i=(a=t.split(":").map(Number),o=2,function(e){if(Array.isArray(e))return e}(a)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(a,o)||function(e,t){if(e){if("string"==typeof e)return re(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?re(e,t):void 0}}
1(a,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=i[0],c=i[1];if(l&&c){var u=l/c,s=new Image,d=URL.createObjectURL(e);s.onload=function(){URL.revokeObjectURL(d);var a=s.width/s.height;Math.abs(a-u)<.1?r():n(new Error('Image "'.concat(e.name,'" should have a ').concat(t," ratio (width should be ").concat(u,"x the height). Current ratio is ").concat(a.toFixed(2),":1")))},s.onerror=function(){URL.revokeObjectURL(d),n(new Error('Failed to load image "'.concat(e.name,'"')))},s.src=d}else n(new Error('Invalid ratio format "'.concat(t,'". Expected format "width:height" (e.g., "3:2")')))})},ae=r("./react/components/shadcn/ui/tabs.tsx"),oe=r("./react/components/App/UserMenuContent.tsx"),ie=r("./react/components/PageHeader.tsx");function le(e,t,r,n,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,a)}function ce(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){le(o,n,a,i,l,"next",e)}function l(e){le(o,n,a,i,l,"throw",e)}i(void 0)})}}function ue(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}
1if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function se(e){var t=e.title,r=e.subjectId,i=e.tabs,c=e.activeTab,u=e.className,d=void 0===u?"space-y-16":u,b=e.header,g=e.onTabChange,w=e.liveLink,x=null!==r&&!isNaN(r),E=x?i.reduce(function(e,t){return t.mediaModel&&(e[t.id]=function(e){var t=e.mediaModel,r=e.subjectId,i=h((0,n.useState)(null),2),c=i[0],u=i[1],d=h((0,n.useState)([]),2),b=d[0],g=d[1],w=h((0,n.useState)(""),2),x=w[0],E=w[1],j=(0,o.jE)(),k=(0,a.H4v)(),O=(0,a.QU)(),S=(0,a.pFj)(),N=(0,a.fQB)(),A=(0,a.EVs)(t,r);(0,n.useEffect)(function(){if(A.data){var e=A.data;E(e.upload_url);var t=e.files.map(function(e,t){return{id:e.id,title:e.title||"",url:e.url,order:t,pdf:e.is_pdf||!1}});g(t)}A.error&&(u("Failed to load media files"),console.error("Failed to load media files:",A.error))},[A.data,A.error]);var P=(0,n.useCallback)(function(e){return s(function(){var n,a,o,i,l;return v(this,function(c){switch(c.label){case 0:u(null),c.label=1;case 1:return c.trys.push([1,3,,4]),n={file:e},[4,k.mutateAsync({mediaModel:t,subjectId:r,data:n})];case 2:if((a=c.sent()).error)throw new Error(a.error);return a.files&&(o=a.files.map(function(e){return{id:e.id,title:e.title||"",url:e.url,order:b.length,pdf:e.is_pdf||!1}}),g(function(e){return y(e).concat(y(o))})),[2,a];case 3:throw i=c.sent(),l=f(i,Error)?i.message:"Failed to upload file",u(l),console.error("Failed to upload file:",i),i;case 4:return[2]}})})()},[t,r,k,b]),C=(0,n.useCallback)(function(e){return s(function(){var n,a,o;return v(this,function(i){switch(i.label){case 0:u(null),n=y(b),i.label=1;case 1:return i.trys.push([1,3,,4]),g(function(t){return t.filter(function(t){return t.id!==e})}),[4,O.mutateAsync({mediaModel:t,subjectId:r,picId:e})];case 2:return i.sent(),[3,4];case 3:throw a=i.sent(),o=f(a,Error)?a.message:"Failed to delete file",u(o),console.error("Failed to delete file:",a),g(n),a;case 4:return[2]}})})()},[t,r,O,b]),I=(0,n.useCallback)(function(e){return s(function(){var n,a,o,i,l;return v(this,function(c){switch(c.label){case 0:u(null),n=y(b),c.label=1;case 1:return c.trys.push([1,3,,4]),(a=y(b)).sort(function(t,r){return e.indexOf(t.id)-e.indexOf(r.id)}),g(a),o={pic_ids:e},[4,S.mutateAsync({mediaModel:t,subjectId:r,data:o})];case 2:return c.sent(),[3,4];case 3:throw i=c.sent(),l=f(i,Error)?i.message:"Failed to reorder files",u(l),console.error("Failed to reorder files:",i),g(n),i;case 4:return[2]}})})()},[t,r,S,b]),D=(0,n.useCallback)(function(e,n){return s(function(){var a,o,i;return v(this,function(l){switch(l.label){case 0:u(null),g(b.map(function(t){return t.id===e?m(p({},t),{title:n}):t})),a=["getMediaItems",t,r],l.label=1;case 1:return l.trys.push([1,3,,4]),j.setQueryData(a,function(t){return t?m(p({},t),{files:t.files.map(function(t){return t.id===e?m(p({},t),{title:n}):t})}):t}),[4,N.mutateAsync({mediaModel:t,subjectId:r,picId:e,data:{title:n}})];case 2:return l.sent(),[3,4];case 3:throw o=l.sent(),i=f(o,Error)?o.message:"Failed to edit title",u(i),console.error("Failed to edit title:",o),j.invalidateQueries({queryKey:a}),o;case 4:return[2]}})})()},[t,r,N,j]),F=(0,n.useCallback)(function(){return s(function(){return v(this,function(e){switch(e.label){case 0:return[4,A.refetch()];case 1:return e.sent(),[2]}})})()},[A]);return{isRequesting:A.isLoading||A.isFetching,isDeleting:O.isPending,isAdding:k.isPending,isEditing:N.isPending,error:c,files:b,uploadUrl:x,uploadFile:P,deleteFile:C,reorderFiles:I,editTitle:D,refreshFiles:F,mediaModel:t,config:l[t],titleEditable:l[t].titleEditable,thumbDimensions:l[t].thumbDimensions}}({mediaModel:t.mediaModel,subjectId:r})),e},{}):{},j=function(e,t){return ce(function(){var r,n,a,o,i,l,c,u,s,d;return ue(this,function(f){switch(f.label){case 0:if(!t)return console.error("Cannot upload files: No valid media handler"),[2];f.label=1;case 1:f.trys.push([1,14,,15]),r=!0,n=!1,a=void 0,f.label=2;case 2:f.trys.push([2,11,12,13]),o=e[Symbol.iterator](),f.label=3;case 3:if(r=(i=o.next()).done)return[3,10];l=i.value,c=t.config.acceptedAspectRatios[0],f.label=4;case 4:return f.trys.push([4,6,,7]),[4,ne(l,c)];case 5:return f.sent(),[3,7];case 6:return u=f.sent(),console.error(u.message),[3,7];case 7:return[4,t.uploadFile(l)];case 8:f.sent(),f.label=9;case 9:return r=!0,[3,3];case 10:return[3,13];case 11:return s=f.sent(),n=!0,a=s,[3,13];case 12:try{r||null==o.return||o.return()}finally{if(n)throw a}
1return[7];case 13:return[3,15];case 14:throw d=f.sent(),console.error("Error uploading files:",d),d;case 15:return[2]}})})()},k=function(e,t){return ce(function(){return ue(this,function(r){if(!t)return console.error("Cannot delete file: No valid media handler"),[2];try{t.deleteFile(e).catch(function(e){console.error("Error deleting file:",e)})}catch(e){console.error("Error deleting file:",e)}return[2]})})()},O=function(e,t){return ce(function(){var r,n;return ue(this,function(a){switch(a.label){case 0:if(!t)return console.error("Cannot reorder files: No valid media handler"),[2];r=e.map(function(e){return e.id}),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,t.reorderFiles(r)];case 2:return a.sent(),[3,4];case 3:return n=a.sent(),console.error("Error reordering files:",n),[3,4];case 4:return[2]}})})()};if(!x)return n.createElement(T.Fc,{variant:"destructive"},n.createElement(T.XL,null,"Error: Missing ID"),n.createElement(T.TN,null,"No valid ID was found in the URL."));if(1===i.length){var S=i[0],A=E[S.id];return n.createElement(oe.A,{className:d},b,n.createElement(ie.A,{actions:w&&n.createElement(N.$,{asChild:!0,variant:"link"},n.createElement("a",{href:w,target:"_blank",rel:"noopener noreferrer"},"See Live Page"))},t),S.customContent||n.createElement(n.Fragment,null,S.description&&n.createElement("div",{className:"p-4"},n.createElement("p",{className:"text-muted-foreground"},S.description)),n.createElement(te,{files:(null==A?void 0:A.files)||[],onCreate:function(e){return j(e,A)},onDelete:function(e){return k(e,A)},onReorder:function(e){return O(e,A)},onEditTitle:function(e,t){return null==A?void 0:A.editTitle(e,t)},hasPrimaryPhoto:"hasPrimaryPhoto"in S&&S.hasPrimaryPhoto,titleEditable:null==A?void 0:A.titleEditable,isRequesting:null==A?void 0:A.isRequesting,isDeleting:null==A?void 0:A.isDeleting,thumbWidth:null==A?void 0:A.thumbDimensions.width,thumbHeight:null==A?void 0:A.thumbDimensions.height,acceptedFileTypes:null==A?void 0:A.config.acceptedFileTypes})))}return n.createElement(oe.A,{className:d},b,n.createElement(ie.A,{actions:w&&n.createElement(N.$,{asChild:!0,variant:"link"},n.createElement("a",{href:w,target:"_blank",rel:"noopener noreferrer"},"See Live Page"))},t),n.createElement(ae.tU,{value:c||i[0].id,className:"w-full",onValueChange:g},n.createElement(ae.j7,{className:"w-full justify-start"},i.map(function(e){return n.createElement(ae.Xi,{key:e.id,value:e.id},e.label)})),i.map(function(e){var t=E[e.id];return n.createElement(ae.av,{key:e.id,value:e.id},e.customContent||n.createElement(n.Fragment,null,e.description&&n.createElement("div",{className:"p-4"},n.createElement("p",{className:"text-muted-foreground"},e.description)),n.createElement(te,{files:(null==t?void 0:t.files)||[],onCreate:function(e){return j(e,t)},onDelete:function(e){return k(e,t)},onReorder:function(e){return O(e,t)},onEditTitle:function(e,r){return null==t?void 0:t.editTitle(e,r)},hasPrimaryPhoto:"hasPrimaryPhoto"in e&&e.hasPrimaryPhoto,titleEditable:null==t?void 0:t.titleEditable,isRequesting:null==t?void 0:t.isRequesting,isDeleting:null==t?void 0:t.isDeleting,thumbWidth:null==t?void 0:t.thumbDimensions.width,thumbHeight:null==t?void 0:t.thumbDimensions.height,acceptedFileTypes:null==t?void 0:t.config.acceptedFileTypes})))})))}},"./react/components/shadcn/ui/alert.tsx"(e,t,r){r.d(t,{Fc:()=>y,TN:()=>v,XL:()=>b});var n=r("./node_modules/react/index.js"),a=r("./node_modules/class-variance-authority/dist/index.mjs"),o=r("./react/utils/shadcn.ts");function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e){if(Array.isArray(e))return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){c(e,t,r[t])})}return e}function d(e,t){if(null==e)return{};var r,n,a,o={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}if(o=function(e,t){if(null==e)return{};var r,n,a={},o=Object.getOwnPropertyNames(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}function f(e,t){return l(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||m(e,t)||u()}function p(e){return l(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||u()}function m(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}var h=(0,a.F)("alert",{variants:{variant:{default:"alert-default",destructive:"alert-destructive",warning:"alert-warning",info:"alert-info"}},defaultVariants:{variant:"default"}}),y=n.forwardRef(function(e,t){var r=p([e,t]),a=r[0],i=r.slice(1),l=a.className,c=a.variant,u=d(a,["className","variant"]),m=f(i,1)[0];return n.createElement("div",s({ref:m,role:"alert",className:(0,o.cn)(h({variant:c}),l)},u))});y.displayName="Alert";var b=n.forwardRef(function(e,t){var r=p([e,t]),a=r[0],i=r.slice(1),l=a.className,c=d(a,["className"]),u=f(i,1)[0];return n.createElement("h5",s({ref:u,className:(0,o.cn)("alert-title",l)},c))});b.displayName="AlertTitle";var v=n.forwardRef(function(e,t){var r=p([e,t]),a=r[0],i=r.slice(1),l=a.className,c=d(a,["className"]),u=f(i,1)[0];return n.createElement("div",s({ref:u,className:(0,o.cn)("alert-description",l)},c))});v.displayName="AlertDescription"},"./react/components/ui/LoadingSpinner.tsx"(e,t,r){r.d(t,{A:()=>l});var n=r("./node_modules/react/index.js"),a=r("./node_modules/@radix-ui/react-icons/dist/react-icons.esm.js"),o=r("./react/utils/shadcn.ts"),i={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-6 w-6",xl:"h-8 w-8"};function l(e){var t=e.className,r=e.size,l=void 0===r?"md":r;return n.createElement(a.jfu,{className:(0,o.cn)("animate-spin",i[l],t)})}},"./react/components/ui/MultipleFileDropZone.tsx"(e,t,r){r.d(t,{A:()=>m});var n=r("./node_modules/react/index.js"),a=r("./node_modules/react-dropzone/dist/es/index.js"),o=r("./react/components/shadcn/ui/alert.tsx"),i=r("./react/components/ui/LoadingSpinner.tsx"),l=r("./node_modules/classnames/index.js"),c=r.n(l);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t,r,n,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,a)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var f={"image/jpeg":[],"image/png":[],"application/pdf":[],"application/msword":[".doc"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"]},p={".pdf":"application/pdf",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};
1const m=function(e){var t=e.handleUpload,r=e.acceptedFileTypes,l=e.maxSize,u=void 0===l?20:l,m=e.showHelperText,h=void 0!==m&&m,y=e.className,b=void 0===y?"h-64":y,v=e.children,g=d(n.useState(null),2),w=g[0],x=g[1],E=d(n.useState(0),2),j=E[0],k=E[1],O=n.useMemo(function(){if(!(null==r?void 0:r.length))return f;var e={};return r.forEach(function(t){var r=p[t.toLowerCase()];r&&(e[r]=[t])}),e},[r]),S=(0,a.VB)({onDrop:function(e){return(r=function(){var r,n,a,o,i,l,c;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}
1if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,function(u){switch(u.label){case 0:x(null),k(e.length),r=!0,n=!1,a=void 0,u.label=1;case 1:u.trys.push([1,6,7,8]),o=e[Symbol.iterator](),u.label=2;case 2:return(r=(i=o.next()).done)?[3,5]:(l=i.value,[4,t(l).catch(function(e){x("Failed to upload: ".concat(e))}).finally(function(){k(function(e){return e-1})})]);case 3:u.sent(),u.label=4;case 4:return r=!0,[3,2];case 5:return[3,8];case 6:return c=u.sent(),n=!0,a=c,[3,8];case 7:try{r||null==o.return||o.return()}finally{if(n)throw a}return[7];case 8:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,a){var o=r.apply(e,t);function i(e){s(o,n,a,i,l,"next",e)}function l(e){s(o,n,a,i,l,"throw",e)}i(void 0)})})();var r},accept:O,maxFiles:void 0,maxSize:1024*u*1024}),N=S.getRootProps,A=S.getInputProps;return n.createElement("div",{className:"dropzone-container w-full space-y-4"},n.createElement("div",N({className:c()("flex flex-col items-center justify-center text-center space-y-3 border-2 border-dashed rounded-sm border-gray-300 p-4 dark:border-gray-600 dark:bg-gray-800 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700",b)}),n.createElement("input",A()),function(){if(j>0){var e=1===j?"file":"files";return n.createElement("div",{className:"flex flex-col items-center gap-2"},n.createElement(i.A,null),n.createElement("p",{className:"m-0 text-base text-gray-600"},"Uploading ",j," ",e,"..."))}return v}(),n.createElement("div",{className:"text-sm text-gray-500"},h&&"(Drop files or click here to upload)")),w&&n.createElement(o.Fc,{variant:"destructive"},w))}}}]);
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.