class MPCheckoutSessionDataRegister{static FLOW_ID_KEY="_mp_flow_id";static PUBLIC_KEY_KEY="_mp_public_key";static FLOW_ID=null;static PUBLIC_KEY=wc_mercadopago_checkout_session_data_register_params.public_key;static LOCALE=wc_mercadopago_checkout_session_data_register_params.locale;static HIDDEN_INPUT_NAME_PREFIX="mercadopago_checkout_session";static FORM_SELECTORS="form#blocks_checkout_form, form[name=checkout], form.wc-block-components-form, form.wc-block-checkout__form, form#order_review";static generateFlowId(){const t=this.generateUUIDV4();if("undefined"==typeof MercadoPago)return t;if(!window.mpSdkInstance){const t=new MercadoPago(this.PUBLIC_KEY,{locale:this.LOCALE});window.mpSdkInstance=t}return"function"==typeof window.mpSdkInstance?.getSDKInstanceId?window.mpSdkInstance.getSDKInstanceId():t}static generateUUIDV4(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}static getDataToHiddenInput(){return[{id:this.FLOW_ID_KEY,value:this.FLOW_ID,name:`${this.HIDDEN_INPUT_NAME_PREFIX}[${this.FLOW_ID_KEY}]`}]}static getHiddenInputDataFromBlocksCheckout(){return this.getDataToHiddenInput().reduce(((t,e)=>(t[e.name]=e.value,t)),{})}static registerOnSessionStorage(){sessionStorage.setItem(this.FLOW_ID_KEY,this.FLOW_ID),sessionStorage.setItem(this.PUBLIC_KEY_KEY,this.PUBLIC_KEY)}static registerOnHiddenInput(){this.getDataToHiddenInput().forEach((t=>{document.querySelector(this.FORM_SELECTORS).appendChild(((t,e,n)=>{const o=document.createElement("input");return o.style.display="none",o.setAttribute("type","hidden"),o.setAttribute("id",t),o.setAttribute("name",n),o.setAttribute("value",e),o})(t.id,t.value,t.name))}))}static execute(){document.addEventListener("DOMContentLoaded",(()=>{document.querySelector(this.FORM_SELECTORS)&&(this.FLOW_ID=this.generateFlowId(),this.registerOnSessionStorage(),this.registerOnHiddenInput(),window.mpHiddenInputDataFromBlocksCheckout=this.getHiddenInputDataFromBlocksCheckout())}))}}MPCheckoutSessionDataRegister.execute();