@agrada_digital/pbm 0.0.137 → 0.0.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vanilla.js +1 -1
- package/package.json +1 -1
package/dist/vanilla.js
CHANGED
|
@@ -80,7 +80,7 @@ Error generating stack: `+i.message+`
|
|
|
80
80
|
*
|
|
81
81
|
* This source code is licensed under the ISC license.
|
|
82
82
|
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/const Uv=$m("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Qm={modal:{id:"",open:!1,label:"",url:""}},rr=Cu(n=>({...Qm,setModal:r=>n({modal:r}),resetModal:()=>n({modal:Qm.modal})})),Lv=n=>n.replace(/\D/g,"").slice(0,11).replace(/^(\d{2})(\d{5})(\d{0,4})/,"($1) $2-$3").trim(),Vv=n=>n.replace(/\D/g,"").slice(0,8).replace(/^(\d{5})(\d{0,3})/,"$1-$2"),Hv=n=>n.replace(/\D/g,"").replace(/(\d{3})(\d{3})(\d{3})(\d{2})/,"$1.$2.$3-$4"),Xm=n=>Number(String(n).replace(",",".")),qv=n=>{const r=String(n);if(r.includes(".")||r.includes(","))return Xm(n);const l=r.slice(-2);return+`${r.slice(0,-2)||"0"}.${l}`},Gv=n=>{const r=n.slice(-2);return+`${n.slice(0,-2)||"0"}.${r}`};function Zv(n){return String(n).replace(/[.,]/g,"")}const ya={phone:n=>Lv(n),cep:n=>Vv(n),cpf:n=>Hv(n),priceToInteger:n=>Zv(n),price:n=>Xm(n),transformPrice:n=>qv(n),transformPorcent:n=>Gv(n)};/*! js-cookie v3.0.5 | MIT */function hs(n){for(var r=1;r<arguments.length;r++){var l=arguments[r];for(var s in l)n[s]=l[s]}return n}var Yv={read:function(n){return n[0]==='"'&&(n=n.slice(1,-1)),n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(n){return encodeURIComponent(n).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Bu(n,r){function l(u,f,d){if(!(typeof document>"u")){d=hs({},r,d),typeof d.expires=="number"&&(d.expires=new Date(Date.now()+d.expires*864e5)),d.expires&&(d.expires=d.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var m="";for(var y in d)d[y]&&(m+="; "+y,d[y]!==!0&&(m+="="+d[y].split(";")[0]));return document.cookie=u+"="+n.write(f,u)+m}}function s(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var f=document.cookie?document.cookie.split("; "):[],d={},m=0;m<f.length;m++){var y=f[m].split("="),p=y.slice(1).join("=");try{var S=decodeURIComponent(y[0]);if(d[S]=n.read(p,S),u===S)break}catch{}}return u?d[u]:d}}return Object.create({set:l,get:s,remove:function(u,f){l(u,"",hs({},f,{expires:-1}))},withAttributes:function(u){return Bu(this.converter,hs({},this.attributes,u))},withConverter:function(u){return Bu(hs({},this.converter,u),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(n)}})}var rt=Bu(Yv,{path:"/"});const Uu={BASE_URL:"/",DEV:!0,MODE:"production",PROD:!1,SSR:!1,VITE_API_URL:"https://serverless-pbm.vercel.app",VITE_CLIENT_ID_SANTOREMEDIO:"fff909d6-a77e-4ffc-a4bb-47a1cde99621",VITE_CLIENT_SECRET_SANTOREMEDIO:"ZTK8Q~gqjOkbBmH3vN1AIsKUbwkhUYOkzfvIUb18",VITE_CORREIOS_API_URL:"https://viacep.com.br/ws",VITE_GRANT_TYPE_SANTOREMEDIO:"client_credentials",VITE_SCOPE_SANTOREMEDIO:"https://interplayersdevb2c.onmicrosoft.com/services/varejo-api-pre/.default",VITE_USERNAME_SANTOREMEDIO:"147de435-fac6-4c57-95d8-bb06feb0496b"},ir=n=>{var r;if(typeof{url:Ja&&Ja.tagName.toUpperCase()==="SCRIPT"&&Ja.src||new URL("vanilla.js",document.baseURI).href}<"u")return Uu==null?void 0:Uu[n];if(typeof process<"u")return(r=process.env)==null?void 0:r[n]},$v=async({product:n,consumer:r})=>{const l=rt.get("tenant_id");if(!l)throw new Error(`No configuration found for tenant: ${l}`);if(!r||!r.holderId)throw new Error("Consumer holderId information is required");if(!n)throw new Error("Product information is required");try{const u=await(await fetch(`${ir("VITE_API_URL")}/api/lookup-consumer.ts`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${rt.get("pbm-token")}`},body:JSON.stringify({tenant_id:l,product:n,table_id:rt.get("current-table-id"),local_hour:rt.get("current-local-hour"),consumer:r})})).json();if(!u.success)throw new Error("PBMLOG: Enable Discount Failed!");return u}catch(s){return console.error("Error during enable discount:",s),{success:!1,error:"Authorization failed"}}};function Fv({startTransition:n}){const r=Kt(),[l,s]=pe.useState(!1),{setModal:u}=rr(),{handleSubmit:f,register:d,setValue:m,clearErrors:y,unregister:p,formState:{errors:S}}=Sv({resolver:Mv(Qb),mode:"onSubmit",defaultValues:{securityNumber:r.securityNumber||"",coupon:""}}),v=async N=>{if(r.targetProduct===null){console.error("PBMLOG: Product is not defined!");return}if(!r.targetProduct.id){console.error("PBMLOG: Product ID is not defined!");return}if(!r.targetProduct.listPrice){console.error("PBMLOG: List Price is not defined!");return}if(!r.targetProduct.authorizedQuantity){console.error("PBMLOG: Authorized Quantity is not defined!");return}r.setSecurityNumber(N.securityNumber.replace(/\D/g,""));const B=await $v({product:r.targetProduct,consumer:{holderId:N.securityNumber.replace(/\D/g,"")}});if(!B.success){u({id:"CustomerNotRegistered",open:!0});return}r.setBenefitsList(B.product),r.setState("isActivated")},E=async N=>{if(!r.isAuthenticatedShopper){u({id:"ShopperIsNotAuthenticated",open:!0});return}l||m("coupon",void 0,{shouldValidate:!1}),l&&N.coupon!=null&&r.setCardID(N.coupon),n(async()=>{await v(N)})};return x.jsx(x.Fragment,{children:[x.jsx("form",{onSubmit:f(E),className:ot("w-full h-auto flex items-start justify-center flex-col mb-2 transition-all duration-150"),id:"form_security_number_pbm",children:[x.jsx("label",{htmlFor:"input_security_number_pbm",className:ot("w-full h-auto flex items-start flex-col justify-center relative py-2 transition-all duration-100",{"mb-4":S.securityNumber&&!l}),id:"label_security_number_pbm",children:[x.jsx("input",{type:"text",className:ot("w-full h-10 bg-(--pbm-input-background) rounded-lg text-sm font-semibold outline-(--pbm-outline-color) focus:outline focus:bg-(--pbm-input-focus) focus:outline-(--pbm-outline-focus-color) text-zinc-600 placeholder:text-zinc-600 px-4 placeholder:text-sm placeholder:font-semibold",{"outline outline-red-600":S.securityNumber,"rounded-lg":l}),style:{"--tw-outline-color":S.securityNumber?void 0:"var(--pbm-secondary)"},placeholder:"Digite seu CPF aqui...",required:!0,maxLength:14,...d("securityNumber",{onChange:N=>{const B=ya.cpf(N.target.value);m("securityNumber",B,{shouldValidate:!0})}}),defaultValue:r.securityNumber||"",id:"input_security_number_pbm"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:126,columnNumber:11},this),S.securityNumber&&x.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"security_number_form_error",children:S.securityNumber.message},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:157,columnNumber:13},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:116,columnNumber:9},this),x.jsx(pe.Activity,{mode:l?"visible":"hidden",children:x.jsx("label",{htmlFor:"input_coupon_pbm",className:ot("w-full h-auto flex items-start flex-col justify-center relative py-2",{"mt-2":S.securityNumber}),id:"label_coupon_pbm",children:[x.jsx("input",{type:"text",className:ot("w-full h-10 bg-gray-100 rounded-s-lg text-sm font-semibold focus:outline focus:bg-white text-zinc-600 placeholder:text-zinc-600 px-4 placeholder:text-sm placeholder:font-semibold",{"outline outline-red-600":S.coupon,"rounded-lg":l}),style:{"--tw-outline-color":S.coupon?void 0:"var(--pbm-secondary)"},placeholder:"Cupom / ID do Cartão",...d("coupon",{required:l?"Cupom / ID do Cartão obrigatório.":!1,shouldUnregister:!l,onChange:N=>{m("coupon",N.target.value,{shouldValidate:l})}}),id:"input_coupon_pbm"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:177,columnNumber:13},this),S.coupon&&x.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"coupon_form_error",children:S.coupon.message},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:208,columnNumber:15},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:167,columnNumber:11},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:166,columnNumber:9},this),x.jsx("button",{type:"submit",className:ot("w-full h-10 rounded-lg flex items-center justify-center cursor-pointer text-sm text-white font-semibold transition-all duration-150",{"rounded-lg":l}),style:{backgroundColor:"var(--pbm-primary)"},id:"button_submit_security_number_pbm",children:"Comprar com desconto"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:218,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:109,columnNumber:7},this),x.jsx("section",{className:"flex items-start flex-col gap-2",children:[x.jsx(Wa,{className:"bg-transparent p-0 pl-2 w-auto h-auto underline cursor-pointer hover:bg-transparent flex items-center justify-start gap-1",style:{color:"var(--pbm-text)"},onMouseOver:N=>N.currentTarget.style.filter="brightness(0.8)",onMouseOut:N=>N.currentTarget.style.filter="none",onClick:()=>{const N=!l;s(N),N||(p("coupon"),y("coupon"))},id:"check_benefits_button",children:[x.jsx("span",{className:"text-start",children:l?"Não possui Cupom / ID do Cartão?":"Possui Cupom / ID do Cartão?"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:252,columnNumber:11},this),x.jsx(Fm,{size:16,className:ot({"rotate-0":!l,"rotate-180":l})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:257,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:234,columnNumber:9},this),x.jsx(Wa,{className:"bg-transparent p-0 pl-2 w-auto h-auto underline cursor-pointer hover:bg-transparent flex items-center justify-start gap-1",style:{color:"var(--pbm-text)"},onMouseOver:N=>N.currentTarget.style.filter="brightness(0.8)",onMouseOut:N=>N.currentTarget.style.filter="none",onClick:()=>r.setState("isPreview"),id:"check_benefits_button",children:[x.jsx("span",{children:"Consultar Benefícios"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:275,columnNumber:11},this),x.jsx(Fm,{size:16},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:276,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:265,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:233,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:108,columnNumber:5},this)}function Qv({size:n}){return x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","data-name":"Camada 1",viewBox:"0 0 500 500",width:n,height:n,children:x.jsx("path",{d:"M421.44 78.56C375.64 32.77 314.76 7.55 250 7.55S124.36 32.77 78.56 78.56C32.77 124.36 7.55 185.24 7.55 250s25.22 125.64 71.01 171.44c45.8 45.79 106.68 71.01 171.44 71.01s125.64-25.22 171.44-71.01c45.79-45.8 71.01-106.68 71.01-171.44s-25.22-125.64-71.01-171.44zm-49.17 121.7L242.88 334.63c-8.98 9.29-23.57 10.17-33.59 2.02l-79.63-64.7c-10.69-8.67-12.33-24.38-3.66-35.07 8.67-10.69 24.38-12.33 35.07-3.65l61.9 50.39L336.5 165.74c4.4-4.75 10.48-7.59 16.95-7.93a24.88 24.88 0 0118.83 7.26c9.72 9.72 9.71 25.48 0 35.19z",fill:"#229b00"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:13,columnNumber:7},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:6,columnNumber:5},this)}function Xv({size:n}){return x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","data-name":"Camada 1",viewBox:"0 0 500 500",width:n,height:n,children:[x.jsx("circle",{cx:250,cy:250,r:237.45,fill:"#fff"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:29,columnNumber:7},this),x.jsx("path",{d:"M250 492.45c-64.76 0-125.64-25.22-171.44-71.01C32.77 375.64 7.55 314.76 7.55 250S32.77 124.36 78.56 78.56C124.36 32.77 185.24 7.55 250 7.55s125.64 25.22 171.44 71.01c45.79 45.79 71.01 106.68 71.01 171.44s-25.22 125.64-71.01 171.44c-45.79 45.79-106.68 71.01-171.44 71.01zm0-474.9C121.83 17.55 17.55 121.83 17.55 250S121.83 482.45 250 482.45 482.45 378.17 482.45 250 378.17 17.55 250 17.55z",fill:"#d8d8d8"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:30,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:22,columnNumber:5},this)}function Kv({size:n,color:r}){return x.jsx("svg",{viewBox:"-0.003 0 99.979 99.979",xmlns:"http://www.w3.org/2000/svg",fill:"#000000",width:n,height:n,children:[x.jsx("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:47,columnNumber:7},this),x.jsx("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:48,columnNumber:7},this),x.jsx("g",{id:"SVGRepo_iconCarrier",children:[x.jsx("path",{fill:"#ffe700",d:"M92.869 7.105c9.478 9.476 9.478 24.832 0 34.308L41.411 92.869c-9.475 9.474-24.833 9.474-34.307 0-9.476-9.475-9.476-24.832 0-34.308L58.562 7.105c9.475-9.473 24.834-9.473 34.307 0z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:54,columnNumber:9},this),x.jsx("path",{fill:r,d:"M32.548 33.122L7.105 58.563c-9.476 9.476-9.476 24.833 0 34.308 9.474 9.475 24.832 9.475 34.307 0L66.85 67.43 32.548 33.122z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:58,columnNumber:9},this),x.jsx("path",{fill:r,d:"M65.43 68.862L31.134 34.568l1.414-1.414 34.294 34.294z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:62,columnNumber:9},this),x.jsx("path",{fill:r,d:"M38.096 41.51L12.7 66.906a5.894 5.894 0 0 0 0 8.339 5.896 5.896 0 0 0 8.339 0l25.396-25.396-8.339-8.339z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:66,columnNumber:9},this),x.jsx("path",{fill:"#ffe700",d:"M75.244 12.7a5.897 5.897 0 0 0-8.343 0L39.51 40.096l8.339 8.339 27.396-27.396a5.899 5.899 0 0 0-.001-8.339z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:70,columnNumber:9},this),x.jsx("path",{fill:r,d:"M47.862 48.444l-1.414 1.414-8.335-8.336 1.414-1.414z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:74,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:53,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:40,columnNumber:5},this)}function Jv({size:n,color:r}){return x.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:n,height:n,children:[x.jsx("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:92,columnNumber:7},this),x.jsx("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:93,columnNumber:7},this),x.jsx("g",{id:"SVGRepo_iconCarrier",children:x.jsx("path",{d:"M7.33199 16.3154C6.94146 15.9248 6.3083 15.9248 5.91777 16.3154C5.52725 16.7059 5.52725 17.339 5.91777 17.7296L10.5834 22.3952C11.3644 23.1762 12.6308 23.1762 13.4118 22.3952L18.0802 17.7267C18.4707 17.3362 18.4707 16.703 18.0802 16.3125C17.6897 15.922 17.0565 15.922 16.666 16.3125L13 19.9786V2.0001C13 1.44781 12.5523 1.0001 12 1.0001C11.4477 1.0001 11 1.44781 11 2.0001V19.9833L7.33199 16.3154Z",fill:r},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:99,columnNumber:9},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:98,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:85,columnNumber:5},this)}const ps={CheckON:Qv,CheckOFF:Xv,Pills:Kv,ArrowDown:Jv};function Iv(){var y;const{targetProduct:n,benefitsEnabled:r,setBenefitsEnabled:l}=Kt(),s=ya.transformPrice(Number(n==null?void 0:n.listPrice)),u=ya.transformPrice(Number(n==null?void 0:n.discountValue)||0),f=ya.transformPorcent((n==null?void 0:n.discountPercentual)||"0"),d=s*f/100,m=s-u||s-d;return x.jsx("header",{className:"flex items-start justify-start flex-col gap-4 w-full p-0.5 rounded-xl mt-5",id:"header_pbm",children:[x.jsx("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:"enable_benefits_checkbox",children:[x.jsx("input",{id:"enable_benefits_checkbox",type:"checkbox",name:"option",className:"peer hidden",checked:r,onChange:p=>l(p.target.checked)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:32,columnNumber:9},this),x.jsx("div",{className:"w-5 h-5 border border-(--pbm-primary) rounded-full flex items-center justify-center transition-all duration-300 after:content-[''] after:w-2 after:h-2 after:rounded-full after:bg-(--pbm-primary) after:scale-0 after:transition-transform after:duration-200 peer-checked:after:scale-100"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:42,columnNumber:9},this),x.jsx("p",{className:"font-medium text-(--pbm-primary) select-none text-sm",children:"Desconto de Laboratório"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:43,columnNumber:9},this),x.jsx(ps.Pills,{size:16,color:"var(--pbm-primary)"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:46,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:28,columnNumber:7},this),x.jsx("span",{className:"py-1 rounded-xl shrink-0 text-white text-xl font-bold flex items-center justify-start gap-2 relative","data-testid":"test_id_header_price",id:"header_price",children:x.jsx("section",{className:"flex items-start gap-2 justify-center-safe flex-col",children:[x.jsx("div",{className:"flex items-center-safe justify-start gap-1",children:[x.jsx("span",{className:"line-through text-sm font-light text-zinc-600",children:(y=Number(s))==null?void 0:y.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:56,columnNumber:13},this),x.jsx(ps.ArrowDown,{size:14,color:"var(--pbm-primary)"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:65,columnNumber:13},this),x.jsx("span",{className:"font-semibold text-sm text-(--pbm-primary)",children:[f.toFixed(2),"%"]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:67,columnNumber:13},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:55,columnNumber:11},this),x.jsx("span",{className:"text-lg text-zinc-700 font-bold",children:m==null?void 0:m.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:72,columnNumber:11},this),(n==null?void 0:n.informativeMessage)&&x.jsx("span",{className:"text-xs text-zinc-600 font-medium",children:n==null?void 0:n.informativeMessage},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:82,columnNumber:13},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:54,columnNumber:9},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:49,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:24,columnNumber:5},this)}function Pv({textColor:n}){return x.jsx("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[x.jsx("div",{"data-testid":"test_id_spin",className:"w-8 h-8 border-4 shrink-0 border-gray-300 rounded-full animate-spin",style:{borderTopColor:"var(--pbm-secondary)"},id:"loading_spin"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Loading/index.tsx",lineNumber:8,columnNumber:7},this),x.jsx("p",{className:"text-sm font-semibold text-start",style:{color:n||"var(--pbm-text)"},id:"loading_label",children:"Um momento... estamos verificando seus dados."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Loading/index.tsx",lineNumber:14,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Loading/index.tsx",lineNumber:7,columnNumber:5},this)}function Lu({children:n,variant:r}){const{benefitsEnabled:l}=Kt();return x.jsx("main",{className:ot({"border-3 border-(--pbm-border) overflow-hidden flex flex-col items-center justify-center min-w-(--min-container) max-w-(--max-container) w-full h-auto rounded-xl p-4 bg-white gap-4 relative":r==="main","w-full relative":r==="simple","h-0 overflow-hidden":!l&&r==="simple"}),"data-testid":"test_id_container","data-variant":r,id:"container_pbm",children:n},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Container/index.tsx",lineNumber:15,columnNumber:5},this)}function Hr(n){return x.jsx("h2",{className:ot("text-start font-semibold text-sm",n.className),style:{color:n.textColor||"var(--pbm-text)",fontSize:n.textSize,textAlign:n.textAlign},"data-testid":"test_id_title",id:"title_pbm",children:n.children},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Title/index.tsx",lineNumber:13,columnNumber:5},this)}function Wv({data:n,onChange:r,checked:l}){console.log("PBMLOG Item data:",JSON.stringify(n,null,2));const{setAvailableDiscountSelected:s,state:u,isAuthenticatedShopper:f}=Kt(),{setModal:d}=rr(),m=n.id+"_"+n.authorizedQuantity,y=ya.transformPrice(Number(n==null?void 0:n.grossPrice)||Number(n==null?void 0:n.listPrice)||0),p=ya.transformPrice(Number(n==null?void 0:n.discountValue)||0),S=ya.transformPorcent((n==null?void 0:n.discountPercentual)||"0"),v=p*Number(n.authorizedQuantity),E=y*Number(n.authorizedQuantity),N=E*S/100,B=E-v||E-N,w=pe.useCallback(()=>{if(l){const P=K=>Math.round(K*100)/100;s({discount:{total:P(v),unit:P(p)},quantity:Number(n.authorizedQuantity),totalPrice:P(B),grossPrice:n.grossPrice})}},[l,n.authorizedQuantity,n.grossPrice,s,v,p,B]);pe.useEffect(()=>{w()},[w]);const q=()=>{if(!f&&u==="isActivated"){d({id:"ShopperIsNotAuthenticated",open:!0});return}r()};return x.jsx("label",{htmlFor:m,className:ot("label_benefits w-full flex items-center justify-start bg-zinc-300/60 border border-zinc-400/50 px-4 py-2 transition-colors rounded-lg gap-1",{"cursor-not-allowed":u==="isPreview","cursor-pointer":u==="isActivated"}),style:{borderColor:l?"var(--pbm-primary)":void 0,backgroundColor:l?"color-mix(in srgb, var(--pbm-primary), transparent 90%)":void 0},id:"label_benefits_"+m,children:[x.jsx("input",{type:"radio",name:"benefits_discount",id:m,className:"hidden",checked:l,onChange:q,disabled:u==="isPreview"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:107,columnNumber:7},this),x.jsx("span",{style:{color:"var(--pbm-primary)"},children:l?x.jsx(ps.CheckON,{size:20},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:118,columnNumber:52},this):x.jsx(ps.CheckOFF,{size:20},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:118,columnNumber:21},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:117,columnNumber:7},this),x.jsx("span",{className:"font-semibold text-sm",style:{color:"var(--pbm-text)"},children:[n.authorizedQuantity,"un"]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:121,columnNumber:7},this),x.jsx("section",{className:"ml-auto relative gap-2 flex items-center-safe justify-end-safe",children:[x.jsx("span",{className:"text-white -top-4 py-0.5 font-semibold text-xs px-2 w-auto text-nowrap rounded-2xl -right-3",style:{backgroundColor:"var(--pbm-primary)"},children:[v.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})," ","OFF"]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:129,columnNumber:9},this),x.jsx("strong",{className:"font-semibold text-sm text-center",style:{color:"var(--pbm-text)"},children:B.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:141,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:128,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:90,columnNumber:5},this)}const e1="N000";function t1(){var y;const{setState:n,state:r,customLoginUrl:l,isAuthenticatedShopper:s,benefitsList:u}=Kt(),[f,d]=pe.useState(null),[m]=pe.useState(u);return m!=null&&m.length&&((y=m[0])==null?void 0:y.returnCode)!==e1&&r==="isActivated"?x.jsx("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:x.jsx("p",{className:"text-sm font-semibold text-start",style:{color:"var(--pbm-text)"},id:"benefits_error_handle",children:m[0].informativeText},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:31,columnNumber:9},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:30,columnNumber:7},this):x.jsx("section",{className:"flex items-start justify-center gap-4 w-full h-auto flex-col",id:"benefits_table_pbm",children:[x.jsx(Hr,{children:"Descontos disponíveis:"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:47,columnNumber:7},this),x.jsx("form",{className:"flex flex-col items-center justify-start w-full gap-4.5",id:"form_benefits_table_pbm",onSubmit:p=>p.preventDefault(),children:[!m&&x.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",id:"benefits_empty_pbm",children:"Não foi possível encontrar benefícios para esse produto."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:55,columnNumber:11},this),m&&m.map(p=>{const S=p.id+"_"+p.authorizedQuantity;return x.jsx(Wv,{data:p,checked:f===S,onChange:()=>d(S)},S,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:68,columnNumber:15},this)})]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:49,columnNumber:7},this),r==="isPreview"&&x.jsx(Wa,{onClick:()=>n("isEmpty"),className:"bg-transparent p-0 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",id:"unauthorized_benefits_button",children:["Atenção: Não é possível utilizar os benefícos sem realizar a consulta do CPF e o Login, por favor"," ",x.jsx("span",{className:"underline",children:"insira seu cpf para utilizar os benefícios"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:86,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:79,columnNumber:9},this),r==="isActivated"&&x.jsx(x.Fragment,{children:[!s&&x.jsx(Wa,{type:"button",onClick:()=>window.location.assign(l||"/login"),className:"bg-transparent p-0 pl-2 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",id:"login",children:x.jsx("span",{className:"underline",children:"Por favor, faça o Login para aproveitar os benefícios!"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:101,columnNumber:15},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:95,columnNumber:13},this),x.jsx(Wa,{onClick:()=>n("isEmpty"),className:"bg-transparent p-0 pl-2 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",id:"change_security_number",children:x.jsx("span",{className:"underline",children:"Deseja editar o cpf digitado?"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:112,columnNumber:13},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:107,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:93,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:43,columnNumber:5},this)}function gs(n){return x.jsx("p",{className:ot("font-normal text-sm",n.textAlign&&`text-${n.textAlign}`,n.className),style:{color:n.textColor||"var(--pbm-text)",fontSize:n.textSize,textAlign:n.textAlign},"data-testid":"test_id_text",id:"text_pbm",children:n.children},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Text/index.tsx",lineNumber:13,columnNumber:5},this)}function a1({textColor:n}){const{urlAcceptTerms:r}=Kt(),{setModal:l}=rr(),s=()=>{r&&l({open:!0,id:"iframe_pbm",label:"Aceitar os termos",url:r})};return x.jsx("section",{"data-testid":"test_id_invalid",className:"flex items-end justify-center gap-2 w-full h-auto flex-col border-y py-6",style:{borderColor:"color-mix(in srgb, var(--pbm-text), transparent 80%)"},id:"security_number_invalid_container_pbm",children:[x.jsx(Hr,{className:"w-full",textColor:n,children:"CPF não cadastrado."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:25,columnNumber:7},this),x.jsx(gs,{className:"w-full",textColor:n,children:["Conclua seu cadastro para habilitar o benefício. ",x.jsx("br",{},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:29,columnNumber:58},this),"Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar."]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:28,columnNumber:7},this),x.jsx(Wa,{onClick:()=>s(),style:{backgroundColor:"var(--pbm-primary)"},children:"Aceitar os termos"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:33,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:19,columnNumber:5},this)}function n1({textColor:n}){const{urlRegisterIndustry:r}=Kt(),{setModal:l}=rr(),s=()=>{r&&l({open:!0,id:"iframe_pbm",label:"Ativar CPF",url:r})};return x.jsx("section",{"data-testid":"test_id_registered",className:"flex items-end justify-center gap-2 w-full h-auto flex-col border-y py-6",style:{borderColor:"color-mix(in srgb, var(--pbm-text), transparent 80%)"},id:"security_number_registered_container_pbm",children:[x.jsx(Hr,{className:"w-full",textColor:n,children:"Ops, seu CPF ainda não está habilitado para este produto."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberRegitered/index.tsx",lineNumber:25,columnNumber:7},this),x.jsx(gs,{className:"w-full",textColor:n,children:"Para ativar o benefício, clique em “Ativar CPF” e conclua a etapa na página externa. Depois, é só voltar para continuar — vamos aguardar você aqui."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberRegitered/index.tsx",lineNumber:28,columnNumber:7},this),x.jsx(Wa,{onClick:()=>s(),style:{backgroundColor:"var(--pbm-primary)"},children:"Ativar CPF"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberRegitered/index.tsx",lineNumber:31,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberRegitered/index.tsx",lineNumber:19,columnNumber:5},this)}const Km={ErrorMessage:"Erro ao aplicar o benefício"},Jm=Cu(n=>({...Km,setErrorMessage:r=>n({ErrorMessage:r}),resetErrorMessage:()=>n({ErrorMessage:Km.ErrorMessage})})),Im=()=>{const{ErrorMessage:n}=Jm(),{setState:r}=Kt();return x.jsx(Lu,{variant:"main",children:[x.jsx(Hr,{children:"Erro ao Aplicar o Benefício"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:15,columnNumber:13},void 0),x.jsx(gs,{textAlign:"center",children:n},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:16,columnNumber:13},void 0),x.jsx(Wa,{className:"bg-transparent p-0 pl-2 w-auto h-auto underline cursor-pointer hover:bg-transparent flex items-center justify-start gap-1",style:{color:"var(--pbm-text)"},onMouseOver:l=>l.currentTarget.style.filter="brightness(0.8)",onMouseOut:l=>l.currentTarget.style.filter="none",onClick:()=>r("isEmpty"),id:"check_benefits_button",children:[x.jsx("span",{children:"Tentar novamente"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:25,columnNumber:17},void 0),x.jsx(Uv,{size:16},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:26,columnNumber:17},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:17,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:14,columnNumber:9},void 0)},Pm={personalData:{name:"",phone:"",birthday:"",email:""},address:{postalcode:"",number:"",complement:"",street:"",neighborhood:"",city:"",uf:"",stateAddress:""},genderResponsibility:{gender:"",patient:null},doctor:{typeCredential:"CRM",register:"",state:"",doctorName:""},acceptances:{acceptPhone:!1,acceptsSms:!1,acceptsEmail:!1,acceptsMail:!1,acceptsPrivacyTermsLGPD:!1},step:0},lr=Cu(n=>({...Pm,setPersonalData:r=>n(l=>({personalData:{...l.personalData,...r}})),setAddress:r=>n(l=>({address:{...l.address,...r}})),setGenderResponsibility:r=>n(l=>({genderResponsibility:{...l.genderResponsibility,...r}})),setDoctor:r=>n(l=>({doctor:{...l.doctor,...r}})),setAcceptances:r=>n(l=>({acceptances:{...l.acceptances,...r}})),setStep:r=>n({step:r}),resetForm:()=>n(Pm)})),Gt=({label:n,error:r,children:l})=>x.jsx("div",{className:"flex flex-col gap-1",children:[x.jsx("label",{className:"text-xs font-medium text-zinc-500 uppercase tracking-wide",children:n},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/FieldWrapper.tsx",lineNumber:11,columnNumber:5},void 0),l,r&&x.jsx("span",{className:"text-xs text-red-500 mt-0.5",children:r},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/FieldWrapper.tsx",lineNumber:15,columnNumber:15},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/FieldWrapper.tsx",lineNumber:10,columnNumber:3},void 0),Xi="w-full rounded-lg border border-gray-200 bg-gray-100 px-3 py-2.5 text-sm text-gray-400 cursor-not-allowed",ja=n=>ot("w-full rounded-lg border px-3 py-2.5 text-sm text-gray-800 outline-none transition-all","focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500",n?"border-red-400 bg-red-50":"border-gray-200 bg-gray-50 hover:border-gray-300"),Ki=({onNext:n,onBack:r,loading:l,nextLabel:s="Continuar",isLast:u=!1})=>x.jsx("div",{className:"flex gap-2 mt-2 pt-4 border-t border-gray-100",children:[r&&x.jsx("button",{type:"button",onClick:r,className:"flex-1 rounded-lg border border-gray-200 py-2.5 text-sm font-medium text-zinc-600 hover:bg-zinc-600/10 transition-all cursor-pointer",children:"Voltar"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:18,columnNumber:7},void 0),x.jsx("button",{type:"button",onClick:n,disabled:l,className:ot("flex-2 rounded-lg py-2.5 text-sm font-semibold text-white transition-all cursor-pointer",u?"bg-emerald-600 hover:bg-emerald-500":"bg-(--pbm-primary) hover:bg-(--pbm-primary)/60",l&&"opacity-60 cursor-not-allowed"),children:l?x.jsx("span",{className:"flex items-center justify-center gap-2",children:[x.jsx("svg",{className:"h-4 w-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[x.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:41,columnNumber:13},void 0),x.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:49,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:40,columnNumber:11},void 0),"Enviando..."]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:39,columnNumber:9},void 0):s},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:26,columnNumber:5},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:16,columnNumber:3},void 0),ys={PersonalData:0,Address:1,GenderResponsibility:2,Doctor:3,Acceptances:4},r1=({securityNumber:n,onNext:r})=>{const{personalData:l,setPersonalData:s,setStep:u}=lr(),{setModal:f}=rr(),[d,m]=pe.useState({}),[y,p]=pe.useState(!1),S=()=>{const E={};return(!l.name.trim()||l.name.trim().split(" ").length<2)&&(E.name="Informe o nome completo."),/^\(\d{2}\) \d{5}-\d{4}$/.test(l.phone)||(E.phone="Telefone inválido."),l.birthday||(E.birthday="Data de nascimento obrigatória."),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l.email)||(E.email="E-mail inválido."),m(E),Object.keys(E).length===0},v=async()=>{if(S()){p(!0);try{u(ys.Address),r()}catch{console.error("An error occurred while setting personal data form.")}finally{p(!1)}}};return x.jsx("div",{className:"flex flex-col gap-4",children:[x.jsx(Gt,{label:"CPF",children:[x.jsx("input",{className:Xi,value:ya.cpf(n),disabled:!0,readOnly:!0},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:58,columnNumber:9},void 0),x.jsx("p",{className:"text-xs text-gray-400 mt-1",children:x.jsx("button",{type:"button",className:"text-(--pbm-primary) hover:text-(--pbm-primary)/60 cursor-pointer underline underline-offset-2 transition-colors",onClick:()=>f({id:"",open:!1}),children:"Deseja alterar o CPF? Clique aqui."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:65,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:64,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:57,columnNumber:7},void 0),x.jsx(Gt,{label:"Nome completo",error:d.name,children:x.jsx("input",{className:ja(d.name),placeholder:"Ex: João da Silva",value:l.name,onChange:E=>{s({name:E.target.value}),m(N=>({...N,name:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:76,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:75,columnNumber:7},void 0),x.jsx("div",{className:"grid grid-cols-2 gap-3",children:[x.jsx(Gt,{label:"Telefone",error:d.phone,children:x.jsx("input",{className:ja(d.phone),placeholder:"(11) 99999-8888",value:l.phone,onChange:E=>{s({phone:ya.phone(E.target.value)}),m(N=>({...N,phone:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:89,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:88,columnNumber:9},void 0),x.jsx(Gt,{label:"Data de nascimento",error:d.birthday,children:x.jsx("input",{type:"date",className:ja(d.birthday),value:l.birthday,onChange:E=>{s({birthday:E.target.value}),m(N=>({...N,birthday:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:101,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:100,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:87,columnNumber:7},void 0),x.jsx(Gt,{label:"E-mail",error:d.email,children:x.jsx("input",{type:"email",className:ja(d.email),placeholder:"joao@email.com",value:l.email,onChange:E=>{s({email:E.target.value}),m(N=>({...N,email:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:114,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:113,columnNumber:7},void 0),x.jsx(Ki,{onNext:v,loading:y},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:126,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:56,columnNumber:5},void 0)};async function i1({postal_code:n}){const r=await fetch(`${ir("VITE_CORREIOS_API_URL")}/${n}/json/`);if(!r.ok)throw new Error("Erro ao consultar CEP");return{...await r.json(),success:!0}}const l1=({onNext:n,onBack:r})=>{const{address:l,setAddress:s,setStep:u}=lr(),[f,d]=pe.useState({}),[m,y]=pe.useState(!1),[p,S]=pe.useState(!1),v=pe.useCallback(async B=>{const w=B.replace(/\D/g,"");if(w.length===8){y(!0);try{const q=await i1({postal_code:w});if(!q.success){console.error("Failed to lookup postal code");return}s({street:q.logradouro,neighborhood:q.bairro,uf:q.uf,city:q.localidade,stateAddress:q.estado,postalcode:q.cep,complement:q.complemento||""})}catch{console.error("Failed to fetch address for CEP:",B)}finally{y(!1)}}},[s]),E=()=>{const B={};return/^\d{5}-\d{3}$/.test(l.postalcode)||(B.postalcode="CEP inválido."),l.number.trim()||(B.number="Número obrigatório."),d(B),Object.keys(B).length===0},N=async()=>{if(E()){S(!0);try{u(ys.GenderResponsibility),n()}catch{console.log("An error occurred while submitting address form.")}finally{S(!1)}}};return x.jsx("div",{className:"flex flex-col gap-4",children:[x.jsx(Gt,{label:"CEP",error:f.postalcode,children:x.jsx("div",{className:"relative",children:[x.jsx("input",{className:ja(f.postalcode),placeholder:"00000-000",value:l.postalcode,onChange:B=>{const w=ya.cep(B.target.value);s({postalcode:w}),d(q=>({...q,postalcode:void 0})),w.replace(/\D/g,"").length===8&&v(w)}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:87,columnNumber:11},void 0),m&&x.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:x.jsx("svg",{className:"h-4 w-4 animate-spin text-blue-500",viewBox:"0 0 24 24",fill:"none",children:[x.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:109,columnNumber:17},void 0),x.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:117,columnNumber:17},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:104,columnNumber:15},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:103,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:86,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:85,columnNumber:7},void 0),x.jsx("div",{className:"grid grid-cols-2 gap-3",children:[x.jsx(Gt,{label:"Rua",children:x.jsx("input",{className:Xi,value:l.street||"",disabled:!0,readOnly:!0,placeholder:"Preenchido pelo CEP"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:130,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:129,columnNumber:9},void 0),x.jsx(Gt,{label:"Bairro",children:x.jsx("input",{className:Xi,value:l.neighborhood||"",disabled:!0,readOnly:!0,placeholder:"Preenchido pelo CEP"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:139,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:138,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:128,columnNumber:7},void 0),x.jsx("div",{className:"grid grid-cols-2 gap-3",children:[x.jsx(Gt,{label:"Cidade",children:x.jsx("input",{className:Xi,value:l.city||"",disabled:!0,readOnly:!0,placeholder:"Preenchido pelo CEP"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:151,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:150,columnNumber:9},void 0),x.jsx(Gt,{label:"Estado",children:x.jsx("input",{className:Xi,value:l.stateAddress||"",disabled:!0,readOnly:!0,placeholder:"UF"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:160,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:159,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:149,columnNumber:7},void 0),x.jsx("div",{className:"grid grid-cols-2 gap-3",children:[x.jsx(Gt,{label:"Número",error:f.number,children:x.jsx("input",{className:ja(f.number),placeholder:"Ex: 100",value:l.number,onChange:B=>{s({number:B.target.value}),d(w=>({...w,number:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:172,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:171,columnNumber:9},void 0),x.jsx(Gt,{label:"Complemento",children:x.jsx("input",{className:ja(),placeholder:"Apto, bloco...",value:l.complement,onChange:B=>s({complement:B.target.value})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:183,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:182,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:170,columnNumber:7},void 0),x.jsx(Ki,{onNext:N,onBack:r,loading:p},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:192,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:84,columnNumber:5},void 0)},s1=({onNext:n,onBack:r})=>{const{genderResponsibility:l,setGenderResponsibility:s,setStep:u}=lr(),[f,d]=pe.useState({}),[m,y]=pe.useState(!1),p=()=>{const E={};return l.gender||(E.gender="Selecione o gênero."),l.patient===null&&(E.patient="Informe se é o paciente."),d(E),Object.keys(E).length===0},S=async()=>{if(p()){y(!0);try{u(ys.Doctor),n()}catch{console.error("An error occurred while submitting gender responsibility data.")}finally{y(!1)}}},v=[{value:"M",label:"Masculino"},{value:"F",label:"Feminino"},{value:"O",label:"Outro"}];return x.jsx("div",{className:"flex flex-col gap-5",children:[x.jsx("div",{children:[x.jsx("label",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide block mb-2",children:"Gênero"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:56,columnNumber:9},void 0),x.jsx("div",{className:"flex gap-2",children:v.map(E=>x.jsx("button",{type:"button",onClick:()=>{s({gender:E.value}),d(N=>({...N,gender:void 0}))},className:ot("flex-1 py-2.5 cursor-pointer px-2.5 rounded-lg border text-sm font-medium transition-all",l.gender===E.value?"border-(--pbm-primary) bg-(--pbm-primary) text-white":"border-gray-200 bg-gray-50 text-gray-600 hover:border-(--pbm-primary)"),children:E.label},E.value,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:61,columnNumber:13},void 0))},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:59,columnNumber:9},void 0),f.gender&&x.jsx("span",{className:"text-xs text-red-500 mt-1 block",children:f.gender},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:80,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:55,columnNumber:7},void 0),x.jsx("div",{children:[x.jsx("label",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide block mb-2",children:"Você é o paciente?"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:87,columnNumber:9},void 0),x.jsx("div",{className:"flex gap-2",children:[{label:"Sim, sou o paciente",value:!0},{label:"Não, sou responsável",value:!1}].map(E=>x.jsx("button",{type:"button",onClick:()=>{s({patient:E.value}),d(N=>({...N,patient:void 0}))},className:ot("flex-1 py-2.5 px-2.5 text-nowrap cursor-pointer rounded-lg border text-sm font-medium transition-all",l.patient===E.value?"border-(--pbm-primary) bg-(--pbm-primary) text-white":"border-gray-200 bg-gray-50 text-gray-600 hover:border-(--pbm-primary)"),children:E.label},String(E.value),!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:95,columnNumber:13},void 0))},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:90,columnNumber:9},void 0),f.patient&&x.jsx("span",{className:"text-xs text-red-500 mt-1 block",children:f.patient},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:114,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:86,columnNumber:7},void 0),x.jsx(Ki,{onNext:S,onBack:r,loading:m},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:120,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:54,columnNumber:5},void 0)},o1=["AC","AL","AP","AM","BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SC","SP","SE","TO"],u1=({onNext:n,onBack:r})=>{const{doctor:l,setDoctor:s,setStep:u}=lr(),[f,d]=pe.useState({}),[m,y]=pe.useState(!1),p=()=>{const v={};return l.typeCredential||(v.typeCredential="Tipo de credencial obrigatório."),l.register.trim()||(v.register="Número do registro obrigatório."),l.state||(v.state="Estado obrigatório."),l.doctorName.trim()||(v.doctorName="Nome do médico obrigatório."),d(v),Object.keys(v).length===0},S=async()=>{if(p()){y(!0);try{u(ys.Acceptances),n()}catch{console.error("An error occurred while submitting doctor data.")}finally{y(!1)}}};return x.jsx("div",{className:"flex flex-col gap-4",children:[x.jsx("div",{className:"grid grid-cols-3 gap-3",children:[x.jsx(Gt,{label:"Tipo credencial",error:f.typeCredential,children:x.jsx("select",{className:ja(f.typeCredential),value:l.typeCredential,onChange:v=>{s({typeCredential:v.target.value}),d(E=>({...E,typeCredential:void 0}))},children:[x.jsx("option",{value:"CRM",children:"CRM"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:63,columnNumber:13},void 0),x.jsx("option",{value:"CRO",children:"CRO"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:64,columnNumber:13},void 0),x.jsx("option",{value:"CRF",children:"CRF"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:65,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:52,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:51,columnNumber:9},void 0),x.jsx(Gt,{label:"Estado (UF)",error:f.state,children:x.jsx("select",{className:ja(f.state),value:l.state,onChange:v=>{s({state:v.target.value}),d(E=>({...E,state:void 0}))},children:[x.jsx("option",{value:"",children:"UF"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:78,columnNumber:13},void 0),o1.map(v=>x.jsx("option",{value:v,children:v},v,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:80,columnNumber:15},void 0))]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:70,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:69,columnNumber:9},void 0),x.jsx(Gt,{label:"Nº registro",error:f.register,children:x.jsx("div",{className:"relative",children:x.jsx("input",{className:ja(f.register),placeholder:"Ex: 123456",value:l.register,onChange:v=>{s({register:v.target.value.replace(/\D/g,"")}),d(E=>({...E,register:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:89,columnNumber:13},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:88,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:87,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:50,columnNumber:7},void 0),x.jsx(Gt,{label:"Nome do médico",error:f.doctorName,children:[x.jsx("div",{className:"relative",children:x.jsx("input",{className:ja(f.doctorName),placeholder:"Nome Completo do Profissional",value:l.doctorName,onChange:v=>{s({doctorName:v.target.value}),d(E=>({...E,doctorName:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:107,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:106,columnNumber:9},void 0),x.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Preenchido automaticamente ao informar registro + UF."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:120,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:105,columnNumber:7},void 0),x.jsx(Ki,{onNext:S,onBack:r,loading:m},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:125,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:49,columnNumber:5},void 0)},Ji=({label:n,checked:r,onChange:l,required:s,error:u})=>x.jsx("label",{className:ot("flex items-start gap-3 cursor-pointer group p-3 rounded-lg border transition-all",r?"border-emerald-200 bg-emerald-50/60":"border-zinc-100 hover:border-zinc-200 bg-zinc-50/40",u?"border-red-300 bg-red-50/40":""),children:[x.jsx("div",{className:ot("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-all",r?"border-(--pbm-primary) bg-(--pbm-primary)":"border-zinc-300 bg-white"),children:r&&x.jsx("svg",{className:"h-2.5 w-2.5 text-white",viewBox:"0 0 10 8",fill:"none",children:x.jsx("path",{d:"M1 4l3 3 5-6",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:35,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:34,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:25,columnNumber:5},void 0),x.jsx("span",{className:"text-sm text-zinc-700 leading-snug",children:[n,s&&x.jsx("span",{className:"text-red-400 ml-1",children:"*"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:47,columnNumber:20},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:45,columnNumber:5},void 0),x.jsx("input",{type:"checkbox",className:"sr-only",checked:r,onChange:f=>l(f.target.checked)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:49,columnNumber:5},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:16,columnNumber:3},void 0),c1=async({product:n,consumer:r,healthProfessional:l})=>{const s=rt.get("tenant_id");if(!s)throw new Error(`No configuration found for tenant: ${s}`);if(!r)throw new Error("Consumer information is required");if(!l)throw new Error("Health professional information is required");if(!n)throw new Error("Product information is required");try{const f=await(await fetch(`${ir("VITE_API_URL")}/api/discount.ts`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${rt.get("pbm-token")}`},body:JSON.stringify({tenant_id:s,product:n,table_id:rt.get("current-table-id"),local_hour:rt.get("current-local-hour"),consumer:r,healthProfessional:l})})).json();if(!f.success)throw new Error("PBMLOG: Enable Discount Failed!");return rt.set("current-central-number",f.product[0].centralNumber.toString(),{secure:!0,sameSite:"Strict",expires:1}),rt.set("current-term-code",f.product[0].activationFields.acceptLgpd.termCode.value.toString(),{secure:!0,sameSite:"Strict",expires:1}),f}catch(u){return console.error("Error during enable discount:",u),{success:!1,error:"Authorization failed"}}},f1=async({product:n,consumer:r,healthProfessional:l})=>{const s=rt.get("tenant_id");if(!s)throw new Error(`No configuration found for tenant: ${s}`);if(!r)throw new Error("Consumer information is required");if(!l)throw new Error("Health professional information is required");if(!n)throw new Error("Product information is required");try{const f=await(await fetch(`${ir("VITE_API_URL")}/api/activate.ts`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${rt.get("pbm-token")}`},body:JSON.stringify({tenant_id:s,product:n,table_id:rt.get("current-table-id"),local_hour:rt.get("current-local-hour"),central_number:rt.get("current-central-number"),consumer:r,healthProfessional:l,acceptLgpd:{evidenceType:"SITE",evidence:"VSTOSITE",termCode:rt.get("current-term-code")}})})).json();if(!f.success)throw new Error("PBMLOG: Activate Failed!");return f}catch(u){return console.error("Error during activate:",u),{success:!1,error:"Authorization failed"}}},d1=({onBack:n,onDone:r,securityNumber:l})=>{const{acceptances:s,setAcceptances:u}=lr(),{targetProduct:f,cardID:d}=Kt(),[m,y]=pe.useState({}),[p,S]=pe.useState(!1),v=lr.getState(),E=()=>{const w={};return s.acceptsPrivacyTermsLGPD||(w.lgpd="É obrigatório aceitar os termos de privacidade (LGPD)."),y(w),Object.keys(w).length===0},N=async w=>{try{const q=await f1(w);console.log("Activate response:",q)}catch(q){console.error("Error during consumer activation:",q)}},B=async()=>{if(!E())return;if(S(!0),!f){console.error("No target product found in PBM store."),S(!1);return}const w=v.personalData.phone.replace(/\D/g,""),q=w.slice(0,2),P=w.slice(2),K={consumer:{holderId:l,cardId:d||"",name:v.personalData.name,email:v.personalData.email,birthdate:v.personalData.birthday,genre:v.genderResponsibility.gender,postalCode:v.address.postalcode.replace(/\D/g,""),stateCode:v.address.uf||"",cityName:v.address.city||"",cityRegion:v.address.neighborhood||"",addressType:"casa",streetAddress:v.address.street||"",addressNumber:v.address.number||"",addressAdditionalInformation:v.address.complement||"",DDDcellPhone:q,cellphone:P,acceptInformativeMaterial:s.acceptsMail?"S":"N",acceptMail:s.acceptsMail?"S":"N",acceptEmail:s.acceptsEmail?"S":"N",acceptCalls:s.acceptPhone?"S":"N",acceptSMS:s.acceptsSms?"S":"N",acceptTerm:s.acceptsPrivacyTermsLGPD?"S":"N",acceptWhatsApp:"N"},healthProfessional:{id:v.doctor.register,stateCode:v.doctor.state,type:v.doctor.typeCredential,name:v.doctor.doctorName},product:{id:f.id,ean:f.ean,requestedQuantity:f.requestedQuantity,listPrice:f.listPrice,netPrice:f.netPrice}};try{const ae=await c1(K);ae.success?await N(K):console.error("Failed to enable discount:",ae),r()}catch{console.error("An error occurred while submitting acceptances data.")}finally{S(!1)}};return x.jsx("div",{className:"flex flex-col gap-3",children:[x.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"Selecione como deseja receber comunicações:"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:119,columnNumber:7},void 0),x.jsx(Ji,{label:"Aceito receber contato por telefone",checked:s.acceptPhone,onChange:w=>u({acceptPhone:w})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:123,columnNumber:7},void 0),x.jsx(Ji,{label:"Aceito receber SMS",checked:s.acceptsSms,onChange:w=>u({acceptsSms:w})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:128,columnNumber:7},void 0),x.jsx(Ji,{label:"Aceito receber e-mails",checked:s.acceptsEmail,onChange:w=>u({acceptsEmail:w})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:133,columnNumber:7},void 0),x.jsx(Ji,{label:"Aceito receber correspondências por correio",checked:s.acceptsMail,onChange:w=>u({acceptsMail:w})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:138,columnNumber:7},void 0),x.jsx("div",{className:"mt-1",children:[x.jsx(Ji,{label:"Li e aceito os Termos de Privacidade (LGPD)",checked:s.acceptsPrivacyTermsLGPD,onChange:w=>{u({acceptsPrivacyTermsLGPD:w}),y({})},required:!0,error:m.lgpd},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:145,columnNumber:9},void 0),m.lgpd&&x.jsx("span",{className:"text-xs text-red-500 mt-1 block pl-1",children:m.lgpd},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:156,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:144,columnNumber:7},void 0),x.jsx(Ki,{onNext:B,onBack:n,loading:p,nextLabel:"Concluir cadastro",isLast:!0},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:162,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:118,columnNumber:5},void 0)},Wm=["Dados Pessoais","Endereço","Perfil","Médico","Aceites"],m1=({current:n})=>x.jsx("div",{className:"flex items-center w-full justify-center mb-6",children:Wm.map((r,l)=>{const s=l<n,u=l===n;return x.jsx("div",{className:"flex items-center w-full min-w-0 justify-center relative",children:[x.jsx("div",{className:"flex flex-col items-center justify-center gap-1 shrink-0 z-10",children:[x.jsx("div",{className:ot("flex h-7 w-7 items-center justify-center rounded-full text-xs font-semibold transition-all",s?"bg-emerald-600 text-white":u?"bg-(--pbm-primary) text-white ring-4 ring-(--pbm-primary)/15":"bg-zinc-100 text-zinc-400"),children:s?x.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 12 10",fill:"none",children:x.jsx("path",{d:"M1 5l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:34,columnNumber:19},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:33,columnNumber:17},void 0):l+1},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:22,columnNumber:13},void 0),x.jsx("span",{className:ot("text-[10px] font-medium whitespace-nowrap hidden sm:block",u?"text-(--pbm-primary)":s?"text-emerald-600":"text-zinc-400"),children:r},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:46,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:21,columnNumber:11},void 0),l<Wm.length-1&&x.jsx("div",{className:ot("h-0.5 w-full rounded transition-all absolute top-3.5 left-10","bg-zinc-200")},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:60,columnNumber:13},void 0)]},l,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:17,columnNumber:9},void 0)})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:12,columnNumber:3},void 0),h1=({onClose:n})=>x.jsx("div",{className:"flex flex-col items-center gap-4 py-4 text-center",children:[x.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-green-100",children:x.jsx("svg",{className:"h-8 w-8 text-green-500",viewBox:"0 0 24 24",fill:"none",children:x.jsx("path",{d:"M5 13l4 4L19 7",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:5,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:4,columnNumber:7},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:3,columnNumber:5},void 0),x.jsx("div",{children:[x.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"Cadastro concluído!"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:15,columnNumber:7},void 0),x.jsx("p",{className:"text-sm text-zinc-500 mt-1",children:"Você já pode aproveitar os benefícios de farmácia."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:18,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:14,columnNumber:5},void 0),x.jsx("button",{onClick:n,className:"cursor-pointer mt-2 rounded-lg bg-(--primary-color) px-6 py-2.5 text-sm font-semibold text-white hover:bg-(--primary-color)/80 transition-all",children:"Fechar"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:22,columnNumber:5},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:2,columnNumber:3},void 0),p1=({ID:n})=>{const{modal:r,setModal:l}=rr(),{securityNumber:s}=Kt(),{resetForm:u,step:f,setStep:d}=lr(),[m,y]=pe.useState(!1),p=()=>{l({id:"",open:!1}),setTimeout(()=>{d(0),y(!1),u()},300)},S=()=>d(f+1),v=()=>d(f-1),E=s.replace(/\D/g,""),N=[x.jsx(r1,{securityNumber:E,onNext:S},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:36,columnNumber:5},void 0),x.jsx(l1,{securityNumber:E,onNext:S,onBack:v},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:37,columnNumber:5},void 0),x.jsx(s1,{securityNumber:E,onNext:S,onBack:v},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:42,columnNumber:5},void 0),x.jsx(u1,{securityNumber:E,onNext:S,onBack:v},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:47,columnNumber:5},void 0),x.jsx(d1,{securityNumber:E,onBack:v,onDone:()=>y(!0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:52,columnNumber:5},void 0)];return x.jsx("main",{className:ot("fixed inset-0 flex items-center justify-end z-50 flex-col transition-all shadow bg-black/40",{"opacity-100 pointer-events-auto":r.id===n&&r.open,"opacity-0 pointer-events-none":r.id!==n||!r.open}),children:[x.jsx("div",{className:"absolute inset-0",onClick:p},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:69,columnNumber:7},void 0),x.jsx("section",{className:"z-10 bg-white flex flex-col p-6 rounded-2xl w-full max-w-125 min-w-125 mx-4 shadow-xl max-h-[90vh] overflow-y-auto",children:[x.jsx("div",{className:"flex items-center justify-between mb-4",children:[x.jsx(Hr,{textSize:"18px",textAlign:"start",children:m?"Tudo pronto!":"Benefício de Farmácia"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:73,columnNumber:11},void 0),x.jsx("button",{onClick:p,className:"flex h-7 w-7 cursor-pointer items-center justify-center rounded-full text-gray-400 hover:bg-gray-100 hover:text-gray-600 transition-all",children:x.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 14 14",fill:"none",children:x.jsx("path",{d:"M1 1l12 12M13 1L1 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:81,columnNumber:15},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:80,columnNumber:13},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:76,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:72,columnNumber:9},void 0),!m&&x.jsx(m1,{current:f},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:91,columnNumber:19},void 0),m?x.jsx(h1,{onClose:p},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:93,columnNumber:17},void 0):N[f]]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:71,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:60,columnNumber:5},void 0)},g1=n=>n===void 0?"":"?"+Object.keys(n).map(r=>r+"="+n[r]).join("&");function y1(n){const{setState:r}=Kt();return x.jsx("a",{...n,target:n.target||"_self",href:typeof n.href=="string"?n.href:n.href.pathname+g1(n.href.param),className:ot("w-3xs cursor-pointer h-10 rounded-lg text-white text-sm font-semibold transition-colors flex items-center justify-center",n.className),style:{backgroundColor:"var(--pbm-primary)"},onMouseOver:l=>l.currentTarget.style.backgroundColor="var(--pbm-secondary)",onMouseOut:l=>l.currentTarget.style.backgroundColor="var(--pbm-primary)","data-testid":"test_id_link",id:"link_pbm",onClick:()=>r("isEmpty"),children:n.children},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Link/index.tsx",lineNumber:18,columnNumber:5},this)}const b1=({ID:n})=>{const{customLoginUrl:r}=Kt(),{modal:l,setModal:s}=rr();return x.jsx("main",{className:ot("fixed inset-0 flex items-center justify-center z-50 flex-col transition-all shadow bg-black/40",{"opacity-100 pointer-events-auto":l.id===n&&l.open,"opacity-0 pointer-events-none":l.id!=n||!l.open}),children:[x.jsx("div",{className:"absolute inset-0",onClick:()=>s({id:"",open:!1})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:23,columnNumber:7},void 0),x.jsx("section",{className:"z-10 bg-white gap-2 flex-col items-center-safe justify-center-safe p-8 rounded-xl",children:[x.jsx(Hr,{textColor:"tomato",textSize:"18px",textAlign:"center",className:"mb-2",children:"Opa! Parece que você não está Logado"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:28,columnNumber:9},void 0),x.jsx(gs,{className:"mb-2",textAlign:"center",children:["Para aproveitar os benefícios é necessário realizar o"," ",x.jsx("strong",{children:"Login"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:38,columnNumber:11},void 0)," ou ",x.jsx("strong",{children:"Cadastro"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:38,columnNumber:37},void 0)," no site!"]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:36,columnNumber:9},void 0),x.jsx("section",{className:"flex items-center-safe justify-center-safe gap-4",children:[x.jsx(Wa,{className:"bg-gray-600 hover:bg-gray-500",onClick:()=>s({id:"",open:!1}),children:"Seguir sem Benefícios"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:41,columnNumber:11},void 0),x.jsx(y1,{href:r||"/login",children:"Aproveitar Benefícios"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:47,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:40,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:27,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:14,columnNumber:5},void 0)};function eh(n){var r,l,s="";if(typeof n=="string"||typeof n=="number")s+=n;else if(typeof n=="object")if(Array.isArray(n)){var u=n.length;for(r=0;r<u;r++)n[r]&&(l=eh(n[r]))&&(s&&(s+=" "),s+=l)}else for(l in n)n[l]&&(s&&(s+=" "),s+=l);return s}function th(){for(var n,r,l=0,s="",u=arguments.length;l<u;l++)(n=arguments[l])&&(r=eh(n))&&(s&&(s+=" "),s+=r);return s}function v1(n,r,l=void 0){const s={};for(const u in n){const f=n[u];let d="",m=!0;for(let y=0;y<f.length;y+=1){const p=f[y];p&&(d+=(m===!0?"":" ")+r(p),m=!1,l&&l[p]&&(d+=" "+l[p]))}s[u]=d}return s}function sr(n,...r){const l=new URL(`https://mui.com/production-error/?code=${n}`);return r.forEach(s=>l.searchParams.append("args[]",s)),`Minified MUI error #${n}; visit ${l} for the full message.`}const x1="$$material";function Vu(){return Vu=Object.assign?Object.assign.bind():function(n){for(var r=1;r<arguments.length;r++){var l=arguments[r];for(var s in l)({}).hasOwnProperty.call(l,s)&&(n[s]=l[s])}return n},Vu.apply(null,arguments)}function S1(n){if(n.sheet)return n.sheet;for(var r=0;r<document.styleSheets.length;r++)if(document.styleSheets[r].ownerNode===n)return document.styleSheets[r]}function N1(n){var r=document.createElement("style");return r.setAttribute("data-emotion",n.key),n.nonce!==void 0&&r.setAttribute("nonce",n.nonce),r.appendChild(document.createTextNode("")),r.setAttribute("data-s",""),r}var _1=(function(){function n(l){var s=this;this._insertTag=function(u){var f;s.tags.length===0?s.insertionPoint?f=s.insertionPoint.nextSibling:s.prepend?f=s.container.firstChild:f=s.before:f=s.tags[s.tags.length-1].nextSibling,s.container.insertBefore(u,f),s.tags.push(u)},this.isSpeedy=l.speedy===void 0?!1:l.speedy,this.tags=[],this.ctr=0,this.nonce=l.nonce,this.key=l.key,this.container=l.container,this.prepend=l.prepend,this.insertionPoint=l.insertionPoint,this.before=null}var r=n.prototype;return r.hydrate=function(s){s.forEach(this._insertTag)},r.insert=function(s){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(N1(this));var u=this.tags[this.tags.length-1];{var f=s.charCodeAt(0)===64&&s.charCodeAt(1)===105;f&&this._alreadyInsertedOrderInsensitiveRule&&console.error(`You're attempting to insert the following rule:
|
|
83
|
+
*/const Uv=$m("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Qm={modal:{id:"",open:!1,label:"",url:""}},rr=Cu(n=>({...Qm,setModal:r=>n({modal:r}),resetModal:()=>n({modal:Qm.modal})})),Lv=n=>n.replace(/\D/g,"").slice(0,11).replace(/^(\d{2})(\d{5})(\d{0,4})/,"($1) $2-$3").trim(),Vv=n=>n.replace(/\D/g,"").slice(0,8).replace(/^(\d{5})(\d{0,3})/,"$1-$2"),Hv=n=>n.replace(/\D/g,"").replace(/(\d{3})(\d{3})(\d{3})(\d{2})/,"$1.$2.$3-$4"),Xm=n=>Number(String(n).replace(",",".")),qv=n=>{const r=String(n);if(r.includes(".")||r.includes(","))return Xm(n);const l=r.slice(-2);return+`${r.slice(0,-2)||"0"}.${l}`},Gv=n=>{const r=n.slice(-2);return+`${n.slice(0,-2)||"0"}.${r}`};function Zv(n){return String(n).replace(/[.,]/g,"")}const ya={phone:n=>Lv(n),cep:n=>Vv(n),cpf:n=>Hv(n),priceToInteger:n=>Zv(n),price:n=>Xm(n),transformPrice:n=>qv(n),transformPorcent:n=>Gv(n)};/*! js-cookie v3.0.5 | MIT */function hs(n){for(var r=1;r<arguments.length;r++){var l=arguments[r];for(var s in l)n[s]=l[s]}return n}var Yv={read:function(n){return n[0]==='"'&&(n=n.slice(1,-1)),n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(n){return encodeURIComponent(n).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Bu(n,r){function l(u,f,d){if(!(typeof document>"u")){d=hs({},r,d),typeof d.expires=="number"&&(d.expires=new Date(Date.now()+d.expires*864e5)),d.expires&&(d.expires=d.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var m="";for(var y in d)d[y]&&(m+="; "+y,d[y]!==!0&&(m+="="+d[y].split(";")[0]));return document.cookie=u+"="+n.write(f,u)+m}}function s(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var f=document.cookie?document.cookie.split("; "):[],d={},m=0;m<f.length;m++){var y=f[m].split("="),p=y.slice(1).join("=");try{var S=decodeURIComponent(y[0]);if(d[S]=n.read(p,S),u===S)break}catch{}}return u?d[u]:d}}return Object.create({set:l,get:s,remove:function(u,f){l(u,"",hs({},f,{expires:-1}))},withAttributes:function(u){return Bu(this.converter,hs({},this.attributes,u))},withConverter:function(u){return Bu(hs({},this.converter,u),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(n)}})}var rt=Bu(Yv,{path:"/"});const Uu={BASE_URL:"/",DEV:!0,MODE:"production",PROD:!1,SSR:!1,VITE_API_URL:"https://serverless-pbm.vercel.app",VITE_CLIENT_ID_SANTOREMEDIO:"fff909d6-a77e-4ffc-a4bb-47a1cde99621",VITE_CLIENT_SECRET_SANTOREMEDIO:"ZTK8Q~gqjOkbBmH3vN1AIsKUbwkhUYOkzfvIUb18",VITE_CORREIOS_API_URL:"https://viacep.com.br/ws",VITE_GRANT_TYPE_SANTOREMEDIO:"client_credentials",VITE_SCOPE_SANTOREMEDIO:"https://interplayersdevb2c.onmicrosoft.com/services/varejo-api-pre/.default",VITE_USERNAME_SANTOREMEDIO:"147de435-fac6-4c57-95d8-bb06feb0496b"},ir=n=>{var r;if(typeof{url:Ja&&Ja.tagName.toUpperCase()==="SCRIPT"&&Ja.src||new URL("vanilla.js",document.baseURI).href}<"u")return Uu==null?void 0:Uu[n];if(typeof process<"u")return(r=process.env)==null?void 0:r[n]},$v=async({product:n,consumer:r})=>{const l=rt.get("tenant_id");if(!l)throw new Error(`No configuration found for tenant: ${l}`);if(!r||!r.holderId)throw new Error("Consumer holderId information is required");if(!n)throw new Error("Product information is required");try{const u=await(await fetch(`${ir("VITE_API_URL")}/api/lookup-consumer.ts`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${rt.get("pbm-token")}`},body:JSON.stringify({tenant_id:l,product:n,table_id:rt.get("current-table-id"),local_hour:rt.get("current-local-hour"),consumer:r})})).json();if(!u.success)throw new Error("PBMLOG: Enable Discount Failed!");return u}catch(s){return console.error("Error during enable discount:",s),{success:!1,error:"Authorization failed"}}};function Fv({startTransition:n}){const r=Kt(),[l,s]=pe.useState(!1),{setModal:u}=rr(),{handleSubmit:f,register:d,setValue:m,clearErrors:y,unregister:p,formState:{errors:S}}=Sv({resolver:Mv(Qb),mode:"onSubmit",defaultValues:{securityNumber:r.securityNumber||"",coupon:""}}),v=async N=>{if(r.targetProduct===null){console.error("PBMLOG: Product is not defined!");return}if(!r.targetProduct.id){console.error("PBMLOG: Product ID is not defined!");return}if(!r.targetProduct.listPrice){console.error("PBMLOG: List Price is not defined!");return}if(!r.targetProduct.authorizedQuantity){console.error("PBMLOG: Authorized Quantity is not defined!");return}r.setSecurityNumber(N.securityNumber.replace(/\D/g,""));const B=await $v({product:r.targetProduct,consumer:{holderId:N.securityNumber.replace(/\D/g,"")}});if(!B.success){u({id:"CustomerNotRegistered",open:!0});return}r.setBenefitsList(B.product),r.setState("isActivated")},E=async N=>{if(!r.isAuthenticatedShopper){u({id:"ShopperIsNotAuthenticated",open:!0});return}l||m("coupon",void 0,{shouldValidate:!1}),l&&N.coupon!=null&&r.setCardID(N.coupon),n(async()=>{await v(N)})};return x.jsx(x.Fragment,{children:[x.jsx("form",{onSubmit:f(E),className:ot("w-full h-auto flex items-start justify-center flex-col mb-2 transition-all duration-150"),id:"form_security_number_pbm",children:[x.jsx("label",{htmlFor:"input_security_number_pbm",className:ot("w-full h-auto flex items-start flex-col justify-center relative py-2 transition-all duration-100",{"mb-4":S.securityNumber&&!l}),id:"label_security_number_pbm",children:[x.jsx("input",{type:"text",className:ot("w-full h-10 bg-(--pbm-input-background) rounded-lg text-sm font-semibold outline-(--pbm-outline-color) focus:outline focus:bg-(--pbm-input-focus) focus:outline-(--pbm-outline-focus-color) text-zinc-600 placeholder:text-zinc-600 px-4 placeholder:text-sm placeholder:font-semibold",{"outline outline-red-600":S.securityNumber,"rounded-lg":l}),style:{"--tw-outline-color":S.securityNumber?void 0:"var(--pbm-secondary)"},placeholder:"Digite seu CPF aqui...",required:!0,maxLength:14,...d("securityNumber",{onChange:N=>{const B=ya.cpf(N.target.value);m("securityNumber",B,{shouldValidate:!0})}}),defaultValue:r.securityNumber||"",id:"input_security_number_pbm"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:126,columnNumber:11},this),S.securityNumber&&x.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"security_number_form_error",children:S.securityNumber.message},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:157,columnNumber:13},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:116,columnNumber:9},this),x.jsx(pe.Activity,{mode:l?"visible":"hidden",children:x.jsx("label",{htmlFor:"input_coupon_pbm",className:ot("w-full h-auto flex items-start flex-col justify-center relative py-2",{"mt-2":S.securityNumber}),id:"label_coupon_pbm",children:[x.jsx("input",{type:"text",className:ot("w-full h-10 bg-gray-100 rounded-s-lg text-sm font-semibold focus:outline focus:bg-white text-zinc-600 placeholder:text-zinc-600 px-4 placeholder:text-sm placeholder:font-semibold",{"outline outline-red-600":S.coupon,"rounded-lg":l}),style:{"--tw-outline-color":S.coupon?void 0:"var(--pbm-secondary)"},placeholder:"Cupom / ID do Cartão",...d("coupon",{required:l?"Cupom / ID do Cartão obrigatório.":!1,shouldUnregister:!l,onChange:N=>{m("coupon",N.target.value,{shouldValidate:l})}}),id:"input_coupon_pbm"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:177,columnNumber:13},this),S.coupon&&x.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"coupon_form_error",children:S.coupon.message},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:208,columnNumber:15},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:167,columnNumber:11},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:166,columnNumber:9},this),x.jsx("button",{type:"submit",className:ot("w-full h-10 rounded-lg flex items-center justify-center cursor-pointer text-sm text-white font-semibold transition-all duration-150",{"rounded-lg":l}),style:{backgroundColor:"var(--pbm-primary)"},id:"button_submit_security_number_pbm",children:"Comprar com desconto"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:218,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:109,columnNumber:7},this),x.jsx("section",{className:"flex items-start flex-col gap-2",children:[x.jsx(Wa,{className:"bg-transparent p-0 pl-2 w-auto h-auto underline cursor-pointer hover:bg-transparent flex items-center justify-start gap-1",style:{color:"var(--pbm-text)"},onMouseOver:N=>N.currentTarget.style.filter="brightness(0.8)",onMouseOut:N=>N.currentTarget.style.filter="none",onClick:()=>{const N=!l;s(N),N||(p("coupon"),y("coupon"))},id:"check_benefits_button",children:[x.jsx("span",{className:"text-start",children:l?"Não possui Cupom / ID do Cartão?":"Possui Cupom / ID do Cartão?"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:252,columnNumber:11},this),x.jsx(Fm,{size:16,className:ot({"rotate-0":!l,"rotate-180":l})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:257,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:234,columnNumber:9},this),x.jsx(Wa,{className:"bg-transparent p-0 pl-2 w-auto h-auto underline cursor-pointer hover:bg-transparent flex items-center justify-start gap-1",style:{color:"var(--pbm-text)"},onMouseOver:N=>N.currentTarget.style.filter="brightness(0.8)",onMouseOut:N=>N.currentTarget.style.filter="none",onClick:()=>r.setState("isPreview"),id:"check_benefits_button",children:[x.jsx("span",{children:"Consultar Benefícios"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:275,columnNumber:11},this),x.jsx(Fm,{size:16},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:276,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:265,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:233,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Form/index.tsx",lineNumber:108,columnNumber:5},this)}function Qv({size:n}){return x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","data-name":"Camada 1",viewBox:"0 0 500 500",width:n,height:n,children:x.jsx("path",{d:"M421.44 78.56C375.64 32.77 314.76 7.55 250 7.55S124.36 32.77 78.56 78.56C32.77 124.36 7.55 185.24 7.55 250s25.22 125.64 71.01 171.44c45.8 45.79 106.68 71.01 171.44 71.01s125.64-25.22 171.44-71.01c45.79-45.8 71.01-106.68 71.01-171.44s-25.22-125.64-71.01-171.44zm-49.17 121.7L242.88 334.63c-8.98 9.29-23.57 10.17-33.59 2.02l-79.63-64.7c-10.69-8.67-12.33-24.38-3.66-35.07 8.67-10.69 24.38-12.33 35.07-3.65l61.9 50.39L336.5 165.74c4.4-4.75 10.48-7.59 16.95-7.93a24.88 24.88 0 0118.83 7.26c9.72 9.72 9.71 25.48 0 35.19z",fill:"#229b00"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:13,columnNumber:7},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:6,columnNumber:5},this)}function Xv({size:n}){return x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","data-name":"Camada 1",viewBox:"0 0 500 500",width:n,height:n,children:[x.jsx("circle",{cx:250,cy:250,r:237.45,fill:"#fff"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:29,columnNumber:7},this),x.jsx("path",{d:"M250 492.45c-64.76 0-125.64-25.22-171.44-71.01C32.77 375.64 7.55 314.76 7.55 250S32.77 124.36 78.56 78.56C124.36 32.77 185.24 7.55 250 7.55s125.64 25.22 171.44 71.01c45.79 45.79 71.01 106.68 71.01 171.44s-25.22 125.64-71.01 171.44c-45.79 45.79-106.68 71.01-171.44 71.01zm0-474.9C121.83 17.55 17.55 121.83 17.55 250S121.83 482.45 250 482.45 482.45 378.17 482.45 250 378.17 17.55 250 17.55z",fill:"#d8d8d8"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:30,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:22,columnNumber:5},this)}function Kv({size:n,color:r}){return x.jsx("svg",{viewBox:"-0.003 0 99.979 99.979",xmlns:"http://www.w3.org/2000/svg",fill:"#000000",width:n,height:n,children:[x.jsx("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:47,columnNumber:7},this),x.jsx("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:48,columnNumber:7},this),x.jsx("g",{id:"SVGRepo_iconCarrier",children:[x.jsx("path",{fill:"#ffe700",d:"M92.869 7.105c9.478 9.476 9.478 24.832 0 34.308L41.411 92.869c-9.475 9.474-24.833 9.474-34.307 0-9.476-9.475-9.476-24.832 0-34.308L58.562 7.105c9.475-9.473 24.834-9.473 34.307 0z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:54,columnNumber:9},this),x.jsx("path",{fill:r,d:"M32.548 33.122L7.105 58.563c-9.476 9.476-9.476 24.833 0 34.308 9.474 9.475 24.832 9.475 34.307 0L66.85 67.43 32.548 33.122z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:58,columnNumber:9},this),x.jsx("path",{fill:r,d:"M65.43 68.862L31.134 34.568l1.414-1.414 34.294 34.294z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:62,columnNumber:9},this),x.jsx("path",{fill:r,d:"M38.096 41.51L12.7 66.906a5.894 5.894 0 0 0 0 8.339 5.896 5.896 0 0 0 8.339 0l25.396-25.396-8.339-8.339z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:66,columnNumber:9},this),x.jsx("path",{fill:"#ffe700",d:"M75.244 12.7a5.897 5.897 0 0 0-8.343 0L39.51 40.096l8.339 8.339 27.396-27.396a5.899 5.899 0 0 0-.001-8.339z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:70,columnNumber:9},this),x.jsx("path",{fill:r,d:"M47.862 48.444l-1.414 1.414-8.335-8.336 1.414-1.414z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:74,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:53,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:40,columnNumber:5},this)}function Jv({size:n,color:r}){return x.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:n,height:n,children:[x.jsx("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:92,columnNumber:7},this),x.jsx("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:93,columnNumber:7},this),x.jsx("g",{id:"SVGRepo_iconCarrier",children:x.jsx("path",{d:"M7.33199 16.3154C6.94146 15.9248 6.3083 15.9248 5.91777 16.3154C5.52725 16.7059 5.52725 17.339 5.91777 17.7296L10.5834 22.3952C11.3644 23.1762 12.6308 23.1762 13.4118 22.3952L18.0802 17.7267C18.4707 17.3362 18.4707 16.703 18.0802 16.3125C17.6897 15.922 17.0565 15.922 16.666 16.3125L13 19.9786V2.0001C13 1.44781 12.5523 1.0001 12 1.0001C11.4477 1.0001 11 1.44781 11 2.0001V19.9833L7.33199 16.3154Z",fill:r},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:99,columnNumber:9},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:98,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Icons/index.tsx",lineNumber:85,columnNumber:5},this)}const ps={CheckON:Qv,CheckOFF:Xv,Pills:Kv,ArrowDown:Jv};function Iv(){var y;const{targetProduct:n,benefitsEnabled:r,setBenefitsEnabled:l}=Kt(),s=ya.transformPrice(Number(n==null?void 0:n.listPrice)),u=ya.transformPrice(Number(n==null?void 0:n.discountValue)||0),f=ya.transformPorcent((n==null?void 0:n.discountPercentual)||"0"),d=s*f/100,m=s-u||s-d;return x.jsx("header",{className:"flex items-start justify-start flex-col gap-4 w-full p-0.5 rounded-xl mt-5",id:"header_pbm",children:[x.jsx("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:"enable_benefits_checkbox",children:[x.jsx("input",{id:"enable_benefits_checkbox",type:"checkbox",name:"option",className:"peer hidden",checked:r,onChange:p=>l(p.target.checked)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:32,columnNumber:9},this),x.jsx("div",{className:"w-5 h-5 border border-(--pbm-primary) rounded-full flex items-center justify-center transition-all duration-300 after:content-[''] after:w-2 after:h-2 after:rounded-full after:bg-(--pbm-primary) after:scale-0 after:transition-transform after:duration-200 peer-checked:after:scale-100"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:42,columnNumber:9},this),x.jsx("p",{className:"font-medium text-(--pbm-primary) select-none text-sm",children:"Desconto de Laboratório"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:43,columnNumber:9},this),x.jsx(ps.Pills,{size:16,color:"var(--pbm-primary)"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:46,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:28,columnNumber:7},this),x.jsx("span",{className:"py-1 rounded-xl shrink-0 text-white text-xl font-bold flex items-center justify-start gap-2 relative","data-testid":"test_id_header_price",id:"header_price",children:x.jsx("section",{className:"flex items-start gap-2 justify-center-safe flex-col",children:[x.jsx("div",{className:"flex items-center-safe justify-start gap-1",children:[x.jsx("span",{className:"line-through text-sm font-light text-zinc-600",children:(y=Number(s))==null?void 0:y.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:56,columnNumber:13},this),x.jsx(ps.ArrowDown,{size:14,color:"var(--pbm-primary)"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:65,columnNumber:13},this),x.jsx("span",{className:"font-semibold text-sm text-(--pbm-primary)",children:[f.toFixed(2),"%"]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:67,columnNumber:13},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:55,columnNumber:11},this),x.jsx("span",{className:"text-lg text-zinc-700 font-bold",children:m==null?void 0:m.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:72,columnNumber:11},this),(n==null?void 0:n.informativeMessage)&&x.jsx("span",{className:"text-xs text-zinc-600 font-medium",children:n==null?void 0:n.informativeMessage},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:82,columnNumber:13},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:54,columnNumber:9},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:49,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Header/index.tsx",lineNumber:24,columnNumber:5},this)}function Pv({textColor:n}){return x.jsx("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[x.jsx("div",{"data-testid":"test_id_spin",className:"w-8 h-8 border-4 shrink-0 border-gray-300 rounded-full animate-spin",style:{borderTopColor:"var(--pbm-secondary)"},id:"loading_spin"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Loading/index.tsx",lineNumber:8,columnNumber:7},this),x.jsx("p",{className:"text-sm font-semibold text-start",style:{color:n||"var(--pbm-text)"},id:"loading_label",children:"Um momento... estamos verificando seus dados."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Loading/index.tsx",lineNumber:14,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Loading/index.tsx",lineNumber:7,columnNumber:5},this)}function Lu({children:n,variant:r}){const{benefitsEnabled:l}=Kt();return x.jsx("main",{className:ot({"border-3 border-(--pbm-border) overflow-hidden flex flex-col items-center justify-center min-w-(--min-container) max-w-(--max-container) w-full h-auto rounded-xl p-4 bg-white gap-4 relative":r==="main","w-full relative":r==="simple","h-0 overflow-hidden":!l&&r==="simple"}),"data-testid":"test_id_container","data-variant":r,id:"container_pbm",children:n},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Container/index.tsx",lineNumber:15,columnNumber:5},this)}function Hr(n){return x.jsx("h2",{className:ot("text-start font-semibold text-sm",n.className),style:{color:n.textColor||"var(--pbm-text)",fontSize:n.textSize,textAlign:n.textAlign},"data-testid":"test_id_title",id:"title_pbm",children:n.children},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Title/index.tsx",lineNumber:13,columnNumber:5},this)}function Wv({data:n,onChange:r,checked:l}){console.log("PBMLOG Item data:",JSON.stringify(n,null,2));const{setAvailableDiscountSelected:s,state:u,isAuthenticatedShopper:f}=Kt(),{setModal:d}=rr(),m=n.id+"_"+n.authorizedQuantity,y=ya.transformPrice(Number(n==null?void 0:n.grossPrice)||Number(n==null?void 0:n.listPrice)||0),p=ya.transformPrice(Number(n==null?void 0:n.discountValue)||0),S=ya.transformPorcent((n==null?void 0:n.discountPercentual)||"0"),v=p*Number(n.authorizedQuantity),E=y*Number(n.authorizedQuantity),N=E*S/100,B=E-v||E-N,w=pe.useCallback(()=>{if(l){const P=K=>Math.round(K*100)/100;s({discount:{total:P(v),unit:P(p)},quantity:Number(n.authorizedQuantity),totalPrice:P(B),grossPrice:n.grossPrice})}},[l,n.authorizedQuantity,n.grossPrice,s,v,p,B]);pe.useEffect(()=>{w()},[w]);const q=()=>{if(!f&&u==="isActivated"){d({id:"ShopperIsNotAuthenticated",open:!0});return}r()};return x.jsx("label",{htmlFor:m,className:ot("label_benefits w-full flex items-center justify-start bg-zinc-300/60 border border-zinc-400/50 px-4 py-2 transition-colors rounded-lg gap-1",{"cursor-not-allowed":u==="isPreview","cursor-pointer":u==="isActivated"}),style:{borderColor:l?"var(--pbm-primary)":void 0,backgroundColor:l?"color-mix(in srgb, var(--pbm-primary), transparent 90%)":void 0},id:"label_benefits_"+m,children:[x.jsx("input",{type:"radio",name:"benefits_discount",id:m,className:"hidden",checked:l,onChange:q,disabled:u==="isPreview"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:107,columnNumber:7},this),x.jsx("span",{style:{color:"var(--pbm-primary)"},children:l?x.jsx(ps.CheckON,{size:20},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:118,columnNumber:52},this):x.jsx(ps.CheckOFF,{size:20},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:118,columnNumber:21},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:117,columnNumber:7},this),x.jsx("span",{className:"font-semibold text-sm",style:{color:"var(--pbm-text)"},children:[n.authorizedQuantity,"un"]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:121,columnNumber:7},this),x.jsx("section",{className:"ml-auto relative gap-2 flex items-center-safe justify-end-safe",children:[x.jsx("span",{className:"text-white -top-4 py-0.5 font-semibold text-xs px-2 w-auto text-nowrap rounded-2xl -right-3",style:{backgroundColor:"var(--pbm-primary)"},children:[v.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})," ","OFF"]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:129,columnNumber:9},this),x.jsx("strong",{className:"font-semibold text-sm text-center",style:{color:"var(--pbm-text)"},children:B.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:141,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:128,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/Item.tsx",lineNumber:90,columnNumber:5},this)}const e1="N000";function t1(){var y;const{setState:n,state:r,customLoginUrl:l,isAuthenticatedShopper:s,benefitsList:u}=Kt(),[f,d]=pe.useState(null),[m]=pe.useState(u);return m!=null&&m.length&&((y=m[0])==null?void 0:y.returnCode)!==e1&&r==="isActivated"?x.jsx("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:x.jsx("p",{className:"text-sm font-semibold text-start",style:{color:"var(--pbm-text)"},id:"benefits_error_handle",children:m[0].informativeText},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:31,columnNumber:9},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:30,columnNumber:7},this):x.jsx("section",{className:"flex items-start justify-center gap-4 w-full h-auto flex-col",id:"benefits_table_pbm",children:[x.jsx(Hr,{children:"Descontos disponíveis:"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:47,columnNumber:7},this),x.jsx("form",{className:"flex flex-col items-center justify-start w-full gap-4.5",id:"form_benefits_table_pbm",onSubmit:p=>p.preventDefault(),children:[!m&&x.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",id:"benefits_empty_pbm",children:"Não foi possível encontrar benefícios para esse produto."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:55,columnNumber:11},this),m&&m.map(p=>{const S=p.id+"_"+p.authorizedQuantity;return x.jsx(Wv,{data:p,checked:f===S,onChange:()=>d(S)},S,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:68,columnNumber:15},this)})]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:49,columnNumber:7},this),r==="isPreview"&&x.jsx(Wa,{onClick:()=>n("isEmpty"),className:"bg-transparent p-0 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",id:"unauthorized_benefits_button",children:["Atenção: Não é possível utilizar os benefícos sem realizar a consulta do CPF e o Login, por favor"," ",x.jsx("span",{className:"underline",children:"insira seu cpf para utilizar os benefícios"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:86,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:79,columnNumber:9},this),r==="isActivated"&&x.jsx(x.Fragment,{children:[!s&&x.jsx(Wa,{type:"button",onClick:()=>window.location.assign(l||"/login"),className:"bg-transparent p-0 pl-2 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",id:"login",children:x.jsx("span",{className:"underline",children:"Por favor, faça o Login para aproveitar os benefícios!"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:101,columnNumber:15},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:95,columnNumber:13},this),x.jsx(Wa,{onClick:()=>n("isEmpty"),className:"bg-transparent p-0 pl-2 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",id:"change_security_number",children:x.jsx("span",{className:"underline",children:"Deseja editar o cpf digitado?"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:112,columnNumber:13},this)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:107,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:93,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/BenefitsTable/index.tsx",lineNumber:43,columnNumber:5},this)}function gs(n){return x.jsx("p",{className:ot("font-normal text-sm",n.textAlign&&`text-${n.textAlign}`,n.className),style:{color:n.textColor||"var(--pbm-text)",fontSize:n.textSize,textAlign:n.textAlign},"data-testid":"test_id_text",id:"text_pbm",children:n.children},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Text/index.tsx",lineNumber:13,columnNumber:5},this)}function a1({textColor:n}){const{urlAcceptTerms:r}=Kt(),{setModal:l}=rr(),s=()=>{r&&l({open:!0,id:"iframe_pbm",label:"Aceitar os termos",url:r})};return x.jsx("section",{"data-testid":"test_id_invalid",className:"flex items-end justify-center gap-2 w-full h-auto flex-col border-y py-6",style:{borderColor:"color-mix(in srgb, var(--pbm-text), transparent 80%)"},id:"security_number_invalid_container_pbm",children:[x.jsx(Hr,{className:"w-full",textColor:n,children:"CPF não cadastrado."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:25,columnNumber:7},this),x.jsx(gs,{className:"w-full",textColor:n,children:["Conclua seu cadastro para habilitar o benefício. ",x.jsx("br",{},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:29,columnNumber:58},this),"Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar."]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:28,columnNumber:7},this),x.jsx(Wa,{onClick:()=>s(),style:{backgroundColor:"var(--pbm-primary)"},children:"Aceitar os termos"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:33,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberInvalid/index.tsx",lineNumber:19,columnNumber:5},this)}function n1({textColor:n}){const{urlRegisterIndustry:r}=Kt(),{setModal:l}=rr(),s=()=>{r&&l({open:!0,id:"iframe_pbm",label:"Ativar CPF",url:r})};return x.jsx("section",{"data-testid":"test_id_registered",className:"flex items-end justify-center gap-2 w-full h-auto flex-col border-y py-6",style:{borderColor:"color-mix(in srgb, var(--pbm-text), transparent 80%)"},id:"security_number_registered_container_pbm",children:[x.jsx(Hr,{className:"w-full",textColor:n,children:"Ops, seu CPF ainda não está habilitado para este produto."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberRegitered/index.tsx",lineNumber:25,columnNumber:7},this),x.jsx(gs,{className:"w-full",textColor:n,children:"Para ativar o benefício, clique em “Ativar CPF” e conclua a etapa na página externa. Depois, é só voltar para continuar — vamos aguardar você aqui."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberRegitered/index.tsx",lineNumber:28,columnNumber:7},this),x.jsx(Wa,{onClick:()=>s(),style:{backgroundColor:"var(--pbm-primary)"},children:"Ativar CPF"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberRegitered/index.tsx",lineNumber:31,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/SecurityNumberRegitered/index.tsx",lineNumber:19,columnNumber:5},this)}const Km={ErrorMessage:"Erro ao aplicar o benefício"},Jm=Cu(n=>({...Km,setErrorMessage:r=>n({ErrorMessage:r}),resetErrorMessage:()=>n({ErrorMessage:Km.ErrorMessage})})),Im=()=>{const{ErrorMessage:n}=Jm(),{setState:r}=Kt();return x.jsx(Lu,{variant:"main",children:[x.jsx(Hr,{children:"Erro ao Aplicar o Benefício"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:15,columnNumber:13},void 0),x.jsx(gs,{textAlign:"center",children:n},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:16,columnNumber:13},void 0),x.jsx(Wa,{className:"bg-transparent p-0 pl-2 w-auto h-auto underline cursor-pointer hover:bg-transparent flex items-center justify-start gap-1",style:{color:"var(--pbm-text)"},onMouseOver:l=>l.currentTarget.style.filter="brightness(0.8)",onMouseOut:l=>l.currentTarget.style.filter="none",onClick:()=>r("isEmpty"),id:"check_benefits_button",children:[x.jsx("span",{children:"Tentar novamente"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:25,columnNumber:17},void 0),x.jsx(Uv,{size:16},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:26,columnNumber:17},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:17,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Errors/ErrorToApplyBenefits.tsx",lineNumber:14,columnNumber:9},void 0)},Pm={personalData:{name:"",phone:"",birthday:"",email:""},address:{postalcode:"",number:"",complement:"",street:"",neighborhood:"",city:"",uf:"",stateAddress:""},genderResponsibility:{gender:"",patient:null},doctor:{typeCredential:"CRM",register:"",state:"",doctorName:""},acceptances:{acceptPhone:!1,acceptsSms:!1,acceptsEmail:!1,acceptsMail:!1,acceptsPrivacyTermsLGPD:!1},step:0},lr=Cu(n=>({...Pm,setPersonalData:r=>n(l=>({personalData:{...l.personalData,...r}})),setAddress:r=>n(l=>({address:{...l.address,...r}})),setGenderResponsibility:r=>n(l=>({genderResponsibility:{...l.genderResponsibility,...r}})),setDoctor:r=>n(l=>({doctor:{...l.doctor,...r}})),setAcceptances:r=>n(l=>({acceptances:{...l.acceptances,...r}})),setStep:r=>n({step:r}),resetForm:()=>n(Pm)})),Gt=({label:n,error:r,children:l})=>x.jsx("div",{className:"flex flex-col gap-1",children:[x.jsx("label",{className:"text-xs font-medium text-zinc-500 uppercase tracking-wide",children:n},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/FieldWrapper.tsx",lineNumber:11,columnNumber:5},void 0),l,r&&x.jsx("span",{className:"text-xs text-red-500 mt-0.5",children:r},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/FieldWrapper.tsx",lineNumber:15,columnNumber:15},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/FieldWrapper.tsx",lineNumber:10,columnNumber:3},void 0),Xi="w-full rounded-lg border border-gray-200 bg-gray-100 px-3 py-2.5 text-sm text-gray-400 cursor-not-allowed",ja=n=>ot("w-full rounded-lg border px-3 py-2.5 text-sm text-gray-800 outline-none transition-all","focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500",n?"border-red-400 bg-red-50":"border-gray-200 bg-gray-50 hover:border-gray-300"),Ki=({onNext:n,onBack:r,loading:l,nextLabel:s="Continuar",isLast:u=!1})=>x.jsx("div",{className:"flex gap-2 mt-2 pt-4 border-t border-gray-100",children:[r&&x.jsx("button",{type:"button",onClick:r,className:"flex-1 rounded-lg border border-gray-200 py-2.5 text-sm font-medium text-zinc-600 hover:bg-zinc-600/10 transition-all cursor-pointer",children:"Voltar"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:18,columnNumber:7},void 0),x.jsx("button",{type:"button",onClick:n,disabled:l,className:ot("flex-2 rounded-lg py-2.5 text-sm font-semibold text-white transition-all cursor-pointer",u?"bg-emerald-600 hover:bg-emerald-500":"bg-(--pbm-primary) hover:bg-(--pbm-primary)/60",l&&"opacity-60 cursor-not-allowed"),children:l?x.jsx("span",{className:"flex items-center justify-center gap-2",children:[x.jsx("svg",{className:"h-4 w-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[x.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:41,columnNumber:13},void 0),x.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:49,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:40,columnNumber:11},void 0),"Enviando..."]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:39,columnNumber:9},void 0):s},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:26,columnNumber:5},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepActions.tsx",lineNumber:16,columnNumber:3},void 0),ys={PersonalData:0,Address:1,GenderResponsibility:2,Doctor:3,Acceptances:4},r1=({securityNumber:n,onNext:r})=>{const{personalData:l,setPersonalData:s,setStep:u}=lr(),{setModal:f}=rr(),[d,m]=pe.useState({}),[y,p]=pe.useState(!1),S=()=>{const E={};return(!l.name.trim()||l.name.trim().split(" ").length<2)&&(E.name="Informe o nome completo."),/^\(\d{2}\) \d{5}-\d{4}$/.test(l.phone)||(E.phone="Telefone inválido."),l.birthday||(E.birthday="Data de nascimento obrigatória."),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l.email)||(E.email="E-mail inválido."),m(E),Object.keys(E).length===0},v=async()=>{if(S()){p(!0);try{u(ys.Address),r()}catch{console.error("An error occurred while setting personal data form.")}finally{p(!1)}}};return x.jsx("div",{className:"flex flex-col gap-4",children:[x.jsx(Gt,{label:"CPF",children:[x.jsx("input",{className:Xi,value:ya.cpf(n),disabled:!0,readOnly:!0},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:58,columnNumber:9},void 0),x.jsx("p",{className:"text-xs text-gray-400 mt-1",children:x.jsx("button",{type:"button",className:"text-(--pbm-primary) hover:text-(--pbm-primary)/60 cursor-pointer underline underline-offset-2 transition-colors",onClick:()=>f({id:"",open:!1}),children:"Deseja alterar o CPF? Clique aqui."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:65,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:64,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:57,columnNumber:7},void 0),x.jsx(Gt,{label:"Nome completo",error:d.name,children:x.jsx("input",{className:ja(d.name),placeholder:"Ex: João da Silva",value:l.name,onChange:E=>{s({name:E.target.value}),m(N=>({...N,name:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:76,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:75,columnNumber:7},void 0),x.jsx("div",{className:"grid grid-cols-2 gap-3",children:[x.jsx(Gt,{label:"Telefone",error:d.phone,children:x.jsx("input",{className:ja(d.phone),placeholder:"(11) 99999-8888",value:l.phone,onChange:E=>{s({phone:ya.phone(E.target.value)}),m(N=>({...N,phone:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:89,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:88,columnNumber:9},void 0),x.jsx(Gt,{label:"Data de nascimento",error:d.birthday,children:x.jsx("input",{type:"date",className:ja(d.birthday),value:l.birthday,onChange:E=>{s({birthday:E.target.value}),m(N=>({...N,birthday:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:101,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:100,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:87,columnNumber:7},void 0),x.jsx(Gt,{label:"E-mail",error:d.email,children:x.jsx("input",{type:"email",className:ja(d.email),placeholder:"joao@email.com",value:l.email,onChange:E=>{s({email:E.target.value}),m(N=>({...N,email:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:114,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:113,columnNumber:7},void 0),x.jsx(Ki,{onNext:v,loading:y},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:126,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepPersonalDataForm.tsx",lineNumber:56,columnNumber:5},void 0)};async function i1({postal_code:n}){const r=await fetch(`${ir("VITE_CORREIOS_API_URL")}/${n}/json/`);if(!r.ok)throw new Error("Erro ao consultar CEP");return{...await r.json(),success:!0}}const l1=({onNext:n,onBack:r})=>{const{address:l,setAddress:s,setStep:u}=lr(),[f,d]=pe.useState({}),[m,y]=pe.useState(!1),[p,S]=pe.useState(!1),v=pe.useCallback(async B=>{const w=B.replace(/\D/g,"");if(w.length===8){y(!0);try{const q=await i1({postal_code:w});if(!q.success){console.error("Failed to lookup postal code");return}s({street:q.logradouro,neighborhood:q.bairro,uf:q.uf,city:q.localidade,stateAddress:q.estado,postalcode:q.cep,complement:q.complemento||""})}catch{console.error("Failed to fetch address for CEP:",B)}finally{y(!1)}}},[s]),E=()=>{const B={};return/^\d{5}-\d{3}$/.test(l.postalcode)||(B.postalcode="CEP inválido."),l.number.trim()||(B.number="Número obrigatório."),d(B),Object.keys(B).length===0},N=async()=>{if(E()){S(!0);try{u(ys.GenderResponsibility),n()}catch{console.log("An error occurred while submitting address form.")}finally{S(!1)}}};return x.jsx("div",{className:"flex flex-col gap-4",children:[x.jsx(Gt,{label:"CEP",error:f.postalcode,children:x.jsx("div",{className:"relative",children:[x.jsx("input",{className:ja(f.postalcode),placeholder:"00000-000",value:l.postalcode,onChange:B=>{const w=ya.cep(B.target.value);s({postalcode:w}),d(q=>({...q,postalcode:void 0})),w.replace(/\D/g,"").length===8&&v(w)}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:87,columnNumber:11},void 0),m&&x.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:x.jsx("svg",{className:"h-4 w-4 animate-spin text-blue-500",viewBox:"0 0 24 24",fill:"none",children:[x.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:109,columnNumber:17},void 0),x.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:117,columnNumber:17},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:104,columnNumber:15},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:103,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:86,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:85,columnNumber:7},void 0),x.jsx("div",{className:"grid grid-cols-2 gap-3",children:[x.jsx(Gt,{label:"Rua",children:x.jsx("input",{className:Xi,value:l.street||"",disabled:!0,readOnly:!0,placeholder:"Preenchido pelo CEP"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:130,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:129,columnNumber:9},void 0),x.jsx(Gt,{label:"Bairro",children:x.jsx("input",{className:Xi,value:l.neighborhood||"",disabled:!0,readOnly:!0,placeholder:"Preenchido pelo CEP"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:139,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:138,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:128,columnNumber:7},void 0),x.jsx("div",{className:"grid grid-cols-2 gap-3",children:[x.jsx(Gt,{label:"Cidade",children:x.jsx("input",{className:Xi,value:l.city||"",disabled:!0,readOnly:!0,placeholder:"Preenchido pelo CEP"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:151,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:150,columnNumber:9},void 0),x.jsx(Gt,{label:"Estado",children:x.jsx("input",{className:Xi,value:l.stateAddress||"",disabled:!0,readOnly:!0,placeholder:"UF"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:160,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:159,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:149,columnNumber:7},void 0),x.jsx("div",{className:"grid grid-cols-2 gap-3",children:[x.jsx(Gt,{label:"Número",error:f.number,children:x.jsx("input",{className:ja(f.number),placeholder:"Ex: 100",value:l.number,onChange:B=>{s({number:B.target.value}),d(w=>({...w,number:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:172,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:171,columnNumber:9},void 0),x.jsx(Gt,{label:"Complemento",children:x.jsx("input",{className:ja(),placeholder:"Apto, bloco...",value:l.complement,onChange:B=>s({complement:B.target.value})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:183,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:182,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:170,columnNumber:7},void 0),x.jsx(Ki,{onNext:N,onBack:r,loading:p},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:192,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAddressForm.tsx",lineNumber:84,columnNumber:5},void 0)},s1=({onNext:n,onBack:r})=>{const{genderResponsibility:l,setGenderResponsibility:s,setStep:u}=lr(),[f,d]=pe.useState({}),[m,y]=pe.useState(!1),p=()=>{const E={};return l.gender||(E.gender="Selecione o gênero."),l.patient===null&&(E.patient="Informe se é o paciente."),d(E),Object.keys(E).length===0},S=async()=>{if(p()){y(!0);try{u(ys.Doctor),n()}catch{console.error("An error occurred while submitting gender responsibility data.")}finally{y(!1)}}},v=[{value:"M",label:"Masculino"},{value:"F",label:"Feminino"},{value:"O",label:"Outro"}];return x.jsx("div",{className:"flex flex-col gap-5",children:[x.jsx("div",{children:[x.jsx("label",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide block mb-2",children:"Gênero"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:56,columnNumber:9},void 0),x.jsx("div",{className:"flex gap-2",children:v.map(E=>x.jsx("button",{type:"button",onClick:()=>{s({gender:E.value}),d(N=>({...N,gender:void 0}))},className:ot("flex-1 py-2.5 cursor-pointer px-2.5 rounded-lg border text-sm font-medium transition-all",l.gender===E.value?"border-(--pbm-primary) bg-(--pbm-primary) text-white":"border-gray-200 bg-gray-50 text-gray-600 hover:border-(--pbm-primary)"),children:E.label},E.value,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:61,columnNumber:13},void 0))},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:59,columnNumber:9},void 0),f.gender&&x.jsx("span",{className:"text-xs text-red-500 mt-1 block",children:f.gender},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:80,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:55,columnNumber:7},void 0),x.jsx("div",{children:[x.jsx("label",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide block mb-2",children:"Você é o paciente?"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:87,columnNumber:9},void 0),x.jsx("div",{className:"flex gap-2",children:[{label:"Sim, sou o paciente",value:!0},{label:"Não, sou responsável",value:!1}].map(E=>x.jsx("button",{type:"button",onClick:()=>{s({patient:E.value}),d(N=>({...N,patient:void 0}))},className:ot("flex-1 py-2.5 px-2.5 text-nowrap cursor-pointer rounded-lg border text-sm font-medium transition-all",l.patient===E.value?"border-(--pbm-primary) bg-(--pbm-primary) text-white":"border-gray-200 bg-gray-50 text-gray-600 hover:border-(--pbm-primary)"),children:E.label},String(E.value),!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:95,columnNumber:13},void 0))},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:90,columnNumber:9},void 0),f.patient&&x.jsx("span",{className:"text-xs text-red-500 mt-1 block",children:f.patient},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:114,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:86,columnNumber:7},void 0),x.jsx(Ki,{onNext:S,onBack:r,loading:m},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:120,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepGenderForm.tsx",lineNumber:54,columnNumber:5},void 0)},o1=["AC","AL","AP","AM","BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SC","SP","SE","TO"],u1=({onNext:n,onBack:r})=>{const{doctor:l,setDoctor:s,setStep:u}=lr(),[f,d]=pe.useState({}),[m,y]=pe.useState(!1),p=()=>{const v={};return l.typeCredential||(v.typeCredential="Tipo de credencial obrigatório."),l.register.trim()||(v.register="Número do registro obrigatório."),l.state||(v.state="Estado obrigatório."),l.doctorName.trim()||(v.doctorName="Nome do médico obrigatório."),d(v),Object.keys(v).length===0},S=async()=>{if(p()){y(!0);try{u(ys.Acceptances),n()}catch{console.error("An error occurred while submitting doctor data.")}finally{y(!1)}}};return x.jsx("div",{className:"flex flex-col gap-4",children:[x.jsx("div",{className:"grid grid-cols-3 gap-3",children:[x.jsx(Gt,{label:"Tipo credencial",error:f.typeCredential,children:x.jsx("select",{className:ja(f.typeCredential),value:l.typeCredential,onChange:v=>{s({typeCredential:v.target.value}),d(E=>({...E,typeCredential:void 0}))},children:[x.jsx("option",{value:"CRM",children:"CRM"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:63,columnNumber:13},void 0),x.jsx("option",{value:"CRO",children:"CRO"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:64,columnNumber:13},void 0),x.jsx("option",{value:"CRF",children:"CRF"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:65,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:52,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:51,columnNumber:9},void 0),x.jsx(Gt,{label:"Estado (UF)",error:f.state,children:x.jsx("select",{className:ja(f.state),value:l.state,onChange:v=>{s({state:v.target.value}),d(E=>({...E,state:void 0}))},children:[x.jsx("option",{value:"",children:"UF"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:78,columnNumber:13},void 0),o1.map(v=>x.jsx("option",{value:v,children:v},v,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:80,columnNumber:15},void 0))]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:70,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:69,columnNumber:9},void 0),x.jsx(Gt,{label:"Nº registro",error:f.register,children:x.jsx("div",{className:"relative",children:x.jsx("input",{className:ja(f.register),placeholder:"Ex: 123456",value:l.register,onChange:v=>{s({register:v.target.value.replace(/\D/g,"")}),d(E=>({...E,register:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:89,columnNumber:13},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:88,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:87,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:50,columnNumber:7},void 0),x.jsx(Gt,{label:"Nome do médico",error:f.doctorName,children:[x.jsx("div",{className:"relative",children:x.jsx("input",{className:ja(f.doctorName),placeholder:"Nome Completo do Profissional",value:l.doctorName,onChange:v=>{s({doctorName:v.target.value}),d(E=>({...E,doctorName:void 0}))}},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:107,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:106,columnNumber:9},void 0),x.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Preenchido automaticamente ao informar registro + UF."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:120,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:105,columnNumber:7},void 0),x.jsx(Ki,{onNext:S,onBack:r,loading:m},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:125,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepDoctorForm.tsx",lineNumber:49,columnNumber:5},void 0)},Ji=({label:n,checked:r,onChange:l,required:s,error:u})=>x.jsx("label",{className:ot("flex items-start gap-3 cursor-pointer group p-3 rounded-lg border transition-all",r?"border-emerald-200 bg-emerald-50/60":"border-zinc-100 hover:border-zinc-200 bg-zinc-50/40",u?"border-red-300 bg-red-50/40":""),children:[x.jsx("div",{className:ot("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-all",r?"border-(--pbm-primary) bg-(--pbm-primary)":"border-zinc-300 bg-white"),children:r&&x.jsx("svg",{className:"h-2.5 w-2.5 text-white",viewBox:"0 0 10 8",fill:"none",children:x.jsx("path",{d:"M1 4l3 3 5-6",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:35,columnNumber:11},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:34,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:25,columnNumber:5},void 0),x.jsx("span",{className:"text-sm text-zinc-700 leading-snug",children:[n,s&&x.jsx("span",{className:"text-red-400 ml-1",children:"*"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:47,columnNumber:20},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:45,columnNumber:5},void 0),x.jsx("input",{type:"checkbox",className:"sr-only",checked:r,onChange:f=>l(f.target.checked)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:49,columnNumber:5},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/CheckRow.tsx",lineNumber:16,columnNumber:3},void 0),c1=async({product:n,consumer:r,healthProfessional:l})=>{const s=rt.get("tenant_id");if(!s)throw new Error(`No configuration found for tenant: ${s}`);if(!r)throw new Error("Consumer information is required");if(!l)throw new Error("Health professional information is required");if(!n)throw new Error("Product information is required");try{const f=await(await fetch(`${ir("VITE_API_URL")}/api/discount.ts`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${rt.get("pbm-token")}`},body:JSON.stringify({tenant_id:s,product:n,table_id:rt.get("current-table-id"),local_hour:rt.get("current-local-hour"),consumer:r,healthProfessional:l})})).json();if(!f.success)throw new Error("PBMLOG: Enable Discount Failed!");return rt.set("current-central-number",f.product[0].centralNumber.toString(),{secure:!0,sameSite:"Strict",expires:1}),rt.set("current-term-code",f.product[0].activationFields.acceptLgpd.termCode.value.toString(),{secure:!0,sameSite:"Strict",expires:1}),f}catch(u){return console.error("Error during enable discount:",u),{success:!1,error:"Authorization failed"}}},f1=async({product:n,consumer:r,healthProfessional:l})=>{const s=rt.get("tenant_id");if(!s)throw new Error(`No configuration found for tenant: ${s}`);if(!r)throw new Error("Consumer information is required");if(!l)throw new Error("Health professional information is required");if(!n)throw new Error("Product information is required");try{const f=await(await fetch(`${ir("VITE_API_URL")}/api/activate.ts`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${rt.get("pbm-token")}`},body:JSON.stringify({tenant_id:s,product:n,table_id:rt.get("current-table-id"),local_hour:rt.get("current-local-hour"),central_number:rt.get("current-central-number"),consumer:r,healthProfessional:l,acceptLgpd:{evidenceType:"SITE",evidence:"VSTOSITE",termCode:rt.get("current-term-code")}})})).json();if(!f.success)throw new Error("PBMLOG: Activate Failed!");return f}catch(u){return console.error("Error during activate:",u),{success:!1,error:"Authorization failed"}}},d1=({onBack:n,onDone:r,securityNumber:l})=>{const{acceptances:s,setAcceptances:u}=lr(),{targetProduct:f,cardID:d}=Kt(),[m,y]=pe.useState({}),[p,S]=pe.useState(!1),v=lr.getState(),E=()=>{const w={};return s.acceptsPrivacyTermsLGPD||(w.lgpd="É obrigatório aceitar os termos de privacidade (LGPD)."),y(w),Object.keys(w).length===0},N=async w=>{try{const q=await f1(w);console.log("Activate response:",q)}catch(q){console.error("Error during consumer activation:",q)}},B=async()=>{if(!E())return;if(S(!0),!f){console.error("No target product found in PBM store."),S(!1);return}const w=v.personalData.phone.replace(/\D/g,""),q=w.slice(0,2),P=w.slice(2),K={consumer:{holderId:l,cardId:d||"",name:v.personalData.name,email:v.personalData.email,birthdate:v.personalData.birthday,genre:v.genderResponsibility.gender,postalCode:v.address.postalcode.replace(/\D/g,""),stateCode:v.address.uf||"",cityName:v.address.city||"",cityRegion:v.address.neighborhood||"",addressType:"casa",streetAddress:v.address.street||"",addressNumber:v.address.number||"",addressAdditionalInformation:v.address.complement||"",DDDcellPhone:q,cellphone:P,acceptInformativeMaterial:s.acceptsMail?"S":"N",acceptMail:s.acceptsMail?"S":"N",acceptEmail:s.acceptsEmail?"S":"N",acceptCalls:s.acceptPhone?"S":"N",acceptSMS:s.acceptsSms?"S":"N",acceptTerm:s.acceptsPrivacyTermsLGPD?"S":"N",acceptWhatsApp:"N"},healthProfessional:{id:v.doctor.register,stateCode:v.doctor.state,type:v.doctor.typeCredential,name:v.doctor.doctorName},product:{id:f.id,ean:f.ean,authorizedQuantity:f.authorizedQuantity,listPrice:f.listPrice,netPrice:f.netPrice}};try{const ae=await c1(K);ae.success?await N(K):console.error("Failed to enable discount:",ae),r()}catch{console.error("An error occurred while submitting acceptances data.")}finally{S(!1)}};return x.jsx("div",{className:"flex flex-col gap-3",children:[x.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"Selecione como deseja receber comunicações:"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:119,columnNumber:7},void 0),x.jsx(Ji,{label:"Aceito receber contato por telefone",checked:s.acceptPhone,onChange:w=>u({acceptPhone:w})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:123,columnNumber:7},void 0),x.jsx(Ji,{label:"Aceito receber SMS",checked:s.acceptsSms,onChange:w=>u({acceptsSms:w})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:128,columnNumber:7},void 0),x.jsx(Ji,{label:"Aceito receber e-mails",checked:s.acceptsEmail,onChange:w=>u({acceptsEmail:w})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:133,columnNumber:7},void 0),x.jsx(Ji,{label:"Aceito receber correspondências por correio",checked:s.acceptsMail,onChange:w=>u({acceptsMail:w})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:138,columnNumber:7},void 0),x.jsx("div",{className:"mt-1",children:[x.jsx(Ji,{label:"Li e aceito os Termos de Privacidade (LGPD)",checked:s.acceptsPrivacyTermsLGPD,onChange:w=>{u({acceptsPrivacyTermsLGPD:w}),y({})},required:!0,error:m.lgpd},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:145,columnNumber:9},void 0),m.lgpd&&x.jsx("span",{className:"text-xs text-red-500 mt-1 block pl-1",children:m.lgpd},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:156,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:144,columnNumber:7},void 0),x.jsx(Ki,{onNext:B,onBack:n,loading:p,nextLabel:"Concluir cadastro",isLast:!0},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:162,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/StepAcceptancesForm.tsx",lineNumber:118,columnNumber:5},void 0)},Wm=["Dados Pessoais","Endereço","Perfil","Médico","Aceites"],m1=({current:n})=>x.jsx("div",{className:"flex items-center w-full justify-center mb-6",children:Wm.map((r,l)=>{const s=l<n,u=l===n;return x.jsx("div",{className:"flex items-center w-full min-w-0 justify-center relative",children:[x.jsx("div",{className:"flex flex-col items-center justify-center gap-1 shrink-0 z-10",children:[x.jsx("div",{className:ot("flex h-7 w-7 items-center justify-center rounded-full text-xs font-semibold transition-all",s?"bg-emerald-600 text-white":u?"bg-(--pbm-primary) text-white ring-4 ring-(--pbm-primary)/15":"bg-zinc-100 text-zinc-400"),children:s?x.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 12 10",fill:"none",children:x.jsx("path",{d:"M1 5l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:34,columnNumber:19},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:33,columnNumber:17},void 0):l+1},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:22,columnNumber:13},void 0),x.jsx("span",{className:ot("text-[10px] font-medium whitespace-nowrap hidden sm:block",u?"text-(--pbm-primary)":s?"text-emerald-600":"text-zinc-400"),children:r},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:46,columnNumber:13},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:21,columnNumber:11},void 0),l<Wm.length-1&&x.jsx("div",{className:ot("h-0.5 w-full rounded transition-all absolute top-3.5 left-10","bg-zinc-200")},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:60,columnNumber:13},void 0)]},l,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:17,columnNumber:9},void 0)})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/StepProgress.tsx",lineNumber:12,columnNumber:3},void 0),h1=({onClose:n})=>x.jsx("div",{className:"flex flex-col items-center gap-4 py-4 text-center",children:[x.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-green-100",children:x.jsx("svg",{className:"h-8 w-8 text-green-500",viewBox:"0 0 24 24",fill:"none",children:x.jsx("path",{d:"M5 13l4 4L19 7",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:5,columnNumber:9},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:4,columnNumber:7},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:3,columnNumber:5},void 0),x.jsx("div",{children:[x.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"Cadastro concluído!"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:15,columnNumber:7},void 0),x.jsx("p",{className:"text-sm text-zinc-500 mt-1",children:"Você já pode aproveitar os benefícios de farmácia."},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:18,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:14,columnNumber:5},void 0),x.jsx("button",{onClick:n,className:"cursor-pointer mt-2 rounded-lg bg-(--primary-color) px-6 py-2.5 text-sm font-semibold text-white hover:bg-(--primary-color)/80 transition-all",children:"Fechar"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:22,columnNumber:5},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/Shared/SuccessScreen.tsx",lineNumber:2,columnNumber:3},void 0),p1=({ID:n})=>{const{modal:r,setModal:l}=rr(),{securityNumber:s}=Kt(),{resetForm:u,step:f,setStep:d}=lr(),[m,y]=pe.useState(!1),p=()=>{l({id:"",open:!1}),setTimeout(()=>{d(0),y(!1),u()},300)},S=()=>d(f+1),v=()=>d(f-1),E=s.replace(/\D/g,""),N=[x.jsx(r1,{securityNumber:E,onNext:S},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:36,columnNumber:5},void 0),x.jsx(l1,{securityNumber:E,onNext:S,onBack:v},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:37,columnNumber:5},void 0),x.jsx(s1,{securityNumber:E,onNext:S,onBack:v},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:42,columnNumber:5},void 0),x.jsx(u1,{securityNumber:E,onNext:S,onBack:v},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:47,columnNumber:5},void 0),x.jsx(d1,{securityNumber:E,onBack:v,onDone:()=>y(!0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:52,columnNumber:5},void 0)];return x.jsx("main",{className:ot("fixed inset-0 flex items-center justify-end z-50 flex-col transition-all shadow bg-black/40",{"opacity-100 pointer-events-auto":r.id===n&&r.open,"opacity-0 pointer-events-none":r.id!==n||!r.open}),children:[x.jsx("div",{className:"absolute inset-0",onClick:p},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:69,columnNumber:7},void 0),x.jsx("section",{className:"z-10 bg-white flex flex-col p-6 rounded-2xl w-full max-w-125 min-w-125 mx-4 shadow-xl max-h-[90vh] overflow-y-auto",children:[x.jsx("div",{className:"flex items-center justify-between mb-4",children:[x.jsx(Hr,{textSize:"18px",textAlign:"start",children:m?"Tudo pronto!":"Benefício de Farmácia"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:73,columnNumber:11},void 0),x.jsx("button",{onClick:p,className:"flex h-7 w-7 cursor-pointer items-center justify-center rounded-full text-gray-400 hover:bg-gray-100 hover:text-gray-600 transition-all",children:x.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 14 14",fill:"none",children:x.jsx("path",{d:"M1 1l12 12M13 1L1 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:81,columnNumber:15},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:80,columnNumber:13},void 0)},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:76,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:72,columnNumber:9},void 0),!m&&x.jsx(m1,{current:f},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:91,columnNumber:19},void 0),m?x.jsx(h1,{onClose:p},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:93,columnNumber:17},void 0):N[f]]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:71,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/CustomerNotRegistered/index.tsx",lineNumber:60,columnNumber:5},void 0)},g1=n=>n===void 0?"":"?"+Object.keys(n).map(r=>r+"="+n[r]).join("&");function y1(n){const{setState:r}=Kt();return x.jsx("a",{...n,target:n.target||"_self",href:typeof n.href=="string"?n.href:n.href.pathname+g1(n.href.param),className:ot("w-3xs cursor-pointer h-10 rounded-lg text-white text-sm font-semibold transition-colors flex items-center justify-center",n.className),style:{backgroundColor:"var(--pbm-primary)"},onMouseOver:l=>l.currentTarget.style.backgroundColor="var(--pbm-secondary)",onMouseOut:l=>l.currentTarget.style.backgroundColor="var(--pbm-primary)","data-testid":"test_id_link",id:"link_pbm",onClick:()=>r("isEmpty"),children:n.children},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/UI/Link/index.tsx",lineNumber:18,columnNumber:5},this)}const b1=({ID:n})=>{const{customLoginUrl:r}=Kt(),{modal:l,setModal:s}=rr();return x.jsx("main",{className:ot("fixed inset-0 flex items-center justify-center z-50 flex-col transition-all shadow bg-black/40",{"opacity-100 pointer-events-auto":l.id===n&&l.open,"opacity-0 pointer-events-none":l.id!=n||!l.open}),children:[x.jsx("div",{className:"absolute inset-0",onClick:()=>s({id:"",open:!1})},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:23,columnNumber:7},void 0),x.jsx("section",{className:"z-10 bg-white gap-2 flex-col items-center-safe justify-center-safe p-8 rounded-xl",children:[x.jsx(Hr,{textColor:"tomato",textSize:"18px",textAlign:"center",className:"mb-2",children:"Opa! Parece que você não está Logado"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:28,columnNumber:9},void 0),x.jsx(gs,{className:"mb-2",textAlign:"center",children:["Para aproveitar os benefícios é necessário realizar o"," ",x.jsx("strong",{children:"Login"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:38,columnNumber:11},void 0)," ou ",x.jsx("strong",{children:"Cadastro"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:38,columnNumber:37},void 0)," no site!"]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:36,columnNumber:9},void 0),x.jsx("section",{className:"flex items-center-safe justify-center-safe gap-4",children:[x.jsx(Wa,{className:"bg-gray-600 hover:bg-gray-500",onClick:()=>s({id:"",open:!1}),children:"Seguir sem Benefícios"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:41,columnNumber:11},void 0),x.jsx(y1,{href:r||"/login",children:"Aproveitar Benefícios"},void 0,!1,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:47,columnNumber:11},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:40,columnNumber:9},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:27,columnNumber:7},void 0)]},void 0,!0,{fileName:"C:/Dev/agrada/library-pbm/src/components/Modals/ShopperIsNotAuthenticated.tsx",lineNumber:14,columnNumber:5},void 0)};function eh(n){var r,l,s="";if(typeof n=="string"||typeof n=="number")s+=n;else if(typeof n=="object")if(Array.isArray(n)){var u=n.length;for(r=0;r<u;r++)n[r]&&(l=eh(n[r]))&&(s&&(s+=" "),s+=l)}else for(l in n)n[l]&&(s&&(s+=" "),s+=l);return s}function th(){for(var n,r,l=0,s="",u=arguments.length;l<u;l++)(n=arguments[l])&&(r=eh(n))&&(s&&(s+=" "),s+=r);return s}function v1(n,r,l=void 0){const s={};for(const u in n){const f=n[u];let d="",m=!0;for(let y=0;y<f.length;y+=1){const p=f[y];p&&(d+=(m===!0?"":" ")+r(p),m=!1,l&&l[p]&&(d+=" "+l[p]))}s[u]=d}return s}function sr(n,...r){const l=new URL(`https://mui.com/production-error/?code=${n}`);return r.forEach(s=>l.searchParams.append("args[]",s)),`Minified MUI error #${n}; visit ${l} for the full message.`}const x1="$$material";function Vu(){return Vu=Object.assign?Object.assign.bind():function(n){for(var r=1;r<arguments.length;r++){var l=arguments[r];for(var s in l)({}).hasOwnProperty.call(l,s)&&(n[s]=l[s])}return n},Vu.apply(null,arguments)}function S1(n){if(n.sheet)return n.sheet;for(var r=0;r<document.styleSheets.length;r++)if(document.styleSheets[r].ownerNode===n)return document.styleSheets[r]}function N1(n){var r=document.createElement("style");return r.setAttribute("data-emotion",n.key),n.nonce!==void 0&&r.setAttribute("nonce",n.nonce),r.appendChild(document.createTextNode("")),r.setAttribute("data-s",""),r}var _1=(function(){function n(l){var s=this;this._insertTag=function(u){var f;s.tags.length===0?s.insertionPoint?f=s.insertionPoint.nextSibling:s.prepend?f=s.container.firstChild:f=s.before:f=s.tags[s.tags.length-1].nextSibling,s.container.insertBefore(u,f),s.tags.push(u)},this.isSpeedy=l.speedy===void 0?!1:l.speedy,this.tags=[],this.ctr=0,this.nonce=l.nonce,this.key=l.key,this.container=l.container,this.prepend=l.prepend,this.insertionPoint=l.insertionPoint,this.before=null}var r=n.prototype;return r.hydrate=function(s){s.forEach(this._insertTag)},r.insert=function(s){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(N1(this));var u=this.tags[this.tags.length-1];{var f=s.charCodeAt(0)===64&&s.charCodeAt(1)===105;f&&this._alreadyInsertedOrderInsensitiveRule&&console.error(`You're attempting to insert the following rule:
|
|
84
84
|
`+s+"\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules."),this._alreadyInsertedOrderInsensitiveRule=this._alreadyInsertedOrderInsensitiveRule||!f}if(this.isSpeedy){var d=S1(u);try{d.insertRule(s,d.cssRules.length)}catch(m){/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(s)||console.error('There was a problem inserting the following rule: "'+s+'"',m)}}else u.appendChild(document.createTextNode(s));this.ctr++},r.flush=function(){this.tags.forEach(function(s){var u;return(u=s.parentNode)==null?void 0:u.removeChild(s)}),this.tags=[],this.ctr=0,this._alreadyInsertedOrderInsensitiveRule=!1},n})(),Zt="-ms-",bs="-moz-",Ze="-webkit-",Hu="comm",qu="rule",Gu="decl",C1="@import",ah="@keyframes",w1="@layer",A1=Math.abs,vs=String.fromCharCode,E1=Object.assign;function T1(n,r){return zt(n,0)^45?(((r<<2^zt(n,0))<<2^zt(n,1))<<2^zt(n,2))<<2^zt(n,3):0}function nh(n){return n.trim()}function D1(n,r){return(n=r.exec(n))?n[0]:n}function Ye(n,r,l){return n.replace(r,l)}function Zu(n,r){return n.indexOf(r)}function zt(n,r){return n.charCodeAt(r)|0}function Ii(n,r,l){return n.slice(r,l)}function qa(n){return n.length}function Yu(n){return n.length}function xs(n,r){return r.push(n),n}function O1(n,r){return n.map(r).join("")}var Ss=1,qr=1,rh=0,It=0,_t=0,Gr="";function Ns(n,r,l,s,u,f,d){return{value:n,root:r,parent:l,type:s,props:u,children:f,line:Ss,column:qr,length:d,return:""}}function Pi(n,r){return E1(Ns("",null,null,"",null,null,0),n,{length:-n.length},r)}function M1(){return _t}function R1(){return _t=It>0?zt(Gr,--It):0,qr--,_t===10&&(qr=1,Ss--),_t}function la(){return _t=It<rh?zt(Gr,It++):0,qr++,_t===10&&(qr=1,Ss++),_t}function Ga(){return zt(Gr,It)}function _s(){return It}function Wi(n,r){return Ii(Gr,n,r)}function el(n){switch(n){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ih(n){return Ss=qr=1,rh=qa(Gr=n),It=0,[]}function lh(n){return Gr="",n}function Cs(n){return nh(Wi(It-1,$u(n===91?n+2:n===40?n+1:n)))}function z1(n){for(;(_t=Ga())&&_t<33;)la();return el(n)>2||el(_t)>3?"":" "}function k1(n,r){for(;--r&&la()&&!(_t<48||_t>102||_t>57&&_t<65||_t>70&&_t<97););return Wi(n,_s()+(r<6&&Ga()==32&&la()==32))}function $u(n){for(;la();)switch(_t){case n:return It;case 34:case 39:n!==34&&n!==39&&$u(_t);break;case 40:n===41&&$u(n);break;case 92:la();break}return It}function j1(n,r){for(;la()&&n+_t!==57;)if(n+_t===84&&Ga()===47)break;return"/*"+Wi(r,It-1)+"*"+vs(n===47?n:la())}function B1(n){for(;!el(Ga());)la();return Wi(n,It)}function U1(n){return lh(ws("",null,null,null,[""],n=ih(n),0,[0],n))}function ws(n,r,l,s,u,f,d,m,y){for(var p=0,S=0,v=d,E=0,N=0,B=0,w=1,q=1,P=1,K=0,ae="",ee=u,L=f,Q=s,J=ae;q;)switch(B=K,K=la()){case 40:if(B!=108&&zt(J,v-1)==58){Zu(J+=Ye(Cs(K),"&","&\f"),"&\f")!=-1&&(P=-1);break}case 34:case 39:case 91:J+=Cs(K);break;case 9:case 10:case 13:case 32:J+=z1(B);break;case 92:J+=k1(_s()-1,7);continue;case 47:switch(Ga()){case 42:case 47:xs(L1(j1(la(),_s()),r,l),y);break;default:J+="/"}break;case 123*w:m[p++]=qa(J)*P;case 125*w:case 59:case 0:switch(K){case 0:case 125:q=0;case 59+S:P==-1&&(J=Ye(J,/\f/g,"")),N>0&&qa(J)-v&&xs(N>32?oh(J+";",s,l,v-1):oh(Ye(J," ","")+";",s,l,v-2),y);break;case 59:J+=";";default:if(xs(Q=sh(J,r,l,p,S,u,m,ae,ee=[],L=[],v),f),K===123)if(S===0)ws(J,r,Q,Q,ee,f,v,m,L);else switch(E===99&&zt(J,3)===110?100:E){case 100:case 108:case 109:case 115:ws(n,Q,Q,s&&xs(sh(n,Q,Q,0,0,u,m,ae,u,ee=[],v),L),u,L,v,m,s?ee:L);break;default:ws(J,Q,Q,Q,[""],L,0,m,L)}}p=S=N=0,w=P=1,ae=J="",v=d;break;case 58:v=1+qa(J),N=B;default:if(w<1){if(K==123)--w;else if(K==125&&w++==0&&R1()==125)continue}switch(J+=vs(K),K*w){case 38:P=S>0?1:(J+="\f",-1);break;case 44:m[p++]=(qa(J)-1)*P,P=1;break;case 64:Ga()===45&&(J+=Cs(la())),E=Ga(),S=v=qa(ae=J+=B1(_s())),K++;break;case 45:B===45&&qa(J)==2&&(w=0)}}return f}function sh(n,r,l,s,u,f,d,m,y,p,S){for(var v=u-1,E=u===0?f:[""],N=Yu(E),B=0,w=0,q=0;B<s;++B)for(var P=0,K=Ii(n,v+1,v=A1(w=d[B])),ae=n;P<N;++P)(ae=nh(w>0?E[P]+" "+K:Ye(K,/&\f/g,E[P])))&&(y[q++]=ae);return Ns(n,r,l,u===0?qu:m,y,p,S)}function L1(n,r,l){return Ns(n,r,l,Hu,vs(M1()),Ii(n,2,-2),0)}function oh(n,r,l,s){return Ns(n,r,l,Gu,Ii(n,0,s),Ii(n,s+1,-1),s)}function Zr(n,r){for(var l="",s=Yu(n),u=0;u<s;u++)l+=r(n[u],u,n,r)||"";return l}function V1(n,r,l,s){switch(n.type){case w1:if(n.children.length)break;case C1:case Gu:return n.return=n.return||n.value;case Hu:return"";case ah:return n.return=n.value+"{"+Zr(n.children,s)+"}";case qu:n.value=n.props.join(",")}return qa(l=Zr(n.children,s))?n.return=n.value+"{"+l+"}":""}function H1(n){var r=Yu(n);return function(l,s,u,f){for(var d="",m=0;m<r;m++)d+=n[m](l,s,u,f)||"";return d}}function uh(n){var r=Object.create(null);return function(l){return r[l]===void 0&&(r[l]=n(l)),r[l]}}var q1=function(r,l,s){for(var u=0,f=0;u=f,f=Ga(),u===38&&f===12&&(l[s]=1),!el(f);)la();return Wi(r,It)},G1=function(r,l){var s=-1,u=44;do switch(el(u)){case 0:u===38&&Ga()===12&&(l[s]=1),r[s]+=q1(It-1,l,s);break;case 2:r[s]+=Cs(u);break;case 4:if(u===44){r[++s]=Ga()===58?"&\f":"",l[s]=r[s].length;break}default:r[s]+=vs(u)}while(u=la());return r},Z1=function(r,l){return lh(G1(ih(r),l))},ch=new WeakMap,Y1=function(r){if(!(r.type!=="rule"||!r.parent||r.length<1)){for(var l=r.value,s=r.parent,u=r.column===s.column&&r.line===s.line;s.type!=="rule";)if(s=s.parent,!s)return;if(!(r.props.length===1&&l.charCodeAt(0)!==58&&!ch.get(s))&&!u){ch.set(r,!0);for(var f=[],d=Z1(l,f),m=s.props,y=0,p=0;y<d.length;y++)for(var S=0;S<m.length;S++,p++)r.props[p]=f[y]?d[y].replace(/&\f/g,m[S]):m[S]+" "+d[y]}}},$1=function(r){if(r.type==="decl"){var l=r.value;l.charCodeAt(0)===108&&l.charCodeAt(2)===98&&(r.return="",r.value="")}},F1="emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason",Q1=function(r){return r.type==="comm"&&r.children.indexOf(F1)>-1},X1=function(r){return function(l,s,u){if(!(l.type!=="rule"||r.compat)){var f=l.value.match(/(:first|:nth|:nth-last)-child/g);if(f){for(var d=!!l.parent,m=d?l.parent.children:u,y=m.length-1;y>=0;y--){var p=m[y];if(p.line<l.line)break;if(p.column<l.column){if(Q1(p))return;break}}f.forEach(function(S){console.error('The pseudo class "'+S+'" is potentially unsafe when doing server-side rendering. Try changing it to "'+S.split("-child")[0]+'-of-type".')})}}}},fh=function(r){return r.type.charCodeAt(1)===105&&r.type.charCodeAt(0)===64},K1=function(r,l){for(var s=r-1;s>=0;s--)if(!fh(l[s]))return!0;return!1},dh=function(r){r.type="",r.value="",r.return="",r.children="",r.props=""},J1=function(r,l,s){fh(r)&&(r.parent?(console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."),dh(r)):K1(l,s)&&(console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."),dh(r)))};function mh(n,r){switch(T1(n,r)){case 5103:return Ze+"print-"+n+n;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ze+n+n;case 5349:case 4246:case 4810:case 6968:case 2756:return Ze+n+bs+n+Zt+n+n;case 6828:case 4268:return Ze+n+Zt+n+n;case 6165:return Ze+n+Zt+"flex-"+n+n;case 5187:return Ze+n+Ye(n,/(\w+).+(:[^]+)/,Ze+"box-$1$2"+Zt+"flex-$1$2")+n;case 5443:return Ze+n+Zt+"flex-item-"+Ye(n,/flex-|-self/,"")+n;case 4675:return Ze+n+Zt+"flex-line-pack"+Ye(n,/align-content|flex-|-self/,"")+n;case 5548:return Ze+n+Zt+Ye(n,"shrink","negative")+n;case 5292:return Ze+n+Zt+Ye(n,"basis","preferred-size")+n;case 6060:return Ze+"box-"+Ye(n,"-grow","")+Ze+n+Zt+Ye(n,"grow","positive")+n;case 4554:return Ze+Ye(n,/([^-])(transform)/g,"$1"+Ze+"$2")+n;case 6187:return Ye(Ye(Ye(n,/(zoom-|grab)/,Ze+"$1"),/(image-set)/,Ze+"$1"),n,"")+n;case 5495:case 3959:return Ye(n,/(image-set\([^]*)/,Ze+"$1$`$1");case 4968:return Ye(Ye(n,/(.+:)(flex-)?(.*)/,Ze+"box-pack:$3"+Zt+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ze+n+n;case 4095:case 3583:case 4068:case 2532:return Ye(n,/(.+)-inline(.+)/,Ze+"$1$2")+n;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(qa(n)-1-r>6)switch(zt(n,r+1)){case 109:if(zt(n,r+4)!==45)break;case 102:return Ye(n,/(.+:)(.+)-([^]+)/,"$1"+Ze+"$2-$3$1"+bs+(zt(n,r+3)==108?"$3":"$2-$3"))+n;case 115:return~Zu(n,"stretch")?mh(Ye(n,"stretch","fill-available"),r)+n:n}break;case 4949:if(zt(n,r+1)!==115)break;case 6444:switch(zt(n,qa(n)-3-(~Zu(n,"!important")&&10))){case 107:return Ye(n,":",":"+Ze)+n;case 101:return Ye(n,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ze+(zt(n,14)===45?"inline-":"")+"box$3$1"+Ze+"$2$3$1"+Zt+"$2box$3")+n}break;case 5936:switch(zt(n,r+11)){case 114:return Ze+n+Zt+Ye(n,/[svh]\w+-[tblr]{2}/,"tb")+n;case 108:return Ze+n+Zt+Ye(n,/[svh]\w+-[tblr]{2}/,"tb-rl")+n;case 45:return Ze+n+Zt+Ye(n,/[svh]\w+-[tblr]{2}/,"lr")+n}return Ze+n+Zt+n+n}return n}var I1=function(r,l,s,u){if(r.length>-1&&!r.return)switch(r.type){case Gu:r.return=mh(r.value,r.length);break;case ah:return Zr([Pi(r,{value:Ye(r.value,"@","@"+Ze)})],u);case qu:if(r.length)return O1(r.props,function(f){switch(D1(f,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Zr([Pi(r,{props:[Ye(f,/:(read-\w+)/,":"+bs+"$1")]})],u);case"::placeholder":return Zr([Pi(r,{props:[Ye(f,/:(plac\w+)/,":"+Ze+"input-$1")]}),Pi(r,{props:[Ye(f,/:(plac\w+)/,":"+bs+"$1")]}),Pi(r,{props:[Ye(f,/:(plac\w+)/,Zt+"input-$1")]})],u)}return""})}},P1=[I1],Fu;{var W1=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;Fu=function(r){var l=r.match(W1);if(l)return l[l.length-1]}}var ex=function(r){var l=r.key;if(!l)throw new Error(`You have to configure \`key\` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.
|
|
85
85
|
If multiple caches share the same key they might "fight" for each other's style elements.`);if(l==="css"){var s=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(s,function(w){var q=w.getAttribute("data-emotion");q.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var u=r.stylisPlugins||P1;if(/[^a-z-]/.test(l))throw new Error('Emotion key must only contain lower case alphabetical characters and - but "'+l+'" was passed');var f={},d,m=[];d=r.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+l+' "]'),function(w){for(var q=w.getAttribute("data-emotion").split(" "),P=1;P<q.length;P++)f[q[P]]=!0;m.push(w)});var y,p=[Y1,$1];p.push(X1({get compat(){return B.compat}}),J1);{var S,v=[V1,function(w){w.root||(w.return?S.insert(w.return):w.value&&w.type!==Hu&&S.insert(w.value+"{}"))}],E=H1(p.concat(u,v)),N=function(q){return Zr(U1(q),E)};y=function(q,P,K,ae){if(S=K,Fu){var ee=Fu(P.styles);ee&&(S={insert:function(Q){K.insert(Q+ee)}})}N(q?q+"{"+P.styles+"}":P.styles),ae&&(B.inserted[P.name]=!0)}}var B={key:l,sheet:new _1({key:l,container:d,nonce:r.nonce,speedy:r.speedy,prepend:r.prepend,insertionPoint:r.insertionPoint}),nonce:r.nonce,inserted:f,registered:{},insert:y};return B.sheet.hydrate(m),B},Qu={exports:{}},Fe={};/** @license React v16.13.1
|
|
86
86
|
* react-is.production.min.js
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@agrada_digital/pbm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.138",
|
|
6
6
|
"description": "A React component library to implement the PBM (Pharmacy Benefit Manager) model - Web Component for Vanilla JS",
|
|
7
7
|
"unpkg": "dist/vanilla.js",
|
|
8
8
|
"jsdelivr": "dist/vanilla.js",
|