1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5394],{5246:(e,s,a)=>{a.d(s,{A:()=>t});let t=(0,a(7161).A)("briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]])},5266:(e,s,a)=>{a.d(s,{A:()=>t});let t=(0,a(7161).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},5394:(e,s,a)=>{a.r(s),a.d(s,{__N_SSP:()=>eh,default:()=>ef,initialValues:()=>eg});var t=a(7876),i=a(4232),r=a(9913),n=a(8549),l=a(3693);function d({steps:e=[],initialValues:s,onSubmit:a,onDraftSave:r,children:n,onParentCall:d,isLoading:c=!1,setIsLoading:m=()=>{},validationSchemas:u=[],nextLabel:p="Next",backLabel:h="Back",submitLabel:g="Submit",validate:x,stepHashes:f,validateFns:y=[]}){let[b,v]=(0,i.useState)(0),N=b===e.length-1,j=Array.isArray(f)&&f.length===e.length?f:["company-details","address-details","office-holders","shares","applicant","registration","overview"].slice(0,e.length),S=j.reduce((e,s,a)=>(e[s]=a,e),{"business-name":5,tax:5}),A=e=>{let s=j[e]||"";{let e=window.location.href.split("#")[0];window.history.replaceState(null,"",`${e}${s?"#"+s:""}`);try{if(s){let e=document.getElementById(s);e?e.scrollIntoView({behavior:"smooth",block:"start"}):window.scrollTo({top:0,behavior:"smooth"})}else window.scrollTo({top:0,behavior:"smooth"})}catch{}}},w=(0,i.useMemo)(()=>Array.isArray(y)&&"function"==typeof y[b]?y[b]:x,[y,b,x]),I=(0,i.useRef)(s).current,q=(0,i.useMemo)(()=>Array.isArray(u)?u[b]:void 0,[u,b]);return(0,i.useEffect)(()=>{let e=e=>{let s=(e||"").replace(/^#/,"");s&&void 0!==S[s]&&v(S[s])};{e(window.location.hash);let s=()=>e(window.location.hash);return window.addEventListener("hashchange",s),()=>window.removeEventListener("hashchange",s)}},[]),(0,t.jsx)(l.l1,{initialValues:I,validationSchema:q,validate:w,validateOnMount:!1,validateOnBlur:!0,validateOnChange:!0,enableReinitialize:!1,onSubmit:async(s,t)=>{let i=Object.keys(await t.validateForm()||{}).length>0;if(!N){if(i)t.setTouched(o(s));else{if("function"==typeof r)try{await r({...s,validate_form:0})}catch(e){console.warn("Draft save failed:",e)}v(s=>{let a=Math.min(s+1,e.length-1);return A(a),a}),d&&d(s,m)}t.setSubmitting(!1);return}if(1===Number(s?.validate_form??0)&&i){t.setTouched(o(s)),t.setSubmitting(!1);return}await a(s),t.setSubmitting(!1)},children:({isSubmitting:s,submitForm:a,values:i})=>{if("function"==typeof d)try{d(i,m)}catch(e){}let r=c?"loading":s?"submitting":"",o=!!r;return(0,t.jsxs)(l.lV,{className:"w-full p-10",children:[e?.length>0&&(0,t.jsx)("div",{className:"mb-6 flex sm:flex-wrap items-center justify-between gap-2",children:e.map((e,s)=>{let a=s===b;return(0,t.jsxs)("div",{className:`relative group text-sm px-3 py-1 rounded-full border cursor-pointer 2 ${a?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-600 border-gray-300"}`,onClick:()=>{v(s),A(s)},title:e,children:[(0,t.jsx)("span",{className:"sm:hidden",children:s+1}),(0,t.jsxs)("span",{className:"hidden sm:inline",children:[s+1,". ",e]}),(0,t.jsx)("span",{className:"sm:hidden absolute left-1/2 -top-8 transform -translate-x-1/2 rounded-md px-2 py-1 bg-white text-gray-800 border border-gray-200 text-xs shadow-md opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 pointer-events-none transition-opacity whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:e})]},e)})}),(0,t.jsx)("div",{className:"rounded-xl border border-gray-200 bg-white sm:p-5 p-3 shadow-sm",children:Array.isArray(n)?n[b]:n}),(0,t.jsxs)("div",{className:"mt-6 flex items-center justify-between",children:[(0,t.jsx)("button",{type:"button",className:`rounded-lg border px-4 py-2 ${0===b?"border-gray-200 text-gray-300 cursor-not-allowed":"border-gray-300 text-gray-700 hover:bg-gray-50"}`,onClick:()=>{0!==b&&v(e=>{let s=Math.max(e-1,0);return A(s),s})},disabled:0===b||s||c,children:h}),(0,t.jsx)("button",{type:"button",className:`rounded-lg px-5 py-2 text-white ${o?"bg-blue-300 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,"aria-disabled":o,"data-disabled-reason":r,onClick:()=>a(),children:N?g:p})]})]})}})}function o(e,s=""){let a={};return Object.keys(e||{}
2).forEach(t=>{let i=s?`${s}.${t}`:t,r=e[t];Array.isArray(r)?a[t]=r.map((e,s)=>null==e||"object"!=typeof e||o(e,`${i}[${s}]`)):null!=r&&"object"==typeof r?a[t]=o(r,i):a[t]=!0}),a}var c=a(9058),m=a(7308),u=a(9739),p=a(8417),h=a(5835),g=a(9255),x=a(9780),f=a(4671);let y=({dummyData:e})=>{let{values:s,setFieldValue:a,errors:r,touched:n,submitCount:d}=(0,l.j7)(),o=e=>{let s=(0,l.O6)(r,e),a=(0,l.O6)(n,e);return s&&(a||d>0)?s:""};console.log("RegisteredOffice values",s),(0,i.useEffect)(()=>{s?.registeredOffice?.occupyIndicator===void 0&&a("registeredOffice.occupyIndicator",!1)},[s?.registeredOffice?.occupyIndicator,a]),(0,i.useEffect)(()=>{s?.registeredOffice?.occupyIndicator===!0&&a("registeredOffice.occupierName",s?.generalInformation?.companyName||"")},[s?.registeredOffice?.occupyIndicator,s?.generalInformation?.companyName,a]),(0,i.useEffect)(()=>{s?.registeredOffice?.occupyIndicator===!1&&a("registeredOffice.occupierConsent",!0)},[s?.registeredOffice?.occupyIndicator]);let c=!!(r?.registeredOffice?.address&&n?.registeredOffice?.address);return(0,t.jsxs)(h.mO,{className:"mt-6",status:p.e.registeredOffice.required,children:[(0,t.jsx)(f.A,{}),(0,t.jsxs)("div",{className:"rounded-xl sm:border border-gray-200 bg-white sm:shadow-sm sm:p-6",children:[(0,t.jsxs)("h2",{className:"text-lg font-semibold text-gray-900 flex items-center",children:["Registered Office"," ",(0,t.jsx)(h.mg,{required:p.e.registeredOffice.required}),(0,t.jsx)("div",{className:"ml-2",children:(0,t.jsx)(g.A,{id:"registeredOffice",description:"This is the official address where ASIC will send all legal notices. It must be an Australian street address."})})]}),(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsxs)("h3",{className:"text-base font-medium text-gray-800 mb-2",children:["Address"," ",(0,t.jsx)(h.mg,{required:p.e.registeredOffice.address.required})]}),(0,t.jsx)(h.at,{onChange:e=>{if(!e||0===e.length)return;let s=e[0];if(!s?.geometry)return;a("address_details.registeredOffice.address",null),a("registeredOffice.address.careOf",""),a("registeredOffice.address.line2",""),a("registeredOffice.address.street",null),a("registeredOffice.address.locality",null),a("registeredOffice.address.state",null),a("registeredOffice.address.postcode",null);let{componentMap:t,locality:i,street:r,line2:n,formattedAddress:l}=(0,x.Y)(s);console.log("componentMap",t),console.log("locality",i),console.log("street",r),console.log("line2",n),console.log("formattedAddress",l),a("registeredOffice.address.line2",n||""),a("address_details.registeredOffice.address",l||""),a("registeredOffice.address.street",r||""),a("registeredOffice.address.state",t?.administrative_area_level_1?.short_name||""),a("registeredOffice.address.locality",i||""),a("registeredOffice.address.postcode",t?.postal_code?.long_name||"")},name:"address_details.registeredOffice.address",placeholder:"Start typing your office address"}),(0,t.jsx)(h.Y2,{isError:c,id:"registeredOffice.view",labelOpen:"View Registered Office Address Details",labelClose:"Hide address details",children:(0,t.jsxs)("div",{className:"grid lg:grid-cols-4 sm:grid-cols-2 gap-4 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(h.ZQ,{question:"Street",required:!0,value:s?.registeredOffice?.address?.street||"",id:"registeredOffice.address.street",name:"registeredOffice.address.street",placeholder:"Street name",disabled:!0}),o("registeredOffice.address.street")&&(0,t.jsx)("p",{className:"mt-1 text-xs text-red-600",children:o("registeredOffice.address.street")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.ZQ,{question:"Suburb / Locality",required:!0,value:s?.registeredOffice?.address?.locality||"",id:"registeredOffice.address.locality",name:"registeredOffice.address.locality",placeholder:"Suburb",disabled:!0}),o("registeredOffice.address.locality")&&(0,t.jsx)("p",{className:"mt-1 text-xs text-red-600",children:o("registeredOffice.address.locality")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.FX,{question:"State",required:!0,value:s?.registeredOffice?.address?.state||"",id:"registeredOffice.address.state",name:"registeredOffice.address.state",placeholder:"Select State",options:e.state,disabled:!0}),o("registeredOffice.address.state")&&(0,t.jsx)("p",{className:"mt-1 text-xs text-red-600",children:o("registeredOffice.address.state")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.ZQ,{question:"Postcode",required:!0,value:s?.registeredOffice?.address?.postcode||"",id:"registeredOffice.address.postcode",name:"registeredOffice.address.postcode",placeholder:"e.g., 2000",disabled:!0}),o("registeredOffice.address.postcode")&&(0,t.jsx)("p",{className:"mt-1 text-xs text-red-600",children:o("registeredOffice.address.postcode")})]})]})})]}),(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsxs)("label",{className:"block py-2 font-medium text-gray-700",children:["Will the company occupy the registered office?",(0,t.jsx)(h.mg,{required:p.e.registeredOffice.occupyIndicator.required})]}),(0,t.jsxs)("div",{className:"flex items-center border-2 border-blue-500 rounded-lg w-full",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{a("registeredOffice.occupyIndicator",!0),a("registeredOffice.occupier
2Name",s?.generalInformation?.companyName||"")},className:`w-full py-2 text-center rounded-l-lg font-semibold ${s?.registeredOffice?.occupyIndicator?"bg-blue-600 text-white":"bg-white text-black "}`,children:"Yes"}),(0,t.jsx)("button",{type:"button",onClick:()=>{a("registeredOffice.occupyIndicator",!1),a("registeredOffice.occupierName","")},className:`w-full py-2 text-center rounded-r-lg font-semibold ${!s?.registeredOffice?.occupyIndicator?"bg-blue-600 text-white":"bg-white text-black"}`,children:"No"})]}),s?.registeredOffice?.occupyIndicator?(0,t.jsx)("p",{className:"mt-2 text-sm text-gray-600 italic",children:"The company will occupy the registered office."}):(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)(h.ZQ,{question:"Address occupierâs name",required:!0,value:s?.registeredOffice?.occupierName||"",id:"registeredOffice.occupierName",name:"registeredOffice.occupierName",placeholder:"Enter name of occupier (person or entity)"}),o("registeredOffice.occupierName")&&(0,t.jsx)("p",{className:"mt-1 text-xs text-red-600",children:o("registeredOffice.occupierName")}),(0,t.jsxs)("p",{className:"mt-2 text-xs text-gray-600",children:[(0,t.jsx)("span",{className:"font-semibold text-blue-600",children:"Declaration:"})," ","By continuing, you confirm that you have obtained consent of the occupier named above."]})]})]})]})]})},b=({dummyData:e})=>{let{setFieldValue:s,values:a,errors:r,touched:n,submitCount:d}=(0,l.j7)(),o=e=>{let s=(0,l.O6)(r,e),a=(0,l.O6)(n,e);return s&&(a||d>0)?s:""},c=!!(a&&a.principalPlaceOfBusiness&&a.principalPlaceOfBusiness.sameAsRegisteredOffice);(0,i.useEffect)(()=>{if(c){let e=a&&a.registeredOffice&&a.registeredOffice.address||{};s("principalPlaceOfBusiness.address.careOf",""),s("principalPlaceOfBusiness.address.line2",e.line2||""),s("principalPlaceOfBusiness.address.street",e.street||""),s("principalPlaceOfBusiness.address.locality",e.locality||""),s("principalPlaceOfBusiness.address.state",e.state||""),s("principalPlaceOfBusiness.address.postcode",e.postcode||""),s("address_details.principalPlaceOfBusiness.address",`${e.line2||""} ${e.street||""} ${e.locality||""} ${e.state||""} ${e.postcode||""}`.trim())}},[c,a?.registeredOffice?.address,s]);let m=!!(r?.principalPlaceOfBusiness?.address&&n?.principalPlaceOfBusiness?.address);return(0,t.jsx)(h.mO,{className:"mt-6",status:p.e.principalPlaceOfBusiness?.required??!0,children:(0,t.jsxs)("div",{className:"rounded-xl sm:border border-gray-200 bg-white sm:shadow-sm sm:p-6",children:[(0,t.jsxs)("h2",{className:"text-lg font-semibold text-gray-900 flex items-center",children:["Principal Place of Business"," ",(0,t.jsx)(h.mg,{required:p.e.principalPlaceOfBusiness?.required??!0}),(0,t.jsx)("div",{className:"ml-2",children:(0,t.jsx)(g.A,{id:"ppob",description:"The main location where the company carries on business. Must be an Australian street address (no PO Boxes)."})})]}),(0,t.jsxs)("div",{className:"mt-5 flex items-center",children:[(0,t.jsx)("span",{className:" text-sm font-medium text-gray-900",children:"Same as registered office"}),(0,t.jsxs)("label",{htmlFor:"ppob-same-toggle",className:"ml-3 inline-flex items-center cursor-pointer select-none",children:[(0,t.jsx)("input",{id:"ppob-same-toggle",type:"checkbox",className:"sr-only",checked:c,onChange:e=>{s("principalPlaceOfBusiness.sameAsRegisteredOffice",e?.target?!!e.target.checked:!!e)},"aria-checked":c,"aria-label":"Same as registered office"}),(0,t.jsx)("span",{"aria-hidden":"true",className:"relative inline-flex items-center h-6 w-11 rounded-full transition-colors focus:outline-none "+(c?"bg-gray-900":"bg-gray-300 border border-gray-300"),style:{WebkitTapHighlightColor:"transparent"},children:(0,t.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform "+(c?"translate-x-5":"translate-x-1")})})]})]}),(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsxs)("h3",{className:"text-base font-medium text-gray-800 mb-2",children:["Address ",(0,t.jsx)(h.mg,{required:!0})]}),(0,t.jsx)(h.at,{onChange:e=>{let a=e?.[0];if(!a?.geometry)return;let{componentMap:t,locality:i,street:r,line2:n,formattedAddress:l}=(0,x.Y)(a)||{};s("principalPlaceOfBusiness.address.careOf",""),s("principalPlaceOfBusiness.address.line2",n||""),s("principalPlaceOfBusiness.address.street",r||""),s("principalPlaceOfBusiness.address.locality",i||""),s("principalPlaceOfBusiness.address.state",t?.administrative_area_level_1?.short_name||""),s("principalPlaceOfBusiness.address.postcode",t?.postal_code?.long_name||""),s("address_details.principalPlaceOfBusiness.address",l||"")},name:"address_details.principalPlaceOfBusiness.address",placeholder:"Start typing your business address",disabled:c}),(0,t.jsx)(h.Y2,{isError:m,id:"ppob.view",labelOpen:"View Principal Place of Business Address Details",labelClose:"Hide address details",children:(0,t.jsxs)("div",{className:"grid lg:grid-cols-4 sm:grid-cols-2 gap-4 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(h.ZQ,{question:"Street",required:!0,value:a?.principalPlaceOfBusiness?.address?.street||"",id:"principalPlaceOfBusiness.address.street",name:"principalPlaceOfBusiness.address.street",placeholder:"Street name",disabled:!0}),o("principalPlaceOfBusiness.address.street")&&(0,t.jsx)("p",{className:"mt-1 text-xs text-red-600",children:o("principalPlaceOfBusiness.address.street")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.ZQ,{question:"Suburb / Locality",required:!0,value:a?.principalPlaceOfBusiness?.address?.locality||"",id:"principalPlaceOfBusiness.address.locality",name:"principalPlaceOfBusiness.address.locality",placeholder:"Suburb",disabled:!0}),o("principalPlaceOfBusiness.address.locality")&&(0,t.jsx)("p",{className:"mt-1 text-xs text-red-600",children:o("principalPlaceOfBusiness.address.locality")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.FX,{question:"State",required:!0,value:a?.principalPlaceOfBusiness?.address?.state||"",id:"principalPlaceOfBusiness.address.state",name:"principalPlaceOfBusiness.address.state",placeholder:"Select State",options:e.state,disabled:!0}),o("principalPlaceOfBusiness.address.state")&&(0,t.jsx)("p",{className:"mt-1 text-xs text-red-600",children:o("principalPlaceOfBusiness.address.state")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.ZQ,{question:"Postcode",required:!0,value:a?.principalPlaceOfBusiness?.address?.postcode||"",id:"principalPlaceOfBusiness.address.postcode",name:"principalPlaceOfBusiness.address.postcode",placeholder:"e.g., 2000",disabled:!0}),o("principalPlaceOfBusiness.address.postcode")&&(0,t.jsx)("p",{className:"mt-1 text-xs text-red-600",children:o("principalPlaceOfBusiness.address.postcode")})]})]})})]})]})})};var v=a(129),N=a(5246),j=a(5266),S=a(9065),A=a(7388),w=a(2878);
2let I={name:{familyName:null,givenName1:null,givenName2:null,givenName3:null},birthDetails:{date:null,locality:null,localityQualifier:null,country:"AU",intlIndicator:!1,officeHolderBirthCountry:"AU"},address:{careOf:"",line2:"",street:null,locality:null,state:null,postcode:null,country:"AU"},isFormerName:!1,roles:["DIR"],addressOverriddenIndicator:!1,email:"",mobile:"",tfnIndicator:!0,tfn:"",associateRoles:["DIR","POF"],isShareHolder:!1},q=e=>JSON.parse(JSON.stringify(e));function O({dummyData:e,data:s}){let a,r,{values:n,setFieldValue:d,setFieldError:o,errors:c,touched:m}=(0,l.j7)();console.log("OfficeHolders values:",n);let u=n?.officeHolders??[];(0,i.useEffect)(()=>{if(!Array.isArray(n?.officeHolders))return;let e=[...n.officeHolders],s=!1;for(let a=0;a<e.length;a++){let t=e[a]||{};t?.birthDetails||(e[a].birthDetails=q(I.birthDetails),s=!0),t?.address||(e[a].address=q(I.address),s=!0),Array.isArray(t?.associateRoles)||(e[a].associateRoles=q(I.associateRoles),s=!0),void 0===t?.isShareHolder&&(e[a].isShareHolder=!1,s=!0),Array.isArray(t?.roles)||(e[a].roles=q(I.roles),s=!0);let i=["ACT","NSW","NT","QLD","SA","TAS","VIC","WA"],r=e[a].birthDetails?.localityQualifier??null,n=e[a].birthDetails?.country??null;!r||i.includes(r)||n&&"AU"!==n?n&&e[a].birthDetails?.country||(e[a].birthDetails.country="AU",s=!0):(e[a].birthDetails.country=r,s=!0),e[a].address?.country||(e[a].address.country="AU",s=!0)}s&&d("officeHolders",e,!0)},[n?.officeHolders?.length]),(0,i.useEffect)(()=>{Array.isArray(n?.officeHolders)&&((n.officeHolders||[]).map(e=>String(e?.tfnIndicator??"")).join("|"),n.officeHolders.forEach((e,s)=>{e?.tfnIndicator===!1&&(n?.officeHolders?.[s]?.tfn&&d(`officeHolders[${s}].tfn`,"",!1),"function"==typeof o&&o(`officeHolders[${s}].tfn`,void 0))}))},[(n.officeHolders||[]).map(e=>String(e?.tfnIndicator??"")).join("|")]);let g=(0,i.useRef)(u.length),[y,b]=(0,i.useState)(0);(0,i.useEffect)(()=>{if(!Array.isArray(n?.officeHolders)||0===n.officeHolders.length){d("officeHolders",[q(I)],!0),b(0),g.current=1;return}(y<0||y>=n.officeHolders.length)&&b(0),n.officeHolders.length>g.current&&b(n.officeHolders.length-1),n.officeHolders.length<=y&&b(Math.max(0,n.officeHolders.length-1)),g.current=n.officeHolders.length},[n?.officeHolders?.length]),(0,i.useEffect)(()=>{if(!Array.isArray(n?.officeHolders))return;let e=[...n.officeHolders],s=!1;for(let a=0;a<e.length;a++){let t=e[a]||{};t?.birthDetails||(e[a].birthDetails=q(I.birthDetails),s=!0),t?.address||(e[a].address=q(I.address),s=!0),Array.isArray(t?.associateRoles)||(e[a].associateRoles=q(I.associateRoles),s=!0),void 0===t?.isShareHolder&&(e[a].isShareHolder=!1,s=!0),Array.isArray(t?.roles)||(e[a].roles=q(I.roles),s=!0);let i=e[a].birthDetails?.officeHolderBirthCountry??null,r=e[a].birthDetails?.country??null;i?(r!==i&&(e[a].birthDetails.country=i,s=!0),"AU"!==i&&e[a].birthDetails.localityQualifier!==i&&(e[a].birthDetails.localityQualifier=i,s=!0)):(e[a].birthDetails.officeHolderBirthCountry||(e[a].birthDetails.officeHolderBirthCountry="AU",s=!0),r||(e[a].birthDetails.country="AU",s=!0)),e[a].address?.country||(e[a].address.country="AU",s=!0)}s&&d("officeHolders",e,!0)},[n?.officeHolders?.length]);let[O,_]=(0,i.useState)({});(0,i.useEffect)(()=>{if(!n?.officeHolders)return;let e={};n.officeHolders.forEach((s,a)=>{e[a]=!!s?.isShareHolder||Array.isArray(s.roles)&&s.roles.includes("SHR")}),_(e)},[n.officeHolders]);let C=["DIR","CSY","POF","CSH"],R=(e={})=>{let s=Array.isArray(e.roles)?e.roles.slice():[],a=[];return s.includes("DIR")&&a.push("DIR"),s.includes("SEC")&&a.push("CSY"),e.isShareHolder&&a.push("CSH"),(a.includes("DIR")||a.includes("CSH"))&&a.push("POF"),Array.from(new Set(a)).filter(e=>C.includes(e))},D=(e,s)=>Array.isArray(u?.[e]?.roles)&&u[e].roles.includes(s),$=(e,s)=>{let a=u?.[e]?.roles??[],t=a.includes(s)?a.filter(e=>e!==s):[...a,s];d(`officeHolders[${e}].roles`,t,!0);let i={...u?.[e]||{},roles:t,isShareHolder:u?.[e]?.isShareHolder||!1},r=R(i);d(`officeHolders[${e}].associateRoles`,r,!0),_(s=>({...s,[e]:!!i.isShareHolder||r.includes("CSH")}))},H=e=>{if(!e)return"Date of birth is required";if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return"Birth date must be in YYYY-MM-DD format";let s=new Date(e);if(isNaN(s.getTime()))return"Invalid date";let a=new Date;return s>a?"Birth date cannot be in the future":s>new Date(a.getFullYear()-18,a.getMonth(),a.getDate())?"Must be at least 18 years old":s<new Date(a.getFullYear()-100,a.getMonth(),a.getDate())?"Date of birth cannot be more than 100 years ago":void 0};function M({name:e,label:s="Date of birth",required:a=!1}){let i,r,n,d,o,c,{setFieldError:m}=(0,l.j7)(),[u,p,h]=(0,l.Mt)({name:e,validate:H}),g=u.value?H(u.value):void 0;return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-900",children:[s," ",a?(0,t.jsx)("span",{className:"text-red-600",children:"*"}):null]}),(0,t.jsx)("input",{type:"date",...u,value:u.value||"",onChange:e=>{let s=e.target.value;h.setValue(s,!0),h.setTouched(!0,!1),H(s)},onBlur:u.onBlur,max:(r=new Date((i=new Date).getFullYear()-18,i.getMonth(),i.getDate()),n=e=>String(e).padStart(2,"0"),`${r.getFullYear()}-${n(r.getMonth()+1)}-${n(r.getDate())}`),min:(o=new Date((d=new Date).getFullYear()-100,d.getMonth(),d.getDate()),c=e=>String(e).padStart(2,"0"),`${o.getFullYear()}-${c(o.getMonth()+1)}-${c(o.getDate())}`),className:`w-full rounded-md border p-2 text-sm ${g||p.error?"border-red-500":"border-gray-300"}`,placeholder:"YYYY-MM-DD"}),u.value&&g||!u.value&&p.error?(0,t.jsx)("p",{className:"text-red-600 text-xs mt-1",children:g||p.error}):null]})}return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,t.jsx)(f.A,{}),(0,t.jsxs)("div",{className:"lg:col-span-3 space-y-6",children:[(0,t.jsxs)(h.mO,{status:p.e.officeHolders.required,
2children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Directors & Shareholders"}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:"Add the people who will manage and own the company. A person can hold multiple roles."}),(0,t.jsx)(h.xQ,{name:"officeHolders",title:"associate",template:I,children:(s,a,i)=>{let r,l,o,g=u?.[a]||{},f=!!(m?.officeHolders?.[a]&&c?.officeHolders?.[a]),I=y===a,q=g?.name?.givenName1||g?.name?.familyName?`${g?.name?.givenName1||""} ${g?.name?.familyName||""}`.trim():"Start here",O=n?.officeHolders?.[a]?.birthDetails?.country??null,C="AU"!==O;return(0,t.jsxs)("div",{className:`rounded-xl border bg-white shadow-sm overflow-hidden ${f?"border-red-400":"border-gray-200"}`,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"h-7 w-7 rounded-full bg-blue-600 text-white grid place-items-center text-sm font-semibold",children:a+1}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"text-sm font-medium text-gray-900",children:["Associate ",a+1]}),(0,t.jsx)("div",{className:"text-xs text-gray-600",children:q})]}),f&&(0,t.jsx)(v.A,{className:"text-red-500 ml-2",size:16})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[a>0&&(0,t.jsx)("button",{type:"button",onClick:()=>i(a),className:"text-sm text-red-600 hover:underline",children:"Remove"}),(0,t.jsx)("button",{type:"button",onClick:()=>b(I?-1:a),className:"rounded-lg border px-2.5 py-1.5 text-sm text-gray-700 hover:bg-gray-50",children:I?"Hide":"Edit"})]})]}),I&&(0,t.jsxs)("div",{className:"border-t px-5 py-5 space-y-6 bg-gray-50",children:[(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("h3",{className:"text-sm font-medium text-gray-900",children:["Roles in Company ",(0,t.jsx)(h.mg,{required:!0})]}),(0,t.jsxs)("div",{className:"grid sm:grid-cols-1 gap-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>$(a,"DIR"),className:`text-left rounded-lg border p-1 sm:p-3 transition ${D(a,"DIR")?"border-blue-600 ring-2 ring-blue-600/20 bg-blue-600/20":"border-gray-300"}`,children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2 sm:gap-3",children:[(0,t.jsx)("div",{className:`${D(a,"DIR")?"bg-blue-600":"bg-gray-400"} sm:p-2 p-1 rounded-full`,children:(0,t.jsx)(N.A,{className:"w-4 h-4 sm:w-6 sm:h-6 text-white"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium text-sm",children:"Director"}),(0,t.jsx)("p",{className:"text-sm text-gray-700 sm:mt-2",children:"Manages the company and makes key decisions."}),(0,t.jsx)("p",{className:"text-xs text-gray-500 flex items-center hidden sm:block",children:" â Must be 18+ and an Australian resident."})]})]}),D(a,"DIR")&&(0,t.jsx)("div",{className:"text-blue-500",children:(0,t.jsx)(j.A,{className:"w-6 h-6"})})]})}),(0,t.jsx)("button",{type:"button",onClick:()=>{let e,s;_(e=>({...e,[a]:!e[a]})),e=!u?.[a]?.isShareHolder,d(`officeHolders[${a}].isShareHolder`,e,!0),s=R({...u?.[a]||{},isShareHolder:e}),d(`officeHolders[${a}].associateRoles`,s,!0),_(s=>({...s,[a]:e}))},className:`text-left rounded-lg border p-1 sm:p-3 transition ${n?.officeHolders?.[a]?.isShareHolder?"border-blue-600 ring-2 ring-blue-600/20 bg-blue-600/20":"border-gray-300"}`,children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2 sm:gap-3",children:[(0,t.jsx)("div",{className:`${n?.officeHolders?.[a]?.isShareHolder?"bg-blue-600":"bg-gray-400"} sm:p-2 p-1 rounded-full`,children:(0,t.jsx)(S.A,{className:"w-4 h-4 sm:w-6 sm:h-6 text-white"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium text-sm",children:"Shareholder"}),(0,t.jsx)("p",{className:"text-sm text-gray-700 mt-2",children:"Owns shares in the company."}),(0,t.jsx)("p",{className:"text-xs text-gray-500 flex items-center hidden sm:block",children:" â Will need to specify share allocation"})]})]}),n?.officeHolders?.[a]?.isShareHolder&&(0,t.jsx)("div",{className:"text-blue-500",children:(0,t.jsx)(j.A,{className:"w-6 h-6"})})]})}),(0,t.jsx)("button",{type:"button",onClick:()=>$(a,"SEC"),className:`text-left rounded-lg border p-1 sm:p-3 transition ${D(a,"SEC")?"border-blue-600 ring-2 ring-blue-600/20 bg-blue-600/20":"border-gray-300"}`,children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2 sm:gap-3",children:[(0,t.jsx)("div",{className:`${D(a,"SEC")?"bg-blue-600":"bg-gray-400"} sm:p-2 p-1 rounded-full`,children:(0,t.jsx)(A.A,{className:"w-4 h-4 sm:w-6 sm:h-6 text-white"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium text-sm",children:"Company Secretary"}),(0,t.jsx)("p",{className:"text-sm text-gray-700 mt-2",children:"Handles administrative and compliance duties."}),(0,t.jsx)("p",{className:"text-xs text-green-500 flex items-center hidden sm:block",children:" â Optional for proprietary companies"})]})]}),D(a,"SEC")&&(0,t.jsx)("div",{className:"text-blue-500",children:(0,t.jsx)(j.A,{className:"w-6 h-6"})})]})})]}),(l=!(r=n?.officeHolders?.[a]?.roles??[]).includes("DIR")&&!r.includes("SEC"),o=!!m?.officeHolders?.[a],l&&o?(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700",children:[(0,t.jsx)(v.A,{size:15,className:"shrink-0"}),"At least one role (Director or Company Secretary) must be selected."]}):null)]}),(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Personal details"}),(0,t.jsxs)("div",{className:"grid md:grid-cols-3 gap-4",children:[(0,t.jsx)(h.ZQ,{question:"First Name",required:!0,name:`officeHolders[${a}].name.givenName1`,placeholder:"First name"}),(0,t.jsx)(h.ZQ,{question:"Last Name",required:!0,name:`officeHolders[${a}].name.familyName`,placeholder:"Last name"}),(0,t.jsx)(h.ZQ,{question:"Middle Name",name:`officeHolders[${a}].name.givenName2`,placeholder:"Middle name (optional)"})]})]}),(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Contact Details"}),(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,t.jsx)(h.ZQ,{question:"Email address",name:`officeHolders[${a}].email`,type:"email",placeholder:"Email address",required:!0}),(0,t.jsx)(h.ZQ,{question:"Mobile number",name:`officeHolders[${a}].mobile`,type:"tel",placeholder:"Mobile number",required:!0})]})]}),(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("h3",{className:"text-sm font-medium text-gray-900",children:["Residential address ",(0,t.jsx)(h.mg,{required:p.e.officeHolders.address.required})]}),(0,t.jsx)(h.at,{name:`address_details.officeHolders[${a}].address`,onChange:e=>((e,s)=>{let a=e?.[0];if(!a?.geometry)return;let{formattedAddress:t,line2:i,street:r,componentMap:n,locality:l}=(0,x.Y)(a);d(`address_details.officeHolders[${s}].address`,t),d(`officeHolders[${s}].address.line2`,i||""),d(`officeHolders[${s}].address.street`,r),d(`officeHolders[${s}].address.state`,n.administrative_area_level_1?.short_name??null),d(`officeHolders[${s}].address.country`,n.country?.short_name??null),d(`officeHolders[${s}].address.locality`,l??null),d(`officeHolders[${s}
2].birthDetails.locality`,l??null),d(`officeHolders[${s}].address.postcode`,n.postal_code?.long_name??null)})(e,a),placeholder:"Start typing addressâ¦"}),(0,t.jsx)(h.Y2,{id:`officeHolder-${a}-addr`,labelOpen:"View address details",labelClose:"Hide address details",isError:!!(c?.officeHolders?.[a]?.address&&m?.officeHolders?.[a]?.address),children:(0,t.jsxs)("div",{className:"grid lg:grid-cols-4 sm:grid-cols-2 gap-4",children:[(0,t.jsx)(h.ZQ,{question:"Street",value:g?.address?.street||"",id:`officeHolders[${a}].address.street`,name:`officeHolders[${a}].address.street`,placeholder:"Street name",disabled:!0}),(0,t.jsx)(h.ZQ,{question:"Suburb / Locality",value:g?.address?.locality||"",id:`officeHolders[${a}].address.locality`,name:`officeHolders[${a}].address.locality`,placeholder:"Suburb",disabled:!0}),(0,t.jsx)(h.FX,{question:"State",required:!0,value:g?.address?.state||"",id:`officeHolders[${a}].address.state`,name:`officeHolders[${a}].address.state`,placeholder:"Select State",options:e.state,disabled:!0}),(0,t.jsx)(h.ZQ,{question:"Postcode",value:g?.address?.postcode||"",id:`officeHolders[${a}].address.postcode`,name:`officeHolders[${a}].address.postcode`,placeholder:"e.g., 2000",disabled:!0})]})})]}),(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("h3",{className:"text-sm font-medium text-gray-900",children:["Birth details ",(0,t.jsx)(h.mg,{required:p.e.officeHolders.birthDetails.required})]}),(0,t.jsxs)("div",{className:"grid md:grid-cols-3 gap-4",children:[(0,t.jsx)(M,{name:`officeHolders[${a}].birthDetails.date`,label:"Date of birth",required:!0}),(0,t.jsx)(h.FX,{required:!0,question:"Country of Birth",name:`officeHolders[${a}].birthDetails.country`,value:n?.officeHolders?.[a]?.birthDetails?.country??"AU",placeholder:"Country of birth",options:e?.country,onChange:e=>{d(`officeHolders[${a}].birthDetails.officeHolderBirthCountry`,e),"AU"===e?(d(`officeHolders[${a}].birthDetails.localityQualifier`,null),d(`officeHolders[${a}].birthDetails.intlIndicator`,!1)):(d(`officeHolders[${a}].birthDetails.localityQualifier`,e),d(`officeHolders[${a}].birthDetails.intlIndicator`,!0))}})]}),C?(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-4 mt-2",children:[(0,t.jsx)(h.ZQ,{question:"City/Suburb of birth",name:`officeHolders[${a}].birthDetails.locality`,placeholder:"City/Suburb of birth"}),(0,t.jsx)(h.ZQ,{question:"Country of birth (qualifier)",name:`officeHolders[${a}].birthDetails.localityQualifier`,value:e?.country?.find(e=>String(e.value)===String(O))?.title||n?.officeHolders?.[a]?.birthDetails?.localityQualifier||O||"",placeholder:"Country",readOnly:!0})]}):(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-4 mt-2",children:[(0,t.jsx)(h.ZQ,{question:"City/Suburb of birth",name:`officeHolders[${a}].birthDetails.locality`,placeholder:"City/Suburb of birth"}),(0,t.jsx)(h.FX,{question:"State (or country)",name:`officeHolders[${a}].birthDetails.localityQualifier`,options:e.state,value:n?.officeHolders?.[a]?.birthDetails?.localityQualifier??"",placeholder:"State (or country)"})]})]}),(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsx)(h.ly,{question:"Has this person used a former name?",value:n.officeHolders?.[a]?.isFormerName||!1,id:`officeHolders[${a}].isFormerName`,name:`officeHolders[${a}].isFormerName`}),n.officeHolders?.[a]?.isFormerName&&(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(h.ZQ,{name:`officeHolders[${a}].formerName.givenName1`,placeholder:"First name",question:"First Name",required:!0}),c?.officeHolders?.[a]?.formerName?.givenName1&&(0,t.jsx)("p",{className:"text-red-600 text-xs mt-1",children:c.officeHolders[a].formerName.givenName1})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.ZQ,{name:`officeHolders[${a}].formerName.familyName`,placeholder:"Last name",question:"Last Name",required:!0}),c?.officeHolders?.[a]?.formerName?.familyName&&(0,t.jsx)("p",{className:"text-red-600 text-xs mt-1",children:c.officeHolders[a].formerName.familyName})]})]})]}),(0,t.jsx)("section",{className:"pt-2",children:(0,t.jsxs)("div",{className:"text-xs text-gray-600",children:["Role summary:\xa0",(0,t.jsx)("span",{className:"font-medium text-gray-900",children:[D(a,"DIR")?"Director":null,n?.officeHolders?.[a]?.isShareHolder?"Shareholder":null,D(a,"SEC")?"Company Secretary":null].filter(
2Boolean).join(", ")||"â"})]})}),(D(a,"DIR")||D(a,"SEC")||n?.officeHolders?.[a]?.isShareHolder)&&(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(h.ly,{required:!0,question:"Do you have an existing tax file number ?",value:n?.officeHolders?.[a]?.tfnIndicator,id:`officeHolders[${a}].tfnIndicator`,name:`officeHolders[${a}].tfnIndicator`,tooltip:""}),(0,t.jsxs)("small",{className:"text-primary text-[12px] flex items-center gap-1",children:[(0,t.jsx)(w.A,{size:14})," providing TFN helps speed up the ABN registration process."]})]}),(0,t.jsx)(h.mO,{className:"min-w-[250px]",status:!!n?.officeHolders?.[a]?.tfnIndicator,children:(0,t.jsx)(h.ZQ,{question:"Tax File Number",required:!!n?.officeHolders?.[a]?.tfnIndicator,id:`officeHolders[${a}].tfn`,name:`officeHolders[${a}].tfn`,placeholder:"Enter your 9 digit TFN",numericOnly:!0,minLength:9,maxLength:9,inputMode:"numeric",pattern:"\\d{0,9}",tooltip:{description:"Providing your TFN is optional but recommended. It helps the ATO process your ABN faster..."}})})]})]})]},a)}})]}),(a=c?.officeHolders?._error,r=Array.isArray(n?.officeHolders)&&n.officeHolders.some(e=>!!e?.isShareHolder),a||(r?null:"At least one shareholder must be selected")?(0,t.jsx)("div",{className:"mb-4 rounded border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:(0,t.jsx)("div",{children:a||"At least one shareholder must be selected"})}):null)]})]})}let _="ORDINARY",C={careOf:"",line2:"",street:"",locality:"",state:"",postcode:""},R=e=>Array.isArray(e)?e:[],D=(e,s=0)=>
2{if(""===e||null==e)return s;let a=Number(e);return Number.isFinite(a)?a:s},$=e=>Array.isArray(e)?Object.fromEntries(e):{};function H({dummyData:e}){let{values:s,setFieldValue:a}=(0,l.j7)();console.log("Shares values:",s);let r=R(s?.shareStructure),n=R(s?.shareAllocation),d=R(s?.officeHolders),[o,c]=(0,i.useState)("done"),[m,u]=(0,i.useState)(!1),p=(0,i.useRef)(null);(0,i.useRef)(null);let[g,x]=(0,i.useState)("equal");(0,i.useEffect)(()=>{let e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;s?.applicant?.dateSigned||a("applicant.dateSigned",t),s?.applicant?.declaresTrueAndCorrectIndicator!==!0&&a("applicant.declaresTrueAndCorrectIndicator",!0)},[]),(0,i.useEffect)(()=>{r.length||a("shareStructure",[{classCode:"ORD",classTitle:_,numberIssued:100,totalAmountPaid:100,totalAmountUnpaid:0,fullyPaidIndicator:!0}])},[r.length]),(0,i.useEffect)(()=>{if(!d.length)return;let t=d.filter(e=>e?.isShareHolder),i=d.map((e,s)=>`${s}:${!!e?.isShareHolder}`).join("|"),l=(s?.__shareholderIdentityKey__??null)!==i,o=r?.[0]?.classCode||e?.shareCodes?.[0]?.value||"ORD",m={};if(R(n).forEach(e=>{let s=e?.holdingOwners?.[0]?.holderIndex;null!=s&&(m[s]=e)}),!l){let e=R(n).map(e=>{let s=e?.holdingOwners?.[0]?.holderIndex,a=null!=s?d[s]:null;return a?{...e,holdingOwners:[{...e.holdingOwners[0],individual:{familyName:a?.name?.fam
2ilyName||"",givenName1:a?.name?.givenName1||"",givenName2:a?.name?.givenName2||"",givenName3:a?.name?.givenName3||""},address:{...C,line2:a?.address?.line2||"",street:a?.address?.street||"",locality:a?.address?.locality||"",state:a?.address?.state||"",postcode:a?.address?.postcode||"",country:a?.address?.country||""}}]}:e});JSON.stringify(e)!==JSON.stringify(n)&&a("shareAllocation",e);return}a("__shareholderIdentityKey__",i);let u=t.map(e=>{let s=d.indexOf(e),a=m[s];return{classCode:a?.classCode??o,numberIssued:0,fullyPaidIndicator:a?.fullyPaidIndicator??!0,totalAmountPaid:0,totalAmountUnpaid:0,amountPaidPerShare:0,amountUnpaidPerShare:0,beneficialOwnerIndicator:a?.beneficialOwnerIndicator??!0,beneficialOwner:a?.beneficialOwner??"",holdingOwners:[{isIndividual:!0,individual:{familyName:e?.name?.familyName||"",givenName1:e?.name?.givenName1||"",givenName2:e?.name?.givenName2||"",givenName3:e?.name?.givenName3||""},address:{...C,line2:e?.address?.line2||"",street:e?.address?.street||"",locality:e?.address?.locality||"",state:e?.address?.state||"",postcode:e?.address?.postcode||"",country:e?.address?.country||""},holderIndex:s}]}});if(u.length>0){let e=D(r?.[0]?.numberIssued,100),s=D(r?.[0]?.totalAmountPaid,+e),a=e>0?s/e:1,t=Math.floor(e/u.length),i=e-t*u.length;u.forEach(e=>{let s=t+ +(i>0);i-=1,e.numberIssued=s,e.amountPaidPerShare=+a.toFixed(4),e.totalAmountPaid=+(a*s).toFixed(2),e.amountUnpaidPerShare=0,e.totalAmountUnpaid=0}),p.current=null,x("equal"),c("done")}a("shareAllocation",u),s?.showShareAllocation||a("showShareAllocation",!0)},[d.map((e,s)=>`${s}:${!!e?.isShareHolder}`).join("|")]),(0,i.useEffect)(()=>{let e=((e=[])=>e.map(e=>({...e,holdingOwners:R(e.holdingOwners).map(e=>e?.isIndividual?{isIndividual:!0,individual:e?.individual||{},address:e?.address||{},holderIndex:e?.holderIndex}:{isIndividual:!1,organisation:{...e?.organisation||{}},address:e?.address||{},holderIndex:e?.holderIndex})})))(n);JSON.stringify(e)!==JSON.stringify(n)&&a("shareAllocation",e)},[JSON.stringify(n)]);let y=(0,i.useMemo)(()=>{let e=new Set;return R(r).forEach(s=>{let a=s?.classCode||"ORD";a&&e.add(a)}),R(n).forEach(s=>{let a=s?.classCode??"ORD";a&&e.add(a)}),Array.from(e)},[r,n]),b=(0,i.useMemo)(()=>{let e=$(R(y).map(e=>[e,0]));return R(r).forEach(s=>{let a=s?.classCode||"ORD";e[a]=(e[a]??0)+D(s?.numberIssued,0)}),e},[y,r]),v=(0,i.useMemo)(()=>{let e=$(R(y).map(e=>[e,0]));return R(r).forEach(s=>{let a=s?.classCode||"ORD";e[a]=(e[a]??0)+D(s?.totalAmountPaid,0)}),e},[y,r]),N=(0,i.useMemo)(()=>{let e=$(R(y).map(e=>[e,[]]));
2return R(n).forEach((s,a)=>{let t=s?.classCode||"ORD";(e[t]||=[]).push({idx:a,row:s})}),e},[y,n]),j=()=>{let e=R(n).map(e=>({...e}));R(y).forEach(s=>{let a=D(b[s],0),t=R(N[s]);if(a<=0||!t.length)return;let i=Math.floor(a/t.length),r=a-i*t.length,n=a>0?D(v[s],0)/a:0;t.forEach(({idx:s})=>{let a=i+ +(r>0);r-=1,e[s]={...e[s],numberIssued:a,amountPaidPerShare:D(n,0),totalAmountPaid:D(n*a,0),amountUnpaidPerShare:0,totalAmountUnpaid:0}})}),a("shareAllocation",e),c("done"),x("equal")},[S,A]=(0,i.useState)({});(0,i.useEffect)(()=>{let e={...S};R(y).forEach(s=>{let a=R(N[s]).length;if(!Array.isArray(e[s])||e[s].length!==a){let t=Math.floor(100/Math.max(1,a)),i=100-t*Math.max(1,a);e[s]=Array.from({length:a},(e,s)=>t+ +(s<i))}}),A(e)},[JSON.stringify(R(y).map(e=>[e,R(N[e]).length]))]);let w=(e,s,a)=>{let t=[...S[e]||[]];t[s]=Math.max(0,Math.min(100,Number(a)||0));let i=100-t.reduce((e,s)=>e+s,0);if(0!==i){let e=t.findIndex((e,a)=>a!==s);e>=0&&(t[e]=Math.max(0,Math.min(100,t[e]+i)))}A(s=>({...s,[e]:t}))};(0,i.useEffect)(()=>{let e=JSON.stringify({totals:b,allocCount:R(n).length,mode:o});if("custom"!==o&&R(y).length&&R(n).length){if(R(n).every(e=>D(e?.numberIssued,0)>0)&&null===p.current)return;p.current!==e&&(j(),p.current=e)}},[JSON.stringify(b),R(n).length,o,R(y).length]);let I=(0,i.useMemo)(()=>R(y).map(e=>{let s=D(b[e],0),a=R(N[e]).reduce((e,{row:s})=>e+D(s?.numberIssued,0),0);return{code:e,issued:s,allocated:a,ok:s===a}}),[y,b,N]),q=I.every(e=>e.ok);(0,i.useEffect)(()=>{s?.shares_allocation_valid!==q&&a("shares_allocation_valid",q)},[q]);let O=D(r?.[0]?.numberIssued,0),[H,M]=(0,i.useState)(O>0?D(r?.[0]?.totalAmountPaid,0)/O:1),P=R(d).filter(e=>(e?.roles||[]).includes("DIR")).length,k=R(d).filter(e=>(e?.roles||[]).includes("SEC")).length,B=R(d).filter(e=>e?.isShareHolder).length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.A,{}),(0,t.jsx)("div",{className:"rounded-xl sm:border sm:border-gray-200 sm:p-4 mb-6 bg-white",children:(0,t.jsxs)("div",{className:"flex items-start justify-between flex-col sm:flex-row gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-semibold",children:"Company Structure & Ownership"}),(0,t.jsxs)("div",{className:"text-sm mt-2",children:[(0,t.jsx)("span",{className:"font-medium",children:"Directors:"})," ",P,"\xa0\xa0",(0,t.jsx)("span",{className:"font-medium",children:"Shareholders:"})," ",B,"\xa0\xa0",(0,t.jsx)("span",{className:"font-medium",children:"Company Secretary:"})," ",k]}),(0,t.jsxs)("div",{className:"text-xs text-gray-600 mt-2 max-w-xl",children:["Standard structure: ",O||100," shares @ $",D(H,1).toFixed(2)," = ",(D(H,1)*(O||100)).toFixed(2)," total.",(0,t.jsx)("br",{}),"Weâll automatically split ownership equally. You can customize anytime."]}),(0,t.jsxs)("div",{className:"mt-3 flex flex-col sm:flex-row gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:j,className:`rounded-md text-sm px-3 py-1.5 ${"equal"===g?"bg-blue-600 text-white":"border"}`,children:"Equal"}),(0,t.jsx)("button",{type:"button",onClick:()=>{let e=R(n).map(e=>({...e}));R(y).forEach(s=>{let a=D(b[s],0),t=R(N[s]);if(a<=0||0===t.length)return;let i=Math.max(1,Math.round(.51*a)),r=Math.max(0,a-i),n=t.length-1,l=a>0?D(v[s],0)/a:0;t.forEach(({idx:s},a)=>{let t=0;if(0===a)t=i;else{let e=n>0?Math.floor(r/n):0;t=e+ +(a-1<(n>0?r-e*n:0))}e[s]={...e[s],numberIssued:t,amountPaidPerShare:D(l,0),totalAmountPaid:D(l*t,0),amountUnpaidPerShare:0,totalAmountUnpaid:0}})}),a("shareAllocation",e),c("done"),x("majority")},className:`rounded-md text-sm px-3 py-1.5 ${"majority"===g?"bg-blue-600 text-white":"border"}`,children:"Majority (51%)"}),(0,t.jsx)("button",{type:"button",onClick:()=>{c(e=>"custom"===e?"done":"custom"),x("custom")},className:`sm:ml-auto rounded-md text-sm px-3 py-1.5 ${"custom"===g?"bg-blue-600 text-white":"border"}`,children:"custom"===o?"Hide customize options":"Customize ownership"})]}),(0,t.jsxs)("div",{className:"mt-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>u(e=>!e),className:"text-sm text-gray-700 underline",children:m?"Hide advanced options":"Advanced options"}),m&&(0,t.jsxs)("div",{className:"mt-3 grid lg:grid-cols-4 grid-cols-1 gap-4",children:[(0,t.jsx)(h.ZQ,{question:"Total shares",type:"number",min:0,id:"shareStructure[0].numberIssued",name:"shareStructure[0].numberIssued",value:O,onChange:e=>{let s,t;return s=Math.max(0,D(e.target.value,0)),t=D(H,1),void(a("shareStructure[0].classCode",r?.[0]?.classCode||"ORD"),a("shareStructure[0].classTitle",r?.[0]?.classTitle||_),a("shareStructure[0].numberIssued",s),a("shareStructure[0].totalAmountPaid",+(s*t).toFixed(2)),a("shareStructure[0].totalAmountUnpaid",0),a("shareStructure[0].fullyPaidIndicator",!0),"custom"!==o&&j())}}),(0,t.jsx)(h.ZQ,{question:"Price per share",type:"number",min:0,value:H,onChange:e=>{let s;M(s=Math.max(0,D(e.target.value,1))),a("shareStructure[0].totalAmountPaid",+(D(r?.[0]?.numberIssued,0)*s).toFixed(2)),"custom"!==o&&j()},id:"pricePerShareLocal",name:"pricePerShareLocal"}),(0,t.jsx)(h.ZQ,{question:"Total company capital",value:(D(H,0)*O).toFixed(2),readOnly:!0,id:"totalCapitalReadonly",name:"totalCapitalReadonly"})]})]})]}),(0,t.jsxs)("div",{className:"rounded-lg border bg-gray-50 p-3",children:[(0,t.jsx)("div",{className:"text-sm font-medium mb-2",children:"Breakdown"}),(0,t.jsxs)("div",{className:"text-xs text-gray-700",children:[R(n).map((e,s)=>{let a=e?.holdingOwners?.[0],i=a?.isIndividual?`${a?.individual?.givenName1||""} ${a?.individual?.familyName||""}`.trim()||`Holder ${s+1}`:a?.organisation?.name||`Holder ${s+1}`;return(0,t.jsxs)("div",{className:"flex justify-between text-xs mb-2",children:[(0,t.jsx)("div",{children:i}),(0,t.jsxs)("div",{children:["$",(D(H,0)*D(e?.numberIssued,0)).toFixed(2)]})]},s)}
2),(0,t.jsxs)("div",{className:"border-t mt-2 pt-2 text-xs font-medium flex justify-between",children:[(0,t.jsx)("div",{children:"Total company capital:"}),(0,t.jsxs)("div",{children:["$",(D(H,1)*(O||100)).toFixed(2)]})]})]})]})]})}),"custom"!==o&&(0,t.jsx)("div",{className:"rounded-xl sm:border sm:border-gray-200 sm:p-4",children:R(y).map(e=>{let s=R(N[e]),a=D(b[e],0);return a<=0||!s.length?null:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:"Ownership Split"}),(0,t.jsxs)("div",{className:"text-xs text-gray-500",children:[e," \xa0 ",a," shares"]})]}),(0,t.jsx)("div",{className:"space-y-3",children:s.map(({idx:e,row:s},i)=>{let r=s?.holdingOwners?.[0],n=r?.isIndividual?`${r?.individual?.givenName1||""} ${r?.individual?.familyName||""}`.trim()||`Holder ${i+1}`:r?.organisation?.name||`Holder ${i+1}`,l=a>0?Math.round(D(s?.numberIssued,0)/a*100):0;return(0,t.jsxs)("div",{className:"rounded-lg border p-3 bg-white",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:n}),(0,t.jsxs)("div",{className:"text-sm font-medium",children:[l,"% ",(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["(",D(s?.numberIssued,0)," shares)"]})]})]}),(0,t.jsx)("div",{className:"w-full bg-gray-100 h-3 rounded-full overflow-hidden",children:(0,t.jsx)("div",{style:{width:`${l}%`},className:"h-3 bg-black/80"})})]},e)})})]},e)})}),"custom"===o&&(0,t.jsx)("div",{className:"mt-6",children:R(y).map(e=>{let s=R(N[e]),i=D(b[e],0);if(i<=0||!s.length)return null;let r=S[e]||[];return(0,t.jsxs)("div",{className:"mt-2 rounded-xl border border-gray-200 p-4 bg-white",children:[(0,t.jsxs)("div",{className:"flex items-center flex-col sm:flex-row sm:justify-between mb-1",children:[(0,t.jsxs)("div",{className:"text-sm font-medium",children:["Ownership Split â ",e]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let s,t,i,r,l,d,o;return s=R(n).map(e=>({...e})),t=R(N[e]),i=S[e]||[],l=(r=D(b[e],0))>0?D(v[e],0)/r:0,d=i.map(e=>Math.round(e/100*r)),o=r-d.reduce((e,s)=>e+s,0),void(d.length&&(d[0]+=o),t.forEach(({idx:e},a)=>{let t=D(d[a],0);s[e]={...s[e],numberIssued:t,amountPaidPerShare:D(l,0),totalAmountPaid:D(l*t,0),amountUnpaidPerShare:0,totalAmountUnpaid:0}}),a("shareAllocation",s),a("showShareAllocation",!0),c("done"),x("custom"))},className:"w-full sm:w-auto my-2 sm:my-0 rounded-md bg-blue-600 text-white text-xs px-3 py-2",children:"Apply to allocations"})]}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 mb-3",children:["Distribute ",i," shares. Sliders must total 100%."]}),(0,t.jsx)("div",{className:"space-y-4",children:s.map(({idx:s,row:a},n)=>{let l=a?.holdingOwners?.[0],d=l?.isIndividual?`${l?.individual?.givenName1||""} ${l?.individual?.familyName||""}`.trim()||`Holder ${n+1}`:l?.organisation?.name||`Holder ${n+1}`,o=r[n]??0,c=Math.round(o/100*i);return(0,t.jsxs)("div",{className:"rounded-lg border border-gray-100 p-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:d}),(0,t.jsxs)("div",{className:"text-xs text-gray-600",children:[o,"% \xa0|\xa0 ",c," shares"]})]}),(0,t.jsx)("input",{type:"range",min:0,max:100,step:1,value:o,onChange:s=>w(e,n,Number(s.target.value)),className:"w-full accent-blue-600"}),(0,t.jsxs)("div",{className:"mt-2 text-right",children:[(0,t.jsx)("input",{type:"number",min:0,max:100,value:o,onChange:s=>w(e,n,Number(s.target.value)),className:"w-20 border rounded px-2 py-1 text-right text-sm"})," %"]})]},s)})}),(0,t.jsxs)("div",{className:"mt-2 text-xs text-gray-500 text-right",children:["Total: ",(r||[]).reduce((e,s)=>e+(Number(s)||0),0),"%"]})]},e)})}),(0,t.jsxs)("article",{className:"mt-6 w-full",children:[(0,t.jsx)("h6",{children:"Gross Total Of Share Allocations"}),(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg border border-gray-200",children:(0,t.jsxs)("table",{className:"table-auto w-full border-collapse border border-gray-200 ",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"bg-gray-100",children:[(0,t.jsx)("th",{className:"p-3 text-left",children:"Class Code"}),(0,t.jsx)("th",{className:"p-3 text-right",children:"Shares Issued"}),(0,t.jsx)("th",{className:"p-3 text-right",children:"Shares Allocated"}),(0,t.jsx)("th",{className:"p-3 text-center",children:"All Allocated"})]})}),(0,t.jsx)("tbody",{children:I.map(({code:e,issued:s,allocated:a,ok:i})=>(0,t.jsxs)("tr",{className:"border",children:[(0,t.jsx)("td",{className:"p-3",children:e}),(0,t.jsx)("td",{className:"p-3 text-right",children:s}),(0,t.jsx)("td",{className:"p-3 text-right",children:a}),(0,t.jsx)("td",{className:"p-3 text-center",children:i?(0,t.jsx)("span",{className:"text-green-600",children:"yes"}):(0,t.jsx)("span",{className:"text-red-600",children:"need allocation"})})]},e))})]})}),!q&&(0,t.jsx)("div",{className:"mt-3 rounded border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:"Shares allocated must equal shares issued for every class before you continue."})]})]})}var M=a(4760);let P=({dummyData:e,data:s})=>{let{setFieldValue:a,values:r}=(0,l.j7)(),[n,d]=(0,i.useState)(null),o=async e=>{if(e&&e.length>0){let s=await (0,M.PY)(e);return(console.log(s),s?.data?.status=="Registered")?(d({message:"ACN is Valid",valid:!0}),!0):(d({message:"ACN is Invalid",valid:!1}),!1)}};return console.log(s),(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(h.mO,{status:p.e.nonShareMembersAmount(s).required,
2children:[(0,t.jsxs)("h5",{className:"font-semibold",children:["Non Share Members ",(0,t.jsx)(h.mg,{required:p.e.nonShareMembersAmount(s).required})]}),(0,t.jsx)("article",{className:"grid grid-cols-1 gap-10 my-5",children:(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembersAmount(s).question,required:p.e.nonShareMembersAmount(s).required,value:s?.nonShareMembersAmount,status:p.e.nonShareMembersAmount(s).status,id:"nonShareMembersAmount",name:"nonShareMembersAmount",placeholder:"last two digits represent decimals (e.g. 100 is $1)",type:"number"})}),(0,t.jsx)(h.mO,{status:p.e.nonShareMembers.required(s).required,children:(0,t.jsx)(h.xQ,{name:"nonShareMembers",template:{isIndividual:null,address:{careOf:null,line2:null,street:null,locality:null,state:null,postcode:null,country:null}},children:(i,r,l)=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"float-right",children:r>0&&(0,t.jsx)("button",{type:"button",className:"text-red-500 border-red-500 rounded-md px-2 py-1 bg-red-100",onClick:()=>l(r),children:"Remove member"})}),(0,t.jsxs)("h6",{className:"my-5",children:["Non Share Member (",r+1,")"]}),(0,t.jsx)(h.ly,{question:"Is this member an individual?",required:p.e.nonShareMembers.isIndividual.required,sta:!0,value:s?.nonShareMembers[r].isIndividual,id:`nonShareMembers[${r}].isIndividual`,name:`nonShareMembers[${r}].isIndividual`,relatedField:`nonShareMembers[${r}].individual`,relatedValue:{familyName:"",givenName1:"",givenName2:"",givenName3:""},relatedReset:null,onToggle:e=>{e?(a(`nonShareMembers[${r}].organisation`,void 0),a(`nonShareMembers[${r}].individual`,{familyName:null,givenName1:null,givenName2:null,givenName3:null})):(a(`nonShareMembers[${r}].individual`,void 0),a(`nonShareMembers[${r}].organisation`,{name:null,acn:null}))}}),(0,t.jsxs)(h.mO,{className:"mt-5",status:p.e.nonShareMembers.individual.required(s,r).required,
2children:[(0,t.jsx)("h6",{className:"my-5",children:"Individual Member Details"}),(0,t.jsxs)("article",{className:"grid grid-cols-2 gap-10",children:[(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.individual.familyName(s,r).question,required:p.e.nonShareMembers.individual.familyName(s,r).required,value:s?.nonShareMembers?.[r]?.individual?.familyName,status:p.e.nonShareMembers.individual.familyName(s,r).status,id:`nonShareMembers[${r}].individual.familyName`,name:`nonShareMembers[${r}].individual.familyName`,placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.individual.givenName1(s,r).question,required:p.e.nonShareMembers.individual.givenName1(s,r).required,value:s?.nonShareMembers?.[r]?.individual?.givenName1,status:p.e.nonShareMembers.individual.givenName1(s,r).status,id:`nonShareMembers[${r}].individual.givenName1`,name:`nonShareMembers[${r}].individual.givenName1`,placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.individual.givenName2(s,r).question,required:p.e.nonShareMembers.individual.givenName2(s,r).required,value:s?.nonShareMembers?.[r]?.individual?.givenName2,status:p.e.nonShareMembers.individual.givenName2(s,r).status,id:`nonShareMembers[${r}].individual.givenName2`,name:`nonShareMembers[${r}].individual.givenName2`,placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.individual.givenName3(s,r).question,required:p.e.nonShareMembers.individual.givenName3(s,r).required,value:s?.nonShareMembers?.[r]?.individual?.givenName3,status:p.e.nonShareMembers.individual.givenName3(s,r).status,id:`nonShareMembers[${r}].individual.givenName3`,name:`nonShareMembers[${r}].individual.givenName3`,placeholder:""})]})]}),(0,t.jsxs)(h.mO,{className:"mt-5",status:p.e.nonShareMembers.organisation.required(s,r).required,
2children:[(0,t.jsx)("h6",{className:"my-5",children:"Organisation Member Details"}),(0,t.jsxs)("article",{className:"grid grid-cols-2 gap-10",children:[(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.organisation.name(s,r).question,required:p.e.nonShareMembers.organisation.name(s,r).required,value:s?.nonShareMembers?.[r]?.organisation?.name,status:p.e.nonShareMembers.organisation.name(s,r).status,id:`nonShareMembers[${r}].organisation.name`,name:`nonShareMembers[${r}].organisation.name`,placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.organisation.acn(s,r).question,required:p.e.nonShareMembers.organisation.acn(s,r).required,value:s?.nonShareMembers?.[r]?.organisation?.acn,status:p.e.nonShareMembers.organisation.acn(s,r).status,id:`nonShareMembers[${r}].organisation.acn`,name:`nonShareMembers[${r}].organisation.acn`,placeholder:"",onBlur:o,APIStatus:n})]})]}),(0,t.jsxs)(h.mO,{className:"mt-5",status:p.e.nonShareMembers.address.required,children:[(0,t.jsx)("h6",{className:"my-5",children:"Member Address Details"}),(0,t.jsxs)("article",{className:"grid grid-cols-2 gap-10 items-end",children:[(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.address.careOf(s,r).question,required:p.e.nonShareMembers.address.careOf(s,r).required,value:s?.nonShareMembers?.[r]?.address?.careOf,status:p.e.nonShareMembers.address.careOf(s,r).status,id:`nonShareMembers[${r}].address.careOf`,name:`nonShareMembers[${r}].address.careOf`,placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.address.line2(s,r).question,required:p.e.nonShareMembers.address.line2(s,r).required,value:s?.nonShareMembers?.[r]?.address?.line2,status:p.e.nonShareMembers.address.line2(s,r).status,id:`nonShareMembers[${r}].address.line2`,name:`nonShareMembers[${r}].address.line2`,placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.address.street(s,r).question,required:p.e.nonShareMembers.address.street(s,r).required,value:s?.nonShareMembers?.[r]?.address?.street,status:p.e.nonShareMembers.address.street(s,r).status,id:`nonShareMembers[${r}].address.street`,name:`nonShareMembers[${r}].address.street`,placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.address.locality(s,r).question,required:p.e.nonShareMembers.address.locality(s,r).required,value:s?.nonShareMembers?.[r]?.address?.locality,status:p.e.nonShareMembers.address.locality(s,r).status,id:`nonShareMembers[${r}].address.locality`,name:`nonShareMembers[${r}].address.locality`,placeholder:""}),(0,t.jsx)(h.FX,{question:p.e.nonShareMembers.address.country(s,r).question,required:p.e.nonShareMembers.address.country(s,r).required,value:s?.nonShareMembers?.[r]?.address?.country,status:p.e.nonShareMembers.address.country(s,r).status,id:`nonShareMembers[${r}].address.country`,name:`nonShareMembers[${r}].address.country`,placeholder:"Select Country",options:e.country}),(0,t.jsx)(h.mO,{status:p.e.nonShareMembers.address.state(s,r).required,
2children:(0,t.jsx)(h.FX,{question:p.e.nonShareMembers.address.state(s,r).question,required:p.e.nonShareMembers.address.state(s,r).required,value:s?.nonShareMembers?.[r]?.address?.state,status:p.e.nonShareMembers.address.state(s,r).status,id:`nonShareMembers[${r}].address.state`,name:`nonShareMembers[${r}].address.state`,placeholder:"Select State",options:e.jurisdiction})}),(0,t.jsx)(h.mO,{status:p.e.nonShareMembers.address.postcode(s,r).required,children:(0,t.jsx)(h.ZQ,{question:p.e.nonShareMembers.address.postcode(s,r).question,required:p.e.nonShareMembers.address.postcode(s,r).required,value:s?.nonShareMembers?.[r]?.address?.postcode,status:p.e.nonShareMembers.address.postcode(s,r).status,id:`nonShareMembers[${r}].address.postcode`,name:`nonShareMembers[${r}].address.postcode`,placeholder:""})})]})]})]})})})]})})},k={careOf:"",line2:"",street:"",locality:"",state:"",postcode:"",country:""},B={title:"",familyName:"",givenName1:"",givenName2:"",givenName3:"",email:"",phone_number:"",dateOfBirth:"",genderCode:""},T={name:"",acn:"",email:"",phone_number:""},E={familyName:"",givenName1:"",givenName2:"",givenName3:""},F=c.p;function Q(e,s,a){let t=s.split("."),i=e;for(let e=0;e<t.length-1;e++){let s=t[e];(null==i[s]||"object"!=typeof i[s])&&(i[s]={}),i=i[s]}let r=t[t.length-1];null==i[r]&&(i[r]=a)}let L=e=>{if(!e)return"â";let s=e?.name?.givenName1??"",a=e?.name?.familyName??"";return`${s} ${a}`.trim()||e?.name?.companyName||"No name"},Z=({dummyData:e,data:s})=>{let{setFieldValue:a,values:r,errors:n,touched:d,submitCount:o}=(0,l.j7)(),[c,m]=(0,i.useState)(null),u=(0,i.useRef)(!1);console.log("values==>",r);let g=async e=>{if(!e)return;let s=await (0,M.PY)(e);return s?.data?.status==="Registered"?(m({message:"ACN is Valid",valid:!0}),!0):(m({message:"ACN is Invalid",valid:!1}),!1)};(0,i.useEffect)(()=>{Q(r,"applicant",{}),Q(r,"applicant.address",{...k}),r?.applicant?.isIndividual==null&&a("applicant.isIndividual",!0),r?.admin||a("admin",{manualReviewIndicator:!1,manualReviewText:""}),r?.applicant?.isIndividual??!0?r?.applicant?.individual||a("applicant.individual",{...B}):(r?.applicant?.organisation||a("applicant.organisation",{...T}),r?.applicant?.organisationSignatoryIndividual||a("applicant.organisationSignatoryIndividual",{...E}),r?.applicant?.organisationSignatoryRole==null&&a("applicant.organisationSignatoryRole",""))},[r?.applicant?.isIndividual]),(0,i.useEffect)(()=>{!w||u.current||(r?.officeHolders&&r.officeHolders[0]||s?.officeHolders&&s.officeHolders[0])&&(u.current=!0)},[r?.officeHolders]),(0,i.useEffect)(()=>{r?.applicant?.dateSigned||a("applicant.dateSigned",new Date().toISOString().slice(0,10))},[]),r?.applicant?.isIndividual??s?.applicant?.isIndividual;let[y,b]=(0,i.useState)(!1),[v,N]=(0,i.useState)(null),[j,S]=(0,i.useState)(!1),A=!!r?.applicant?.useDirectorPrefill,[w,I]=(0,i.useState)(A),q=Array.isArray(r?.officeHolders)?r.officeHolders:[],O=q.map((e,s)=>({h:e,idx:s})).filter(({h:e})=>!!Array.isArray(e?.roles)&&e.roles.includes("DIR")).map(({idx:e})=>e),_=((e=[])=>{let s=["isPrimary","primary","isPrimaryDirector","primaryContact","isAsicContact","is_asic_contact","primary_contact","is_primary"];for(let a=0;a<e.length;a++){let t=e[a];for(let e of s)if(t&&(!0===t[e]||"true"===t[e]))return a}return -1})(q),C=()=>{a("applicant.isIndividual",!0),a("applicant.individual",{title:"",familyName:"",givenName1:"",givenName2:"",givenName3:"",email:"",phone_number:"",dateOfBirth:"",genderCode:""}),a("applicant.address",{careOf:"",line2:"",street:"",locality:"",state:"",postcode:"",country:""}),a("address_details.applicant.address",""),N(null),S(!1)};(0,i.useEffect)(()=>{let e=!!r?.applicant?.useDirectorPrefill;e!==w&&I(e);let s="number"==typeof r?.applicant?.prefillSourceIndex?r.applicant.prefillSourceIndex:null,a=r?.applicant?.prefillSourceName??null;null!==s&&s>=0&&q[s]?(N({index:s,name:a||L(q[s])}),S(!0)):r?.applicant?.useDirectorPrefill&&!j&&1===q.length&&R(0)},[r?.applicant?.useDirectorPrefill,r?.applicant?.prefillSourceIndex,r?.applicant?.prefillSourceName,q.length]);let R=e=>{let s=q[e];s&&(a("applicant.isIndividual",!0),r?.applicant?.individual||a("applicant.individual",{...B}),((e,s)=>{if(!e)return;s("applicant.individual.givenName1",e?.name?.givenName1||""),s("applicant.individual.givenName2",e?.name?.givenName2||""),s("applicant.individual.givenName3",e?.name?.givenName3||""),s("applicant.individual.familyName",e?.name?.fam
2ilyName||""),s("applicant.individual.email",e?.email||e?.emailAddress||""),s("applicant.individual.phone_number",e?.mobile||e?.phone_number||e?.phone||""),e?.name?.title&&s("applicant.individual.title",e?.name?.title),e?.birthDetails?.date&&s("applicant.individual.dateOfBirth",e.birthDetails.date),e?.genderCode&&s("applicant.individual.genderCode",e.genderCode);let a=e?.address||{};s("applicant.address.careOf",a?.careOf??""),s("applicant.address.line2",a?.line2??""),s("applicant.address.street",a?.street??""),s("applicant.address.locality",a?.locality??""),s("applicant.address.state",a?.state??""),s("applicant.address.postcode",a?.postcode??""),s("applicant.address.country",a?.country??"")})(s,a),a("applicant.useDirectorPrefill",!0),a("applicant.prefillSourceIndex",e),a("applicant.prefillSourceName",L(s)),N({index:e,name:L(s)}),S(!0),b(!1),I(!0))},D=(e=[])=>Array.isArray(e)?e.map(e=>({...e,title:String(e.title??e.value??"").toUpperCase()})):[];return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,t.jsx)(f.A,{}),(0,t.jsx)("div",{className:"lg:col-span-3",children:(0,t.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white shadow-sm",children:[(0,t.jsxs)("div",{className:"border-b px-5 py-4",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Applicant"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"These are the details of the person lodging the company application"})]}),(0,t.jsxs)("div",{className:"px-5 py-5 space-y-8",children:[(0,t.jsxs)(h.mO,{className:"rounded-lg sm:border border-gray-200 p-0 sm:p-4",status:p.e.applicant.individual.required(r).required,children:[(0,t.jsxs)("div",{className:"flex items-start justify-between flex-col sm:flex-row",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h6",{className:"mb-1 font-medium text-gray-900",children:["Individual details"," ",(0,t.jsx)(h.mg,{required:p.e.applicant.individual.required(r).required})]}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mb-4",children:"Enter your legal name and best contact details"})]}),(0,t.jsx)("div",{className:"flex items-center gap-3",children:q.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"text-xs sm:text-sm pb-3 sm:pb-0 font-medium text-gray-900",children:"Use directorâs details"}
2),(0,t.jsxs)("label",{htmlFor:"use-director-toggle",className:"ml-2 inline-flex items-center cursor-pointer select-none",title:"Copy details from primary director (or choose a director)",children:[(0,t.jsx)("input",{id:"use-director-toggle",type:"checkbox",className:"sr-only",checked:w,onChange:e=>(e=>{if(I(e),a("applicant.useDirectorPrefill",e),e){if(_>=0)return void R(_);if(1===O.length)return void R(O[0]);if(0===O.length&&1===q.length)return void R(0);q.length>0?(b(!0),S(!1),N(null)):b(!1)}else b(!1),j?C():N(null),a("applicant.useDirectorPrefill",!1),a("applicant.prefillSourceIndex",void 0),a("applicant.prefillSourceName",""),S(!1)})(e.target.checked),"aria-checked":w,"aria-label":"Use director's details"}),(0,t.jsx)("span",{"aria-hidden":"true",className:"relative inline-flex items-center h-6 w-11 rounded-full transition-colors focus:outline-none "+(w?"bg-gray-900":"bg-gray-300 border border-gray-300"),style:{WebkitTapHighlightColor:"transparent"},children:(0,t.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform "+(w?"translate-x-5":"translate-x-1")})})]})]})})]}),y&&!v&&(0,t.jsxs)("div",{className:"mt-3 sm:border rounded sm:p-3 bg-white",children:[(0,t.jsx)("div",{className:"text-xs sm:text-sm text-gray-700 mb-2",children:"Choose a person to copy from"}),(0,t.jsx)("div",{className:"space-y-2 max-h-48 overflow-auto",children:(O.length>0?O:q.map((e,s)=>s)).map(e=>{let s=q[e];return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between border rounded px-1 sm:px-3 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium text-sm",children:L(s)}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 hidden sm:block",children:[s?.email??"No email"," \xb7 ",s?.mobile??s?.phone_number??"No phone"]})]}),(0,t.jsx)("div",{children:(0,t.jsx)("button",{type:"button",onClick:()=>R(e),className:"bg-blue-600 text-white text-sm px-3 py-1 rounded w-full mt-2 sm:mt-0",children:"Use"})})]},e)})}),(0,t.jsx)("div",{className:"mt-2 text-xs text-gray-500",children:"If you want a different person, add them as an associate above then choose them here."})]}),v&&(0,t.jsxs)("div",{className:"inline-flex flex-col sm:flex-row items-center gap-3 rounded-md my-4 bg-green-50 px-1 sm:px-3 py-2 text-sm text-green-800 border border-green-100",children:[(0,t.jsxs)("span",{children:["Filled from ",v.name]}),(0,t.jsx)("button",{type:"button",onClick:()=>{C(),a("applicant.useDirectorPrefill",!1),a("applicant.prefillSourceIndex",void 0),a("applicant.prefillSourceName",""),I(!1),b(!1),N(null),S(!1)},className:"text-xs text-white px-4 py-1 bg-red-500 rounded-md w-full","aria-label":"Undo prefill",children:"Undo"})]}),(0,t.jsxs)("article",{className:"grid lg:grid-cols-3 grid-cols-1 gap-5 ",children:[(0,t.jsx)(h.FX,{question:"Title",required:!0,value:r?.applicant?.individual?.title,id:"applicant.individual.title",name:"applicant.individual.title",placeholder:"Select title",options:D(F?.abn?.nameTitles||[])}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.individual.givenName1(r).question,required:p.e.applicant.individual.givenName1(r).required,value:r?.applicant?.individual?.givenName1,status:p.e.applicant.individual.givenName1(r).status,id:"applicant.individual.givenName1",name:"applicant.individual.givenName1",placeholder:"JOHN"}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.individual.givenName2(r).question,required:p.e.applicant.individual.givenName2(r).required,value:r?.applicant?.individual?.givenName2,status:p.e.applicant.individual.givenName2(r).status,id:"applicant.individual.givenName2",name:"applicant.individual.givenName2",placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.individual.familyName(r).question,required:p.e.applicant.individual.familyName(r).required,value:r?.applicant?.individual?.familyName,status:p.e.applicant.individual.familyName(r).status,id:"applicant.individual.familyName",name:"applicant.individual.familyName",placeholder:"DOE"}),(0,t.jsx)("div",{children:(0,t.jsx)(h.ZQ,{question:"Date of birth",type:"date",required:p.e.applicant.individual.dateOfBirth(r).required,value:r?.applicant?.individual?.dateOfBirth,id:"applicant.individual.dateOfBirth",name:"applicant.individual.dateOfBirth",placeholder:""})}),(0,t.jsx)(h.FX,{question:"Gender",required:!0,value:r?.applicant?.individual?.genderCode,id:"applicant.individual.genderCode",name:"applicant.individual.genderCode",placeholder:"Select gender",options:D(F?.abn?.gender||[])}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.individual.email(r).question,required:p.e.applicant.individual.email(r).required,value:r?.applicant?.individual?.email,status:p.e.applicant.individual.email(r).status,id:"applicant.individual.email",name:"applicant.individual.email",placeholder:"email of the applicant"}
2),(0,t.jsx)(h.ZQ,{question:p.e.applicant.individual.phone_number(r).question,required:p.e.applicant.individual.phone_number(r).required,value:r?.applicant?.individual?.phone_number,status:p.e.applicant.individual.phone_number(r).status,id:"applicant.individual.phone_number",name:"applicant.individual.phone_number",placeholder:"+61 4xx xxx xxx",type:"tel"})]})]}),(0,t.jsxs)(h.mO,{className:"rounded-lg sm:border border-gray-200 p-0 sm:p-4",status:p.e.applicant.organisation.required(r).required,children:[(0,t.jsxs)("h6",{className:"mb-1 font-medium text-gray-900",children:["Organisation details"," ",(0,t.jsx)(h.mg,{required:p.e.applicant.organisation.required(r).required})]}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mb-4",children:"Enter the organisationâs legal details. Weâll validate the ACN."}),(0,t.jsxs)("article",{className:"grid lg:grid-cols-4 grid-cols-1 gap-5 items-end",children:[(0,t.jsx)(h.ZQ,{question:p.e.applicant.organisation.name(r).question,required:p.e.applicant.organisation.name(r).required,value:r?.applicant?.organisation?.name,status:p.e.applicant.organisation.name(r).status,id:"applicant.organisation.name",name:"applicant.organisation.name",placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.organisation.acn(r).question,required:p.e.applicant.organisation.acn(r).required,value:r?.applicant?.organisation?.acn,status:p.e.applicant.organisation.acn(r).status,id:"applicant.organisation.acn",name:"applicant.organisation.acn",placeholder:"",onBlur:e=>g(e?.target?.value),APIStatus:c}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.organisation.email(r).question,required:p.e.applicant.organisation.email(r).required,value:r?.applicant?.organisation?.email,status:p.e.applicant.organisation.email(r).status,id:"applicant.organisation.email",name:"applicant.organisation.email",placeholder:"email of the organisation"}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.organisation.phone_number(r).question,required:p.e.applicant.organisation.phone_number(r).required,value:r?.applicant?.organisation?.phone_number,status:p.e.applicant.organisation.phone_number(r).status,id:"applicant.organisation.phone_number",name:"applicant.organisation.phone_number",placeholder:"+61 2 xxx xxxx"})]}),(0,t.jsxs)("h6",{className:"my-5 font-medium text-gray-900",children:["Organisation signatory individual"," ",(0,t.jsx)(h.mg,{required:p.e.applicant.organisationSignatoryIndividual.required(r).required})]}),(0,t.jsxs)("article",{className:"grid lg:grid-cols-4 grid-cols-1 gap-5",children:[(0,t.jsx)(h.ZQ,{question:p.e.applicant.organisationSignatoryIndividual.familyName(r).question,required:p.e.applicant.organisationSignatoryIndividual.familyName(r).required,value:r?.applicant?.organisationSignatoryIndividual?.familyName,status:p.e.applicant.organisationSignatoryIndividual.familyName(r).status,id:"applicant.organisationSignatoryIndividual.familyName",name:"applicant.organisationSignatoryIndividual.familyName",placeholder:"DOE"}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.organisationSignatoryIndividual.givenName1(r).question,required:p.e.applicant.organisationSignatoryIndividual.givenName1(r).required,value:r?.applicant?.organisationSignatoryIndividual?.givenName1,status:p.e.applicant.organisationSignatoryIndividual.givenName1(r).status,id:"applicant.organisationSignatoryIndividual.givenName1",name:"applicant.organisationSignatoryIndividual.givenName1",placeholder:"JOHN"}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.organisationSignatoryIndividual.givenName2(r).question,required:p.e.applicant.organisationSignatoryIndividual.givenName2(r).required,value:r?.applicant?.organisationSignatoryIndividual?.givenName2,status:p.e.applicant.organisationSignatoryIndividual.givenName2(r).status,id:"applicant.organisationSignatoryIndividual.givenName2",name:"applicant.organisationSignatoryIndividual.givenName2",placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.organisationSignatoryIndividual.givenName3(r).question,required:p.e.applicant.organisationSignatoryIndividual.givenName3(r).required,value:r?.applicant?.organisationSignatoryIndividual?.givenName3,status:p.e.applicant.organisationSignatoryIndividual.givenName3(r).status,id:"applicant.organisationSignatoryIndividual.givenName3",name:"applicant.organisationSignatoryIndividual.givenName3",placeholder:""})]}),(0,t.jsx)("div",{className:"mt-5",children:(0,t.jsx)(h.FX,{question:p.e.applicant.organisationSignatoryRole(r).question,required:p.e.applicant.organisationSignatoryRole(r).required,status:p.e.applicant.organisationSignatoryRole(r).status,id:"applicant.organisationSignatoryRole",name:"applicant.organisationSignatoryRole",options:e?.signatory||[],value:r?.applicant?.organisationSignatoryRole,placeholder:"Select signatory role"})})]}),(0,t.jsxs)(h.mO,{className:"rounded-lg sm:border border-gray-200 p-0 sm:p-4",status:!!p.e.applicant.address.required,
2children:[(0,t.jsxs)("h6",{className:"mb-1 font-medium text-gray-900",children:["Applicant address ",(0,t.jsx)(h.mg,{required:!!p.e.applicant.address.required})]}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mb-4",children:"Must be a physical residential or business address."}),!w&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(h.at,{name:"address_details.applicant.address",onChange:e=>{let s=e?.[0];if(!s?.geometry)return;let{formattedAddress:t,line2:i,street:r,componentMap:n,locality:l}=(0,x.Y)(s);a("address_details.applicant.address",t??""),a("applicant.address.line2",i??""),a("applicant.address.street",r??""),a("applicant.address.locality",l??""),a("applicant.address.state",n.administrative_area_level_1?.short_name??""),a("applicant.address.postcode",n.postal_code?.long_name??""),a("applicant.address.country",n.country?.short_name??"")},placeholder:"Start typing your addressâ¦"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Select your address from the dropdown to auto-fill the fields below."})]}),(0,t.jsxs)("article",{className:"grid lg:grid-cols-4 grid-cols-1 gap-5 items-end",children:[(0,t.jsx)(h.ZQ,{question:p.e.applicant.address.line2(r).question,required:p.e.applicant.address.line2(r).required,value:r?.applicant?.address?.line2,status:p.e.applicant.address.line2(r).status,id:"applicant.address.line2",name:"applicant.address.line2",placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.address.street(r).question,required:p.e.applicant.address.street(r).required,value:r?.applicant?.address?.street,status:p.e.applicant.address.street(r).status,id:"applicant.address.street",name:"applicant.address.street",placeholder:""}),(0,t.jsx)(h.ZQ,{question:p.e.applicant.address.locality(r).question,required:p.e.applicant.address.locality(r).required,value:r?.applicant?.address?.locality,status:p.e.applicant.address.locality(r).status,id:"applicant.address.locality",name:"applicant.address.locality",placeholder:""}),(0,t.jsx)(h.FX,{question:p.e.applicant.address.country(r).question,required:p.e.applicant.address.country(r).required,value:r?.applicant?.address?.country,status:p.e.applicant.address.country(r).status,id:"applicant.address.country",name:"applicant.address.country",placeholder:"Select Country",options:e?.country||[]}),(0,t.jsx)("div",{className:"lg:col-span-2",children:(0,t.jsx)(h.FX,{question:p.e.applicant.address.state(r).question,required:p.e.applicant.address.state(r).required,value:r?.applicant?.address?.state,status:p.e.applicant.address.state(r).status,id:"applicant.address.state",name:"applicant.address.state",placeholder:"Select State",options:e?.jurisdiction||[]})}),(0,t.jsx)("div",{className:"lg:col-span-2",children:(0,t.jsx)(h.ZQ,{question:p.e.applicant.address.postcode(r).question,required:p.e.applicant.address.postcode(r).required,value:r?.applicant?.address?.postcode,status:p.e.applicant.address.postcode(r).status,id:"applicant.address.postcode",name:"applicant.address.postcode",placeholder:""})})]})]}),(0,t.jsx)("div",{className:"rounded-lg sm:border border-gray-200 p-0 sm:p-4",children:(0,t.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-5",children:(0,t.jsx)(h.ZQ,{type:"date",question:p.e.applicant.dateSigned(r).question,required:p.e.applicant.dateSigned.required,value:r?.applicant?.dateSigned,status:p.e.applicant.dateSigned(r).status,id:"applicant.dateSigned",name:"applicant.dateSigned",placeholder:""})})})]})]})})]})},Y=()=>(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-6 py-5 flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsx)("div",{className:"h-12 w-1 rounded-full bg-gradient-to-b from-blue-600 to-indigo-600"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Declaration & Important Information"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-gray-600",children:"By submitting, you authorise Summit to lodge ABN / Business N
2ame applications and agree to the terms below."})]})]}),(0,t.jsx)("div",{className:"hidden sm:flex items-center gap-3",children:(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-yellow-50 px-3 py-1 text-xs font-medium text-yellow-800 border border-yellow-100",children:"Agent No: 52205"})})]}),(0,t.jsx)("div",{className:"border-t border-gray-100 px-6 py-6 grid grid-cols-1 lg:grid-cols-12 gap-6",children:(0,t.jsx)("div",{className:"lg:col-span-12",children:(0,t.jsxs)("div",{className:"space-y-6 max-h-[56vh] lg:max-h-[62vh] overflow-auto pr-3",children:[(0,t.jsxs)("p",{className:"text-sm text-gray-700",children:["By submitting this form, I authorise"," ",(0,t.jsx)("strong",{children:"Summit Startup Services Pty Ltd"})," (ACN: ","676 998 771",", ABN: ","11 676 998 771",") to act on my behalf to:"]}),(0,t.jsxs)("ul",{className:"space-y-3 text-sm text-gray-700",children:[(0,t.jsxs)("li",{className:"flex gap-3",children:[(0,t.jsx)("span",{className:"mt-0.5 text-blue-600",children:"â¢"}),(0,t.jsxs)("div",{children:["Lodge an ",(0,t.jsx)("strong",{children:"Australian Business Number (ABN)"})," application with the ",(0,t.jsx)("strong",{children:"Australian Business Register (ABR)"})," (ATO)."]})]}),(0,t.jsxs)("li",{className:"flex gap-3",children:[(0,t.jsx)("span",{className:"mt-0.5 text-blue-600",children:"â¢"}),(0,t.jsxs)("div",{children:["If requested, lodge a ",(0,t.jsx)("strong",{children:"Business Name"})," application with",(0,t.jsx)("strong",{children:" ASIC"}),", with Summit acting as ASIC Registered Agent (Agent No: 52205)."]})]})]}),(0,t.jsxs)("section",{className:"pt-2",children:[(0,t.jsx)("h4",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Consents & privacy"}),(0,t.jsxs)("ul",{className:"list-disc ml-5 space-y-2 text-sm text-gray-700",children:[(0,t.jsx)("li",{children:"I consent to Summit collecting, using and disclosing the personal information in this form to the ABR/ATO, ASIC and other government agencies as needed to process my application(s)."}),(0,t.jsx)("li",{children:"I confirm I have obtained consent from all individuals named."}),(0,t.jsxs)("li",{children:["I have read and agree to Summitâs"," ",(0,t.jsx)("a",{href:"#",target:"_blank",rel:"noreferrer",className:"text-blue-600 underline",children:"Privacy Policy"})," ","and"," ",(0,t.jsx)("a",{href:"#",target:"_blank",rel:"noreferrer",className:"text-blue-600 underline",children:"Terms of Service"}),"."]})]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Accuracy & identity"}),(0,t.jsxs)("div",{className:"text-sm text-gray-700 space-y-2",children:[(0,t.jsx)("p",{children:"The information I provide is true, correct and complete."}),(0,t.jsx)("p",{children:"ABN start/expected start date must be accurate â backdating may trigger manual ABR review and delays."}),(0,t.jsx)("p",{children:"I have required identification details for key individuals (TFN + name + DOB OR name + residential address + DOB)."})]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Eligibility & legal confirmations"}),(0,t.jsxs)("ul",{className:"list-disc ml-5 space-y-2 text-sm text-gray-700",children:[(0,t.jsxs)("li",{children:["I am not disqualified under ",(0,t.jsx)("strong",{children:"s206B(1)"})," of the Corporations Act 2001."]}),(0,t.jsxs)("li",{children:["I have not, within the last five (5) years, been convicted of or released for offences listed under ",(0,t.jsx)("strong",{children:"s32(1)(c) or (d)"})," of the Business Names Registration Act 2011."]}),(0,t.jsx)("li",{children:"This application complies with the ASIC Electronic Lodgement Protocol."}),(0,t.jsx)("li",{children:"I understand Summit does not provide legal or financial advice and that I am responsible for choosing an appropriate business structure."})]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-sm font-semibold text-gray-900 mb-2",children:"ABN entitlement (enterprise test)"}),(0,t.jsx)("p",{className:"text-sm text-gray-700",children:"I understand an ABN is issued only if I am carrying on (or will within 6 months) an enterprise. Relevant indicators include:"}),(0,t.jsxs)("ul",{className:"list-disc ml-5 space-y-1 text-sm text-gray-700",children:[(0,t.jsx)("li",{children:"I source my own clients/customers and set my own rates."}),(0,t.jsx)("li",{children:"I issue invoices and operate a business bank account."}),(0,t.jsx)("li",{children:"I can delegate/contract work when required."}),(0,t.jsx)("li",{children:"I am responsible for public liability/professional indemnity/workersâ compensation/income protection (as applicable)."})]}),(0,t.jsxs)("p",{className:"text-sm text-gray-700 mt-2",children:["Providing false or misleading information may attract penalties of up to"," ",(0,t.jsx)("strong",{children:"$12,600 per offence"}),"."]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Ongoing obligations"}),(0,t.jsxs)("ul",{className:"list-disc ml-5 space-y-2 text-sm text-gray-700",children:[(0,t.jsx)("li",{children:"Keep ABN details up to date; notify changes within 28 days."}),(0,t.jsx)("li",{children:"Cancel ABN if you cease trading or stop operating an enterprise."}),(0,t.jsx)("li",{children:"If registered for GST, comply with ATO lodgement and payment obligations."})]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Fees, timing & refunds"}),(0,t.jsx)("p",{className:"text-sm text-gray-700 space-y-2",children:"Summit charges a professional service fee. Government fees may apply. Professional fees are non-refundable once Summit has lodged or commenced service. Manual reviews or additional checks can extend timeframes."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Communications & records"}),(0,t.jsx)("p",{className:"text-sm text-gray-700",children:"Summit may contact me by email/SMS/phone and store records securely (may include reputable cloud providers in or outside Australia) in accordance with its Privacy Policy."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Limitation of liability & governing law"}),(0,t.jsxs)("p",{className:"text-sm text-gray-700",children:["To the maximum extent permitted by law, Summitâs liability is limited to re-supply of the services or their cost. These terms are governed by the laws of"," ",(0,t.jsx)("strong",{children:"Queensland"}),"."]})]}),(0,t.jsxs)("p",{className:"text-sm text-blue-600 font-medium",children:["By clicking ",(0,t.jsx)("strong",{children:"Submit"}),", I confirm I have read and agree to the above declarations and authorisations."]})]})})})]})}),U=e=>null==e||""===e||"null"===e,G=e=>e&&"object"==typeof e&&!Array.isArray(e),z=e=>Array.isArray(e)&&e.length>0,W=(e=[])=>s=>{if(U(s))return;let a=e.find(e=>e?.value===s||e?.code===s);return a?.title||a?.label||s},V=e=>{let s=window.location.pathname+window.location.search;window.history.pushState(null,"",`${s}#${e}`),window.dispatchEvent(new HashChangeEvent("hashchange"));try{window.scrollTo({top:0,behavior:"smooth"})}catch{}};function J({dummyData:e={},data:s=null}){let a=(0,l.j7)?.(),i=a?.values,r=s??i??{},{values:n}=(0,l.j7)();
2console.log("Overview values:",n);let d=W(e?.companyType);W(e?.companyClass),W(e?.companySubClass);let o=W(e?.jurisdiction);W(e?.country),W(e?.roles),G(r?.generalInformation)&&U(r?.generalInformation?.companyName)&&U(r?.generalInformation?.companyType)&&U(r?.generalInformation?.companyClass)&&U(r?.generalInformation?.companySubClass)&&U(r?.generalInformation?.jurisdiction)&&U(r?.generalInformation?.nameIdenticalAbn),z(r?.nameIdentical),G(r?.nameReserved)&&(!U(r?.nameReserved?.documentNumber)||G(r?.nameReserved?.individual)||G(r?.nameReserved?.organisation)),G(r?.registeredOffice)&&U(r?.registeredOffice?.occupierName)&&U(r?.registeredOffice?.occupierConsent)&&G(r?.registeredOffice?.address),G(r?.principalPlaceOfBusiness)&&G(r?.principalPlaceOfBusiness?.address),G(r?.ultimateHoldingCompany)&&U(r?.ultimateHoldingCompany?.name)&&U(r?.ultimateHoldingCompany?.acn)&&U(r?.ultimateHoldingCompany?.abn)&&U(r?.ultimateHoldingCompany?.country),z(r?.officeHolders),z(r?.shareStructure),z(r?.shareAllocation),U(r?.nonShareMembersAmount),z(r?.nonShareMembers),G(r?.applicant)&&(G(r?.applicant?.individual)||G(r?.applicant?.organisation)||!U(r?.applicant?.dateSigned)||U(r?.applicant?.declaresTrueAndCorrectIndicator)),G(r?.admin)&&U(r?.admin?.manualReviewIndicator)&&U(r?.admin?.manualReviewText);let c=r?.generalInformation?.companyName||r?.businessName?.businessName||"-",m=o(r?.generalInformation?.jurisdiction)||"-",u=d(r?.generalInformation?.companyType)||"-",p=r?.businessActivity?.description||"-";r?.payment_subtotal??r?.subtotal,r?.payment_gst??r?.gst;let g=r?.payment_total??r?.total??null,x=Array.isArray(r?.officeHolders)?r.officeHolders.filter(e=>!!Array.isArray(e.roles)&&e.roles.includes("DIR")):[],y=[];if(Array.isArray(r?.shareAllocation))r.shareAllocation.forEach(e=>{let s=Number(e?.numberIssued)||null,a=Array.isArray(e?.holdingOwners)?e.holdingOwners:[],t=s&&a.length?Math.floor(s/a.length):null;a.forEach(e=>{let s=e?.isIndividual&&(e?.individual?.givenName1||e?.individual?.givenName?`${e?.individual?.givenName1??e?.individual?.givenName??""} ${e?.individual?.familyName??""}`.trim():null)||e?.organisation?.name||e?.name||e?.fullName||`${e?.address?.line2??""} ${e?.address?.street??""}`.trim()||"Unknown",a=e?.shares||e?.numberOfShares||e?.shareCount||t||null;y.push({name:s,shares:a})})});else if(Array.isArray(r?.shareStructure)&&Array.isArray(r?.officeHolders)){let e=r.shareStructure.reduce((e,s)=>e+(Number(s.numberIssued)||0),0),s=r.officeHolders;if(s.length&&e){let a=Math.floor(e/s.length);s.forEach(e=>{let s=`${e?.name?.givenName1??""} ${e?.name?.familyName??""}`.trim()||e?.name?.companyName||"Unknown";y.push({name:s,shares:a})})}}r?.companyABN??r?.abn??r?.businessABN??r?.business?.abn??r?.company?.abn??r?.abn_number??r?.businessapi_request_abn;let b="-";b=r?.taxRegistrationIndicator?.gst===!0?"Registered":r?.taxRegistrationIndicator?.gst===!1?"Not registered":"-";let v=r?.businessRegistrationIndicator,N=r?.businessName?.businessName??null,j=r?.businessName?.period??null,S=Array.isArray(r?.selectedServices)&&r.selectedServices.length?r.selectedServices:[{key:"company",title:"Company registration",included:!0},{key:"businessName",title:"Business name registration",included:!!(v||r?.businessRegistrationIndicator)},{key:"constitution",title:"Constitution package",included:!!r?.companyComplianceDocuments},{key:"abn",title:"ABN registration",included:!!r?.companyTaxRegistrations}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.A,{}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h6",{className:"font-semibold text-lg mb-4 ",children:"Company Registration Overview"}),(0,t.jsxs)("div",{className:"grid gap-6 ",children:[(0,t.jsxs)("div",{className:"grid md:grid-cols-1 gap-6",children:[(0,t.jsxs)("div",{className:"rounded-2xl border bg-white sm:p-6 p-2 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold text-gray-900",children:"Company Information"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Your company details"})]}),(0,t.jsx)("button",{type:"button",onClick:e=>
2{e.preventDefault(),e.stopPropagation(),V("company-details")},className:"text-sm text-blue-600 hover:underline",children:"Edit company details"})]}),(0,t.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-4 text-sm text-gray-700",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"Company Name"}),(0,t.jsx)("div",{className:"font-medium text-gray-900",children:c})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"Registration State"}),(0,t.jsx)("div",{className:"font-medium text-gray-900",children:m})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"Company Type"}),(0,t.jsx)("div",{className:"font-medium text-gray-900",children:u})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"Business Activity"}),(0,t.jsx)("div",{className:"font-medium text-gray-900",children:p})]}),(0,t.jsxs)("div",{className:"mt-4 border-t pt-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-900",children:"Shareholders & Directors"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"Quick summary of company controllers"})]}),(0,t.jsx)("div",{children:(0,t.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),V("office-holders")},className:"text-sm text-blue-600 hover:underline",children:"Edit details"})})]}),(0,t.jsxs)("div",{className:"mt-3 text-sm text-gray-700",children:[(0,t.jsxs)("div",{className:"mb-2",children:[(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"Directors"}),(0,t.jsx)("div",{className:"font-medium text-gray-900",children:x.length?x.map(e=>(e=>{if(!e)return"â";let s=e?.name?.givenName1??e?.givenName??e?.individual?.givenName1??"",a=e?.name?.familyName??e?.familyName??e?.individual?.familyName??"";return`${s} ${a}`.trim()||e?.name?.companyName||e?.organisation?.name||"â"})(e)).join(", "):"â"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"Shareholders"}),y.length?(0,t.jsx)("ul",{className:"list-disc pl-5 mt-1 text-gray-800",children:y.map((e,s)=>(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"font-medium",children:e.name}),e.shares?` â ${e.shares} shares`:""]},s))}):(0,t.jsx)("div",{className:"font-medium text-gray-900",children:"â"})]})]})]})]})]}),v&&(0,t.jsxs)("div",{className:"rounded-2xl border bg-white sm:p-6 p-2 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold text-gray-900",children:"Business Name"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Registered business name (if included)"})]}),(0,t.jsx)("div",{children:(0,t.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),V("company-details")},className:"text-sm text-blue-600 hover:underline",children:"Edit details"})})]}),(0,t.jsxs)("div",{className:"mt-4 text-sm text-gray-700",children:[(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"Selected"}),(0,t.jsx)("div",{className:"font-medium text-gray-900",children:v?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:N}),j?(0,t.jsxs)("span",{className:"text-xs text-gray-500 ml-2",children:["(",j," years)"]}):null]}):(0,t.jsx)("span",{className:"text-gray-600",children:"No business name included"})})]})]}),r?.taxRegistrationIndicator?.gst&&(0,t.jsxs)("div",{className:"rounded-2xl border bg-white sm:p-6 p-2 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold text-gray-900",children:"GST Details"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Tax and ABN registration status"})]}),(0,t.jsx)("div",{children:(0,t.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),V("tax")},className:"text-sm text-blue-600 hover:underline",children:"Edit details"})})]}),(0,t.jsx)("div",{className:"mt-4 text-sm text-gray-700 grid grid-cols-1 gap-3",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"GST Status"}),(0,t.jsx)("div",{className:"font-medium text-gray-900",children:b})]})})]}),(0,t.jsxs)("div",{className:"rounded-2xl border bg-white sm:p-6 p-2 shadow-sm",children:[(0,t.jsx)("div",{className:"flex items-start justify-between",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold text-gray-900",children:"Selected Services"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"What we'll deliver"})]})}),(0,t.jsx)("div",{className:"mt-4 text-sm text-gray-700",children:S.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center justify-between py-2 border-b last:border-b-0",children:[(0,t.jsx)("div",{children:e.title||e}),(0,t.jsx)("div",{children:e.included?(0,t.jsx)("div",{className:"inline-block text-xs bg-green-50 text-green-700 px-2 py-1 rounded",children:"Included"}):(0,t.jsx)("div",{className:"inline-block text-xs bg-gray-100 text-gray-700 px-2 py-1 rounded",children:"Not included"})})]},e.key??s))})]})]}),(0,t.jsxs)("div",{className:"grid md:grid-cols-1 gap-6",children:[(0,t.jsxs)("div",{className:"rounded-2xl border bg-white sm:p-6 p-2 shadow-sm",children:[(0,t.jsx)("h4",{className:"font-semibold text-gray-900",children:"Payment Summary"}),(0,t.jsxs)("div",{className:"mt-4 text-sm text-gray-700 space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between font-semibold text-gray-900",children:[(0,t.jsx)("span",{children:"Total"}),(0,t.jsx)("span",{children:(e=>{if(null==e||""===e)return"â";let s=Number(e||0);return`$${s.toFixed(2)}`})(g)})]}),r?.payment_status===1?(0,t.jsx)("div",{className:"mt-3 text-sm text-green-700 bg-green-50 border border-green-100 px-3 py-2 rounded",children:"â Payment c
2ompleted"}):(0,t.jsx)("div",{className:"mt-3 text-sm text-gray-600",children:"Payment pending"})]})]}),(0,t.jsxs)("div",{className:"rounded-2xl border bg-white sm:p-6 p-2 shadow-sm",children:[(0,t.jsx)("h4",{className:"font-semibold text-gray-900",children:"What happens next?"}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-2",children:"Expected timeline"}),(0,t.jsxs)("div",{className:"mt-4 space-y-4 text-sm",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 bg-blue-500 rounded-full text-white font-bold",children:"1"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium",children:"Lodgement (minutes)"}),(0,t.jsx)("div",{className:"text-gray-600",children:"We submit to ASIC via our DSP link, usually within minutes of checkout."})]})]}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 bg-blue-500 rounded-full text-white font-bold",children:"2"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium",children:"ACN issued (usually within hours)"}),(0,t.jsx)("div",{className:"text-gray-600",children:"Most companies are registered instantly or within a few hours."})]})]}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 bg-green-500 rounded-full text-white font-bold",children:"3"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium",children:"ABN/GST (same day in most cases)"}),(0,t.jsx)("div",{className:"text-gray-600",children:"If requested, ABR/ATO responses are typically same day."})]})]})]}),(0,t.jsx)("div",{className:"bg-gray-100 p-3 mt-4 rounded-md shadow-sm",children:(0,t.jsxs)("div",{className:"text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"text-black font-bold",children:"Note : "}),"Timeframes assume the details are correct and the name is available. ASIC/ABR may take longer if something triggers manual review (e.g., reserved words, identical/like names, identity/address mismatches, backdated ABN/GST start dates, overseas directors, PEP/sanctions checks)."]})})]})]})]}),(0,t.jsx)("div",{className:"rounded-lg border border-gray-200 p-4 mt-6",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center text-sm text-gray-700",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"text-red-500 font-semibold",children:"Note:"}),"\xa0You confirm and declare that all the information you provided are correct and true.\xa0"]}),(0,t.jsx)(h.Iy,{className:"text-purple-600 cursor-pointer",label:"Please read terms and declaration",children:(0,t.jsx)(Y,{})}),(0,t.jsx)("p",{className:"ml-1",children:"for more."})]})})]})]})}var X=a(9574),K=a(9099);function ee({message:e}){return e?(0,t.jsx)("p",{className:"mt-1 text-xs text-red-500",children:e}):null}let es=[{value:"LEGISLATIVE REQUIREMENT",label:"Legislative Requirement"},{value:"VOLUNTARY",label:"Voluntary"}],ea=[{value:"$0 - $74,999",label:"$0 - $74,999"},{value:"$75,000 - $149,999",label:"$75,000 - $149,000"},{value:"$150,000 - $1,999,999",label:"$150,000 - $1,999,999"},{value:"$2,000,000 - $9,999,999",label:"$2 million - $9,999,999"},{value:"$10,000,000 - $19,999,999",label:"$10 million - $19,999,999"},{value:"$20 million and over",label:"$20 million and over"}],et=[{value:"ANNUALLY",label:"Annually",hint:"For turnover under $75k"},{value:"QUARTERLY",label:"Quarterly",badge:"Most common",hint:"For turnover less than $20m"},{value:"MONTHLY",label:"Monthly",hint:"For turnover $20m or more"}],ei=[{value:!0,label:"Cash accounting",hint:"When you receive payment",badge:"Most common"},{value:!1,label:"Accrual accounting",hint:"When you issue the invoice"}];function er(){let{values:e,setFieldValue:s,errors:a,touched:r,submitCount:n}=(0,l.j7)();console.log("Registration",e);let d=e=>{let s=e.split("."),t=a;for(let e of s)t=t?.[e];let i=r;for(let e of s)i=i?.[e];return i||n>0?t:void 0};function o(a){a?s("taxRegistrations.gst",{turnoverRangeCode:"",lodgementFrequencyCode:"",cashAccountingIndicator:null,importIndicator:null,gstStartDate:e?.businessActivity?.abnStartDate}):s("taxRegistrations",void 0),s("taxRegistrationIndicator.gst",!!a),s("taxRegistrationIndicator._gstChoiceMade",!0)}e?.taxRegistrationIndicator?._gstChoiceMade;let c=(0,i.useRef)(null),m=(0,i.useRef)(null),[u,p]=(0,i.useState)(e?.businessActivity?.description||""),[h,x]=(0,i.useState)([]),[y,b]=(0,i.useState)(!1),[v,N]=(0,i.useState)(!1),[j,S]=(0,i.useState)(-1),[A,w]=(0,i.useState)(e?.businessActivity?.code?{code:e.businessActivity.code,fullName:e.businessActivity.description}:null);async function I(e){if(!e?.trim())return void x([]);b(!0);try{let s=await (0,M.Ud)(e),a=s?.data?.activities??s?.data??s??[],t=(Array.isArray(a)?a:[]).map(e=>"string"==typeof e?{code:e,fullName:e}:{code:e?.code??e?.value??e?.id??"",fullName:e?.fullName??e?.name??e?.label??String(e)});x(t),N(t.length>0),S(t.length?0:-1)}catch{x([]),N(!1),S(-1)}finally{b(!1)}}function q(e){e&&(s("businessActivity.code",e.code??null),s("businessActivity.description",e.fullName??e.code??""),p(e.fullName??""),N(!1),S(-1))}function o(a){a?s("taxRegistrations.gst",{turnoverRangeCode:"",lodgementFrequencyCode:"",cashAccountingIndicator:null,importIndicator:null,gstStartDate:e?.businessActivity?.abnStartDate}):s("taxRegistrations",void 0),s("taxRegistrationIndicator.gst",!!a)}(0,i.useEffect)(()=>{function e(e){c.current&&(c.current.contains(e.target)||(N(!1),S(-1)))}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{e?.businessActivity?.code?(w({code:e.businessActivity.code,fullName:e.businessActivity.description}),p(e.businessActivity.description??"")):e?.businessActivity?.code||w(null)},[e?.businessActivity?.code]);let O="p-4 rounded-2xl border bg-white hover:bg-blue-50 hover:border-blue-300 transition-all duration-200",_="p-4 rounded-2xl border bg-white border-blue-500 shadow-sm";return(0,i.useEffect)(()=>{let a=new Date().toISOString().split("T")[0];e?.businessActivity?.abnStartDate||s("businessActivity.abnStartDate",a),e?.taxRegistrations?.gst&&!e?.taxRegistrations?.gst?.gstStartDate&&s("taxRegistrations.gst.gstStartDate",a)},[e?.businessActivity?.abnStartDate]),(0,i.useEffect)(()=>{e&&!1===e.companyTaxRegistrations&&(s("taxRegistrationIndicator",{...e?.taxRegistrationIndicator||{},gst:!1},!1),s("taxRegistrations",void 0,!1))},[e?.companyTaxRegistrations]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.A,{}),(0,t.jsx)("div",{className:"max-w-6xl mx-auto",children:(0,t.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:(0,t.jsx)("section",{className:"lg:col-span-12",children:(0,t.jsxs)("div",{className:"rounded-xl sm:border bg-white sm:p-6 sm:sh
2adow-sm",children:[(0,t.jsx)("h3",{className:"text-[15px] font-semibold mb-4",children:"Tax & Name Registrations"}),(0,t.jsx)("div",{className:"text-sm text-gray-800 mb-4",children:"ABN details"}),(0,t.jsxs)("div",{className:"mb-5",ref:c,children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Business activity ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("div",{className:"ml-2",children:(0,t.jsx)(g.A,{id:"businessActivity",description:"Options are limited, thatâs normal. Pick the closest match to what you mainly do. It doesnât need to be perfect."})})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{ref:m,type:"text",value:u,onChange:function(e){let a=e.target.value;p(a),s("businessActivity.description",a),a.length>2?I(a):(x([]),N(!1),S(-1))},onKeyDown:function(e){if(v&&0!==h.length)if("ArrowDown"===e.key)e.preventDefault(),S(e=>(e+1)%h.length);else if("ArrowUp"===e.key)e.preventDefault(),S(e=>(e-1+h.length)%h.length);else if("Enter"===e.key){e.preventDefault();let s=h[j]??h[0];s&&q(s)}else"Escape"===e.key&&(e.preventDefault(),N(!1),S(-1))},onBlur:function(){setTimeout(()=>{A&&A.fullName===u||(A&&A.fullName?p(A.fullName):p(""),A||(s("businessActivity.code",null),s("businessActivity.description","")),N(!1),S(-1))},120)},placeholder:"Start typing your activity...",className:"w-full text-base border rounded-md p-3 bg-gray-50 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-300","aria-label":"Business activity","aria-autocomplete":"list","aria-expanded":v,autoComplete:"off",onFocus:()=>{h.length>0&&N(!0)}}),v&&(0,t.jsxs)("ul",{className:"absolute left-0 right-0 mt-1 max-h-60 overflow-y-auto bg-white border rounded-lg shadow-lg z-50",children:[h.map((e,s)=>{let a=s===j;return(0,t.jsx)("li",{onMouseEnter:()=>S(s),onMouseDown:s=>{s.preventDefault(),q(e)},className:`px-4 py-2 text-sm cursor-pointer ${a?"bg-blue-50":"hover:bg-blue-50"}`,role:"option","aria-selected":a,children:e.fullName},`${e.code}-${s}`)}),y&&(0,t.jsx)("li",{className:"px-4 py-2 text-xs text-gray-500",children:"Loadingâ¦"}),!y&&0===h.length&&(0,t.jsx)("li",{className:"px-4 py-2 text-xs text-gray-500",children:"No results"})]})]}),(0,t.jsx)(ee,{message:d("businessActivity.code")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Choose the activity that best describes what you mainly do."})]}),(0,t.jsxs)("div",{className:"mb-5",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["ABN start date ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("div",{className:"ml-2",children:(0,t.jsx)(g.A,{id:"abnStartDate",description:"Use the date you started carrying on business (first sale, invoice, contract, ads, or stock purchase). Note: Backdating often triggers a manual ABR review and can slow approval. We recommend using todayâs date."})})]}),(0,t.jsx)("input",{type:"date",className:"w-full border rounded-md p-3 bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-300",value:e?.businessActivity?.abnStartDate??"",onChange:e=>s("businessActivity.abnStartDate",e.target.value),style:{WebkitAppearance:"none",MozAppearance:"none",lineHeight:"1.5rem",height:"48px",fontSize:"16px"}}),(0,t.jsx)(ee,{message:d("businessActivity.abnStartDate")})]}),(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Why do you need an ABN? ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("div",{className:"ml-2",children:(0,t.jsx)(g.A,{id:"whyNeedAnAbn",description:"Pick the main reason. Most new companies should select Starting or running a business."})})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("select",{className:"w-full border rounded-md p-3 bg-white focus:outline-none focus:ring-2 focus:ring-blue-300",value:e?.applicationReason?.code??"",onChange:e=>s("applicationReason.code",e.target.value),style:{WebkitAppearance:"none",MozAp
2pearance:"none",lineHeight:"1.5rem",height:"48px",fontSize:"16px"},children:[(0,t.jsx)("option",{value:"",children:"Select reason"}),es.map((e,s)=>(0,t.jsx)("option",{value:e.value,children:e.label},s))]}),e?.applicationReason?.code==="Starting or running a business"&&(0,t.jsx)("span",{className:"hidden sm:block pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 bg-green-50 text-green-700 text-xs px-2 py-0.5 rounded-full border border-green-100",children:"Most common"})]}),(0,t.jsx)(ee,{message:d("applicationReason.code")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Most companies should choose âStarting or running a businessâ."})]}),(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsxs)("div",{className:"rounded-lg border p-4",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:"Tax residency"}),(0,t.jsxs)("div",{className:"mt-3 text-sm text-gray-600 flex gap-2",children:[(0,t.jsx)("div",{className:"shrink-0",children:(0,t.jsx)("div",{className:"w-5 h-5 rounded-full border text-center text-xs leading-5 text-gray-500",children:"i"})}),(0,t.jsx)("div",{children:"Because you're forming an Australian company (Pty Ltd), the company is considered an Australian resident for tax purposes."})]}),(0,t.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,t.jsx)("input",{id:"taxResidentConfirm",type:"checkbox",checked:!!e?.taxationInformation?.australianResidentIndicator,onChange:e=>s("taxationInformation.australianResidentIndicator",e.target.checked),className:"w-4 h-4 rounded border-gray-300"}),(0,t.jsxs)("label",{htmlFor:"taxResidentConfirm",className:"text-sm",children:["I confirm this company is an Australian resident for tax purposes."," ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]})]}),(0,t.jsx)(ee,{message:d("taxationInformation.australianResidentIndicator")})]})}),(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold",children:"GST registration"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"GST registration is mandatory if your annual turnover exceeds $75,000. You can also choose to register voluntarily."})]}),(0,t.jsxs)("div",{className:"mb-5",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-3",children:["Will your planned income exceed $75,000 in the next 12 months? ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>o(!0),className:`text-left ${e?.taxRegistrations?.gst?_:O}`,children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"w-5 h-5 rounded-full border-2 border-blue-500 flex items-center justify-center",children:e?.taxRegistrations?.gst?(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-blue-600"}):(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-white"})}),(0,t.jsx)("div",{children:(0,t.jsx)("div",{className:"font-medium",children:"Yes, register for GST"})})]})}),(0,t.jsx)("button",{type:"button",onClick:()=>o(!1),className:`text-left ${!e?.taxRegistrations?.gst?_:O}`,children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"w-5 h-5 rounded-full border-2 border-blue-500 flex items-center justify-center",children:e?.taxRegistrations?.gst?(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-white"}):(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-blue-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium",children:"No, skip GST registration"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"You can register later if needed"})]})]})})]}),(0,t.jsx)(ee,{message:d("taxRegistrationIndicator._gstChoiceMade")})]}),e?.taxRegistrations?.gst&&(0,t.jsxs)("div",{className:"sm:border rounded-lg sm:bg-gray-50 sm:p-4 space-y-4 mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Annual expected turnover ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("div",{className:"ml-2",children:(0,t.jsx)(g.A,{id:"trunOver",description:"âEstimate your gross business income for the next 12 months (exclude GST). A reasonable estimate is fineâyou can update this later.â"})})]}),(0,t.jsxs)("select",{className:"w-full border rounded-md p-3 bg-white focus:outline-none focus:ring-2 focus:ring-blue-300",value:e?.taxRegistrations?.gst?.turnoverRangeCode??"",onChange:e=>{let a=e.target.value;s("taxRegistrations.gst.turnoverRangeCode",a),s("applicationReason.code","$0 - $74,999"===a?"VOLUNTARY":"LEGISLATIVE REQUIREMENT")}
2,style:{WebkitAppearance:"none",MozAppearance:"none",lineHeight:"1.5rem",height:"48px",fontSize:"16px"},children:[(0,t.jsx)("option",{value:"",children:"Select turnover"}),ea.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,t.jsx)(ee,{message:d("taxRegistrations.gst.turnoverRangeCode")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["How often will the business lodge GST? ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("div",{className:"ml-2",children:(0,t.jsx)(g.A,{id:"lodgeGst",description:"âYour GST reporting cycle. Quarterly is standard for turnover under $20m. Monthly is required at $20m+ (or you can opt in). Annual is only available if youâre voluntarily registered and under $75k. You can change this with the ATO later.â"})})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3",children:et.map(a=>{let i=e?.taxRegistrations?.gst?.lodgementFrequencyCode===a.value;return(0,t.jsx)("button",{type:"button",onClick:()=>s("taxRegistrations.gst.lodgementFrequencyCode",a.value),className:`text-left ${i?_:O} min-h-[72px]`,children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"w-5 h-5 rounded-full border-2 border-blue-500 flex items-center justify-center",children:i?(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-blue-600"}):(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-white"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium",children:a.label}),a.hint?(0,t.jsx)("div",{className:"text-xs text-gray-500",children:a.hint}):null]})]}),a.badge&&(0,t.jsx)("span",{className:"hidden sm:block text-xs bg-green-50 text-green-700 px-2 py-0.5 rounded-full border border-green-100",children:a.badge})]})},a.value)})}),(0,t.jsx)(ee,{message:d("taxRegistrations.gst.lodgementFrequencyCode")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["When will you account for GST to the ATO? ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("div",{className:"ml-2",children:(0,t.jsx)(g.A,{id:"gstAto",description:" âCash: report GST when you receive/pay money. Accrual: report when you issue/receive an invoice. Most small businesses eligible for cash choose it. (Generally available if turnover is < $10m.)â"})})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:ei.map(a=>{let i=e?.taxRegistrations?.gst?.cashAccountingIndicator===a.value;return(0,t.jsx)("button",{type:"button",onClick:()=>s("taxRegistrations.gst.cashAccountingIndicator",a.value),className:`text-left ${i?_:O} min-h-[72px]`,children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"w-5 h-5 rounded-full border-2 border-blue-500 flex items-center justify-center",children:i?(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-blue-600"}):(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-white"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium",children:a.label}),a.hint?(0,t.jsx)("div",{className:"text-xs text-gray-500",children:a.hint}):null]})]}),a.badge&&(0,t.jsx)("span",{className:"hidden sm:block text-xs bg-green-50 text-green-700 px-2 py-0.5 rounded-full border border-green-100",children:a.badge})]})},String(a.value))})}),(0,t.jsx)(ee,{message:d("taxRegistrations.gst.cashAccountingIndicator")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Do you import goods or services into Australia? ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("div",{className:"ml-2",children:(0,t.jsx)(g.A,{id:"goodServicesAustralia",description:"âSelect Yes if you buy goods from overseas (stock/equipment) or pay overseas suppliers for services used here (e.g., software, cloud, ads, contractors). This helps the ATO apply import/âreverse chargeâ rules.â"})})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[{label:"Yes",value:!0,hint:"I import goods or services"},{label:"No",value:!1,hint:"Domestic business only"}].map(a=>{let i=e?.taxRegistrations?.gst?.importIndicator===a.value;return(0,t.jsx)("button",{type:"button","aria-pressed":i,onClick:()=>
2s("taxRegistrations.gst.importIndicator",a.value),className:`text-left ${i?_:O} min-h-[56px]`,children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:"w-5 h-5 rounded-full border-2 border-blue-500 flex items-center justify-center mt-0.5",children:i?(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-blue-600"}):(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-white"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("div",{className:"font-medium",children:a.label}),(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:a.hint})]})]})},String(a.value))})}),(0,t.jsx)(ee,{message:d("taxRegistrations.gst.importIndicator")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["GST start date ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"date",className:"w-full border rounded-md p-3 bg-white focus:outline-none focus:ring-2 focus:ring-blue-300",value:e?.taxRegistrations?.gst?.gstStartDate??"",onChange:e=>s("taxRegistrations.gst.gstStartDate",e.target.value),style:{WebkitAppearance:"none",MozAppearance:"none",lineHeight:"1.5rem",height:"48px",fontSize:"16px"}}),(0,t.jsx)(ee,{message:d("taxRegistrations.gst.gstStartDate")}),(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"This should match or be after your ABN start date."})]})]})]})})})})]})}function en(e,s,a){let t=e;for(let e=0;e<s.length-1;e++)t[s[e]]||(t[s[e]]={}),t=t[s[e]];t[s[s.length-1]]=a}function el(e){let s={};if(e?.applicant?.isIndividual===!0){let a=e?.applicant?.individual??{},t=a.dateOfBirth;if(t){let e=function(e){let s=new Date(e);if(Number.isNaN(s.getTime()))return null;let a=new Date,t=a.getFullYear()-s.getFullYear(),i=a.getMonth()-s.getMonth();return(i<0||0===i&&a.getDate()<s.getDate())&&t--,t}(t);null===e?en(s,["applicant","individual","dateOfBirth"],"Please enter a valid date of birth"):e<18&&en(s,["applicant","individual","dateOfBirth"],"Applicant must be at least 18 years old")}else en(s,["applicant","individual","dateOfBirth"],"Date of birth is required");a.givenName1?.trim()||en(s,["applicant","individual","givenName1"],"First name is required"),a.familyName?.trim()||en(s,["applicant","individual","familyName"],"Family name is required"),a.email?/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a.email)||en(s,["applicant","individual","email"],"Please enter a valid email address"):en(s,["applicant","individual","email"],"Email is required"),a.phone_number||en(s,["applicant","individual","phone_number"],"Phone number is required")}let a=e?.applicant?.address??{};return a.street||en(s,["applicant","address","street"],"Street is required"),a.locality||en(s,["applicant","address","locality"],"Locality is required"),a.country||en(s,["applicant","address","country"],"Country is required"),"AU"===a.country&&(a.state||en(s,["applicant","address","state"],"State is required"),a.postcode||en(s,["applicant","address","postcode"],"Postcode is required")),s}function ed(e){let s={};function a(e,a){let t=e.split("."),i=s;for(let e=0;e<t.length-1;e++)i[t[e]]||(i[t[e]]={}),i=i[t[e]];i[t[t.length-1]]=a}if(e?.businessActivity?.code||a("businessActivity.code","Please select a business activity from the list"),e?.businessActivity?.abnStartDate||a("businessActivity.abnStartDate","ABN start date is required"),e?.applicationReason?.code||a("applicationReason.code","Please select why you need an ABN"),e?.taxationInformation?.australianResidentIndicator||a("taxationInformation.australianResidentIndicator","You must confirm Australian tax residency"),e?.taxRegistrations?.gst){let s=e.taxRegistrations.gst;s.turnoverRangeCode||a("taxRegistrations.gst.turnoverRangeCode","Please select your expected annual turnover"),s.lodgementFrequencyCode||a("taxRegistrations.gst.lodgementFrequencyCode","Please select how often you will lodge GST"),(null===s.cashAccountingIndicator||void 0===s.cashAccountingIndicator)&&a("taxRegistrations.gst.cashAccountingIndicator","Please select your accounting method"),(null===s.importIndicator||void 0===s.importIndicator)&&a("taxRegistrations.gst.importIndicator","Please indicate if you import goods or services"),s.gstStartDate||a("taxRegistrations.gst.gstStartDate","GST start date is required")}return s}let eo=new Date,ec=String(eo.getDate()).padStart(2,"0"),em=String(eo.getMonth()+1).padStart(2,"0"),eu=eo.getFullYear(),ep=`${eu}-${em}-${ec}`;var eh=!0;let eg={reg_type:"company",id:null,generalInformation:{companyName:null,acnNameIndicator:!1,acnNameLegalElements:null,companyType:"APTY",companyClass:"LMSH",companySubClass:"PROP",jurisdiction:null,governedByConstitution:!1,nonCashSharesIndicator:null,nameReservedIndicator:null,nameIdenticalIndicator:null,nameIdenticalAbn:null,residentialOfficeholders:!0},ultimateHoldingCompanyIndicator:null,registeredOffice:{address:{careOf:"",line2:"",street:null,locality:null,state:null,postcode:null}
2,occupyIndicator:null,occupierName:null,occupierConsent:null},principalPlaceOfBusiness:{address:{careOf:"",line2:"",street:null,locality:null,state:null,postcode:null}},officeHolders:[{name:{familyName:null,givenName1:null,givenName2:null,givenName3:null},birthDetails:{date:null,locality:null,localityQualifier:null},address:{careOf:"",line2:"",street:null,locality:null,state:null,postcode:null,country:null},isFormerName:!1,roles:["DIR","SEC"],addressOverriddenIndicator:!1,email:"",mobile:"",tfnIndicator:!0,tfn:""}],shareStructure:[{classCode:"ORD",classTitle:"ORDINARY",numberIssued:100,totalAmountPaid:100,totalAmountUnpaid:0}],shareAllocation:[{classCode:"ORD",numberIssued:null,fullyPaidIndicator:!0,totalAmountPaid:100,totalAmountUnpaid:0,amountPaidPerShare:1,amountUnpaidPerShare:0,beneficialOwnerIndicator:!0,holdingOwners:[{isIndividual:null,address:{careOf:"",line2:"",street:null,locality:null,state:null,postcode:null}}]}],applicant:{isIndividual:!0,individual:{title:"",familyName:"",givenName1:"",givenName2:"",givenName3:"",email:"",phone_number:"",dateOfBirth:"",genderCode:""},organisation:{name:"",acn:"",email:"",phone_number:""},organisationSignatoryIndividual:{familyName:"",givenName1:"",givenName2:"",givenName3:""},organisationSignatoryRole:"",address:{careOf:"",line2:"",street:null,locality:null,state:null,postcode:null,country:null},dateSigned:ep,declaresTrueAndCorrectIndicator:!0},admin:{manualReviewIndicator:!1,manualReviewText:null},address_details:{registeredOffice:{address:null,expand:!1},principalPlaceOfBusiness:{address:null,expand:!1}},payment_transaction_id:"",payment_status:null,customer_name:"",customer_email:"",companyComplianceDocuments:!1,companyTaxRegistrations:!1,businessRegistrationIndicator:!1,businessName:{businessName:null,period:0},validate_form:0,businessActivity:{code:null,description:"",abnStartDate:ep},applicationReason:{code:""},taxationInformation:{australianResidentIndicator:null},taxRegistrationIndicator:{gst:!1},taxRegistrations:{gst:null},testTransmissionIndicator:(0,X.G)("false")},ex=["Company Details","Address Details","Office Holders","Shares","Applicant","Registration","Overview"],ef=({fieldsData:e,initialValues:s,accessAllowed:a})=>{let l=(0,K.useRouter)(),[o,h]=(0,i.useState)(null),[g,x]=(0,i.useState)(!1),{generateKey:f}=(0,m.A)(),[v,N]=(0,i.useState)(!1),[j,S]=(0,i.useState)(!1),[A,w]=(0,i.useState)("");if(console.log("errorMessageSubmit===>",A),console.log("index accessAllowed",a,e,s,"https://api.business-registration.com.au/api"),!a)return(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 px-5",children:(0,t.jsxs)("div",{className:"bg-white max-w-md w-full shadow-xl rounded-xl p-8 text-center border border-gray-200",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-800",children:"Complete Your Pre-Registration First"}),(0,t.jsx)("p",{className:"text-gray-600 mt-2 mb-6",children:"You need to choose your services and finish the pre-registration process before continuing with your company registration."}),(0,t.jsx)("a",{href:"/abn/register/company-form",className:"bg-blue-600 hover:bg-blue-700 text-white px-5 py-3 rounded-lg shadow inline-block",children:"Go to Pre-Registration"})]})});let{individual:I,page_title:q}=c.p,[_,C]=(0,i.useState)(!0),R=e=>{for(let s of e){let e=window.localStorage?.getItem(s);if(e)return e;let a=window.sessionStorage?.getItem(s);if(a)return a}return null};(0,i.useEffect)(()=>{try{let e=R(["payment_transaction_id","paymentTransactionId","txn_id"])||"",s=R(["payment_status","paymentStatus"]),a=null!=s?Number(s):1,t=R(["customer_name","payer_name","full_name"])||"",i=R(["customer_email","payer_email","email"])||"";window.__company_prefill__={payment_transaction_id:e,payment_status:a||1,customer_name:t,customer_email:i}}catch(e){}},[]);let D=e=>{if(!e)return"Step 7 â Overview";let s=e.toLowerCase();return s.includes("generalinformation")||s.includes("companyname")||s.includes("companytype")?"Step 1 â Company Details":s.includes("registeredoffice")||s.includes("principalplaceofbusiness")||s.includes("principalplace")?"Step 2 â Address Details":s.includes("officeholders")||s.includes("officeholder")?"Step 3 â Office Holders":s.includes("sharestructure")||s.includes("shareallocation")||s.includes("nonsharemembers")||s.includes("holdingowners")?"Step 4 â Shares / Members":s.includes("applicant")||s.includes("datesigned")?"Step 5 â Applicant":s.includes("registration")||s.includes("companytaxregistrations")||s.includes("companycompliancedocuments")?"Step 6 â Registration":"Step 7 â Overview"},$=async(e,s)=>{S(!1),h(""),s&&(x(!0),h(await (0,u.r)(e,s)),S(!0))},M=async e=>{try{let s=window.__company_prefill__||{},a=e?.generalInformation?.acnNameLegalElements||"PTY LTD",t=T(e?.generalInformation?.companyName,a),i={...e,generalInformation:{...e.generalInformation,companyName:t},id:e?.id??"",payment_transaction_id:e?.payment_transaction_id??s?.payment_transaction_id??"",payment_status:e?.payment_status??s?.payment_status??1,customer_name:e?.customer_name??s?.customer_name??"",customer_email:e?.customer_email??s?.customer_email??"",companyComplianceDocuments:e?.companyComplianceDocuments??!1,companyTaxRegistrations:e?.companyTaxRegistrations??!1,businessRegistrationIndicator:e?.businessRegistrationIndicator??!1,businessName:{businessName:e?.businessName?.businessName??e?.generalInformation?.companyName??null,period:Number(e?.businessName?.period??0)},validate_form:0,testTransmissionIndicator:(0,X.G)("false")};e?.companyTaxRegistrations===!1&&(i.taxRegistrationIndicator={gst:!1},i.taxRegistrations="");let n=JSON.parse(JSON.stringify(i));Array.isArray(n.officeHolders)&&(n.officeHolders=n.officeHolders.map(e=>
2(e?.birthDetails?.country&&delete e.birthDetails.country,e))),console.log("Draft save payload:",n);let l=await r.A.post("https://api.business-registration.com.au/api/register/company",JSON.stringify(n,null,2),{headers:{"Content-Type":"application/json"}}),d=l?.data?.data?.id??l?.data?.id??null;d&&(window.__company_draft_id__=d,console.log("Draft saved, id:",d))}catch(e){console.warn("Draft save error (non-blocking):",e?.response?.data||e?.message)}},k=async e=>{console.log("submit values=======>",e),N(!0);try{let s=window.__company_prefill__||{},a=window.__company_draft_id__||null,t=e?.generalInformation?.acnNameLegalElements||"PTY LTD",i=T(e?.generalInformation?.companyName,t),n={...e,generalInformation:{...e.generalInformation,companyName:i},id:e?.id??a??"",payment_method:e?.payment_method,payment_transaction_id:e?.payment_transaction_id??s?.payment_transaction_id??"",payment_status:e?.payment_status??s?.payment_status??1,customer_name:e?.customer_name??s?.customer_name??"",customer_email:e?.customer_email??s?.customer_email??"",companyComplianceDocuments:e?.companyComplianceDocuments??!1,companyTaxRegistrations:e?.companyTaxRegistrations??!1,businessRegistrationIndicator:e?.businessRegistrationIndicator??!1,businessName:{businessName:e?.businessName?.businessName??e?.generalInformation?.companyName??null,period:Number(e?.businessName?.period??0)},validate_form:1,testTransmissionIndicator:(0,X.G)("false")};e?.companyTaxRegistrations===!1&&(n.taxRegistrationIndicator={gst:!1},n.taxRegistrations=""),console.log("payload-------\x3e",n);let d=function(e){if(!Array.isArray(e?.officeHolders))return e;let s=JSON.parse(JSON.stringify(e));return s.officeHolders=s.officeHolders.map(e=>(e.birthDetails&&e.birthDetails.country&&delete e.birthDetails.country,e)),s}(n),o=await r.A.post("https://api.business-registration.com.au/api/register/company",JSON.stringify(d,null,2),{headers:{"Content-Type":"application/json"}});console.log("res====>",o?.data?.data?.data?.businessapi_request_id),o?.data?.data?.data?.businessapi_request_id&&(localStorage.removeItem("form_id"),localStorage.removeItem("intent_id")),l.push(`/abn/thankyou/id=${o?.data?.data?.data?.businessapi_request_id||""}`)}catch(e){console.log("Registration response:",e?.response?.data),console.log("Registration response:",e?.response?.data?.id),console.log("Registration response:",e?.response?.data?.id),console.error("Submit error:",e?.response?.data||e?.message),w(e?.response?.data?.data?.errors),alert("There was an issue submitting your application. Please try again.")}finally{N(!1)}},B=["PTY. LTD","PTY LTD","PTY. LIMITED","PTY LIMITED","PROPRIETARY LTD.","PROPRIETARY LTD","PROPRIETARY LIMITED"],T=(e,s="PTY LTD")=>{let a=(e||"").trim();if(!a)return"";let t=a.toUpperCase();return B.some(e=>t.endsWith(e.toUpperCase()))?a:`${((e="")=>{if(!e)return"";let s=e.trimEnd();for(let e of B){let a=(" "+e).trim();if(s.toUpperCase().endsWith(a.toUpperCase()))return s.slice(0,s.length-a.length).trimEnd()}return s})(a)} ${s}`.trim()},E=_?ex:ex.filter(e=>"Registration"!==e),F=[(0,t.jsx)(({values:e})=>(0,t.jsx)(n.A,{dummyData:I,checkNameAvailability:$,availabilityStatus:o,checkButton:g,checkname:j,setCheckButton:x,setAvailabilityStatus:h}),{},"step1"),(0,t.jsx)(({values:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y,{dummyData:I}),(0,t.jsx)(b,{dummyData:I})]}),{},"step2"),(0,t.jsx)(({values:e})=>(0,t.jsx)(O,{dummyData:I}),{},"step3"),(0,t.jsx)(({values:e})=>p.e.nonShareMembersAmount(e).required?(0,t.jsx)(P,{dummyData:I}):(0,t.jsx)(H,{dummyData:I}),{},"step4"),(0,t.jsx)(({values:e})=>(0,t.jsx)(Z,{dummyData:I}),{},"step5"),..._?[(0,t.jsx)(({values:e})=>(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(er,{})}),{},"step6")]:[],(0,t.jsx)(({values:e})=>(0,t.jsx)(J,{dummyData:I,data:e}),{},"step7")],Q=(e=>{if(!e)return[];let s=[],a=new Set,t=(e,t,i)=>{if(!i)return;let r=`${e}||${String(i).trim()}`;a.has(r)||(a.add(r),s.push({step:e||D(t),field:t,msg:i}))},i=(e,s="")=>{if(null!=e){if("string"==typeof e)return void t(D(s),s||null,e);if(Array.isArray(e))return void(e.every(e=>
2"string"==typeof e)?e.forEach(e=>t(D(s),s,e)):e.forEach((e,a)=>i(e,`${s}[${a}]`)));if("object"==typeof e)return void Object.entries(e).forEach(([e,a])=>{let r=s?`${s}.${e}`:e;Array.isArray(a)&&a.every(e=>"string"==typeof e)?a.forEach(e=>t(D(r),r,e)):i(a,r)})}};return i(e,""),s})(A).reduce((e,s)=>{let a=s.step||"Step 7 â Overview";return e[a]=e[a]||[],e[a].push({field:(e=>{if(!e)return"";let s=e.replace(/\[.*?\]/g,"");return s.toLowerCase().includes("principalplaceofbusiness")?"Principal place of business":s.toLowerCase().includes("registeredoffice")?"Registered office":s.toLowerCase().includes("officeholders")?"Office holder":s.toLowerCase().includes("shareallocation")?"Share allocation":s.toLowerCase().includes("applicant")?"Applicant":e})(s.field),raw:s.msg,friendly:(e=>{if(!e)return e;let s=e.toLowerCase();if(s.includes("must be 4 digits")||s.includes("4 digits"))return"Postcode must be 4 digits.";let a=e.match(/after\s+([0-9]{4}-[0-9]{2}-[0-9]{2})/i);return a?`Date must be after ${a[1]}.`:s.includes("must be a date")||s.includes("invalid date")?"Invalid date. Please provide a valid date.":e})(s.msg)}),e},{});return(0,t.jsxs)("div",{className:"max-w-5xl mx-auto",children:[Object.keys(Q).length>0&&(0,t.jsxs)("div",{className:"p-4 mb-4 bg-red-50 text-red-700 rounded max-h-[200px] overflow-y-auto md:max-h-max",children:[(0,t.jsx)("div",{className:"font-semibold mb-2",children:"Please fix the following errors before submitting:"}),(0,t.jsx)("ul",{className:"ml-0",children:Object.entries(Q).map(([e,s])=>(0,t.jsxs)("li",{className:"mb-2",children:[(0,t.jsxs)("div",{className:"font-medium",children:[e,":"]}),(0,t.jsx)("ul",{className:"list-disc ml-6",children:s.map((e,s)=>(0,t.jsxs)("li",{className:"mb-1",children:[e.friendly,e.field?(0,t.jsxs)("span",{className:"text-sm text-gray-600",children:[" â ",e.field]}):null]},s))})]},e))})]}),(0,t.jsx)(d,{steps:E,onParentCall:e=>{x(!1),h(null),e&&void 0!==e.companyTaxRegistrations&&C(!!e.companyTaxRegistrations)},initialValues:s,onSubmit:k,onDraftSave:M,isLoading:v,setIsLoading:N,validate:e=>{let s={};if(!e||!Array.isArray(e.officeHolders))return s;let a=[];if(e.officeHolders.forEach((s,t)=>{let i={},r={},n=p.e.officeHolders.birthDetails.date(e,t);n?.status&&!1===n.status.valid&&(r.date=n.status.message||"Invalid date of birth"),s?.birthDetails?.date||(r.date=r.date||"Date of birth is required");let l=p.e.officeHolders.birthDetails.locality(e,t),d=p.e.officeHolders.birthDetails.localityQualifier(e,t);l?.status&&!1===l.status.valid&&(r.locality=l.status.message||"Birth city/locality is required"),d?.status&&!1===d.status.valid&&(r.localityQualifier=d.status.message||"Birth state is required"),Object.keys(r).length&&(i.birthDetails=r);let o={};if(s?.address?.street||(o.street="Street is required"),s?.address?.locality||(o.locality="Suburb / Locality is required"),s?.address?.postcode||(o.postcode="Postcode is required"),Object.keys(o).length&&(i.address=o),s?.isFormerName){let e={};s?.formerName?.givenName1||(e.givenName1="First name is required"),s?.formerName?.familyName||(e.familyName="Last name is required"),Object.keys(e).length&&(i.formerName=e)}let c=s?.roles??[];c.includes("DIR")||c.includes("SEC")||(i.roles="At least one role (Director or Company Secretary) must be selected"),a[t]=Object.keys(i).length?i:void 0}),a.some(Boolean)&&(s.officeHolders=a),!(Array.isArray(e.officeHolders)&&e.officeHolders.some(e=>!!e?.isShareHolder))){let a=Array.isArray(s.officeHolders)?s.officeHolders.slice():Array(e.officeHolders.length).fill(void 0);a._error="At least one shareholder must be selected",s.officeHolders=a}return s},validateFns:[null,null,null,e=>{let s={},a=Array.isArray(e?.shareAllocation)?e.shareAllocation:[],t=Array.isArray(e?.shareStructure)?e.shareStructure:[];if(!a.length)return s.shareAllocation="At least one shareholder with share allocation is required.",s;let i={};t.forEach(e=>{let s=e?.classCode||"ORD";i[s]=(i[s]??0)+Number(e?.numberIssued||0)});let r={};a.forEach(e=>{let s=e?.classCode||"ORD";r[s]=(r[s]??0)+Number(e?.numberIssued||0)});let n=[];
2return Object.keys(i).forEach(e=>{let s=i[e]??0,a=r[e]??0;s!==a&&n.push(`Share class ${e}: ${a} allocated out of ${s} issued. Must equal 100%.`)}),n.length&&(s.shareAllocation=n.join(" ")),s},el,..._?[ed]:[],null],children:F})]})}},7308:(e,s,a)=>{a.d(s,{A:()=>i});var t=a(4232);let i=()=>({generateKey:(0,t.useCallback)((e,s="Director_Info")=>{let a=["first","second","third","fourth"];if(e>=0&&e<a.length)return`${a[e]}_${s}`;throw Error("Index out of bounds")},[])})},7388:(e,s,a)=>{a.d(s,{A:()=>t});let t=(0,a(7161).A)("user-check",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]])},9065:(e,s,a)=>{a.d(s,{A:()=>t});let t=(0,a(7161).A)("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]])},9574:(e,s,a)=>{a.d(s,{G:()=>t});let t=(e,s=!1)=>e?"true"===e.toLowerCase():s},9739:(e,s,a)=>{a.d(s,{H:()=>o,r:()=>d});var t=a(7876),i=a(734),r=a(9913),n=a(7717);let l=Object.fromEntries(Object.entries({company:"051",individual:"117",partnership:"161",superfund:"210",trust:"212"}).map(([e,s])=>[s,e])),d=async(e,s)=>{if(console.log("Incoming code:",e,"businessName:",s),!s||""===s.trim())return{status:"empty",message:"Please enter a business/company name"};let a=l[e];if(console.log("Mapped for API:",a),!a)return{status:"error",message:`Invalid registration type code: ${e}`};try{let e=await r.A.post("https://api.business-registration.com.au/api/check-business-name",{reg_type:a,business_company_name:s.trim()});if(console.log("response---\x3e",e),200===e.status)return{status:"available",message:e?.data?.message,icon:(0,t.jsx)(n.cxC,{})};return{status:"unavailable",message:"Sorry, this business/company name is not available.",icon:(0,t.jsx)(i.cW1,{})}}catch(e){return console.error("Error checking business name:",e?.response?.data||e.message),{status:"error",message:e?.response?.data?.message||"â Error checking name. Try again."}}},o=async e=>{console.log(e,"ggrrr");try{let s=await r.A.post("/check-abn",{abn:`${e}`},{headers:{"Content-Type":"application/json"}});if(console.log(s?.data?.data,"skdhfiosdjfijdif"),200===s.status)return{status:"available",message:"Congratulations, this ABN is available",data:s?.data?.data};return{status:"unavailable",message:"Sorry, this ABN is not available.",data:null}}catch(e){return console.error("Error checking business name:",e),{status:"error",message:"â Error checking name. Try again.",data:null}}}},9780:(e,s,a)=>{a.d(s,{Y:()=>t,w:()=>i});let t=e=>{let s=e.address_components||[],a={name:e?.name,subpremise:"",premise:"",street_number:"",route:"",country:"",postal_code:"",locality:null,administrative_area_level_1:"",administrative_area_level_2:null,administrative_area_level_3:null,administrative_area_level_4:null,administrative_area_level_5:null};
2console.log("fdfds",a),s.forEach(e=>{let s=e.types[0];a.hasOwnProperty(s)&&(console.log("fdfds",a[s]),a[s]={long_name:e.long_name||"",short_name:e.short_name||""})});let t=e=>e&&e.long_name||"",i=[t(a.subpremise),t(a.premise),t(a.street_number),t(a.route),t(a.locality),t(a.administrative_area_level_5),t(a.administrative_area_level_4),t(a.administrative_area_level_3),t(a.administrative_area_level_2),t(a.administrative_area_level_1),t(a.country)].filter(Boolean).join(" ").trim(),r=[t(a.locality),t(a.administrative_area_level_5),t(a.administrative_area_level_4),t(a.administrative_area_level_3)].filter(Boolean).join(" ").trim(),n=[t(a.street_number),t(a.route)].filter(Boolean).join(" ").trim();return{componentMap:a,formattedAddress:i,locality:r,line2:null,street:n}},i=e=>{let s=e.address_components||[];console.log("fdfds",s);let a=e=>s.find(s=>s.types.includes(e)),t=e=>a(e)?.long_name||"",i=e=>a(e)?.short_name||"",r=t("subpremise"),n=t("street_number"),l=t("route");if(!n&&l){let e=l.match(/^([\d\/\-]+)\s+(.*)$/);e&&(n=e[1],l=e[2])}let d=l.split(" "),o=d.pop()||"",c=d.join(" "),m={Road:"RD",Street:"ST",Avenue:"AVE",Parade:"PDE",Drive:"DR",Crescent:"CRES",Boulevard:"BLVD",Lane:"LANE",Court:"CT",Place:"PL"}[o]||o.toUpperCase(),u=t("locality")||t("administrative_area_level_2"),p=i("administrative_area_level_1"),h=t("postal_code"),g=i("country");return{formattedAddress:e.formatted_address||"",unitOrOfficeNumber:r,streetNumber:n,streetName:c.toUpperCase(),streetType:m,locality:u.toUpperCase(),state:p,postCode:h,country:g}}},9913:(e,s,a)=>{a.d(s,{A:()=>t});let t=a(1040).A.create({baseURL:"https://api.business-registration.com.au/api"})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.