form-component-library-demo 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime"),u=require("lucide-react");var d=`field_library_token`,f=`field_library_user`,p=class{constructor({baseUrl:e,appId:t,onAuthError:n}){if(!e)throw Error(`baseUrl is required`);if(!t)throw Error(`appId is required`);if(this.baseUrl=e.replace(/\/+$/,``),this.appId=t,this.onAuthError=n,this.token=null,this.user=null,typeof window<`u`){this.token=localStorage.getItem(d);try{let e=localStorage.getItem(f);e&&(this.user=JSON.parse(e))}catch{this.user=null}}}setAuthErrorHandler(e){this.onAuthError=e}setToken(e){this.token=e,!(typeof window>`u`)&&(e?localStorage.setItem(d,e):(localStorage.removeItem(d),localStorage.removeItem(f),this.user=null))}getToken(){return this.token}async request(e,t,n,r={}){let i={"Content-Type":`application/json`,...r};return this.token&&(i.Authorization=`Bearer ${this.token}`),this.send(e,t,{headers:i,body:n===void 0?void 0:JSON.stringify(n)})}async requestForm(e,t){let n={};return this.token&&(n.Authorization=`Bearer ${this.token}`),this.send(`POST`,e,{headers:n,body:t})}async send(e,t,n){let r=await fetch(`${this.baseUrl}${t}`,{method:e,...n});if(r.status===401)throw this.setToken(null),this.onAuthError?.(),{status:401,message:`Unauthorized`};if(!r.ok){let e=r.statusText;try{let t=await r.json();t.error&&(e=t.error)}catch{}throw{status:r.status,message:e}}if(r.status!==204)return await r.json()}async login(e,t,n){let r=await this.request(`POST`,`/usr/login`,{email:e,password:t,...n?{org_id:Number(n)}:{}});return this.setToken(r.token),typeof window<`u`&&r.user&&(this.user=r.user,localStorage.setItem(f,JSON.stringify(r.user))),r}logout(){this.setToken(null)}async getMe(){let e=await this.request(`GET`,`/usr/app/${this.appId}/me`);return this.user&&(this.user={...this.user,...e},typeof window<`u`&&localStorage.setItem(f,JSON.stringify(this.user))),e}currentUser(){if(!this.token)return null;if(this.user)return this.user;try{let e=JSON.parse(atob(this.token.split(`.`)[1]));return{id:String(e.user_id??e.sub??``),org_id:String(e.org_id??``),name:e.name??``,email:e.email??``,mobile:String(e.mobile??e.mobile_number??e.phone??e.phone_number??e.user_mobile??``),roles:e.roles??[],groups:e.groups??[]}}catch{return null}}recordView(e,t={}){return this.request(`POST`,`/app/${this.appId}/view/recordview`,{rv_template_uid:e,...t.presetAlias?{preset_alias:t.presetAlias}:{},search_query:{page:t.page??1,limit:t.limit??50,sort_by:t.sortBy??``,sort_dir:t.sortDir??`desc`,search:t.search??``,filters:(t.filters??[]).map(e=>{let t={field_key:e.field_key,data_type:e.data_type??`character varying`};return e.values&&e.values.length>0?t.values=e.values:(t.value=e.value??``,t.value2=``),t})}})}detailView(e,t){return this.request(`GET`,`/app/${this.appId}/view/detailview/${e}?instance_id=${encodeURIComponent(String(t))}`)}audit(e){return this.request(`GET`,`/app/${this.appId}/view/audit?instance_id=${encodeURIComponent(String(e))}`)}aiDecisions(e){return this.request(`GET`,`/monitor/decisions?instance_id=${encodeURIComponent(String(e))}`).then(e=>e.decisions??[])}formSchema(e,t){return this.request(`POST`,`/app/${this.appId}/view/form-screens`,{activity_id:e,device_type:`desktop`,...t==null?{}:{instance_id:t}})}startInstance(e,t,n){return this.request(`POST`,`/app/${this.appId}/start`,{workflow_uuid:e,activity_id:t,data:n})}performActivity(e,t,n,r){return this.request(`POST`,`/app/${this.appId}/activity`,{workflow_uuid:e,instance_id:typeof t==`string`&&Number(t)||t,activity_id:n,data:r})}lookupRecords(e,t,n){return this.request(`POST`,`/app/${this.appId}/rdbms-templates/${t}/records`,{workflow_uuid:e,activity_id:n.activityId,field_id:n.fieldId,instance_id:n.instanceId||void 0,search:n.search??``,limit:n.limit??50,offset:0,form_data:n.formData??{}})}wfLookupRecords(e,t){return this.request(`POST`,`/app/${this.appId}/wf-lookup/records`,{workflow_uuid:e,activity_id:t.activityId,field_id:t.fieldId,form_data:t.formData??{},search:t.search??``,limit:t.limit??100,offset:t.offset??0})}datasetOptions(e,t){return this.request(`POST`,`/app/${this.appId}/dataset-options`,{workflow_uuid:e,activity_id:t.activityId,field_id:t.fieldId,instance_id:t.instanceId||void 0,search:t.search??``,limit:t.limit??200,offset:0,form_data:t.formData??{}})}getDatasets(){return this.request(`GET`,`/app/${this.appId}/datasets`)}getDataset(e){return this.request(`GET`,`/app/${this.appId}/datasets/${e}`)}createDataset(e){return this.request(`POST`,`/app/${this.appId}/datasets`,e)}updateDataset(e,t){return this.request(`PUT`,`/app/${this.appId}/datasets/${e}`,t)}fieldForm(e,t,n){let r=new FormData;return r.append(`file`,t),r.append(`workflow_uuid`,e),r.append(`activity_id`,n.activityId),r.append(`field_id`,n.fieldId),n.instanceId!=null&&r.append(`instance_id`,String(n.instanceId)),r}uploadFile(e,t,n){return this.requestForm(`/app/${this.appId}/upload`,this.fieldForm(e,t,n))}async extractOcr(e,t,n){if(t instanceof File||t instanceof Blob){let r=new FormData;return r.append(`file`,t),r.append(`store_file`,`true`),r.append(`workflow_uuid`,e),r.append(`activity_id`,n.activityId),r.append(`field_id`,n.fieldId),n.versionUuid&&r.append(`version_uuid`,n.versionUuid),n.instanceId!=null&&r.append(`instance_id`,String(n.instanceId)),this.requestForm(`/app/${this.appId}/ocr-extract`,r)}{let r={workflow_uuid:e,activity_id:n.activityId,field_id:n.fieldId,version_uuid:n.versionUuid,files:[t]};return n.instanceId!=null&&(r.instance_id=Number(n.instanceId)),{...await this.request(`POST`,`/app/${this.appId}/ocr-extract`,r),file:t}}}async getFilePreviewBlob(e){let t={};this.token&&(t.Authorization=`Bearer ${this.token}`);let n=await fetch(`${this.baseUrl}/app/${this.appId}/view/files/${e}/preview`,{method:`GET`,headers:t});if(n.status===401)throw this.setToken(null),this.onAuthError?.(),{status:401,message:`Unauthorized`};if(!n.ok)throw{status:n.status,message:`Failed to fetch preview`};return await n.blob()}},m={imagePreviewLoading:`_imagePreviewLoading_s2a11_1`,spinner:`_spinner_s2a11_10`,"zf-spin":`_zf-spin_s2a11_1`,spinnerSm:`_spinnerSm_s2a11_19`,imagePreviewError:`_imagePreviewError_s2a11_28`,imagePreview:`_imagePreview_s2a11_1`},h=(...e)=>e.filter(Boolean).join(` `);function g({file:e,client:t,className:n=``}){let[r,i]=(0,c.useState)(null),[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let n=null,r=!0;async function a(){if(!e){r&&i(null);return}if(e instanceof File){n=URL.createObjectURL(e),r&&i(n);return}if(e.uuid){if(!t){console.warn(`ImagePreview: 'client' prop is missing, cannot load remote preview`),r&&u(!0);return}r&&o(!0);try{let a=await t.getFilePreviewBlob(e.uuid);n=URL.createObjectURL(a),r&&i(n)}catch(e){console.error(`Failed to load image preview:`,e),r&&u(!0)}finally{r&&o(!1)}}}return a(),()=>{r=!1,n&&URL.revokeObjectURL(n)}},[e,t]),a?(0,l.jsx)(`div`,{className:h(m.imagePreviewLoading,n),children:(0,l.jsx)(`div`,{className:h(m.spinner,m.spinnerSm)})}):s||!r?(0,l.jsx)(`div`,{className:h(m.imagePreviewError,n),children:s?`Preview failed`:`No preview`}):(0,l.jsx)(`img`,{src:r,alt:`Preview`,className:h(m.imagePreview,n)})}var _={fieldContainer:`_fieldContainer_1tgn0_2`,label:`_label_1tgn0_14`,fieldBody:`_fieldBody_1tgn0_21`,sizeSm:`_sizeSm_1tgn0_28`,dropzone:`_dropzone_1tgn0_28`,sizeMd:`_sizeMd_1tgn0_29`,sizeLg:`_sizeLg_1tgn0_30`,variantPrimary:`_variantPrimary_1tgn0_33`,dropzoneIconWrapper:`_dropzoneIconWrapper_1tgn0_35`,dropzoneTitle:`_dropzoneTitle_1tgn0_36`,browseButton:`_browseButton_1tgn0_37`,fileCard:`_fileCard_1tgn0_39`,spinner:`_spinner_1tgn0_40`,variantSecondary:`_variantSecondary_1tgn0_42`,dropzoneLoading:`_dropzoneLoading_1tgn0_72`,dropzoneContent:`_dropzoneContent_1tgn0_77`,dropzoneIcon:`_dropzoneIcon_1tgn0_35`,dropzoneSub:`_dropzoneSub_1tgn0_109`,fileList:`_fileList_1tgn0_135`,fileCardPreview:`_fileCardPreview_1tgn0_152`,documentPreview:`_documentPreview_1tgn0_163`,documentBadge:`_documentBadge_1tgn0_173`,fileCardDetails:`_fileCardDetails_1tgn0_185`,statusSuccess:`_statusSuccess_1tgn0_193`,fileNameLarge:`_fileNameLarge_1tgn0_203`,fileMeta:`_fileMeta_1tgn0_211`,fileActions:`_fileActions_1tgn0_217`,btnActionBlue:`_btnActionBlue_1tgn0_224`,btnActionRed:`_btnActionRed_1tgn0_243`,hidden:`_hidden_1tgn0_263`,errorText:`_errorText_1tgn0_264`,overlay:`_overlay_1tgn0_266`,spin:`_spin_1tgn0_40`,spinnerSm:`_spinnerSm_1tgn0_286`,extractedPanel:`_extractedPanel_1tgn0_296`,extractedTitle:`_extractedTitle_1tgn0_304`,extractedList:`_extractedList_1tgn0_311`,extractedItem:`_extractedItem_1tgn0_317`,extractedKey:`_extractedKey_1tgn0_329`,extractedVal:`_extractedVal_1tgn0_336`},v=(...e)=>e.filter(Boolean).join(` `),y=e=>{let t=e.name||e.original_name||``,n=e.type||e.mime_type||``;return t.endsWith(`.pdf`)||n.includes(`pdf`)||t.match(/\.(doc|docx|txt)$/i)?(0,l.jsx)(u.FileText,{className:_.fileIcon}):(0,l.jsx)(u.File,{className:_.fileIcon})};function b({label:e,value:t,onChange:n,onExtracted:r,onProcess:i,client:a,showExtracted:o=!0,accept:s=`image/*,application/pdf`,variant:d=`primary`,size:f=`md`,previewSize:p=`md`,width:m=`full`,className:h=``}){let[b,x]=(0,c.useState)(!1),[S,C]=(0,c.useState)(null),[w,T]=(0,c.useState)(null),E=(0,c.useRef)(null),D=Array.isArray(t)?t:t?[t]:[],O=e=>{e.file&&n(e.file),e.extract_error?C(e.extract_error):e.extracted&&(T(e.extracted),r&&r({...e.extracted}))},k=async e=>{let t=e.target.files?.[0];if(t){x(!0),C(null),T(null);try{let e=await i(t);e&&e.file&&!e.file.size&&!e.file.file_size&&(e.file.size=t.size),O(e)}catch(e){console.error(e),C(`OCR extraction failed`)}finally{x(!1),E.current&&(E.current.value=``)}}},A=async e=>{x(!0),C(null);try{let t=await i(e);t&&t.file&&!t.file.size&&!t.file.file_size&&(t.file.size=e.size||e.file_size),O(t)}catch(e){console.error(e),C(`OCR extraction retry failed`)}finally{x(!1)}},j=e=>{let t=[...D];if(t.splice(e,1),n(t.length===0?null:t),t.length===0){if(w&&r){let e={};for(let t of Object.keys(w))e[t]=``;r(e)}T(null)}},M=e=>e instanceof File?e.type.startsWith(`image/`):e.mime_type?e.mime_type.startsWith(`image/`):e.original_name?/\.(jpg|jpeg|png|gif|webp)$/i.test(e.original_name):!1,N=m===`full`?{width:`100%`}:{width:m};return(0,l.jsxs)(`div`,{className:v(_.fieldContainer,_[`variant${d.charAt(0).toUpperCase()+d.slice(1)}`],_[`size${f.charAt(0).toUpperCase()+f.slice(1)}`],_[`previewSize${p.charAt(0).toUpperCase()+p.slice(1)}`],h),style:N,children:[(0,l.jsx)(`label`,{className:_.label,children:e}),(0,l.jsxs)(`div`,{className:_.fieldBody,children:[(0,l.jsx)(`input`,{ref:E,type:`file`,onChange:k,disabled:b,accept:s,className:_.hidden}),D.length===0&&(0,l.jsx)(`div`,{className:v(_.dropzone,b&&_.dropzoneLoading),onClick:()=>E.current?.click(),children:b?(0,l.jsxs)(`div`,{className:_.dropzoneContent,children:[(0,l.jsx)(`div`,{className:v(_.spinner,_.spinnerSm,_.dropzoneIconWrapper)}),(0,l.jsx)(`p`,{className:_.dropzoneTitle,children:`Extracting OCR data...`})]}):(0,l.jsxs)(`div`,{className:_.dropzoneContent,children:[(0,l.jsx)(`div`,{className:_.dropzoneIconWrapper,children:(0,l.jsx)(u.FileUp,{className:_.dropzoneIcon})}),(0,l.jsx)(`p`,{className:_.dropzoneTitle,children:`Drop a document to extract`}),(0,l.jsx)(`p`,{className:_.dropzoneSub,children:`PNG, JPG, JPEG or PDF (Max 5MB)`}),(0,l.jsxs)(`button`,{type:`button`,className:_.browseButton,children:[(0,l.jsx)(u.Folder,{size:16}),`Browse Files`]})]})}),D.length>0&&(0,l.jsx)(`div`,{className:_.fileList,children:D.map((e,t)=>{let n=e.name||e.original_name||`Document`,r=``,i=e?.size||e?.file_size;i&&(r=i>1048576?`${(i/1048576).toFixed(1)} MB`:`${(i/1024).toFixed(1)} KB`);let o=n.split(`.`).pop()?.toUpperCase()||`FILE`;return(0,l.jsxs)(`div`,{className:_.fileCard,children:[(0,l.jsxs)(`div`,{className:_.fileCardPreview,children:[M(e)?(0,l.jsx)(g,{file:e,client:a}):(0,l.jsxs)(`div`,{className:_.documentPreview,children:[y(e),(0,l.jsx)(`span`,{className:_.documentBadge,children:`PDF`})]}),b&&(0,l.jsx)(`div`,{className:_.overlay,children:(0,l.jsx)(`div`,{className:_.spinner})})]}),(0,l.jsxs)(`div`,{className:_.fileCardDetails,children:[(0,l.jsxs)(`div`,{className:_.statusSuccess,children:[(0,l.jsx)(u.CheckCircle2,{size:16}),(0,l.jsx)(`span`,{children:`Document uploaded successfully`})]}),(0,l.jsx)(`h4`,{className:_.fileNameLarge,title:n,children:n}),(0,l.jsxs)(`p`,{className:_.fileMeta,children:[o,` • `,r]}),!b&&(0,l.jsxs)(`div`,{className:_.fileActions,children:[(0,l.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),A(e)},className:_.btnActionBlue,children:[(0,l.jsx)(u.RefreshCw,{size:14}),` Re-extract`]}),(0,l.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),j(t)},className:_.btnActionRed,children:[(0,l.jsx)(u.Trash2,{size:14}),` Delete`]})]})]})]},t)})}),S&&(0,l.jsxs)(`div`,{className:_.fieldBody,children:[(0,l.jsx)(`p`,{className:_.errorText,children:S}),D.length>0&&!w&&(0,l.jsx)(`button`,{type:`button`,onClick:()=>A(D[0]),disabled:b,className:_.btnActionBlue,style:{alignSelf:`flex-start`,marginTop:`0.5rem`},children:b?`Retrying...`:`Retry Extraction`})]}),o&&w&&(0,l.jsxs)(`div`,{className:_.extractedPanel,children:[(0,l.jsx)(`p`,{className:_.extractedTitle,children:`Extracted Data`}),(0,l.jsx)(`div`,{className:_.extractedList,children:Object.entries(w).map(([e,t])=>(0,l.jsxs)(`div`,{className:_.extractedItem,children:[(0,l.jsx)(`span`,{className:_.extractedKey,children:e.replace(/_/g,` `)}),(0,l.jsx)(`span`,{className:_.extractedVal,children:String(t)})]},e))})]})]})]})}exports.ImagePreview=g,exports.OcrField=b,exports.ZinoClient=p;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime"),u=require("lucide-react");var d=`field_library_token`,f=`field_library_user`,p=class{constructor({baseUrl:e,appId:t,onAuthError:n}){if(!e)throw Error(`baseUrl is required`);if(!t)throw Error(`appId is required`);if(this.baseUrl=e.replace(/\/+$/,``),this.appId=t,this.onAuthError=n,this.token=null,this.user=null,typeof window<`u`){this.token=localStorage.getItem(d);try{let e=localStorage.getItem(f);e&&(this.user=JSON.parse(e))}catch{this.user=null}}}setAuthErrorHandler(e){this.onAuthError=e}setToken(e){this.token=e,!(typeof window>`u`)&&(e?localStorage.setItem(d,e):(localStorage.removeItem(d),localStorage.removeItem(f),this.user=null))}getToken(){return this.token}async request(e,t,n,r={}){let i={"Content-Type":`application/json`,...r};return this.token&&(i.Authorization=`Bearer ${this.token}`),this.send(e,t,{headers:i,body:n===void 0?void 0:JSON.stringify(n)})}async requestForm(e,t){let n={};return this.token&&(n.Authorization=`Bearer ${this.token}`),this.send(`POST`,e,{headers:n,body:t})}async send(e,t,n){let r=await fetch(`${this.baseUrl}${t}`,{method:e,...n});if(r.status===401)throw this.setToken(null),this.onAuthError?.(),{status:401,message:`Unauthorized`};if(!r.ok){let e=r.statusText;try{let t=await r.json();t.error&&(e=t.error)}catch{}throw{status:r.status,message:e}}if(r.status!==204)return await r.json()}async login(e,t,n){let r=await this.request(`POST`,`/usr/login`,{email:e,password:t,...n?{org_id:Number(n)}:{}});return this.setToken(r.token),typeof window<`u`&&r.user&&(this.user=r.user,localStorage.setItem(f,JSON.stringify(r.user))),r}logout(){this.setToken(null)}async getMe(){let e=await this.request(`GET`,`/usr/app/${this.appId}/me`);return this.user&&(this.user={...this.user,...e},typeof window<`u`&&localStorage.setItem(f,JSON.stringify(this.user))),e}currentUser(){if(!this.token)return null;if(this.user)return this.user;try{let e=JSON.parse(atob(this.token.split(`.`)[1]));return{id:String(e.user_id??e.sub??``),org_id:String(e.org_id??``),name:e.name??``,email:e.email??``,mobile:String(e.mobile??e.mobile_number??e.phone??e.phone_number??e.user_mobile??``),roles:e.roles??[],groups:e.groups??[]}}catch{return null}}recordView(e,t={}){return this.request(`POST`,`/app/${this.appId}/view/recordview`,{rv_template_uid:e,...t.presetAlias?{preset_alias:t.presetAlias}:{},search_query:{page:t.page??1,limit:t.limit??50,sort_by:t.sortBy??``,sort_dir:t.sortDir??`desc`,search:t.search??``,filters:(t.filters??[]).map(e=>{let t={field_key:e.field_key,data_type:e.data_type??`character varying`};return e.values&&e.values.length>0?t.values=e.values:(t.value=e.value??``,t.value2=``),t})}})}detailView(e,t){return this.request(`GET`,`/app/${this.appId}/view/detailview/${e}?instance_id=${encodeURIComponent(String(t))}`)}audit(e){return this.request(`GET`,`/app/${this.appId}/view/audit?instance_id=${encodeURIComponent(String(e))}`)}aiDecisions(e){return this.request(`GET`,`/monitor/decisions?instance_id=${encodeURIComponent(String(e))}`).then(e=>e.decisions??[])}formSchema(e,t){return this.request(`POST`,`/app/${this.appId}/view/form-screens`,{activity_id:e,device_type:`desktop`,...t==null?{}:{instance_id:t}})}startInstance(e,t,n){return this.request(`POST`,`/app/${this.appId}/start`,{workflow_uuid:e,activity_id:t,data:n})}performActivity(e,t,n,r){return this.request(`POST`,`/app/${this.appId}/activity`,{workflow_uuid:e,instance_id:typeof t==`string`&&Number(t)||t,activity_id:n,data:r})}lookupRecords(e,t,n){return this.request(`POST`,`/app/${this.appId}/rdbms-templates/${t}/records`,{workflow_uuid:e,activity_id:n.activityId,field_id:n.fieldId,instance_id:n.instanceId||void 0,search:n.search??``,limit:n.limit??50,offset:0,form_data:n.formData??{}})}wfLookupRecords(e,t){return this.request(`POST`,`/app/${this.appId}/wf-lookup/records`,{workflow_uuid:e,activity_id:t.activityId,field_id:t.fieldId,form_data:t.formData??{},search:t.search??``,limit:t.limit??100,offset:t.offset??0})}datasetOptions(e,t){return this.request(`POST`,`/app/${this.appId}/dataset-options`,{workflow_uuid:e,activity_id:t.activityId,field_id:t.fieldId,instance_id:t.instanceId||void 0,search:t.search??``,limit:t.limit??200,offset:0,form_data:t.formData??{}})}getDatasets(){return this.request(`GET`,`/app/${this.appId}/datasets`)}getDataset(e){return this.request(`GET`,`/app/${this.appId}/datasets/${e}`)}createDataset(e){return this.request(`POST`,`/app/${this.appId}/datasets`,e)}updateDataset(e,t){return this.request(`PUT`,`/app/${this.appId}/datasets/${e}`,t)}fieldForm(e,t,n){let r=new FormData;return r.append(`file`,t),r.append(`workflow_uuid`,e),r.append(`activity_id`,n.activityId),r.append(`field_id`,n.fieldId),n.instanceId!=null&&r.append(`instance_id`,String(n.instanceId)),r}uploadFile(e,t,n){return this.requestForm(`/app/${this.appId}/upload`,this.fieldForm(e,t,n))}async extractOcr(e,t,n){if(t instanceof File||t instanceof Blob){let r=new FormData;return r.append(`file`,t),r.append(`store_file`,`true`),r.append(`workflow_uuid`,e),r.append(`activity_id`,n.activityId),r.append(`field_id`,n.fieldId),n.versionUuid&&r.append(`version_uuid`,n.versionUuid),n.instanceId!=null&&r.append(`instance_id`,String(n.instanceId)),this.requestForm(`/app/${this.appId}/ocr-extract`,r)}{let r={workflow_uuid:e,activity_id:n.activityId,field_id:n.fieldId,version_uuid:n.versionUuid,files:[t]};return n.instanceId!=null&&(r.instance_id=Number(n.instanceId)),{...await this.request(`POST`,`/app/${this.appId}/ocr-extract`,r),file:t}}}async getFilePreviewBlob(e){let t={};this.token&&(t.Authorization=`Bearer ${this.token}`);let n=await fetch(`${this.baseUrl}/app/${this.appId}/view/files/${e}/preview`,{method:`GET`,headers:t});if(n.status===401)throw this.setToken(null),this.onAuthError?.(),{status:401,message:`Unauthorized`};if(!n.ok)throw{status:n.status,message:`Failed to fetch preview`};return await n.blob()}},m={imagePreviewLoading:`_imagePreviewLoading_s2a11_1`,spinner:`_spinner_s2a11_10`,"zf-spin":`_zf-spin_s2a11_1`,spinnerSm:`_spinnerSm_s2a11_19`,imagePreviewError:`_imagePreviewError_s2a11_28`,imagePreview:`_imagePreview_s2a11_1`},h=(...e)=>e.filter(Boolean).join(` `);function g({file:e,client:t,className:n=``}){let[r,i]=(0,c.useState)(null),[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let n=null,r=!0;async function a(){if(!e){r&&i(null);return}if(e instanceof File){n=URL.createObjectURL(e),r&&i(n);return}if(e.uuid){if(!t){console.warn(`ImagePreview: 'client' prop is missing, cannot load remote preview`),r&&u(!0);return}r&&o(!0);try{let a=await t.getFilePreviewBlob(e.uuid);n=URL.createObjectURL(a),r&&i(n)}catch(e){console.error(`Failed to load image preview:`,e),r&&u(!0)}finally{r&&o(!1)}}}return a(),()=>{r=!1,n&&URL.revokeObjectURL(n)}},[e,t]),a?(0,l.jsx)(`div`,{className:h(m.imagePreviewLoading,n),children:(0,l.jsx)(`div`,{className:h(m.spinner,m.spinnerSm)})}):s||!r?(0,l.jsx)(`div`,{className:h(m.imagePreviewError,n),children:s?`Preview failed`:`No preview`}):(0,l.jsx)(`img`,{src:r,alt:`Preview`,className:h(m.imagePreview,n)})}var _={fieldContainer:`_fieldContainer_1tgn0_2`,label:`_label_1tgn0_14`,fieldBody:`_fieldBody_1tgn0_21`,sizeSm:`_sizeSm_1tgn0_28`,dropzone:`_dropzone_1tgn0_28`,sizeMd:`_sizeMd_1tgn0_29`,sizeLg:`_sizeLg_1tgn0_30`,variantPrimary:`_variantPrimary_1tgn0_33`,dropzoneIconWrapper:`_dropzoneIconWrapper_1tgn0_35`,dropzoneTitle:`_dropzoneTitle_1tgn0_36`,browseButton:`_browseButton_1tgn0_37`,fileCard:`_fileCard_1tgn0_39`,spinner:`_spinner_1tgn0_40`,variantSecondary:`_variantSecondary_1tgn0_42`,dropzoneLoading:`_dropzoneLoading_1tgn0_72`,dropzoneContent:`_dropzoneContent_1tgn0_77`,dropzoneIcon:`_dropzoneIcon_1tgn0_35`,dropzoneSub:`_dropzoneSub_1tgn0_109`,fileList:`_fileList_1tgn0_135`,fileCardPreview:`_fileCardPreview_1tgn0_152`,documentPreview:`_documentPreview_1tgn0_163`,documentBadge:`_documentBadge_1tgn0_173`,fileCardDetails:`_fileCardDetails_1tgn0_185`,statusSuccess:`_statusSuccess_1tgn0_193`,fileNameLarge:`_fileNameLarge_1tgn0_203`,fileMeta:`_fileMeta_1tgn0_211`,fileActions:`_fileActions_1tgn0_217`,btnActionBlue:`_btnActionBlue_1tgn0_224`,btnActionRed:`_btnActionRed_1tgn0_243`,hidden:`_hidden_1tgn0_263`,errorText:`_errorText_1tgn0_264`,overlay:`_overlay_1tgn0_266`,spin:`_spin_1tgn0_40`,spinnerSm:`_spinnerSm_1tgn0_286`,extractedPanel:`_extractedPanel_1tgn0_296`,extractedTitle:`_extractedTitle_1tgn0_304`,extractedList:`_extractedList_1tgn0_311`,extractedItem:`_extractedItem_1tgn0_317`,extractedKey:`_extractedKey_1tgn0_329`,extractedVal:`_extractedVal_1tgn0_336`},v=(...e)=>e.filter(Boolean).join(` `),y=e=>{let t=e.name||e.original_name||``,n=e.type||e.mime_type||``;return t.endsWith(`.pdf`)||n.includes(`pdf`)||t.match(/\.(doc|docx|txt)$/i)?(0,l.jsx)(u.FileText,{className:_.fileIcon}):(0,l.jsx)(u.File,{className:_.fileIcon})};function b({label:e,value:t,onChange:n,onExtracted:r,onProcess:i,client:a,showExtracted:o=!0,accept:s=`image/*,application/pdf`,variant:d=`primary`,size:f=`md`,width:p=`full`,className:m=``}){let[h,b]=(0,c.useState)(!1),[x,S]=(0,c.useState)(null),[C,w]=(0,c.useState)(null),T=(0,c.useRef)(null),E=Array.isArray(t)?t:t?[t]:[],D=e=>{e.file&&n(e.file),e.extract_error?S(e.extract_error):e.extracted&&(w(e.extracted),r&&r({...e.extracted}))},O=async e=>{let t=e.target.files?.[0];if(t){b(!0),S(null),w(null);try{let e=await i(t);e&&e.file&&!e.file.size&&!e.file.file_size&&(e.file.size=t.size),D(e)}catch(e){console.error(e),S(`OCR extraction failed`)}finally{b(!1),T.current&&(T.current.value=``)}}},k=async e=>{b(!0),S(null);try{let t=await i(e);t&&t.file&&!t.file.size&&!t.file.file_size&&(t.file.size=e.size||e.file_size),D(t)}catch(e){console.error(e),S(`OCR extraction retry failed`)}finally{b(!1)}},A=e=>{let t=[...E];if(t.splice(e,1),n(t.length===0?null:t),t.length===0){if(C&&r){let e={};for(let t of Object.keys(C))e[t]=``;r(e)}w(null)}},j=e=>e instanceof File?e.type.startsWith(`image/`):e.mime_type?e.mime_type.startsWith(`image/`):e.original_name?/\.(jpg|jpeg|png|gif|webp)$/i.test(e.original_name):!1,M=p===`full`?{width:`100%`}:{width:p};return(0,l.jsxs)(`div`,{className:v(_.fieldContainer,_[`variant${d.charAt(0).toUpperCase()+d.slice(1)}`],_[`size${f.charAt(0).toUpperCase()+f.slice(1)}`],m),style:M,children:[(0,l.jsx)(`label`,{className:_.label,children:e}),(0,l.jsxs)(`div`,{className:_.fieldBody,children:[(0,l.jsx)(`input`,{ref:T,type:`file`,onChange:O,disabled:h,accept:s,className:_.hidden}),E.length===0&&(0,l.jsx)(`div`,{className:v(_.dropzone,h&&_.dropzoneLoading),onClick:()=>T.current?.click(),children:h?(0,l.jsxs)(`div`,{className:_.dropzoneContent,children:[(0,l.jsx)(`div`,{className:v(_.spinner,_.spinnerSm,_.dropzoneIconWrapper)}),(0,l.jsx)(`p`,{className:_.dropzoneTitle,children:`Extracting OCR data...`})]}):(0,l.jsxs)(`div`,{className:_.dropzoneContent,children:[(0,l.jsx)(`div`,{className:_.dropzoneIconWrapper,children:(0,l.jsx)(u.FileUp,{className:_.dropzoneIcon})}),(0,l.jsx)(`p`,{className:_.dropzoneTitle,children:`Drop a document to extract`}),(0,l.jsx)(`p`,{className:_.dropzoneSub,children:`PNG, JPG, JPEG or PDF (Max 5MB)`}),(0,l.jsxs)(`button`,{type:`button`,className:_.browseButton,children:[(0,l.jsx)(u.Folder,{size:16}),`Browse Files`]})]})}),E.length>0&&(0,l.jsx)(`div`,{className:_.fileList,children:E.map((e,t)=>{let n=e.name||e.original_name||`Document`,r=``,i=e?.size||e?.file_size;i&&(r=i>1048576?`${(i/1048576).toFixed(1)} MB`:`${(i/1024).toFixed(1)} KB`);let o=n.split(`.`).pop()?.toUpperCase()||`FILE`;return(0,l.jsxs)(`div`,{className:_.fileCard,children:[(0,l.jsxs)(`div`,{className:_.fileCardPreview,children:[j(e)?(0,l.jsx)(g,{file:e,client:a}):(0,l.jsxs)(`div`,{className:_.documentPreview,children:[y(e),(0,l.jsx)(`span`,{className:_.documentBadge,children:`PDF`})]}),h&&(0,l.jsx)(`div`,{className:_.overlay,children:(0,l.jsx)(`div`,{className:_.spinner})})]}),(0,l.jsxs)(`div`,{className:_.fileCardDetails,children:[(0,l.jsxs)(`div`,{className:_.statusSuccess,children:[(0,l.jsx)(u.CheckCircle2,{size:16}),(0,l.jsx)(`span`,{children:`Document uploaded successfully`})]}),(0,l.jsx)(`h4`,{className:_.fileNameLarge,title:n,children:n}),(0,l.jsxs)(`p`,{className:_.fileMeta,children:[o,` • `,r]}),!h&&(0,l.jsxs)(`div`,{className:_.fileActions,children:[(0,l.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),k(e)},className:_.btnActionBlue,children:[(0,l.jsx)(u.RefreshCw,{size:14}),` Re-extract`]}),(0,l.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),A(t)},className:_.btnActionRed,children:[(0,l.jsx)(u.Trash2,{size:14}),` Delete`]})]})]})]},t)})}),x&&(0,l.jsxs)(`div`,{className:_.fieldBody,children:[(0,l.jsx)(`p`,{className:_.errorText,children:x}),E.length>0&&!C&&(0,l.jsx)(`button`,{type:`button`,onClick:()=>k(E[0]),disabled:h,className:_.btnActionBlue,style:{alignSelf:`flex-start`,marginTop:`0.5rem`},children:h?`Retrying...`:`Retry Extraction`})]}),o&&C&&(0,l.jsxs)(`div`,{className:_.extractedPanel,children:[(0,l.jsx)(`p`,{className:_.extractedTitle,children:`Extracted Data`}),(0,l.jsx)(`div`,{className:_.extractedList,children:Object.entries(C).map(([e,t])=>(0,l.jsxs)(`div`,{className:_.extractedItem,children:[(0,l.jsx)(`span`,{className:_.extractedKey,children:e.replace(/_/g,` `)}),(0,l.jsx)(`span`,{className:_.extractedVal,children:String(t)})]},e))})]})]})]})}var x={gridContainer:`_gridContainer_1ga7t_1`,gridTable:`_gridTable_1ga7t_17`,gridHeader:`_gridHeader_1ga7t_31`,gridHeaderCell:`_gridHeaderCell_1ga7t_41`,gridRow:`_gridRow_1ga7t_61`,gridCell:`_gridCell_1ga7t_87`,gridFooter:`_gridFooter_1ga7t_189`,gridFooterCell:`_gridFooterCell_1ga7t_201`,addRowButton:`_addRowButton_1ga7t_213`,deleteRowButton:`_deleteRowButton_1ga7t_253`,actionCell:`_actionCell_1ga7t_283`,"variant-compact":`_variant-compact_1ga7t_295`,"variant-striped":`_variant-striped_1ga7t_327`,desktopOnly:`_desktopOnly_1ga7t_337`,mobileOnly:`_mobileOnly_1ga7t_343`,mobileListContainer:`_mobileListContainer_1ga7t_371`,mobileCard:`_mobileCard_1ga7t_383`,mobileCardRow:`_mobileCardRow_1ga7t_401`,mobileCardLabel:`_mobileCardLabel_1ga7t_421`,mobileCardInputWrapper:`_mobileCardInputWrapper_1ga7t_439`,mobileDeleteBtnWrapper:`_mobileDeleteBtnWrapper_1ga7t_513`,mobileAggregationsCard:`_mobileAggregationsCard_1ga7t_529`,mobileAggregationRow:`_mobileAggregationRow_1ga7t_543`,mobileAggregationLabel:`_mobileAggregationLabel_1ga7t_565`,mobileAggregationValue:`_mobileAggregationValue_1ga7t_579`,mobileSummaryCard:`_mobileSummaryCard_1ga7t_591`,mobileSummaryLeft:`_mobileSummaryLeft_1ga7t_621`,mobileSummaryRightWrapper:`_mobileSummaryRightWrapper_1ga7t_633`,mobileSummaryActions:`_mobileSummaryActions_1ga7t_647`,mobileIconButton:`_mobileIconButton_1ga7t_657`,mobileIconDanger:`_mobileIconDanger_1ga7t_697`,mobileSummaryRight:`_mobileSummaryRight_1ga7t_633`,mobileSummaryTitle:`_mobileSummaryTitle_1ga7t_721`,mobileSummaryChip:`_mobileSummaryChip_1ga7t_733`,mobileSummaryValueRow:`_mobileSummaryValueRow_1ga7t_753`},S=({value:e,column:t,rowData:n,rowIndex:r,onChange:i})=>(0,l.jsx)(`td`,{className:x.gridCell,children:t.render?t.render({value:e,onChange:e=>{i(n.id,t.key,e)},rowData:n,rowIndex:r,column:t}):(0,l.jsx)(`span`,{children:e})}),C=({rowData:e,rowIndex:t,columns:n,onChange:r,onDeleteRow:i})=>(0,l.jsxs)(`tr`,{className:x.gridRow,children:[n.map(n=>(0,l.jsx)(S,{value:e[n.key],column:n,rowData:e,rowIndex:t,onChange:r},n.key)),i&&(0,l.jsx)(`td`,{className:`${x.gridCell} ${x.actionCell}`,children:(0,l.jsx)(`button`,{type:`button`,className:x.deleteRowButton,onClick:()=>i(e.id),title:`Remove Row`,children:`Delete`})})]}),w=({data:e,columns:t,onChange:n,aggregations:r,onAddRow:i,onDeleteRow:a,variant:o,showAggregations:s=!0})=>{let u=e=>typeof s==`boolean`?s:!Array.isArray(s)||s.includes(e),d=t.some(e=>e.aggregation&&u(e.key)&&r[e.key]!==void 0),f=(0,c.useRef)(e?e.length:0),p=(0,c.useRef)(null);(0,c.useEffect)(()=>{e&&e.length>f.current&&setTimeout(()=>{if(p.current){let e=p.current.querySelectorAll(`tbody tr`);if(e.length>0){let t=e[e.length-1].querySelector(`input, select, textarea`);t&&t.focus()}}},0),f.current=e?e.length:0},[e]);let m=x[`variant-${o}`]||``;return(0,l.jsxs)(`div`,{className:`${x.gridContainer} ${m}`,children:[(0,l.jsxs)(`table`,{className:x.gridTable,ref:p,children:[(0,l.jsx)(`thead`,{className:x.gridHeader,children:(0,l.jsxs)(`tr`,{children:[t.map(e=>(0,l.jsx)(`th`,{className:x.gridHeaderCell,children:e.title||e.key},e.key)),a&&(0,l.jsx)(`th`,{className:`${x.gridHeaderCell} ${x.actionCell}`})]})}),(0,l.jsx)(`tbody`,{children:e.map((e,r)=>(0,l.jsx)(C,{rowData:e,rowIndex:r,columns:t,onChange:n,onDeleteRow:a},e.id||r))}),d&&(0,l.jsx)(`tfoot`,{className:x.gridFooter,children:(0,l.jsxs)(`tr`,{children:[t.map((e,t)=>{let n=t===0,i=u(e.key)?r[e.key]:void 0;return(0,l.jsx)(`td`,{className:x.gridFooterCell,children:i===void 0?n?`Total`:``:i},e.key)}),a&&(0,l.jsx)(`td`,{className:x.gridFooterCell})]})})]}),i&&(0,l.jsx)(`button`,{className:x.addRowButton,onClick:i,type:`button`,children:`+ Add Row`})]})},T=({data:e,columns:t,onChange:n,aggregations:r,onAddRow:i,onDeleteRow:a,showAggregations:o})=>{let[s,u]=(0,c.useState)(null),d=(0,c.useRef)(e?e.length:0);(0,c.useEffect)(()=>{if(e&&e.length>d.current){let t=e[e.length-1];t&&t.id&&u(t.id)}d.current=e?e.length:0},[e]),(0,c.useEffect)(()=>{s!==null&&setTimeout(()=>{let e=document.getElementById(`mobile-card-${s}`);if(e){e.scrollIntoView({behavior:`smooth`,block:`start`});let t=e.querySelector(`input, select, textarea`);t&&t.focus()}},50)},[s]);let f=e=>typeof o==`boolean`?o:!Array.isArray(o)||o.includes(e),p=t.some(e=>e.aggregation&&f(e.key)&&r[e.key]!==void 0);return(0,l.jsxs)(`div`,{className:x.mobileListContainer,children:[e&&e.length>0?e.map(e=>{if(s===e.id)return(0,l.jsxs)(`div`,{id:`mobile-card-${e.id}`,className:x.mobileCard,children:[t.map(t=>(0,l.jsxs)(`div`,{className:x.mobileCardRow,children:[(0,l.jsx)(`div`,{className:x.mobileCardLabel,children:t.title}),(0,l.jsx)(`div`,{className:x.mobileCardInputWrapper,children:t.render({value:e[t.key],rowData:e,onChange:r=>n(e.id,t.key,r)})})]},t.key)),(0,l.jsxs)(`div`,{className:x.mobileDeleteBtnWrapper,children:[(0,l.jsx)(`button`,{className:x.addRowButton,style:{margin:0,marginRight:`auto`,width:`auto`,padding:`0.35rem 0.75rem`,fontSize:`0.875rem`},onClick:e=>{e.stopPropagation(),u(null)},children:`Done`}),a&&(0,l.jsx)(`button`,{className:x.deleteRowButton,onClick:t=>{t.stopPropagation(),a(e.id),u(null)},"aria-label":`Delete Row`,children:`Delete`})]})]},e.id);let r=t.find(e=>e.mobile?.role===`title`)||t[0],i=t.find(e=>e.mobile?.role===`chip`),o=t.filter(e=>e.mobile?.role===`value`);return(0,l.jsxs)(`div`,{className:x.mobileSummaryCard,onClick:()=>u(e.id),children:[(0,l.jsxs)(`div`,{className:x.mobileSummaryLeft,children:[(0,l.jsx)(`div`,{className:x.mobileSummaryTitle,children:r&&e[r.key]!==void 0&&e[r.key]!==``?e[r.key]:`Row ${e.id}`}),i&&e[i.key]&&(0,l.jsx)(`div`,{children:(0,l.jsx)(`span`,{className:x.mobileSummaryChip,children:e[i.key]})})]}),(0,l.jsxs)(`div`,{className:x.mobileSummaryRightWrapper,children:[(0,l.jsx)(`div`,{className:x.mobileSummaryRight,children:o.map(t=>(0,l.jsxs)(`div`,{className:x.mobileSummaryValueRow,children:[t.title,`: `,(0,l.jsx)(`span`,{children:e[t.key]})]},t.key))}),(0,l.jsxs)(`div`,{className:x.mobileSummaryActions,children:[(0,l.jsx)(`button`,{className:x.mobileIconButton,onClick:t=>{t.stopPropagation(),u(e.id)},"aria-label":`Edit`,title:`Edit`,children:(0,l.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,l.jsx)(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),(0,l.jsx)(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})]})}),a&&(0,l.jsx)(`button`,{className:`${x.mobileIconButton} ${x.mobileIconDanger}`,onClick:t=>{t.stopPropagation(),a(e.id)},"aria-label":`Delete`,title:`Delete`,children:(0,l.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,l.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,l.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,l.jsx)(`line`,{x1:`10`,y1:`11`,x2:`10`,y2:`17`}),(0,l.jsx)(`line`,{x1:`14`,y1:`11`,x2:`14`,y2:`17`})]})})]})]})]},e.id)}):(0,l.jsx)(`div`,{style:{textAlign:`center`,padding:`2rem`,color:`var(--zf-text-muted)`},children:`No data available.`}),i&&(0,l.jsx)(`button`,{className:x.addRowButton,onClick:i,children:`+ Add Row`}),p&&(0,l.jsx)(`div`,{className:x.mobileAggregationsCard,children:t.map(e=>e.aggregation&&f(e.key)&&r[e.key]!==void 0?(0,l.jsxs)(`div`,{className:x.mobileAggregationRow,children:[(0,l.jsxs)(`div`,{className:x.mobileAggregationLabel,children:[e.title,` (Total)`]}),(0,l.jsx)(`div`,{className:x.mobileAggregationValue,children:r[e.key]})]},e.key):null)})]})},E=(e,t)=>(0,c.useMemo)(()=>{if(!e||e.length===0||!t)return{};let n={};return t.forEach(t=>{if(t.aggregation){let r=e.map(e=>Number(e[t.key])).filter(e=>!isNaN(e));if(r.length===0){n[t.key]=0;return}switch(t.aggregation){case`sum`:n[t.key]=r.reduce((e,t)=>e+t,0);break;case`avg`:n[t.key]=r.reduce((e,t)=>e+t,0)/r.length;break;case`min`:n[t.key]=Math.min(...r);break;case`max`:n[t.key]=Math.max(...r);break;default:typeof t.aggregation==`function`&&(n[t.key]=t.aggregation(e,t.key))}}}),n},[e,t]),D=({data:e,columns:t,onChange:n,onAddRow:r,onDeleteRow:i,variant:a=`default`,showAggregations:o=!0})=>{let s=E(e,t);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:x.desktopOnly,children:(0,l.jsx)(w,{data:e,columns:t,onChange:n,aggregations:s,onAddRow:r,onDeleteRow:i,variant:a,showAggregations:o})}),(0,l.jsx)(`div`,{className:x.mobileOnly,children:(0,l.jsx)(T,{data:e,columns:t,onChange:n,aggregations:s,onAddRow:r,onDeleteRow:i,showAggregations:o})})]})};exports.Grid=D,exports.ImagePreview=g,exports.OcrField=b,exports.ZinoClient=p,exports.useGridAggregations=E;
@@ -1,2 +1,2 @@
1
- :root{--zf-primary-color:#3b82f6;--zf-primary-hover:#2563eb;--zf-primary-bg-subtle:#3b82f605;--zf-primary-bg-hover:#3b82f614;--zf-secondary-color:#64748b;--zf-secondary-hover:#475569;--zf-secondary-bg-hover:#64748b14;--zf-danger-color:#ef4444;--zf-danger-hover:#dc2828;--zf-danger-bg:#fee2e2;--zf-danger-bg-hover:#ef444426;--zf-border-color:#e2e8f0;--zf-border-style:dashed;--zf-text-color:#0f172a;--zf-text-muted:#64748b;--zf-text-inverse:#fff;--zf-surface-bg:#fff;--zf-surface-subtle:#f1f5f9;--zf-surface-overlay:#ffffffb3;--zf-font-family:inherit;--zf-font-size-xs:.75rem;--zf-font-size-sm:.875rem;--zf-font-size-md:1rem;--zf-font-size-lg:1.125rem;--zf-font-weight-normal:400;--zf-font-weight-medium:500;--zf-font-weight-semibold:600;--zf-font-weight-bold:700;--zf-spacing-1:.25rem;--zf-spacing-1-5:.375rem;--zf-spacing-2:.5rem;--zf-spacing-3:.75rem;--zf-spacing-4:1rem;--zf-spacing-5:1.25rem;--zf-spacing-6:1.5rem;--zf-spacing-8:2rem;--zf-spacing-16:4rem;--zf-radius-sm:.25rem;--zf-radius-md:.375rem;--zf-radius:.5rem;--zf-radius-lg:.5rem;--zf-radius-full:9999px;--zf-shadow-sm:0 1px 2px 0 #0000000d;--zf-shadow-md:0 4px 6px -1px #0000001a, 0 2px 4px -1px #0000000f;--zf-shadow-lg:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--zf-screen-sm:640px;--zf-screen-md:768px;--zf-screen-lg:1024px;--zf-screen-xl:1280px;--zf-z-base:1;--zf-z-overlay:10;--zf-z-modal:50;--zf-z-max:9999}._imagePreviewLoading_s2a11_1{background-color:var(--zf-surface-subtle);justify-content:center;align-items:center;width:100%;height:100%;display:flex}._spinner_s2a11_10{width:var(--zf-spacing-8);height:var(--zf-spacing-8);border:2px solid var(--zf-primary-color);border-radius:var(--zf-radius-full);border-top-color:#0000;animation:1s linear infinite _zf-spin_s2a11_1}._spinnerSm_s2a11_19{width:var(--zf-spacing-6);height:var(--zf-spacing-6)}@keyframes _zf-spin_s2a11_1{to{transform:rotate(360deg)}}._imagePreviewError_s2a11_28{background-color:var(--zf-danger-bg);color:var(--zf-danger-color);font-size:var(--zf-font-size-xs);text-align:center;padding:var(--zf-spacing-2);justify-content:center;align-items:center;width:100%;height:100%;display:flex}._imagePreview_s2a11_1{object-fit:cover;width:100%;height:100%}._fieldContainer_1tgn0_2{gap:var(--zf-spacing-2);font-family:var(--zf-font-family);box-sizing:border-box;flex-direction:column;display:flex}._fieldContainer_1tgn0_2 *{box-sizing:border-box}._label_1tgn0_14{color:#111827;margin-bottom:.5rem;font-size:1rem;font-weight:600}._fieldBody_1tgn0_21{gap:var(--zf-spacing-3);flex-direction:column;display:flex}._sizeSm_1tgn0_28 ._dropzone_1tgn0_28{padding:var(--zf-spacing-4);min-height:auto}._sizeMd_1tgn0_29 ._dropzone_1tgn0_28{padding:var(--zf-spacing-8) var(--zf-spacing-6)}._sizeLg_1tgn0_30 ._dropzone_1tgn0_28{padding:2.5rem 1.5rem}._variantPrimary_1tgn0_33 ._dropzone_1tgn0_28{border-color:var(--zf-primary-color,#3b82f6);background-color:var(--zf-primary-bg-subtle,#f8fafc)}._variantPrimary_1tgn0_33 ._dropzone_1tgn0_28:hover{background-color:var(--zf-primary-bg-hover,#f1f5f9);border-color:var(--zf-primary-hover,#2563eb)}._variantPrimary_1tgn0_33 ._dropzoneIconWrapper_1tgn0_35{background-color:var(--zf-primary-bg-subtle,#eff6ff);color:var(--zf-primary-color,#3b82f6)}._variantPrimary_1tgn0_33 ._dropzoneTitle_1tgn0_36{color:var(--zf-primary-color,#3b82f6)}._variantPrimary_1tgn0_33 ._browseButton_1tgn0_37{border-color:var(--zf-primary-color,#3b82f6);color:var(--zf-primary-color,#3b82f6)}._variantPrimary_1tgn0_33 ._browseButton_1tgn0_37:hover{background-color:var(--zf-primary-bg-subtle,#eff6ff)}._variantPrimary_1tgn0_33 ._fileCard_1tgn0_39{border-color:var(--zf-primary-color,#3b82f6);background-color:var(--zf-primary-bg-subtle,#f8fafc)}._variantPrimary_1tgn0_33 ._spinner_1tgn0_40{border-color:var(--zf-primary-color,#3b82f6);border-top-color:#0000}._variantSecondary_1tgn0_42 ._dropzone_1tgn0_28{border-color:var(--zf-secondary-color,#64748b);background-color:var(--zf-surface-subtle,#f8fafc)}._variantSecondary_1tgn0_42 ._dropzone_1tgn0_28:hover{background-color:var(--zf-secondary-bg-hover,#f1f5f9);border-color:var(--zf-text-color,#334155)}._variantSecondary_1tgn0_42 ._dropzoneIconWrapper_1tgn0_35{background-color:var(--zf-surface-subtle,#f1f5f9);color:var(--zf-secondary-color,#64748b)}._variantSecondary_1tgn0_42 ._dropzoneTitle_1tgn0_36{color:var(--zf-secondary-color,#64748b)}._variantSecondary_1tgn0_42 ._browseButton_1tgn0_37{border-color:var(--zf-secondary-color,#64748b);color:var(--zf-secondary-color,#64748b)}._variantSecondary_1tgn0_42 ._browseButton_1tgn0_37:hover{background-color:var(--zf-surface-subtle,#f1f5f9)}._variantSecondary_1tgn0_42 ._fileCard_1tgn0_39{border-color:var(--zf-secondary-color,#64748b);background-color:var(--zf-surface-subtle,#f8fafc)}._variantSecondary_1tgn0_42 ._spinner_1tgn0_40{border-color:var(--zf-secondary-color,#64748b);border-top-color:#0000}._dropzone_1tgn0_28{border-width:2px;border-style:var(--zf-border-style,dashed);border-radius:var(--zf-radius,12px);text-align:center;cursor:pointer;background-color:#f8fafc;border-color:#3b82f6;flex-direction:column;justify-content:center;align-items:center;padding:2.5rem 1.5rem;transition:all .2s;display:flex}._dropzone_1tgn0_28:hover{background-color:#f1f5f9}._dropzoneLoading_1tgn0_72{opacity:.5;pointer-events:none}._dropzoneContent_1tgn0_77{flex-direction:column;justify-content:center;align-items:center;gap:.5rem;display:flex}._dropzoneIconWrapper_1tgn0_35{color:#3b82f6;background-color:#eff6ff;border-radius:50%;justify-content:center;align-items:center;width:3.5rem;height:3.5rem;margin-bottom:.5rem;display:flex}._dropzoneIcon_1tgn0_35{width:1.75rem;height:1.75rem}._dropzoneTitle_1tgn0_36{color:#3b82f6;margin:0;font-size:1rem;font-weight:600}._dropzoneSub_1tgn0_109{color:#6b7280;margin:0 0 1rem;font-size:.875rem}._browseButton_1tgn0_37{color:#3b82f6;cursor:pointer;background-color:#0000;border:1px solid #3b82f6;border-radius:6px;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.875rem;font-weight:500;transition:all .2s;display:inline-flex}._browseButton_1tgn0_37:hover{background-color:#eff6ff}._fileList_1tgn0_135{flex-direction:column;gap:1rem;display:flex}._fileCard_1tgn0_39{border-radius:var(--zf-radius,12px);background-color:#fff;border:1px solid #e5e7eb;flex-direction:row;gap:1.5rem;padding:1rem;display:flex;box-shadow:0 1px 3px #0000000d}._fileCardPreview_1tgn0_152{background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;flex-shrink:0;width:240px;height:150px;position:relative;overflow:hidden}._documentPreview_1tgn0_163{color:#9ca3af;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;display:flex}._documentBadge_1tgn0_173{color:#fff;background-color:#374151;border-radius:4px;padding:2px 6px;font-size:.65rem;font-weight:700;position:absolute;bottom:8px;left:8px}._fileCardDetails_1tgn0_185{flex-direction:column;flex-grow:1;justify-content:flex-start;padding:.25rem 0;display:flex}._statusSuccess_1tgn0_193{color:#10b981;align-items:center;gap:.5rem;margin-bottom:.75rem;font-size:.875rem;font-weight:500;display:flex}._fileNameLarge_1tgn0_203{color:#111827;word-break:break-all;margin:0 0 .5rem;font-size:1.25rem;font-weight:700}._fileMeta_1tgn0_211{color:#6b7280;margin:0;font-size:.875rem}._fileActions_1tgn0_217{justify-content:flex-end;gap:1rem;margin-top:auto;display:flex}._btnActionBlue_1tgn0_224{color:#3b82f6;cursor:pointer;background-color:#0000;border:1px solid #3b82f6;border-radius:6px;align-items:center;gap:.375rem;padding:.375rem .875rem;font-size:.875rem;font-weight:500;transition:all .2s;display:inline-flex}._btnActionBlue_1tgn0_224:hover{background-color:#eff6ff}._btnActionRed_1tgn0_243{color:#ef4444;cursor:pointer;background-color:#0000;border:1px solid #ef4444;border-radius:6px;align-items:center;gap:.375rem;padding:.375rem .875rem;font-size:.875rem;font-weight:500;transition:all .2s;display:inline-flex}._btnActionRed_1tgn0_243:hover{background-color:#fef2f2}._hidden_1tgn0_263{display:none}._errorText_1tgn0_264{color:#ef4444;margin:0;font-size:.875rem;font-weight:500}._overlay_1tgn0_266{z-index:10;background-color:#ffffffb3;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._spinner_1tgn0_40{border:2px solid #3b82f6;border-top-color:#0000;border-radius:50%;width:2rem;height:2rem;animation:1s linear infinite _spin_1tgn0_40}._spinnerSm_1tgn0_286{width:1.5rem;height:1.5rem}@keyframes _spin_1tgn0_40{to{transform:rotate(360deg)}}._extractedPanel_1tgn0_296{border-radius:var(--zf-radius,8px);background-color:#f9fafb;border:1px solid #e5e7eb;margin-top:1rem;padding:1rem}._extractedTitle_1tgn0_304{color:#111827;margin:0 0 .5rem;font-size:.875rem;font-weight:600}._extractedList_1tgn0_311{grid-template-columns:1fr;gap:.5rem;display:grid}._extractedItem_1tgn0_317{border-bottom:1px solid #e5e7eb;justify-content:space-between;align-items:center;padding:.25rem 0;display:flex}._extractedItem_1tgn0_317:last-child{border-bottom:none}._extractedKey_1tgn0_329{color:#6b7280;text-transform:uppercase;font-size:.75rem;font-weight:600}._extractedVal_1tgn0_336{color:#111827;text-align:right;word-break:break-all;max-width:60%;font-size:.875rem;font-weight:500}@media (width<=640px){._fileCard_1tgn0_39{flex-direction:column;align-items:stretch;gap:1rem;padding:1rem}._fileCardPreview_1tgn0_152{width:100%;height:180px}._fileCardDetails_1tgn0_185{padding:0}._fileActions_1tgn0_217{justify-content:space-between;width:100%;margin-top:1rem}._btnActionBlue_1tgn0_224,._btnActionRed_1tgn0_243{flex:1;justify-content:center}}
1
+ :root{--zf-primary-color:#3b82f6;--zf-primary-hover:#2563eb;--zf-primary-bg-subtle:#3b82f605;--zf-primary-bg-hover:#3b82f614;--zf-secondary-color:#64748b;--zf-secondary-hover:#475569;--zf-secondary-bg-hover:#64748b14;--zf-danger-color:#ef4444;--zf-danger-hover:#dc2828;--zf-danger-bg:#fee2e2;--zf-danger-bg-hover:#ef444426;--zf-border-color:#e2e8f0;--zf-border-style:dashed;--zf-text-color:#0f172a;--zf-text-muted:#64748b;--zf-text-inverse:#fff;--zf-surface-bg:#fff;--zf-surface-subtle:#f1f5f9;--zf-surface-overlay:#ffffffb3;--zf-font-family:inherit;--zf-font-size-xs:.75rem;--zf-font-size-sm:.875rem;--zf-font-size-md:1rem;--zf-font-size-lg:1.125rem;--zf-font-weight-normal:400;--zf-font-weight-medium:500;--zf-font-weight-semibold:600;--zf-font-weight-bold:700;--zf-spacing-1:.25rem;--zf-spacing-1-5:.375rem;--zf-spacing-2:.5rem;--zf-spacing-3:.75rem;--zf-spacing-4:1rem;--zf-spacing-5:1.25rem;--zf-spacing-6:1.5rem;--zf-spacing-8:2rem;--zf-spacing-16:4rem;--zf-radius-sm:.25rem;--zf-radius-md:.375rem;--zf-radius:.5rem;--zf-radius-lg:.5rem;--zf-radius-full:9999px;--zf-shadow-sm:0 1px 2px 0 #0000000d;--zf-shadow-md:0 4px 6px -1px #0000001a, 0 2px 4px -1px #0000000f;--zf-shadow-lg:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--zf-screen-sm:640px;--zf-screen-md:768px;--zf-screen-lg:1024px;--zf-screen-xl:1280px;--zf-z-base:1;--zf-z-overlay:10;--zf-z-modal:50;--zf-z-max:9999}._imagePreviewLoading_s2a11_1{background-color:var(--zf-surface-subtle);justify-content:center;align-items:center;width:100%;height:100%;display:flex}._spinner_s2a11_10{width:var(--zf-spacing-8);height:var(--zf-spacing-8);border:2px solid var(--zf-primary-color);border-radius:var(--zf-radius-full);border-top-color:#0000;animation:1s linear infinite _zf-spin_s2a11_1}._spinnerSm_s2a11_19{width:var(--zf-spacing-6);height:var(--zf-spacing-6)}@keyframes _zf-spin_s2a11_1{to{transform:rotate(360deg)}}._imagePreviewError_s2a11_28{background-color:var(--zf-danger-bg);color:var(--zf-danger-color);font-size:var(--zf-font-size-xs);text-align:center;padding:var(--zf-spacing-2);justify-content:center;align-items:center;width:100%;height:100%;display:flex}._imagePreview_s2a11_1{object-fit:cover;width:100%;height:100%}._fieldContainer_1tgn0_2{gap:var(--zf-spacing-2);font-family:var(--zf-font-family);box-sizing:border-box;flex-direction:column;display:flex}._fieldContainer_1tgn0_2 *{box-sizing:border-box}._label_1tgn0_14{color:#111827;margin-bottom:.5rem;font-size:1rem;font-weight:600}._fieldBody_1tgn0_21{gap:var(--zf-spacing-3);flex-direction:column;display:flex}._sizeSm_1tgn0_28 ._dropzone_1tgn0_28{padding:var(--zf-spacing-4);min-height:auto}._sizeMd_1tgn0_29 ._dropzone_1tgn0_28{padding:var(--zf-spacing-8) var(--zf-spacing-6)}._sizeLg_1tgn0_30 ._dropzone_1tgn0_28{padding:2.5rem 1.5rem}._variantPrimary_1tgn0_33 ._dropzone_1tgn0_28{border-color:var(--zf-primary-color,#3b82f6);background-color:var(--zf-primary-bg-subtle,#f8fafc)}._variantPrimary_1tgn0_33 ._dropzone_1tgn0_28:hover{background-color:var(--zf-primary-bg-hover,#f1f5f9);border-color:var(--zf-primary-hover,#2563eb)}._variantPrimary_1tgn0_33 ._dropzoneIconWrapper_1tgn0_35{background-color:var(--zf-primary-bg-subtle,#eff6ff);color:var(--zf-primary-color,#3b82f6)}._variantPrimary_1tgn0_33 ._dropzoneTitle_1tgn0_36{color:var(--zf-primary-color,#3b82f6)}._variantPrimary_1tgn0_33 ._browseButton_1tgn0_37{border-color:var(--zf-primary-color,#3b82f6);color:var(--zf-primary-color,#3b82f6)}._variantPrimary_1tgn0_33 ._browseButton_1tgn0_37:hover{background-color:var(--zf-primary-bg-subtle,#eff6ff)}._variantPrimary_1tgn0_33 ._fileCard_1tgn0_39{border-color:var(--zf-primary-color,#3b82f6);background-color:var(--zf-primary-bg-subtle,#f8fafc)}._variantPrimary_1tgn0_33 ._spinner_1tgn0_40{border-color:var(--zf-primary-color,#3b82f6);border-top-color:#0000}._variantSecondary_1tgn0_42 ._dropzone_1tgn0_28{border-color:var(--zf-secondary-color,#64748b);background-color:var(--zf-surface-subtle,#f8fafc)}._variantSecondary_1tgn0_42 ._dropzone_1tgn0_28:hover{background-color:var(--zf-secondary-bg-hover,#f1f5f9);border-color:var(--zf-text-color,#334155)}._variantSecondary_1tgn0_42 ._dropzoneIconWrapper_1tgn0_35{background-color:var(--zf-surface-subtle,#f1f5f9);color:var(--zf-secondary-color,#64748b)}._variantSecondary_1tgn0_42 ._dropzoneTitle_1tgn0_36{color:var(--zf-secondary-color,#64748b)}._variantSecondary_1tgn0_42 ._browseButton_1tgn0_37{border-color:var(--zf-secondary-color,#64748b);color:var(--zf-secondary-color,#64748b)}._variantSecondary_1tgn0_42 ._browseButton_1tgn0_37:hover{background-color:var(--zf-surface-subtle,#f1f5f9)}._variantSecondary_1tgn0_42 ._fileCard_1tgn0_39{border-color:var(--zf-secondary-color,#64748b);background-color:var(--zf-surface-subtle,#f8fafc)}._variantSecondary_1tgn0_42 ._spinner_1tgn0_40{border-color:var(--zf-secondary-color,#64748b);border-top-color:#0000}._dropzone_1tgn0_28{border-width:2px;border-style:var(--zf-border-style,dashed);border-radius:var(--zf-radius,12px);text-align:center;cursor:pointer;background-color:#f8fafc;border-color:#3b82f6;flex-direction:column;justify-content:center;align-items:center;padding:2.5rem 1.5rem;transition:all .2s;display:flex}._dropzone_1tgn0_28:hover{background-color:#f1f5f9}._dropzoneLoading_1tgn0_72{opacity:.5;pointer-events:none}._dropzoneContent_1tgn0_77{flex-direction:column;justify-content:center;align-items:center;gap:.5rem;display:flex}._dropzoneIconWrapper_1tgn0_35{color:#3b82f6;background-color:#eff6ff;border-radius:50%;justify-content:center;align-items:center;width:3.5rem;height:3.5rem;margin-bottom:.5rem;display:flex}._dropzoneIcon_1tgn0_35{width:1.75rem;height:1.75rem}._dropzoneTitle_1tgn0_36{color:#3b82f6;margin:0;font-size:1rem;font-weight:600}._dropzoneSub_1tgn0_109{color:#6b7280;margin:0 0 1rem;font-size:.875rem}._browseButton_1tgn0_37{color:#3b82f6;cursor:pointer;background-color:#0000;border:1px solid #3b82f6;border-radius:6px;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.875rem;font-weight:500;transition:all .2s;display:inline-flex}._browseButton_1tgn0_37:hover{background-color:#eff6ff}._fileList_1tgn0_135{flex-direction:column;gap:1rem;display:flex}._fileCard_1tgn0_39{border-radius:var(--zf-radius,12px);background-color:#fff;border:1px solid #e5e7eb;flex-direction:row;gap:1.5rem;padding:1rem;display:flex;box-shadow:0 1px 3px #0000000d}._fileCardPreview_1tgn0_152{background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;flex-shrink:0;width:240px;height:150px;position:relative;overflow:hidden}._documentPreview_1tgn0_163{color:#9ca3af;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;display:flex}._documentBadge_1tgn0_173{color:#fff;background-color:#374151;border-radius:4px;padding:2px 6px;font-size:.65rem;font-weight:700;position:absolute;bottom:8px;left:8px}._fileCardDetails_1tgn0_185{flex-direction:column;flex-grow:1;justify-content:flex-start;padding:.25rem 0;display:flex}._statusSuccess_1tgn0_193{color:#10b981;align-items:center;gap:.5rem;margin-bottom:.75rem;font-size:.875rem;font-weight:500;display:flex}._fileNameLarge_1tgn0_203{color:#111827;word-break:break-all;margin:0 0 .5rem;font-size:1.25rem;font-weight:700}._fileMeta_1tgn0_211{color:#6b7280;margin:0;font-size:.875rem}._fileActions_1tgn0_217{justify-content:flex-end;gap:1rem;margin-top:auto;display:flex}._btnActionBlue_1tgn0_224{color:#3b82f6;cursor:pointer;background-color:#0000;border:1px solid #3b82f6;border-radius:6px;align-items:center;gap:.375rem;padding:.375rem .875rem;font-size:.875rem;font-weight:500;transition:all .2s;display:inline-flex}._btnActionBlue_1tgn0_224:hover{background-color:#eff6ff}._btnActionRed_1tgn0_243{color:#ef4444;cursor:pointer;background-color:#0000;border:1px solid #ef4444;border-radius:6px;align-items:center;gap:.375rem;padding:.375rem .875rem;font-size:.875rem;font-weight:500;transition:all .2s;display:inline-flex}._btnActionRed_1tgn0_243:hover{background-color:#fef2f2}._hidden_1tgn0_263{display:none}._errorText_1tgn0_264{color:#ef4444;margin:0;font-size:.875rem;font-weight:500}._overlay_1tgn0_266{z-index:10;background-color:#ffffffb3;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._spinner_1tgn0_40{border:2px solid #3b82f6;border-top-color:#0000;border-radius:50%;width:2rem;height:2rem;animation:1s linear infinite _spin_1tgn0_40}._spinnerSm_1tgn0_286{width:1.5rem;height:1.5rem}@keyframes _spin_1tgn0_40{to{transform:rotate(360deg)}}._extractedPanel_1tgn0_296{border-radius:var(--zf-radius,8px);background-color:#f9fafb;border:1px solid #e5e7eb;margin-top:1rem;padding:1rem}._extractedTitle_1tgn0_304{color:#111827;margin:0 0 .5rem;font-size:.875rem;font-weight:600}._extractedList_1tgn0_311{grid-template-columns:1fr;gap:.5rem;display:grid}._extractedItem_1tgn0_317{border-bottom:1px solid #e5e7eb;justify-content:space-between;align-items:center;padding:.25rem 0;display:flex}._extractedItem_1tgn0_317:last-child{border-bottom:none}._extractedKey_1tgn0_329{color:#6b7280;text-transform:uppercase;font-size:.75rem;font-weight:600}._extractedVal_1tgn0_336{color:#111827;text-align:right;word-break:break-all;max-width:60%;font-size:.875rem;font-weight:500}@media (width<=640px){._fileCard_1tgn0_39{flex-direction:column;align-items:stretch;gap:1rem;padding:1rem}._fileCardPreview_1tgn0_152{width:100%;height:180px}._fileCardDetails_1tgn0_185{padding:0}._fileActions_1tgn0_217{justify-content:space-between;width:100%;margin-top:1rem}._btnActionBlue_1tgn0_224,._btnActionRed_1tgn0_243{flex:1;justify-content:center}}._gridContainer_1ga7t_1{border:1px solid var(--zf-border-color,#e2e8f0);border-radius:var(--zf-radius-md,.375rem);background:var(--zf-surface-bg,#fff);width:100%;overflow-x:auto}._gridTable_1ga7t_17{border-collapse:collapse;text-align:left;width:100%;font-family:var(--zf-font-family,inherit)}._gridHeader_1ga7t_31{background-color:var(--zf-surface-subtle,#f8fafc);border-bottom:2px solid var(--zf-border-color,#e2e8f0)}._gridHeaderCell_1ga7t_41{font-weight:var(--zf-font-weight-semibold,600);font-size:var(--zf-font-size-sm,.875rem);color:var(--zf-text-muted,#475569);text-transform:uppercase;letter-spacing:.05em;white-space:nowrap;padding:.75rem 1rem}._gridRow_1ga7t_61{border-bottom:1px solid var(--zf-border-color,#e2e8f0);transition:background-color .2s}._gridRow_1ga7t_61:hover{background-color:var(--zf-primary-bg-hover,#f1f5f9)}._gridRow_1ga7t_61:last-child{border-bottom:none}._gridCell_1ga7t_87{vertical-align:middle;border-right:1px solid var(--zf-border-color,#e2e8f0);white-space:nowrap;padding:0}._gridCell_1ga7t_87:last-child{border-right:none}._gridCell_1ga7t_87 input,._gridCell_1ga7t_87 select,._gridCell_1ga7t_87 textarea{width:100%;min-width:max-content;height:100%;font-size:var(--zf-font-size-sm,.875rem);color:var(--zf-text-color,#0f172a);box-sizing:border-box;white-space:nowrap;background:0 0;border:none;outline:none;padding:.75rem 1rem;transition:background-color .2s}._gridCell_1ga7t_87:focus-within{box-shadow:inset 0 0 0 2px var(--zf-primary-color,#3b82f6);background-color:var(--zf-surface-bg,#fff)}._gridCell_1ga7t_87 select{cursor:pointer;appearance:none;background-image:url(data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23131313%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E);background-position:right .7em top 50%,0 0;background-repeat:no-repeat,repeat;background-size:.65em,100%;padding-right:2rem}._gridFooter_1ga7t_189{background-color:var(--zf-surface-subtle,#f8fafc);border-top:2px solid var(--zf-border-color,#e2e8f0);font-weight:var(--zf-font-weight-semibold,600)}._gridFooterCell_1ga7t_201{font-size:var(--zf-font-size-sm,.875rem);color:var(--zf-text-color,#0f172a);padding:.75rem 1rem}._addRowButton_1ga7t_213{background-color:var(--zf-surface-bg,#fff);border:1px dashed var(--zf-border-color,#cbd5e1);color:var(--zf-text-muted,#475569);border-radius:var(--zf-radius-md,.375rem);cursor:pointer;font-weight:var(--zf-font-weight-medium,500);width:calc(100% - 2rem);margin:1rem;padding:.5rem 1rem;transition:all .2s;display:block}._addRowButton_1ga7t_213:hover{background-color:var(--zf-surface-subtle,#f8fafc);border-color:var(--zf-text-muted,#475569);color:var(--zf-text-color,#0f172a)}._deleteRowButton_1ga7t_253{color:var(--zf-danger-color,#ef4444);border:1px solid var(--zf-danger-color,#ef4444);border-radius:var(--zf-radius-sm,.25rem);cursor:pointer;font-size:var(--zf-font-size-sm,.875rem);background-color:#0000;padding:.35rem .75rem;transition:all .2s}._deleteRowButton_1ga7t_253:hover{background-color:var(--zf-danger-bg-hover,#fef2f2)}._actionCell_1ga7t_283{text-align:center;width:80px}._variant-compact_1ga7t_295 ._gridCell_1ga7t_87 input,._variant-compact_1ga7t_295 ._gridCell_1ga7t_87 select,._variant-compact_1ga7t_295 ._gridCell_1ga7t_87 textarea{padding:.25rem .5rem}._variant-compact_1ga7t_295 ._gridCell_1ga7t_87 select{padding-right:1.75rem}._variant-compact_1ga7t_295 ._gridHeaderCell_1ga7t_41,._variant-compact_1ga7t_295 ._gridFooterCell_1ga7t_201{padding:.5rem}._variant-striped_1ga7t_327 ._gridRow_1ga7t_61:nth-child(2n){background-color:var(--zf-primary-bg-subtle,#3b82f605)}._desktopOnly_1ga7t_337{display:block}._mobileOnly_1ga7t_343{display:none}@media (width<=768px){._desktopOnly_1ga7t_337{display:none!important}._mobileOnly_1ga7t_343{display:block!important}}._mobileListContainer_1ga7t_371{flex-direction:column;gap:1rem;display:flex}._mobileCard_1ga7t_383{border:1px solid var(--zf-border-color,#e2e8f0);border-radius:var(--zf-radius-md,.375rem);background:var(--zf-surface-bg,#fff);scroll-margin-top:2rem;overflow:hidden;box-shadow:0 1px 2px #0000000d}._mobileCardRow_1ga7t_401{border-bottom:1px solid var(--zf-border-color,#e2e8f0);flex-direction:column;display:flex}._mobileCardRow_1ga7t_401:last-child{border-bottom:none}._mobileCardLabel_1ga7t_421{font-size:var(--zf-font-size-xs,.75rem);font-weight:var(--zf-font-weight-semibold,600);color:var(--zf-text-muted,#64748b);text-transform:uppercase;letter-spacing:.05em;padding:.5rem 1rem 0}._mobileCardInputWrapper_1ga7t_439{border-radius:var(--zf-radius-sm,.25rem);margin:0 .5rem;padding:0 .5rem .5rem;transition:all .2s}._mobileCardInputWrapper_1ga7t_439 input,._mobileCardInputWrapper_1ga7t_439 select,._mobileCardInputWrapper_1ga7t_439 textarea{width:100%;font-size:var(--zf-font-size-md,1rem);color:var(--zf-text-color,#0f172a);box-sizing:border-box;background:0 0;border:none;outline:none;padding:.5rem}._mobileCardInputWrapper_1ga7t_439 select{cursor:pointer;appearance:none;background-image:url(data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23131313%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E);background-position:right .7em top 50%,0 0;background-repeat:no-repeat,repeat;background-size:.65em,100%;padding-right:2rem}._mobileCardInputWrapper_1ga7t_439:focus-within{box-shadow:inset 0 0 0 2px var(--zf-primary-color,#3b82f6);background-color:var(--zf-surface-bg,#fff)}._mobileDeleteBtnWrapper_1ga7t_513{background-color:var(--zf-surface-subtle,#f8fafc);border-top:1px solid var(--zf-border-color,#e2e8f0);justify-content:flex-end;padding:.75rem 1rem;display:flex}._mobileAggregationsCard_1ga7t_529{background-color:var(--zf-surface-subtle,#f8fafc);border-radius:var(--zf-radius-md,.375rem);border:1px solid var(--zf-border-color,#e2e8f0);padding:1rem}._mobileAggregationRow_1ga7t_543{border-bottom:1px dashed var(--zf-border-color,#cbd5e1);justify-content:space-between;padding:.5rem 0;display:flex}._mobileAggregationRow_1ga7t_543:last-child{border-bottom:none}._mobileAggregationLabel_1ga7t_565{font-weight:var(--zf-font-weight-semibold,600);color:var(--zf-text-muted,#475569);text-transform:uppercase;font-size:var(--zf-font-size-xs,.75rem)}._mobileAggregationValue_1ga7t_579{font-weight:var(--zf-font-weight-bold,700);color:var(--zf-text-color,#0f172a)}._mobileSummaryCard_1ga7t_591{cursor:pointer;background-color:var(--zf-surface-bg,#fff);border:1px solid var(--zf-border-color,#e2e8f0);border-radius:var(--zf-radius-md,.375rem);justify-content:space-between;padding:1rem;display:flex;box-shadow:0 1px 2px #0000000d}._mobileSummaryCard_1ga7t_591:hover{background-color:var(--zf-primary-bg-subtle,#f8fafc)}._mobileSummaryLeft_1ga7t_621{flex-direction:column;gap:.5rem;display:flex}._mobileSummaryRightWrapper_1ga7t_633{flex-direction:row;align-items:center;gap:1rem;display:flex}._mobileSummaryActions_1ga7t_647{gap:.25rem;display:flex}._mobileIconButton_1ga7t_657{border-radius:var(--zf-radius-sm,.25rem);width:28px;height:28px;color:var(--zf-text-muted,#94a3b8);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;transition:all .2s;display:flex}._mobileIconButton_1ga7t_657:hover{background-color:var(--zf-surface-subtle,#f1f5f9);color:var(--zf-text-color,#334155)}._mobileIconDanger_1ga7t_697:hover{color:#ef4444;background-color:#ef44441a}._mobileSummaryRight_1ga7t_633{flex-direction:column;align-items:flex-end;gap:.25rem;display:flex}._mobileSummaryTitle_1ga7t_721{font-size:var(--zf-font-size-md,1rem);font-weight:var(--zf-font-weight-bold,700);color:var(--zf-text-color,#0f172a)}._mobileSummaryChip_1ga7t_733{background-color:var(--zf-primary-bg-subtle,#e0f2fe);color:var(--zf-primary-color,#0369a1);border-radius:var(--zf-radius-full,9999px);font-size:var(--zf-font-size-xs,.75rem);font-weight:var(--zf-font-weight-medium,500);padding:.25rem .75rem;display:inline-block}._mobileSummaryValueRow_1ga7t_753{font-size:var(--zf-font-size-sm,.875rem);color:var(--zf-text-muted,#475569)}._mobileSummaryValueRow_1ga7t_753 span{font-weight:var(--zf-font-weight-semibold,600);color:var(--zf-text-color,#0f172a);margin-left:.25rem}
2
2
  /*$vite$:1*/
package/dist/src/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { useEffect as e, useRef as t, useState as n } from "react";
2
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
3
- import { CheckCircle2 as a, File as o, FileText as s, FileUp as c, Folder as l, RefreshCw as u, Trash2 as d } from "lucide-react";
1
+ import { useEffect as e, useMemo as t, useRef as n, useState as r } from "react";
2
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
3
+ import { CheckCircle2 as s, File as c, FileText as l, FileUp as u, Folder as d, RefreshCw as f, Trash2 as p } from "lucide-react";
4
4
  //#region src/ZinoClient.js
5
- var f = "field_library_token", p = "field_library_user", m = class {
5
+ var m = "field_library_token", h = "field_library_user", g = class {
6
6
  constructor({ baseUrl: e, appId: t, onAuthError: n }) {
7
7
  if (!e) throw Error("baseUrl is required");
8
8
  if (!t) throw Error("appId is required");
9
9
  if (this.baseUrl = e.replace(/\/+$/, ""), this.appId = t, this.onAuthError = n, this.token = null, this.user = null, typeof window < "u") {
10
- this.token = localStorage.getItem(f);
10
+ this.token = localStorage.getItem(m);
11
11
  try {
12
- let e = localStorage.getItem(p);
12
+ let e = localStorage.getItem(h);
13
13
  e && (this.user = JSON.parse(e));
14
14
  } catch {
15
15
  this.user = null;
@@ -20,7 +20,7 @@ var f = "field_library_token", p = "field_library_user", m = class {
20
20
  this.onAuthError = e;
21
21
  }
22
22
  setToken(e) {
23
- this.token = e, !(typeof window > "u") && (e ? localStorage.setItem(f, e) : (localStorage.removeItem(f), localStorage.removeItem(p), this.user = null));
23
+ this.token = e, !(typeof window > "u") && (e ? localStorage.setItem(m, e) : (localStorage.removeItem(m), localStorage.removeItem(h), this.user = null));
24
24
  }
25
25
  getToken() {
26
26
  return this.token;
@@ -70,7 +70,7 @@ var f = "field_library_token", p = "field_library_user", m = class {
70
70
  password: t,
71
71
  ...n ? { org_id: Number(n) } : {}
72
72
  });
73
- return this.setToken(r.token), typeof window < "u" && r.user && (this.user = r.user, localStorage.setItem(p, JSON.stringify(r.user))), r;
73
+ return this.setToken(r.token), typeof window < "u" && r.user && (this.user = r.user, localStorage.setItem(h, JSON.stringify(r.user))), r;
74
74
  }
75
75
  logout() {
76
76
  this.setToken(null);
@@ -80,7 +80,7 @@ var f = "field_library_token", p = "field_library_user", m = class {
80
80
  return this.user && (this.user = {
81
81
  ...this.user,
82
82
  ...e
83
- }, typeof window < "u" && localStorage.setItem(p, JSON.stringify(this.user))), e;
83
+ }, typeof window < "u" && localStorage.setItem(h, JSON.stringify(this.user))), e;
84
84
  }
85
85
  currentUser() {
86
86
  if (!this.token) return null;
@@ -241,59 +241,59 @@ var f = "field_library_token", p = "field_library_user", m = class {
241
241
  };
242
242
  return await n.blob();
243
243
  }
244
- }, h = {
244
+ }, _ = {
245
245
  imagePreviewLoading: "_imagePreviewLoading_s2a11_1",
246
246
  spinner: "_spinner_s2a11_10",
247
247
  "zf-spin": "_zf-spin_s2a11_1",
248
248
  spinnerSm: "_spinnerSm_s2a11_19",
249
249
  imagePreviewError: "_imagePreviewError_s2a11_28",
250
250
  imagePreview: "_imagePreview_s2a11_1"
251
- }, g = (...e) => e.filter(Boolean).join(" ");
252
- function _({ file: t, client: i, className: a = "" }) {
253
- let [o, s] = n(null), [c, l] = n(!1), [u, d] = n(!1);
251
+ }, v = (...e) => e.filter(Boolean).join(" ");
252
+ function y({ file: t, client: n, className: i = "" }) {
253
+ let [o, s] = r(null), [c, l] = r(!1), [u, d] = r(!1);
254
254
  return e(() => {
255
- let e = null, n = !0;
256
- async function r() {
255
+ let e = null, r = !0;
256
+ async function i() {
257
257
  if (!t) {
258
- n && s(null);
258
+ r && s(null);
259
259
  return;
260
260
  }
261
261
  if (t instanceof File) {
262
- e = URL.createObjectURL(t), n && s(e);
262
+ e = URL.createObjectURL(t), r && s(e);
263
263
  return;
264
264
  }
265
265
  if (t.uuid) {
266
- if (!i) {
267
- console.warn("ImagePreview: 'client' prop is missing, cannot load remote preview"), n && d(!0);
266
+ if (!n) {
267
+ console.warn("ImagePreview: 'client' prop is missing, cannot load remote preview"), r && d(!0);
268
268
  return;
269
269
  }
270
- n && l(!0);
270
+ r && l(!0);
271
271
  try {
272
- let r = await i.getFilePreviewBlob(t.uuid);
273
- e = URL.createObjectURL(r), n && s(e);
272
+ let i = await n.getFilePreviewBlob(t.uuid);
273
+ e = URL.createObjectURL(i), r && s(e);
274
274
  } catch (e) {
275
- console.error("Failed to load image preview:", e), n && d(!0);
275
+ console.error("Failed to load image preview:", e), r && d(!0);
276
276
  } finally {
277
- n && l(!1);
277
+ r && l(!1);
278
278
  }
279
279
  }
280
280
  }
281
- return r(), () => {
282
- n = !1, e && URL.revokeObjectURL(e);
281
+ return i(), () => {
282
+ r = !1, e && URL.revokeObjectURL(e);
283
283
  };
284
- }, [t, i]), c ? /* @__PURE__ */ r("div", {
285
- className: g(h.imagePreviewLoading, a),
286
- children: /* @__PURE__ */ r("div", { className: g(h.spinner, h.spinnerSm) })
287
- }) : u || !o ? /* @__PURE__ */ r("div", {
288
- className: g(h.imagePreviewError, a),
284
+ }, [t, n]), c ? /* @__PURE__ */ a("div", {
285
+ className: v(_.imagePreviewLoading, i),
286
+ children: /* @__PURE__ */ a("div", { className: v(_.spinner, _.spinnerSm) })
287
+ }) : u || !o ? /* @__PURE__ */ a("div", {
288
+ className: v(_.imagePreviewError, i),
289
289
  children: u ? "Preview failed" : "No preview"
290
- }) : /* @__PURE__ */ r("img", {
290
+ }) : /* @__PURE__ */ a("img", {
291
291
  src: o,
292
292
  alt: "Preview",
293
- className: g(h.imagePreview, a)
293
+ className: v(_.imagePreview, i)
294
294
  });
295
295
  }
296
- var v = {
296
+ var b = {
297
297
  fieldContainer: "_fieldContainer_1tgn0_2",
298
298
  label: "_label_1tgn0_14",
299
299
  fieldBody: "_fieldBody_1tgn0_21",
@@ -334,155 +334,155 @@ var v = {
334
334
  extractedItem: "_extractedItem_1tgn0_317",
335
335
  extractedKey: "_extractedKey_1tgn0_329",
336
336
  extractedVal: "_extractedVal_1tgn0_336"
337
- }, y = (...e) => e.filter(Boolean).join(" "), b = (e) => {
337
+ }, x = (...e) => e.filter(Boolean).join(" "), S = (e) => {
338
338
  let t = e.name || e.original_name || "", n = e.type || e.mime_type || "";
339
- return t.endsWith(".pdf") || n.includes("pdf") || t.match(/\.(doc|docx|txt)$/i) ? /* @__PURE__ */ r(s, { className: v.fileIcon }) : /* @__PURE__ */ r(o, { className: v.fileIcon });
339
+ return t.endsWith(".pdf") || n.includes("pdf") || t.match(/\.(doc|docx|txt)$/i) ? /* @__PURE__ */ a(l, { className: b.fileIcon }) : /* @__PURE__ */ a(c, { className: b.fileIcon });
340
340
  };
341
- function x({ label: e, value: o, onChange: s, onExtracted: f, onProcess: p, client: m, showExtracted: h = !0, accept: g = "image/*,application/pdf", variant: x = "primary", size: S = "md", previewSize: C = "md", width: w = "full", className: T = "" }) {
342
- let [E, D] = n(!1), [O, k] = n(null), [A, j] = n(null), M = t(null), N = Array.isArray(o) ? o : o ? [o] : [], P = (e) => {
343
- e.file && s(e.file), e.extract_error ? k(e.extract_error) : e.extracted && (j(e.extracted), f && f({ ...e.extracted }));
344
- }, F = async (e) => {
341
+ function C({ label: e, value: t, onChange: i, onExtracted: c, onProcess: l, client: m, showExtracted: h = !0, accept: g = "image/*,application/pdf", variant: _ = "primary", size: v = "md", width: C = "full", className: w = "" }) {
342
+ let [T, E] = r(!1), [D, O] = r(null), [k, A] = r(null), j = n(null), M = Array.isArray(t) ? t : t ? [t] : [], N = (e) => {
343
+ e.file && i(e.file), e.extract_error ? O(e.extract_error) : e.extracted && (A(e.extracted), c && c({ ...e.extracted }));
344
+ }, P = async (e) => {
345
345
  let t = e.target.files?.[0];
346
346
  if (t) {
347
- D(!0), k(null), j(null);
347
+ E(!0), O(null), A(null);
348
348
  try {
349
- let e = await p(t);
350
- e && e.file && !e.file.size && !e.file.file_size && (e.file.size = t.size), P(e);
349
+ let e = await l(t);
350
+ e && e.file && !e.file.size && !e.file.file_size && (e.file.size = t.size), N(e);
351
351
  } catch (e) {
352
- console.error(e), k("OCR extraction failed");
352
+ console.error(e), O("OCR extraction failed");
353
353
  } finally {
354
- D(!1), M.current && (M.current.value = "");
354
+ E(!1), j.current && (j.current.value = "");
355
355
  }
356
356
  }
357
- }, I = async (e) => {
358
- D(!0), k(null);
357
+ }, F = async (e) => {
358
+ E(!0), O(null);
359
359
  try {
360
- let t = await p(e);
361
- t && t.file && !t.file.size && !t.file.file_size && (t.file.size = e.size || e.file_size), P(t);
360
+ let t = await l(e);
361
+ t && t.file && !t.file.size && !t.file.file_size && (t.file.size = e.size || e.file_size), N(t);
362
362
  } catch (e) {
363
- console.error(e), k("OCR extraction retry failed");
363
+ console.error(e), O("OCR extraction retry failed");
364
364
  } finally {
365
- D(!1);
365
+ E(!1);
366
366
  }
367
- }, L = (e) => {
368
- let t = [...N];
369
- if (t.splice(e, 1), s(t.length === 0 ? null : t), t.length === 0) {
370
- if (A && f) {
367
+ }, I = (e) => {
368
+ let t = [...M];
369
+ if (t.splice(e, 1), i(t.length === 0 ? null : t), t.length === 0) {
370
+ if (k && c) {
371
371
  let e = {};
372
- for (let t of Object.keys(A)) e[t] = "";
373
- f(e);
372
+ for (let t of Object.keys(k)) e[t] = "";
373
+ c(e);
374
374
  }
375
- j(null);
375
+ A(null);
376
376
  }
377
- }, R = (e) => e instanceof File ? e.type.startsWith("image/") : e.mime_type ? e.mime_type.startsWith("image/") : e.original_name ? /\.(jpg|jpeg|png|gif|webp)$/i.test(e.original_name) : !1, z = w === "full" ? { width: "100%" } : { width: w };
378
- return /* @__PURE__ */ i("div", {
379
- className: y(v.fieldContainer, v[`variant${x.charAt(0).toUpperCase() + x.slice(1)}`], v[`size${S.charAt(0).toUpperCase() + S.slice(1)}`], v[`previewSize${C.charAt(0).toUpperCase() + C.slice(1)}`], T),
380
- style: z,
381
- children: [/* @__PURE__ */ r("label", {
382
- className: v.label,
377
+ }, L = (e) => e instanceof File ? e.type.startsWith("image/") : e.mime_type ? e.mime_type.startsWith("image/") : e.original_name ? /\.(jpg|jpeg|png|gif|webp)$/i.test(e.original_name) : !1, R = C === "full" ? { width: "100%" } : { width: C };
378
+ return /* @__PURE__ */ o("div", {
379
+ className: x(b.fieldContainer, b[`variant${_.charAt(0).toUpperCase() + _.slice(1)}`], b[`size${v.charAt(0).toUpperCase() + v.slice(1)}`], w),
380
+ style: R,
381
+ children: [/* @__PURE__ */ a("label", {
382
+ className: b.label,
383
383
  children: e
384
- }), /* @__PURE__ */ i("div", {
385
- className: v.fieldBody,
384
+ }), /* @__PURE__ */ o("div", {
385
+ className: b.fieldBody,
386
386
  children: [
387
- /* @__PURE__ */ r("input", {
388
- ref: M,
387
+ /* @__PURE__ */ a("input", {
388
+ ref: j,
389
389
  type: "file",
390
- onChange: F,
391
- disabled: E,
390
+ onChange: P,
391
+ disabled: T,
392
392
  accept: g,
393
- className: v.hidden
393
+ className: b.hidden
394
394
  }),
395
- N.length === 0 && /* @__PURE__ */ r("div", {
396
- className: y(v.dropzone, E && v.dropzoneLoading),
397
- onClick: () => M.current?.click(),
398
- children: E ? /* @__PURE__ */ i("div", {
399
- className: v.dropzoneContent,
400
- children: [/* @__PURE__ */ r("div", { className: y(v.spinner, v.spinnerSm, v.dropzoneIconWrapper) }), /* @__PURE__ */ r("p", {
401
- className: v.dropzoneTitle,
395
+ M.length === 0 && /* @__PURE__ */ a("div", {
396
+ className: x(b.dropzone, T && b.dropzoneLoading),
397
+ onClick: () => j.current?.click(),
398
+ children: T ? /* @__PURE__ */ o("div", {
399
+ className: b.dropzoneContent,
400
+ children: [/* @__PURE__ */ a("div", { className: x(b.spinner, b.spinnerSm, b.dropzoneIconWrapper) }), /* @__PURE__ */ a("p", {
401
+ className: b.dropzoneTitle,
402
402
  children: "Extracting OCR data..."
403
403
  })]
404
- }) : /* @__PURE__ */ i("div", {
405
- className: v.dropzoneContent,
404
+ }) : /* @__PURE__ */ o("div", {
405
+ className: b.dropzoneContent,
406
406
  children: [
407
- /* @__PURE__ */ r("div", {
408
- className: v.dropzoneIconWrapper,
409
- children: /* @__PURE__ */ r(c, { className: v.dropzoneIcon })
407
+ /* @__PURE__ */ a("div", {
408
+ className: b.dropzoneIconWrapper,
409
+ children: /* @__PURE__ */ a(u, { className: b.dropzoneIcon })
410
410
  }),
411
- /* @__PURE__ */ r("p", {
412
- className: v.dropzoneTitle,
411
+ /* @__PURE__ */ a("p", {
412
+ className: b.dropzoneTitle,
413
413
  children: "Drop a document to extract"
414
414
  }),
415
- /* @__PURE__ */ r("p", {
416
- className: v.dropzoneSub,
415
+ /* @__PURE__ */ a("p", {
416
+ className: b.dropzoneSub,
417
417
  children: "PNG, JPG, JPEG or PDF (Max 5MB)"
418
418
  }),
419
- /* @__PURE__ */ i("button", {
419
+ /* @__PURE__ */ o("button", {
420
420
  type: "button",
421
- className: v.browseButton,
422
- children: [/* @__PURE__ */ r(l, { size: 16 }), "Browse Files"]
421
+ className: b.browseButton,
422
+ children: [/* @__PURE__ */ a(d, { size: 16 }), "Browse Files"]
423
423
  })
424
424
  ]
425
425
  })
426
426
  }),
427
- N.length > 0 && /* @__PURE__ */ r("div", {
428
- className: v.fileList,
429
- children: N.map((e, t) => {
430
- let n = e.name || e.original_name || "Document", o = "", s = e?.size || e?.file_size;
431
- s && (o = s > 1048576 ? `${(s / 1048576).toFixed(1)} MB` : `${(s / 1024).toFixed(1)} KB`);
427
+ M.length > 0 && /* @__PURE__ */ a("div", {
428
+ className: b.fileList,
429
+ children: M.map((e, t) => {
430
+ let n = e.name || e.original_name || "Document", r = "", i = e?.size || e?.file_size;
431
+ i && (r = i > 1048576 ? `${(i / 1048576).toFixed(1)} MB` : `${(i / 1024).toFixed(1)} KB`);
432
432
  let c = n.split(".").pop()?.toUpperCase() || "FILE";
433
- return /* @__PURE__ */ i("div", {
434
- className: v.fileCard,
435
- children: [/* @__PURE__ */ i("div", {
436
- className: v.fileCardPreview,
437
- children: [R(e) ? /* @__PURE__ */ r(_, {
433
+ return /* @__PURE__ */ o("div", {
434
+ className: b.fileCard,
435
+ children: [/* @__PURE__ */ o("div", {
436
+ className: b.fileCardPreview,
437
+ children: [L(e) ? /* @__PURE__ */ a(y, {
438
438
  file: e,
439
439
  client: m
440
- }) : /* @__PURE__ */ i("div", {
441
- className: v.documentPreview,
442
- children: [b(e), /* @__PURE__ */ r("span", {
443
- className: v.documentBadge,
440
+ }) : /* @__PURE__ */ o("div", {
441
+ className: b.documentPreview,
442
+ children: [S(e), /* @__PURE__ */ a("span", {
443
+ className: b.documentBadge,
444
444
  children: "PDF"
445
445
  })]
446
- }), E && /* @__PURE__ */ r("div", {
447
- className: v.overlay,
448
- children: /* @__PURE__ */ r("div", { className: v.spinner })
446
+ }), T && /* @__PURE__ */ a("div", {
447
+ className: b.overlay,
448
+ children: /* @__PURE__ */ a("div", { className: b.spinner })
449
449
  })]
450
- }), /* @__PURE__ */ i("div", {
451
- className: v.fileCardDetails,
450
+ }), /* @__PURE__ */ o("div", {
451
+ className: b.fileCardDetails,
452
452
  children: [
453
- /* @__PURE__ */ i("div", {
454
- className: v.statusSuccess,
455
- children: [/* @__PURE__ */ r(a, { size: 16 }), /* @__PURE__ */ r("span", { children: "Document uploaded successfully" })]
453
+ /* @__PURE__ */ o("div", {
454
+ className: b.statusSuccess,
455
+ children: [/* @__PURE__ */ a(s, { size: 16 }), /* @__PURE__ */ a("span", { children: "Document uploaded successfully" })]
456
456
  }),
457
- /* @__PURE__ */ r("h4", {
458
- className: v.fileNameLarge,
457
+ /* @__PURE__ */ a("h4", {
458
+ className: b.fileNameLarge,
459
459
  title: n,
460
460
  children: n
461
461
  }),
462
- /* @__PURE__ */ i("p", {
463
- className: v.fileMeta,
462
+ /* @__PURE__ */ o("p", {
463
+ className: b.fileMeta,
464
464
  children: [
465
465
  c,
466
466
  " • ",
467
- o
467
+ r
468
468
  ]
469
469
  }),
470
- !E && /* @__PURE__ */ i("div", {
471
- className: v.fileActions,
472
- children: [/* @__PURE__ */ i("button", {
470
+ !T && /* @__PURE__ */ o("div", {
471
+ className: b.fileActions,
472
+ children: [/* @__PURE__ */ o("button", {
473
473
  type: "button",
474
474
  onClick: (t) => {
475
- t.stopPropagation(), I(e);
475
+ t.stopPropagation(), F(e);
476
476
  },
477
- className: v.btnActionBlue,
478
- children: [/* @__PURE__ */ r(u, { size: 14 }), " Re-extract"]
479
- }), /* @__PURE__ */ i("button", {
477
+ className: b.btnActionBlue,
478
+ children: [/* @__PURE__ */ a(f, { size: 14 }), " Re-extract"]
479
+ }), /* @__PURE__ */ o("button", {
480
480
  type: "button",
481
481
  onClick: (e) => {
482
- e.stopPropagation(), L(t);
482
+ e.stopPropagation(), I(t);
483
483
  },
484
- className: v.btnActionRed,
485
- children: [/* @__PURE__ */ r(d, { size: 14 }), " Delete"]
484
+ className: b.btnActionRed,
485
+ children: [/* @__PURE__ */ a(p, { size: 14 }), " Delete"]
486
486
  })]
487
487
  })
488
488
  ]
@@ -490,37 +490,37 @@ function x({ label: e, value: o, onChange: s, onExtracted: f, onProcess: p, clie
490
490
  }, t);
491
491
  })
492
492
  }),
493
- O && /* @__PURE__ */ i("div", {
494
- className: v.fieldBody,
495
- children: [/* @__PURE__ */ r("p", {
496
- className: v.errorText,
497
- children: O
498
- }), N.length > 0 && !A && /* @__PURE__ */ r("button", {
493
+ D && /* @__PURE__ */ o("div", {
494
+ className: b.fieldBody,
495
+ children: [/* @__PURE__ */ a("p", {
496
+ className: b.errorText,
497
+ children: D
498
+ }), M.length > 0 && !k && /* @__PURE__ */ a("button", {
499
499
  type: "button",
500
- onClick: () => I(N[0]),
501
- disabled: E,
502
- className: v.btnActionBlue,
500
+ onClick: () => F(M[0]),
501
+ disabled: T,
502
+ className: b.btnActionBlue,
503
503
  style: {
504
504
  alignSelf: "flex-start",
505
505
  marginTop: "0.5rem"
506
506
  },
507
- children: E ? "Retrying..." : "Retry Extraction"
507
+ children: T ? "Retrying..." : "Retry Extraction"
508
508
  })]
509
509
  }),
510
- h && A && /* @__PURE__ */ i("div", {
511
- className: v.extractedPanel,
512
- children: [/* @__PURE__ */ r("p", {
513
- className: v.extractedTitle,
510
+ h && k && /* @__PURE__ */ o("div", {
511
+ className: b.extractedPanel,
512
+ children: [/* @__PURE__ */ a("p", {
513
+ className: b.extractedTitle,
514
514
  children: "Extracted Data"
515
- }), /* @__PURE__ */ r("div", {
516
- className: v.extractedList,
517
- children: Object.entries(A).map(([e, t]) => /* @__PURE__ */ i("div", {
518
- className: v.extractedItem,
519
- children: [/* @__PURE__ */ r("span", {
520
- className: v.extractedKey,
515
+ }), /* @__PURE__ */ a("div", {
516
+ className: b.extractedList,
517
+ children: Object.entries(k).map(([e, t]) => /* @__PURE__ */ o("div", {
518
+ className: b.extractedItem,
519
+ children: [/* @__PURE__ */ a("span", {
520
+ className: b.extractedKey,
521
521
  children: e.replace(/_/g, " ")
522
- }), /* @__PURE__ */ r("span", {
523
- className: v.extractedVal,
522
+ }), /* @__PURE__ */ a("span", {
523
+ className: b.extractedVal,
524
524
  children: String(t)
525
525
  })]
526
526
  }, e))
@@ -530,5 +530,353 @@ function x({ label: e, value: o, onChange: s, onExtracted: f, onProcess: p, clie
530
530
  })]
531
531
  });
532
532
  }
533
+ var w = {
534
+ gridContainer: "_gridContainer_1ga7t_1",
535
+ gridTable: "_gridTable_1ga7t_17",
536
+ gridHeader: "_gridHeader_1ga7t_31",
537
+ gridHeaderCell: "_gridHeaderCell_1ga7t_41",
538
+ gridRow: "_gridRow_1ga7t_61",
539
+ gridCell: "_gridCell_1ga7t_87",
540
+ gridFooter: "_gridFooter_1ga7t_189",
541
+ gridFooterCell: "_gridFooterCell_1ga7t_201",
542
+ addRowButton: "_addRowButton_1ga7t_213",
543
+ deleteRowButton: "_deleteRowButton_1ga7t_253",
544
+ actionCell: "_actionCell_1ga7t_283",
545
+ "variant-compact": "_variant-compact_1ga7t_295",
546
+ "variant-striped": "_variant-striped_1ga7t_327",
547
+ desktopOnly: "_desktopOnly_1ga7t_337",
548
+ mobileOnly: "_mobileOnly_1ga7t_343",
549
+ mobileListContainer: "_mobileListContainer_1ga7t_371",
550
+ mobileCard: "_mobileCard_1ga7t_383",
551
+ mobileCardRow: "_mobileCardRow_1ga7t_401",
552
+ mobileCardLabel: "_mobileCardLabel_1ga7t_421",
553
+ mobileCardInputWrapper: "_mobileCardInputWrapper_1ga7t_439",
554
+ mobileDeleteBtnWrapper: "_mobileDeleteBtnWrapper_1ga7t_513",
555
+ mobileAggregationsCard: "_mobileAggregationsCard_1ga7t_529",
556
+ mobileAggregationRow: "_mobileAggregationRow_1ga7t_543",
557
+ mobileAggregationLabel: "_mobileAggregationLabel_1ga7t_565",
558
+ mobileAggregationValue: "_mobileAggregationValue_1ga7t_579",
559
+ mobileSummaryCard: "_mobileSummaryCard_1ga7t_591",
560
+ mobileSummaryLeft: "_mobileSummaryLeft_1ga7t_621",
561
+ mobileSummaryRightWrapper: "_mobileSummaryRightWrapper_1ga7t_633",
562
+ mobileSummaryActions: "_mobileSummaryActions_1ga7t_647",
563
+ mobileIconButton: "_mobileIconButton_1ga7t_657",
564
+ mobileIconDanger: "_mobileIconDanger_1ga7t_697",
565
+ mobileSummaryRight: "_mobileSummaryRight_1ga7t_633",
566
+ mobileSummaryTitle: "_mobileSummaryTitle_1ga7t_721",
567
+ mobileSummaryChip: "_mobileSummaryChip_1ga7t_733",
568
+ mobileSummaryValueRow: "_mobileSummaryValueRow_1ga7t_753"
569
+ }, T = ({ value: e, column: t, rowData: n, rowIndex: r, onChange: i }) => /* @__PURE__ */ a("td", {
570
+ className: w.gridCell,
571
+ children: t.render ? t.render({
572
+ value: e,
573
+ onChange: (e) => {
574
+ i(n.id, t.key, e);
575
+ },
576
+ rowData: n,
577
+ rowIndex: r,
578
+ column: t
579
+ }) : /* @__PURE__ */ a("span", { children: e })
580
+ }), E = ({ rowData: e, rowIndex: t, columns: n, onChange: r, onDeleteRow: i }) => /* @__PURE__ */ o("tr", {
581
+ className: w.gridRow,
582
+ children: [n.map((n) => /* @__PURE__ */ a(T, {
583
+ value: e[n.key],
584
+ column: n,
585
+ rowData: e,
586
+ rowIndex: t,
587
+ onChange: r
588
+ }, n.key)), i && /* @__PURE__ */ a("td", {
589
+ className: `${w.gridCell} ${w.actionCell}`,
590
+ children: /* @__PURE__ */ a("button", {
591
+ type: "button",
592
+ className: w.deleteRowButton,
593
+ onClick: () => i(e.id),
594
+ title: "Remove Row",
595
+ children: "Delete"
596
+ })
597
+ })]
598
+ }), D = ({ data: t, columns: r, onChange: i, aggregations: s, onAddRow: c, onDeleteRow: l, variant: u, showAggregations: d = !0 }) => {
599
+ let f = (e) => typeof d == "boolean" ? d : !Array.isArray(d) || d.includes(e), p = r.some((e) => e.aggregation && f(e.key) && s[e.key] !== void 0), m = n(t ? t.length : 0), h = n(null);
600
+ e(() => {
601
+ t && t.length > m.current && setTimeout(() => {
602
+ if (h.current) {
603
+ let e = h.current.querySelectorAll("tbody tr");
604
+ if (e.length > 0) {
605
+ let t = e[e.length - 1].querySelector("input, select, textarea");
606
+ t && t.focus();
607
+ }
608
+ }
609
+ }, 0), m.current = t ? t.length : 0;
610
+ }, [t]);
611
+ let g = w[`variant-${u}`] || "";
612
+ return /* @__PURE__ */ o("div", {
613
+ className: `${w.gridContainer} ${g}`,
614
+ children: [/* @__PURE__ */ o("table", {
615
+ className: w.gridTable,
616
+ ref: h,
617
+ children: [
618
+ /* @__PURE__ */ a("thead", {
619
+ className: w.gridHeader,
620
+ children: /* @__PURE__ */ o("tr", { children: [r.map((e) => /* @__PURE__ */ a("th", {
621
+ className: w.gridHeaderCell,
622
+ children: e.title || e.key
623
+ }, e.key)), l && /* @__PURE__ */ a("th", { className: `${w.gridHeaderCell} ${w.actionCell}` })] })
624
+ }),
625
+ /* @__PURE__ */ a("tbody", { children: t.map((e, t) => /* @__PURE__ */ a(E, {
626
+ rowData: e,
627
+ rowIndex: t,
628
+ columns: r,
629
+ onChange: i,
630
+ onDeleteRow: l
631
+ }, e.id || t)) }),
632
+ p && /* @__PURE__ */ a("tfoot", {
633
+ className: w.gridFooter,
634
+ children: /* @__PURE__ */ o("tr", { children: [r.map((e, t) => {
635
+ let n = t === 0, r = f(e.key) ? s[e.key] : void 0;
636
+ return /* @__PURE__ */ a("td", {
637
+ className: w.gridFooterCell,
638
+ children: r === void 0 ? n ? "Total" : "" : r
639
+ }, e.key);
640
+ }), l && /* @__PURE__ */ a("td", { className: w.gridFooterCell })] })
641
+ })
642
+ ]
643
+ }), c && /* @__PURE__ */ a("button", {
644
+ className: w.addRowButton,
645
+ onClick: c,
646
+ type: "button",
647
+ children: "+ Add Row"
648
+ })]
649
+ });
650
+ }, O = ({ data: t, columns: i, onChange: s, aggregations: c, onAddRow: l, onDeleteRow: u, showAggregations: d }) => {
651
+ let [f, p] = r(null), m = n(t ? t.length : 0);
652
+ e(() => {
653
+ if (t && t.length > m.current) {
654
+ let e = t[t.length - 1];
655
+ e && e.id && p(e.id);
656
+ }
657
+ m.current = t ? t.length : 0;
658
+ }, [t]), e(() => {
659
+ f !== null && setTimeout(() => {
660
+ let e = document.getElementById(`mobile-card-${f}`);
661
+ if (e) {
662
+ e.scrollIntoView({
663
+ behavior: "smooth",
664
+ block: "start"
665
+ });
666
+ let t = e.querySelector("input, select, textarea");
667
+ t && t.focus();
668
+ }
669
+ }, 50);
670
+ }, [f]);
671
+ let h = (e) => typeof d == "boolean" ? d : !Array.isArray(d) || d.includes(e), g = i.some((e) => e.aggregation && h(e.key) && c[e.key] !== void 0);
672
+ return /* @__PURE__ */ o("div", {
673
+ className: w.mobileListContainer,
674
+ children: [
675
+ t && t.length > 0 ? t.map((e) => {
676
+ if (f === e.id) return /* @__PURE__ */ o("div", {
677
+ id: `mobile-card-${e.id}`,
678
+ className: w.mobileCard,
679
+ children: [i.map((t) => /* @__PURE__ */ o("div", {
680
+ className: w.mobileCardRow,
681
+ children: [/* @__PURE__ */ a("div", {
682
+ className: w.mobileCardLabel,
683
+ children: t.title
684
+ }), /* @__PURE__ */ a("div", {
685
+ className: w.mobileCardInputWrapper,
686
+ children: t.render({
687
+ value: e[t.key],
688
+ rowData: e,
689
+ onChange: (n) => s(e.id, t.key, n)
690
+ })
691
+ })]
692
+ }, t.key)), /* @__PURE__ */ o("div", {
693
+ className: w.mobileDeleteBtnWrapper,
694
+ children: [/* @__PURE__ */ a("button", {
695
+ className: w.addRowButton,
696
+ style: {
697
+ margin: 0,
698
+ marginRight: "auto",
699
+ width: "auto",
700
+ padding: "0.35rem 0.75rem",
701
+ fontSize: "0.875rem"
702
+ },
703
+ onClick: (e) => {
704
+ e.stopPropagation(), p(null);
705
+ },
706
+ children: "Done"
707
+ }), u && /* @__PURE__ */ a("button", {
708
+ className: w.deleteRowButton,
709
+ onClick: (t) => {
710
+ t.stopPropagation(), u(e.id), p(null);
711
+ },
712
+ "aria-label": "Delete Row",
713
+ children: "Delete"
714
+ })]
715
+ })]
716
+ }, e.id);
717
+ let t = i.find((e) => e.mobile?.role === "title") || i[0], n = i.find((e) => e.mobile?.role === "chip"), r = i.filter((e) => e.mobile?.role === "value");
718
+ return /* @__PURE__ */ o("div", {
719
+ className: w.mobileSummaryCard,
720
+ onClick: () => p(e.id),
721
+ children: [/* @__PURE__ */ o("div", {
722
+ className: w.mobileSummaryLeft,
723
+ children: [/* @__PURE__ */ a("div", {
724
+ className: w.mobileSummaryTitle,
725
+ children: t && e[t.key] !== void 0 && e[t.key] !== "" ? e[t.key] : `Row ${e.id}`
726
+ }), n && e[n.key] && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("span", {
727
+ className: w.mobileSummaryChip,
728
+ children: e[n.key]
729
+ }) })]
730
+ }), /* @__PURE__ */ o("div", {
731
+ className: w.mobileSummaryRightWrapper,
732
+ children: [/* @__PURE__ */ a("div", {
733
+ className: w.mobileSummaryRight,
734
+ children: r.map((t) => /* @__PURE__ */ o("div", {
735
+ className: w.mobileSummaryValueRow,
736
+ children: [
737
+ t.title,
738
+ ": ",
739
+ /* @__PURE__ */ a("span", { children: e[t.key] })
740
+ ]
741
+ }, t.key))
742
+ }), /* @__PURE__ */ o("div", {
743
+ className: w.mobileSummaryActions,
744
+ children: [/* @__PURE__ */ a("button", {
745
+ className: w.mobileIconButton,
746
+ onClick: (t) => {
747
+ t.stopPropagation(), p(e.id);
748
+ },
749
+ "aria-label": "Edit",
750
+ title: "Edit",
751
+ children: /* @__PURE__ */ o("svg", {
752
+ width: "16",
753
+ height: "16",
754
+ viewBox: "0 0 24 24",
755
+ fill: "none",
756
+ stroke: "currentColor",
757
+ strokeWidth: "2",
758
+ strokeLinecap: "round",
759
+ strokeLinejoin: "round",
760
+ children: [/* @__PURE__ */ a("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), /* @__PURE__ */ a("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })]
761
+ })
762
+ }), u && /* @__PURE__ */ a("button", {
763
+ className: `${w.mobileIconButton} ${w.mobileIconDanger}`,
764
+ onClick: (t) => {
765
+ t.stopPropagation(), u(e.id);
766
+ },
767
+ "aria-label": "Delete",
768
+ title: "Delete",
769
+ children: /* @__PURE__ */ o("svg", {
770
+ width: "16",
771
+ height: "16",
772
+ viewBox: "0 0 24 24",
773
+ fill: "none",
774
+ stroke: "currentColor",
775
+ strokeWidth: "2",
776
+ strokeLinecap: "round",
777
+ strokeLinejoin: "round",
778
+ children: [
779
+ /* @__PURE__ */ a("polyline", { points: "3 6 5 6 21 6" }),
780
+ /* @__PURE__ */ a("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
781
+ /* @__PURE__ */ a("line", {
782
+ x1: "10",
783
+ y1: "11",
784
+ x2: "10",
785
+ y2: "17"
786
+ }),
787
+ /* @__PURE__ */ a("line", {
788
+ x1: "14",
789
+ y1: "11",
790
+ x2: "14",
791
+ y2: "17"
792
+ })
793
+ ]
794
+ })
795
+ })]
796
+ })]
797
+ })]
798
+ }, e.id);
799
+ }) : /* @__PURE__ */ a("div", {
800
+ style: {
801
+ textAlign: "center",
802
+ padding: "2rem",
803
+ color: "var(--zf-text-muted)"
804
+ },
805
+ children: "No data available."
806
+ }),
807
+ l && /* @__PURE__ */ a("button", {
808
+ className: w.addRowButton,
809
+ onClick: l,
810
+ children: "+ Add Row"
811
+ }),
812
+ g && /* @__PURE__ */ a("div", {
813
+ className: w.mobileAggregationsCard,
814
+ children: i.map((e) => e.aggregation && h(e.key) && c[e.key] !== void 0 ? /* @__PURE__ */ o("div", {
815
+ className: w.mobileAggregationRow,
816
+ children: [/* @__PURE__ */ o("div", {
817
+ className: w.mobileAggregationLabel,
818
+ children: [e.title, " (Total)"]
819
+ }), /* @__PURE__ */ a("div", {
820
+ className: w.mobileAggregationValue,
821
+ children: c[e.key]
822
+ })]
823
+ }, e.key) : null)
824
+ })
825
+ ]
826
+ });
827
+ }, k = (e, n) => t(() => {
828
+ if (!e || e.length === 0 || !n) return {};
829
+ let t = {};
830
+ return n.forEach((n) => {
831
+ if (n.aggregation) {
832
+ let r = e.map((e) => Number(e[n.key])).filter((e) => !isNaN(e));
833
+ if (r.length === 0) {
834
+ t[n.key] = 0;
835
+ return;
836
+ }
837
+ switch (n.aggregation) {
838
+ case "sum":
839
+ t[n.key] = r.reduce((e, t) => e + t, 0);
840
+ break;
841
+ case "avg":
842
+ t[n.key] = r.reduce((e, t) => e + t, 0) / r.length;
843
+ break;
844
+ case "min":
845
+ t[n.key] = Math.min(...r);
846
+ break;
847
+ case "max":
848
+ t[n.key] = Math.max(...r);
849
+ break;
850
+ default: typeof n.aggregation == "function" && (t[n.key] = n.aggregation(e, n.key));
851
+ }
852
+ }
853
+ }), t;
854
+ }, [e, n]), A = ({ data: e, columns: t, onChange: n, onAddRow: r, onDeleteRow: s, variant: c = "default", showAggregations: l = !0 }) => {
855
+ let u = k(e, t);
856
+ return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("div", {
857
+ className: w.desktopOnly,
858
+ children: /* @__PURE__ */ a(D, {
859
+ data: e,
860
+ columns: t,
861
+ onChange: n,
862
+ aggregations: u,
863
+ onAddRow: r,
864
+ onDeleteRow: s,
865
+ variant: c,
866
+ showAggregations: l
867
+ })
868
+ }), /* @__PURE__ */ a("div", {
869
+ className: w.mobileOnly,
870
+ children: /* @__PURE__ */ a(O, {
871
+ data: e,
872
+ columns: t,
873
+ onChange: n,
874
+ aggregations: u,
875
+ onAddRow: r,
876
+ onDeleteRow: s,
877
+ showAggregations: l
878
+ })
879
+ })] });
880
+ };
533
881
  //#endregion
534
- export { _ as ImagePreview, x as OcrField, m as ZinoClient };
882
+ export { A as Grid, y as ImagePreview, C as OcrField, g as ZinoClient, k as useGridAggregations };
package/package.json CHANGED
@@ -1,34 +1,33 @@
1
- {
2
- "name": "form-component-library-demo",
3
- "version": "1.0.5",
4
- "type": "module",
5
- "description": "Zino Client API library for field and workflow management",
6
- "main": "dist/src/index.cjs",
7
- "module": "dist/src/index.js",
8
- "scripts": {
9
- "build": "vite build",
10
- "dev": "vite build --watch"
11
- },
12
- "keywords": [
13
- "zino",
14
- "client",
15
- "api"
16
- ],
17
- "author": "",
18
- "license": "ISC",
19
- "devDependencies": {
20
- "@vitejs/plugin-react": "^6.1.1",
21
- "esbuild-css-modules-plugin": "^3.1.5",
22
- "vite": "^8.2.2"
23
- },
24
- "dependencies": {
25
- "lucide-react": "^1.34.0"
26
- },
27
- "peerDependencies": {
28
- "react": ">=16.8.0",
29
- "react-dom": ">=16.8.0"
30
- },
31
- "files": [
32
- "dist"
33
- ]
34
- }
1
+ {
2
+ "name": "form-component-library-demo",
3
+ "version": "1.0.7",
4
+ "type": "module",
5
+ "description": "Zino Client API library for field and workflow management",
6
+ "main": "dist/src/index.cjs",
7
+ "module": "dist/src/index.js",
8
+ "scripts": {
9
+ "build": "vite build",
10
+ "dev": "vite build --watch"
11
+ },
12
+ "keywords": [
13
+ "client",
14
+ "api"
15
+ ],
16
+ "author": "",
17
+ "license": "ISC",
18
+ "devDependencies": {
19
+ "@vitejs/plugin-react": "^6.1.1",
20
+ "esbuild-css-modules-plugin": "^3.1.5",
21
+ "vite": "^8.2.2"
22
+ },
23
+ "dependencies": {
24
+ "lucide-react": "^1.34.0"
25
+ },
26
+ "peerDependencies": {
27
+ "react": ">=16.8.0",
28
+ "react-dom": ">=16.8.0"
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ]
33
+ }