PageSourceSearch

https://partners.meridianbet.pe/build/assets/MarketForm-BqMS2A9l.js

js meridianbet.pe collected 2026-09-24 20:31:05 UTC 47,065 bytes, 9 lines download raw bytes

1import{h as Be,j as e,S as he,C as qe,a5 as ze,a6 as Xe,s as ee}from"./main-B85zqRjd.js";import{R as f,e as Ye,d as We}from"./vendor-react-Bjxsyr_G.js";import{D as Ze}from"./vendor-redux-CkTbKByD.js";import{C}from"./ControlPanel-Bidjhjxr.js";import{B as Je}from"./Button-xfGKx8Ra.js";import{T as Qe}from"./ToggleSwitch-DYzOk3nu.js";import{c as Q,a as p}from"./vendor-forms-Chlqk9RW.js";import{d as A,v as be,c as se}from"./customRules-DYikBkCr.js";import{u as es}from"./usePanelFormValidation-DS5H-qF4.js";import{f as l}from"./formStyles-MU_CFwXq.js";import{C as ss}from"./CommissionSetting-C9BjTddt.js";import{I as M}from"./Input-D8QKTzdn.js";import{f as as,a as ts}from"./dateUtils-Cn8z919x.js";import{u as D}from"./vendor-i18n-CmmgQqfv.js";import{R as ge}from"./RadioButton-fh1RYQO7.js";import{C as L}from"./Checkbox-D6300evD.js";import{D as ns}from"./DepositorsAndRegistrationPanel-5NWnUMUU.js";import"./validation-g0OSJvn7.js";import"./DatePicker-CrQzRYM7.js";import"./formatDate-C6Vg3jtv.js";const is="v1/template-types",rs=Be.injectEndpoints({endpoints:a=>({getTemplateTypes:a.query({query:()=>({url:`${is}`,method:"GET"}),transformResponse:s=>(Array.isArray(s)?s:(s==null?void 0:s.data)||[]).map(r=>({id:r.id,name:r.name}))})}),overrideExisting:!1}),{useGetTemplateTypesQuery:ls}=rs,os=Q().shape({name:p().required().max(255),timezone:p().required(),url:p().url().required().max(255),aff_url:p().url().max(255),ads_url:p().url().required().max(255),email:p().email().required().max(255),managers_permission:p(),affiliates_permission:p(),mail_username:p().required().max(255),mail_password:p().required().max(255),mail_server:p().required().max(255),mail_smtp_port:p().required().max(255),mail_encryption:p().required().max(255),ussd_number:p().when("revenue_share_sections_active",{is:a=>Array.isArray(a)&&a.some(s=>((s==null?void 0:s.name)||(s==null?void 0:s.key))==="Ussd"&&((s==null?void 0:s.value)===1||(s==null?void 0:s.value)===!0)),then:a=>a.required().max(255),otherwise:a=>a.notRequired()}),ussd_content:p().when("revenue_share_sections_active",{is:a=>Array.isArray(a)&&a.some(s=>((s==null?void 0:s.name)||(s==null?void 0:s.key))==="Ussd"&&((s==null?void 0:s.value)===1||(s==null?void 0:s.value)===!0)),then:a=>a.required(),otherwise:a=>a.notRequired()}),sport_payin_tax:A("sport_payin_tax_active"),sport_gross_tax:A("sport_gross_tax_active"),sport_admin_fees:A("sport_admin_fees_active"),casino_payin_tax:A("casino_payin_tax_active"),casino_gross_tax:A("casino_gross_tax_active"),casino_admin_fees:A("casino_admin_fees_active"),ussd_payin_tax:A("ussd_payin_tax_active"),ussd_gross_tax:A("ussd_gross_tax_active"),ussd_admin_fees:A("ussd_admin_fees_active"),poker_payin_tax:A("poker_payin_tax_active"),poker_gross_tax:A("poker_gross_tax_active"),poker_admin_fees:A("poker_admin_fees_active"),min_first_depositor_value:se("min_first_depositor_active"),min_monthly_registrations_value:se("min_monthly_registrations_active"),first_depositor_cutoff_day_numbers:se("first_depositor_settings.first_depositor_cutoff_activ"),commission_settings:Q().test("commission-settings-validation","Commission settings validation",function(a){return be.call(this,a,this.parent)})}),ms=Q().shape({name:p().required().max(255),timezone:p().required(),url:p().url().required().max(255),aff_url:p().url().max(255),ads_url:p().url().required().max(255),email:p().email().required().max(255),managers_permission:p(),affiliates_permission:p(),mail_username:p().required().max(255),mail_password:p().required().max(255),mail_server:p().required().max(255),mail_smtp_port:p().required().max(255),mail_encryption:p().required().max(255),ussd_number:p().when("revenue_share_sections_active",{is:a=>Array.isArray(a)&&a.some(s=>((s==null?void 0:s.name)||(s==null?void 0:s.key))==="Ussd"&&((s==null?void 0:s.value)===1||(s==null?void 0:s.value)===!0)),then:a=>a.required().max(255),otherwise:a=>a.notRequired()}),ussd_content:p().when("revenue_share_sections_active",{is:a=>Array.isArray(a)&&a.some(s=>((s==null?void 0:s.name)||(s==null?void 0:s.key))==="Ussd"&&((s==null?void 0:s.value)===1||(s==null?void 0:s.value)===!0)),then:a=>a.required(),otherwise:a=>a.notRequired()}),sport_payin_tax:A("sport_payin_tax_active"),sport_gross_tax:A("sport_gross_tax_active"),sport_admin_fees:A("sport_admin_fees_active"),casino_payin_tax:A("casino_payin_tax_active"),casino_gross_tax:A("casino_gross_tax_active"),casino_admin_fees:A("casino_admin_fees_active"),ussd_payin_tax:A("ussd_payin_tax_active"),ussd_gross_tax:A("ussd_gross_tax_active"),ussd_admin_fees:A("ussd_admin_fees_active"),poker_payin_tax:A("poker_payin_tax_active"),poker_gross_tax:A("poker_gross_tax_active"),poker_admin_fees:A("poker_admin_fees_active"),commission_settings:Q().test("commission-settings-validation","Commission settings validation",function(a){return be.call(this,a,this.parent)})}),ae={name:"",timezone:"",market_id:"",url:"",aff_url:"",ads_url:"",created_at:""},te={logo:null,email:"",managers_permission:"normal",affiliates_permission:"normal",sections:{affiliates:!1,cashiers:!1,advertisers:!1},enable_multiple_transactions:!1,automatic:!1},ne={revenue_share_sections_active:[{name:"Sport",value:0},{name:"Casino",value:0},{name:"Ussd",value:0},{name:"Poker",value:0}]},ie={commission_settings:{sport:[{type:"sport"}],casino:[{type:"casino"}
1],cpa:[{type:"cpa"}],ussd:[{type:"ussd"}],poker:[{type:"poker"}]}},re={min_first_depositor_active:0,min_first_depositor_value:"",min_monthly_registrations_active:0,min_monthly_registrations_value:"",first_depositor_settings:{first_depositor_cutoff_activ:0,first_depositor_cutoff_day_numbers:"",first_depositor_current_month_activ:0}},le={sport_payin_tax_active:0,sport_payin_tax:"",sport_gross_tax_active:0,sport_gross_tax:"",sport_admin_fees_active:0,sport_admin_fees:"",casino_payin_tax_active:0,casino_payin_tax:"",casino_gross_tax_active:0,casino_gross_tax:"",casino_admin_fees_active:0,casino_admin_fees:"",ussd_payin_tax_active:0,ussd_payin_tax:"",ussd_gross_tax_active:0,ussd_gross_tax:"",ussd_admin_fees_active:0,ussd_admin_fees:"",poker_payin_tax_active:0,poker_payin_tax:"",poker_gross_tax_active:0,poker_gross_tax:"",poker_admin_fees_active:0,poker_admin_fees:""},oe={mail_username:"",mail_password:"",mail_server:"",mail_smtp_port:"",mail_encryption:"SSL"},Re={email_templates:[]},me={ussd_number:"",ussd_content:""},ye={active:0},je={websiteInfo:["name","timezone","url","ads_url","aff_url"],permissionSettings:["email"],revenueShareSections:[],commissionSettings:["commission_settings","commission_settings.sport","commission_settings.casino","commission_settings.ussd","commission_settings.poker"],depositorsAndRegistration:["min_first_depositor_value","min_monthly_registrations_value","first_depositor_settings.first_depositor_cutoff_day_numbers"],additionalExpenses:["sport_payin_tax","sport_gross_tax","sport_admin_fees","casino_payin_tax","casino_gross_tax","casino_admin_fees","ussd_payin_tax","ussd_gross_tax","ussd_admin_fees","poker_payin_tax","poker_gross_tax","poker_admin_fees"],mailConfig:["mail_username","mail_password","mail_server","mail_smtp_port","mail_encryption"],emailTemplates:[],ussdMarketingChannel:["ussd_number","ussd_content"]},Ne=Object.keys(je).reduce((a,s)=>(a[s]=!1,a),{});({...ae,...te,...ne,...ie,...re,...le,...oe,...Re,...me,...ye});const cs={name:"MARKETS.MARKET_NAME",timezone:"MARKETS.MARKET_TIMEZONE",market_id:"MARKETS.MARKET_ID",url:"MARKETS.WEBSITE_URL",aff_url:"MARKETS.AFFILIATE_URL",ads_url:"ADS url",created_at:"MARKETS.CREATION_DATE",logo:"MARKETS.LOGO_UPLOAD",email:"MARKETS.EMAIL",managers_permission:"MARKETS.MANAGERS",affiliates_permission:"MARKETS.AFFILIATES",revenue_share_sections_active:"MARKETS.REVENUE_SHARE_SECTIONS",commission_settings:"MARKETS.COMMISSION_AND_CPA_DEAL_SETTINGS","commission_settings.sport":"AFFILIATES.REVENUE_SHARE_SPORT","commission_settings.casino":"AFFILIATES.REVENUE_SHARE_CASINO","commission_settings.ussd":"AFFILIATES.REVENUE_SHARE_USSD","commission_settings.poker":"AFFILIATES.REVENUE_SHARE_POKER","commission_settings.sport.value":"CASHIERS.REVENUE_SHARE","commission_settings.casino.value":"CASHIERS.REVENUE_SHARE","commission_settings.ussd.value":"CASHIERS.REVENUE_SHARE","commission_settings.poker.value":"CASHIERS.REVENUE_SHARE",min_first_depositor_active:"AFFILIATES.MINIMUM_FIRST_DEPOSITORS_PER_MONTH",min_first_depositor_value:"CASHIERS.AMOUNT",min_monthly_registrations_active:"AFFILIATES.MINIMUM_REGISTRATIONS_PER_MONTH",min_monthly_registrations_value:"CASHIERS.AMOUNT",first_depositor_cutoff_activ:"MARKETS.FIRST_DEPOSITORS_CUTTOFF_ACTIVE",first_depositor_cutoff_day_numbers:"CASHIERS.AMOUNT","first_depositor_settings.first_depositor_cutoff_day_numbers":"CASHIERS.AMOUNT",first_depositor_current_month_activ:"MARKETS.FIRST_DEPOSITORS_CURRENT_MONTH",sport_tax_value:"MARKETS.SPORT_FEES",casino_tax_value:"MARKETS.CASINO_FEES",ussd_tax_value:"MARKETS.USSD_FEES",poker_tax_value:"MARKETS.POKER_FEES",sport_payin_tax:"MARKETS.PAYIN_TAX",sport_gross_tax:"MARKETS.GROSS_TAX",sport_admin_fees:"MARKETS.ADMIN_FEES",casino_payin_tax:"MARKETS.PAYIN_TAX",casino_gross_tax:"MARKETS.GROSS_TAX",casino_admin_fees:"MARKETS.ADMIN_FEES",ussd_payin_tax:"MARKETS.PAYIN_TAX",ussd_gross_tax:"MARKETS.GROSS_TAX",ussd_admin_fees:"MARKETS.ADMIN_FEES",poker_payin_tax:"MARKETS.PAYIN_TAX",poker_gross_tax:"MARKETS.GROSS_TAX",poker_admin_fees:"MARKETS.ADMIN_FEES",mail_username:"MARKET_FORM.MAIL_USERNAME",mail_password:"MARKET_FORM.MAIL_PASSWORD",mail_server:"MARKET_FORM.MAIL_SERVER",mail_smtp_port:"MARKET_FORM.MAIL_SMTP_PORT",mail_encryption:"MARKET_FORM.MAIL_ENCRYPTION",email_templates:"MARKETS.EMAILS_TEMPLATES",ussd_number:"MARKETS.USSD_NUMBER",ussd_content:"MARKETS.USSD_CONTENT",active:"MARKETS.ACTIVE",choose_timezone:"MARKETS.CHOOSE_TIMEZONE",example:"MARKETS.EXAMPLE",logo_upload:"MARKETS.LOGO_UPLOAD",select_image:"MARKETS.SELECT_IMAGE",logo_hint:"MARKETS.LOGO_HINT",logo_preview:"MARKETS.LOGO_PREVIEW",sections:"MARKETS.SECTIONS",enable_multiple_transactions:"MARKETS.ENABLE_MULTIPLE_TRANSACTIONS",default:"MARKETS.DEFAULT",low:"MARKETS.LOW",normal_default:"MARKETS.NORMAL_(DEFAULT)",high:"MARKETS.HIGH",system_settings:"MARKETS.SYSTEM_SETTINGS",permission_settings:"MARKETS.PERMISSION_SETTINGS",revenue_share_sections:"MARKETS.REVENUE_SHARE_SECTIONS",commission_and_cpa:"MARKETS.COMMISSION_AND_CPA_DEAL_SETTINGS",first_depositors_and_registration:"MARKETS.FIRST_DEPOSITORS_AND_REGISTRATION_SETTINGS",additional_expenses:"MARKETS.ADDITIONAL_EXPENSES",mail_config:"MARKETS.MAIL_CONFIG",emails_templates:"MARKETS.EMAILS_TEMPLATES",ussd_marketing_channel:"MARKETS.USSD_MARKETING_CHANNEL",market_landing_page:"MARKETS.MARKET_LANDING_PAGE",market_logs:"MARKETS.MARKET_LOGS",edit_existing_market:"MARKETS.EDIT_EXISTING_MARKET",add_new_market:"MARKETS.ADD_NEW_MARKET",cancel:"MARKETS.CANCEL",save:"MARKETS.SAVE",sport_fees:"MARKETS.SPORT_FEES",casino_fees:"MARKETS.CASINO_FEES",ussd_fees:"MARKETS.USSD_FEES",poker_fees:"MARKETS.POKER_FEES",payin_tax:"MARKETS.PAYIN_TAX",gross_tax:"MARKETS.GROSS_TAX",admin_tax:"MARKETS.ADMIN_TAX",admin_fees:"MARKETS.ADMIN_FEES",min_commission_payout:"MARKETS.MIN_COMMISSION_PAYOUT",choose_template:"MARKETS.CHOOSE_TEMPLATE",email_already_in_use:"MARKET_FORM.EMAIL_ALREADY_IN_USE_BY_ANOTHER_MARKET",revenue_share_sections_footnote:"MARKET_FORM.REVENUE_SHARE_SECTIONS_FOOTNOTE",available_params:"EXCEPTIONS.AVAILABLE_PARAMS"},_s=a=>
1{if(!a)return a;const s=String(a).toUpperCase();return s==="SPORT"?"Sport":s==="CASINO"?"Casino":s==="USSD"?"Ussd":s==="POKER"?"Poker":String(a).charAt(0).toUpperCase()+String(a).slice(1)},J=(a,s)=>({[`${s}_payin_tax_active`]:a[`${s}_payin_tax_active`]??a[`${s}_tax_active`]??0,[`${s}_payin_tax`]:(a[`${s}_payin_tax`]??a[`${s}_tax`]??a[`${s}_tax_value`])||"",[`${s}_gross_tax_active`]:a[`${s}_gross_tax_active`]??0,[`${s}_gross_tax`]:(a[`${s}_gross_tax`]??a[`${s}_gross_tax_value`])||"",[`${s}_admin_fees_active`]:a[`${s}_admin_fees_active`]??a[`${s}_admin_tax_active`]??0,[`${s}_admin_fees`]:(a[`${s}_admin_fees`]??a[`${s}_admin_tax_value`])||""}),ds=(a,s)=>{let o={sport:[],casino:[],cpa:[],ussd:[],poker:[]};return Array.isArray(a.commission_settings)?a.commission_settings.forEach(r=>{const n=((r==null?void 0:r.type)||"").toLowerCase();o[n]&&o[n].push({type:n,from:r.from??"",to:r.to??null,value:r.value??""})}):s&&typeof s=="object"&&(o={sport:Array.isArray(s.sport)?s.sport:o.sport,casino:Array.isArray(s.casino)?s.casino:o.casino,cpa:Array.isArray(s.cpa)?s.cpa:o.cpa,ussd:Array.isArray(s.ussd)?s.ussd:o.ussd,poker:Array.isArray(s.poker)?s.poker:o.poker}),Object.keys(o).forEach(r=>{o[r].length||(o[r]=[{type:r,from:"",to:null,value:""}])}),o},ps=a=>{if(!a||typeof a!="object")return null;const s=a.commission_settings||ie.commission_settings,o=a.first_depositor_settings||{};let r;if(Array.isArray(a.revenue_share_sections_active))r=a.revenue_share_sections_active.map(n=>({name:_s((n==null?void 0:n.key)||(n==null?void 0:n.name)),value:typeof(n==null?void 0:n.value)=="number"?n.value:n!=null&&n.value?1:0}));else if(a.revenue_share_sections_active&&typeof a.revenue_share_sections_active=="object"){const n=a.revenue_share_sections_active||{};r=[{name:"Sport",value:n.sport?1:0},{name:"Casino",value:n.casino?1:0},{name:"Ussd",value:n.ussd?1:0},{name:"Poker",value:n.poker?1:0}]}else r=ne.revenue_share_sections_active;return{websiteInfo:{...ae,name:a.name||"",timezone:a.timezone||"GMT0",market_id:a.id||"",url:a.url||"",aff_url:a.aff_url||"",ads_url:a.ads_url||"",created_at:a.created_at||""},permissionSettings:{...te,logo:a.logo_file_url||a.logo||null,email:a.email||"",managers_permission:a.managers_permission||"normal",affiliates_permission:a.affiliates_permission||"normal",sections:(()=>{const n=Array.isArray(a.sections)?a.sections:[],t=_=>n.some(i=>((i==null?void 0:i.name)||"").toLowerCase()===_.toLowerCase());return{affiliates:t("Affiliates"),cashiers:t("Cashiers"),advertisers:t("Referrals")}})(),enable_multiple_transactions:!!a.enable_multiple_transactions,automatic:!!a.automatic},revenueShareSections:{revenue_share_sections_active:r},commissionSettings:{commission_settings:ds(a,s),revenue_share_sport_active:a.revenue_share_sport_active??0,revenue_share_casino_active:a.revenue_share_casino_active??0,revenue_share_ussd_active:a.revenue_share_ussd_active??0,revenue_share_poker_active:a.revenue_share_poker_active??0,cpa_active:a.cpa_active??0,min_cpa_deposit:a.minimum_cpa_deposit_value??"",negative_carryover:a.negative_carryover??0,min_commission_payout:a.minimum_payout_commission??""},depositorsAndRegistration:{...re,min_first_depositor_active:a.min_first_depositor_active??0,min_first_depositor_value:a.min_first_depositor_value||"",min_monthly_registrations_active:a.min_monthly_registrations_active??0,min_monthly_registrations_value:a.min_monthly_registrations_value||"",first_depositor_settings:{first_depositor_cutoff_activ:(o==null?void 0:o.first_depositor_cutoff_activ)??0,first_depositor_cutoff_day_numbers:(o==null?void 0:o.first_depositor_cutoff_day_numbers)||"",first_depositor_current_month_activ:(o==null?void 0:o.first_depositor_current_month_activ)??0}},additionalExpenses:{...le,...J(a,"sport"),...J(a,"casino"),...J(a,"ussd"),...J(a,"poker")},mailConfig:{...oe,mail_username:a.mail_username||"",mail_password:a.mail_password||"",mail_server:a.mail_server||"",mail_smtp_port:a.mail_smtp_port||"",mail_encryption:(()=>{const n=(a.mail_encryption||"").toUpperCase();return n.includes("SSL")?"SSL":n.includes("TLS")&&!n.includes("SSL")?"TLS":n.includes("STARTTLS")?"STARTTLS":"SSL"})()},emailTemplates:(()=>{const n=Array.isArray(a.email_templates)?a.email_templates:[],t=new Map;
1return n.forEach(i=>{const d=(i==null?void 0:i.template_type_id)??(i==null?void 0:i.template_type),u=typeof d=="number"?d:typeof d=="string"&&/^\d+$/.test(d)?Number(d):void 0;if(u===void 0){const m=`__no_type__${t.size}`;t.set(m,{...i});return}const v={...t.get(u)||{},...i,template_type_id:u};t.set(u,v)}),{email_templates:Array.from(t.values())}})(),ussdMarketingChannel:{...me,ussd_number:a.ussd_number||"",ussd_content:a.ussd_content||""},activeStatus:{active:a.active??0}}},V={welcome:["Hello (username),","","Welcome to (market_name)! Your affiliate account has been created successfully.","You can now log in and start promoting.","","Best regards,","(market_name) Team"].join(`
2`),account_approved:["Hello (username),","","Good news! Your affiliate account has been approved.","You can log in and access your dashboard now.","","Best regards,","(market_name) Team"].join(`
3`),account_rejected:["Hello (username),","","We are sorry to inform you that your affiliate account request was not approved at this time.","For more details, please contact support.","","Best regards,","(market_name) Team"].join(`
4`),payment_request:["Hello (username),","","We have received your payment request.","Our team will review it shortly and notify you of any updates.","","Best regards,","(market_name) Finance"].join(`
5`),approved_payment_request:["Hello (username),","","Your payment request has been approved.","Please allow some time for the funds to be processed.","","Best regards,","(market_name) Finance"].join(`
6`),rejected_payment_request:["Hello (username),","","Your payment request has been rejected.","Please contact support if you need more information.","","Best regards,","(market_name) Finance"].join(`
7`),account_suspended:["Hello (username),","","Your affiliate account has been suspended.","Please contact support for further details.","","Best regards,","(market_name) Team"].join(`
8`),email_verify:["Hello (username),","","Please verify your email address to continue using your account.","Click the verification link we sent to your email inbox.","","Best regards,","(market_name) Team"].join(`
9`)},us=[{id:"GMT-12",name:"GMT-12"},{id:"GMT-11",name:"GMT-11"},{id:"GMT-10",name:"GMT-10"},{id:"GMT-9",name:"GMT-9"},{id:"GMT-8",name:"GMT-8"},{id:"GMT-7",name:"GMT-7"},{id:"GMT-6",name:"GMT-6"},{id:"GMT-5",name:"GMT-5"},{id:"GMT-4",name:"GMT-4"},{id:"GMT-3",name:"GMT-3"},{id:"GMT-2",name:"GMT-2"},{id:"GMT-1",name:"GMT-1"},{id:"GMT0",name:"GMT0"},{id:"GMT+1",name:"GMT+1"},{id:"GMT+2",name:"GMT+2"},{id:"GMT+3",name:"GMT+3"},{id:"GMT+4",name:"GMT+4"},{id:"GMT+5",name:"GMT+5"},{id:"GMT+6",name:"GMT+6"},{id:"GMT+7",name:"GMT+7"},{id:"GMT+8",name:"GMT+8"},{id:"GMT+9",name:"GMT+9"},{id:"GMT+10",name:"GMT+10"},{id:"GMT+11",name:"GMT+11"},{id:"GMT+12",name:"GMT+12"}],Me=[{value:"low",label:"MARKETS.LOW"},{value:"normal",label:"MARKETS.NORMAL_(DEFAULT)"},{value:"high",label:"MARKETS.HIGH"}],xs=[{key:"sport",label:"MARKETS.SPORT_FEES",labelKey:"SPORSKE TAKSE",payinTaxLabel:"MARKETS.PAYIN_TAX"},{key:"casino",label:"MARKETS.CASINO_FEES",labelKey:"KAZINO TAKSE",payinTaxLabel:"MARKETS.CASINO_TAX"},{key:"ussd",label:"MARKETS.USSD_FEES",labelKey:"USSD TAKSE",payinTaxLabel:"MARKETS.PAYIN_TAX"},{key:"poker",label:"MARKETS.POKER_FEES",labelKey:"POKER TAKSE",payinTaxLabel:"MARKETS.POKER_TAX"}],Es={Sport:"MARKETING.SPORT",Casino:"MARKETING.CASINO",Ussd:"MARKETING.USSD",Poker:"MARKETING.POKER"};function Ss({value:a,onChange:s,disabled:o=!1,isEdit:r=!1,errors:n={}}){const{t}=D(),_=i=>d=>s==null?void 0:s({...a,[i]:d&&d.target?d.target.value:d});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-span-12 sm:col-span-6 lg:col-span-3",children:e.jsx(M,{label:t?t("MARKETS.MARKET_NAME"):"Naziv marketa",value:a.name,onChange:_("name"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:o,error:n.name})}),e.jsxs("div",{className:"col-span-12 sm:col-span-6 lg:col-span-3",children:[e.jsxs("label",{className:`block ${l.label} mb-1 ${n.timezone?"text-[var(--mdn-red-d2)]":""}`,children:[t?t("MARKETS.MARKET_TIMEZONE"):"Vremenska zona marketa"," ",e.jsxs("span",{className:"italic text-[var(--mdn-text-60)] text-[12px]",children:["(",t?t("MARKETS.EXAMPLE"):"Primer",": GMT+1)"]})]}),e.jsx(he,{items:us,value:a.timezone,onChange:_("timezone"),buttonClassName:`${n.timezone?l.selectBtnError:l.selectBtn} w-full`,className:"!block w-full",wrapperClassName:"w-full",labels:{placeholder:t?t("MARKETS.CHOOSE_TIMEZONE"):"Choose timezone"},disabled:o,placeholderClassName:"text-[var(--mdn-text-38)]",error:n.timezone}),n.timezone&&e.jsx("p",{className:l.errorMessage,children:n.timezone})]}),e.jsx("div",{className:"hidden xl:block xl:col-span-3"}),e.jsx("div",{className:"col-span-12 sm:col-span-6 lg:col-span-3",children:e.jsx(M,{label:t?t("MARKETS.MARKET_ID"):"ID Marketa",value:a.market_id,onChange:_("market_id"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:!0})}),e.jsx("div",{className:"hidden sm:block xl:hidden sm:col-span-6 lg:col-span-3"}),e.jsx("div",{className:"col-span-12 sm:col-span-6 lg:col-span-3",children:e.jsx(M,{label:t?t("MARKETS.WEBSITE_URL"):"URL Veb stranice",value:a.url,onChange:_("url"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:o,error:n.url})}),e.jsx("div",{className:"col-span-12 sm:col-span-6 lg:col-span-3",children:e.jsx(M,{label:t?t("MARKETS.AFFILIATE_URL"):"URL Saradnika",value:a.aff_url,onChange:_("aff_url"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:o,error:n.aff_url})}),e.jsx("div",{className:"hidden xl:block xl:col-span-3"}),e.jsx("div",{className:"col-span-12 sm:col-span-6 lg:col-span-3",children:e.jsx(M,{label:t?t("MARKETS.CREATION_DATE"):"Datum kreiranja",value:as(a.created_at,ts()),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:!0})}),e.jsx("div",{className:"hidden lg:block xl:hidden lg:col-span-3"}),e.jsx("div",{className:"col-span-12 sm:col-span-6 lg:col-span-3",children:e.jsx(M,{label:"Ads URL",value:a.ads_url,onChange:_("ads_url"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:o,error:n.ads_url})})]})}function As({value:a,onChange:s,onImageUpload:o,disabled:r=!1,errors:n={}}){var u,h,v;const{t}=D(),_=m=>x=>s==null?void 0:s({...a,[m]:x&&x.target?x.target.value:x}),i=m=>x=>s==null?void 0:s({...a,sections:{...a.sections,[m]:x.target.checked}}),d=m=>{var N;const x=(N=m.target.files)==null?void 0:N[0];x&&(o==null||o(x))};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-span-12 min-[960px]:col-span-6",children:e.jsxs("div",{className:"grid grid-cols-12 gap-y-6",children:[e.jsxs("div",{className:"col-span-12 min-[600px]:col-span-6",children:[e.jsx("label",{className:`block ${l.label} mb-1`,children:t?t("MARKETS.LOGO_UPLOAD"):"Postavljanje logoa"}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("label",{className:"w-full flex items-center justify-between gap-2 px-4 py-2 bg-[var(--mdn-form-input-bg)] border border-[var(--mdn-border-38)] cursor-pointer hover:bg-gray-100",children:[e.jsx("span",{className:"text-[var(--mdn-text-54)]",children:t?t("MARKETS.CHOOSE_IMAGE"):"Izaberi sliku"}),e.jsx("span",{className:"mdi mdi-camera text-[20px] text-[var(--mdn-text-54)]"}),e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:d,disabled:r})]})}),e.jsx("p",{className:"mt-1 text-[12px] text-[var(--mdn-text-54)]",children:t?t("MARKETING.RECOMMENDED_IMG_SIZE"):"Preporučena veličina slike"})]}),e.jsxs("div",{className:"col-span-12",children:[e.jsx("label",{className:`block ${l.label} mb-1`,children:t?t("MARKETS.LOGO_PREVIEW"):"Izgled logoa"}
9),a.logo?e.jsx("img",{src:typeof a.logo=="string"?a.logo:URL.createObjectURL(a.logo),alt:"Logo",className:"max-h-[60px]"}):e.jsx("div",{className:"h-[80px] w-full max-w-[480px] bg-[var(--mdn-border)] flex items-center justify-center",children:e.jsx("span",{className:"mdi mdi-image-outline text-[24px] text-[var(--mdn-text-54)]"})})]}),e.jsx("div",{className:"col-span-12 min-[600px]:col-span-6",children:e.jsx(M,{label:t?t("MARKETS.EMAIL"):"E-adresa",type:"email",value:a.email,onChange:_("email"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:r,error:n.email})})]})}),e.jsx("div",{className:"col-span-12 min-[960px]:col-span-6",children:e.jsxs("div",{className:"grid grid-cols-12 gap-x-6 gap-y-6",children:[e.jsxs("div",{className:"col-span-12 sm:col-span-6",children:[e.jsx("label",{className:"block mb-4 font-bold text-[var(--mdn-text-87)] text-[14.4px]",children:t?t("MARKETS.MANAGERS"):"Menadžeri"}),e.jsx("div",{className:"flex flex-col gap-2",children:Me.map(m=>e.jsx(ge,{name:"managers_permission",value:m.value,checked:a.managers_permission===m.value,onChange:()=>s==null?void 0:s({...a,managers_permission:m.value}),label:t?t(m.label):m.label,disabled:r},m.value))})]}),e.jsxs("div",{className:"col-span-12 sm:col-span-6",children:[e.jsx("label",{className:"block mb-4 font-bold text-[var(--mdn-text-87)] text-[14.4px]",children:t?t("MARKETS.AFFILIATES"):"Saradnici"}),e.jsx("div",{className:"flex flex-col gap-2",children:Me.map(m=>e.jsx(ge,{name:"affiliates_permission",value:m.value,checked:a.affiliates_permission===m.value,onChange:()=>s==null?void 0:s({...a,affiliates_permission:m.value}),label:t?t(m.label):m.label,disabled:r},m.value))})]})]})}),e.jsxs("div",{className:"col-span-12 min-[960px]:col-span-6",children:[e.jsx("label",{className:"block mb-2 font-bold text-[var(--mdn-text-87)] text-[14.4px]",children:t?t("MARKETS.SECTIONS"):"Sekcije"}),e.jsxs("div",{className:"flex w-full flex-wrap gap-12",children:[e.jsx(L,{checked:!!((u=a.sections)!=null&&u.affiliates),onChange:i("affiliates"),label:t?t("LAYOUT.AFFILIATES"):"Saradnici",disabled:r}),e.jsx(L,{checked:!!((h=a.sections)!=null&&h.cashiers),onChange:i("cashiers"),label:t?t("LAYOUT.CASHIERS"):"Blagajnici",disabled:r}),e.jsx(L,{checked:!!((v=a.sections)!=null&&v.advertisers),onChange:i("advertisers"),label:t?t("LAYOUT.REFERRALS"):"Oglašivači",disabled:r})]})]}),e.jsx("div",{className:"flex col-span-12 min-[960px]:col-span-6 items-end",children:e.jsxs("div",{className:"flex w-full justify-between items-end flex-wrap",children:[e.jsx(L,{checked:!!a.enable_multiple_transactions,onChange:m=>s==null?void 0:s({...a,enable_multiple_transactions:m.target.checked}),label:t?t("MARKETS.ENABLE_MULTIPLE_TRANSACTIONS"):"Omogući više transakcija",disabled:r}),e.jsx(L,{checked:!!a.automatic,onChange:m=>s==null?void 0:s({...a,automatic:m.target.checked}),label:t?t("MARKETS.DEFAULT"):"Zadati",labelClassName:"uppercase",disabled:r})]})})]})}function Ts({value:a,onChange:s,disabled:o=!1}){const{t:r}=D(),n=Array.isArray(a==null?void 0:a.revenue_share_sections_active)?a.revenue_share_sections_active:[],t=i=>{const d=n.map((u,h)=>h===i?{...u,value:u.value?0:1}:u);s==null||s({...a,revenue_share_sections_active:d})},_=i=>{const d=Es[i];if(r&&d){const u=r(d);if(u&&u!==d)return u}return i||""};return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"col-span-12",children:[e.jsx("div",{className:"grid grid-cols-1 min-[600px]:grid-cols-2 min-[960px]:grid-cols-4 gap-x-12 gap-y-4",children:n.map((i={},d)=>e.jsx(L,{checked:!!i.value,onChange:u=>t(d),label:_(i==null?void 0:i.name),labelClassName:`${l.checkboxLabel} uppercase`,disabled:o},(i==null?void 0:i.name)??d))}),e.jsxs("p",{className:"mt-4 text-[12px] text-[var(--mdn-green-500)]",children:["*",r?r("MARKET_FORM.REVENUE_SHARE_SECTIONS_FOOTNOTE"):"Za svaku aktivnu sekciju potrebno je definisati podešavanja provizije i dodatne troškove."]})]})})}function fs({value:a,onChange:s,availableSections:o=[],disabled:r=!1,errors:n={},validateField:t,formData:_}){const{t:i}=D(),d=v=>{const x={sport:"Sport",casino:"Casino",ussd:"Ussd",poker:"Poker"}[v];return o.some(N=>N.name===x&&N.value)},u=(v,m)=>x=>{const N=`${v}_${m}`,E=x&&x.target?x.target.value:x;if(s==null||s({...a,[N]:E}),t&&_){const T={..._,[N]:E};t(N,T)}},h=v=>{const m=v.key,x=r||!d(m),N=a[`${m}_payin_tax_active`],E=a[`${m}_gross_tax_active`],T=a[`${m}_admin_fees_active`];return e.jsxs("div",{className:"col-span-12 min-[600px]:col-span-6",children:[e.jsx("h4",{className:"text-[14px] font-bold uppercase mb-4 text-[var(--mdn-text-87)] min-[960px]:ml-6",children:i?i(`${v.label}`):v.labelKey}),e.jsxs("div",{className:"grid grid-cols-12 gap-4",children:[e.jsxs("div",{className:"flex items-start col-span-12 min-[960px]:col-span-5",children:[e.jsx("div",{className:"mr-2 mt
9-9",children:e.jsx(L,{checked:!!N,onChange:S=>s==null?void 0:s({...a,[`${m}_payin_tax_active`]:S.target.checked?1:0}),disabled:x})}),e.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[e.jsx("label",{children:i?i(v.payinTaxLabel):"PLAĆANJE POREZA"}),e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx(M,{value:a[`${m}_payin_tax`]||"",onChange:u(m,"payin_tax"),variant:"outlined",inputClassName:l.input,disabled:!N||x,error:n[`${m}_payin_tax`]}),e.jsx("span",{className:"text-[14px] text-[var(--mdn-text-87)]",children:"%"})]})]})]}),e.jsxs("div",{className:"flex items-start col-span-12 min-[960px]:col-span-5",children:[e.jsx("div",{className:"mr-2 mt-9",children:e.jsx(L,{checked:!!E,onChange:S=>s==null?void 0:s({...a,[`${m}_gross_tax_active`]:S.target.checked?1:0}),disabled:x})}),e.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[e.jsx("label",{children:i?i("MARKETS.GROSS_TAX"):"BRUTO POREZ"}),e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx(M,{value:a[`${m}_gross_tax`]||"",onChange:u(m,"gross_tax"),variant:"outlined",inputClassName:l.input,disabled:!E||x,error:n[`${m}_gross_tax`]}),e.jsx("span",{className:"text-[14px] text-[var(--mdn-text-87)]",children:"%"})]})]})]}),e.jsx("div",{className:"hidden xl:block xl:col-span-5"}),e.jsxs("div",{className:"flex items-start col-span-12 min-[960px]:col-span-5",children:[e.jsx("div",{className:"mr-2 mt-9",children:e.jsx(L,{checked:!!T,onChange:S=>s==null?void 0:s({...a,[`${m}_admin_fees_active`]:S.target.checked?1:0}),disabled:x})}),e.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[e.jsx("label",{children:i?i("MARKETS.ADMIN_FEES"):"ADMINISTRATIVNE NAKNADE"}),e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx(M,{value:a[`${m}_admin_fees`]||"",onChange:u(m,"admin_fees"),variant:"outlined",inputClassName:l.input,disabled:!T||x,error:n[`${m}_admin_fees`]}),e.jsx("span",{className:"text-[14px] text-[var(--mdn-text-87)]",children:"%"})]})]})]})]})]},v.key)};return e.jsx(e.Fragment,{children:xs.map(h)})}function vs({value:a,onChange:s,disabled:o=!1,errors:r={}}){const{t:n}=D(),t=_=>i=>s==null?void 0:s({...a,[_]:i&&i.target?i.target.value:i});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-span-12 sm:col-span-6 md:col-span-4 lg:col-span-2_4",children:e.jsx(M,{label:n?n("MARKET_FORM.MAIL_USERNAME"):"Username",value:a.mail_username,onChange:t("mail_username"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:o,error:r.mail_username})}),e.jsx("div",{className:"col-span-12 sm:col-span-6 md:col-span-4 lg:col-span-2_4",children:e.jsx(M,{label:n?n("MARKET_FORM.MAIL_PASSWORD"):"Password",type:"password",value:a.mail_password,onChange:t("mail_password"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:o,error:r.mail_password})}),e.jsx("div",{className:"col-span-12 sm:col-span-6 md:col-span-4 lg:col-span-2_4",children:e.jsx(M,{label:n?n("MARKET_FORM.MAIL_SERVER"):"Mail server",value:a.mail_server,onChange:t("mail_server"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:o,error:r.mail_server})}),e.jsx("div",{className:"col-span-12 sm:col-span-6 md:col-span-4 lg:col-span-2_4",children:e.jsx(M,{label:n?n("MARKET_FORM.MAIL_SMTP_PORT"):"SMTP Port",type:"number",value:a.mail_smtp_port,onChange:t("mail_smtp_port"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:o,error:r.mail_smtp_port})}),e.jsx("div",{className:"col-span-12 sm:col-span-6 md:col-span-4 lg:col-span-2_4",children:e.jsx(M,{label:n?n("MARKET_FORM.MAIL_ENCRYPTION"):"Encryption",value:a.mail_encryption,onChange:t("mail_encryption"),variant:"outlined",labelClassName:l.label,noLabelBottomMargin:!0,inputClassName:l.input,disabled:o,error:r.mail_encryption})})]})}function gs({value:a,onChange:s,onAddTemplate:o,onChangeTemplate:r,templateTypes:n=[],disabled:t=!1,error:_=""}){const{t:i}=D(),d=a.email_templates||[],[u,h]=f.useState(""),[v,m]=f.useState(""),x=E=>{const T=(n||[]).find(g=>String(g.id)===String(E)),S=(T==null?void 0:T.name)||"",j=(T==null?void 0:T.id)!=null?Number(T.id):E!=null?Number(E):void 0;h(j||"");const b=d.findIndex(g=>{const G=(g==null?void 0:g.template_type_id)??(g==null?void 0:g.template_type),w=typeof G=="number"?G:typeof G=="string"&&/^\d+$/.test(G)?Number(G):void 0;return w!=null&&j!=null?w===j:(g==null?void 0:g.template_type)===S}),F=b!==-1?d[b]:null,P=i?i(`MARKET_FORM.${String(S).toUpperCase()}`):S,$=(V==null?void 0:V[S])||"";F?(m(F.content||""),F.subject||r==null||r(b,F.content||"",P)):(m($),o==null||o(-1,S,P,$,T==null?void 0:T.id))},N=E=>{m(E);const T=d.findIndex(S=>{const j=(S==null?void 0:S.template_type_id)??(S==null?void 0:S.template_type),b=typeof j=="number"?j:typeof j=="string"&&/^\d+$/.test(j)?Number(j):void 0;return b!=null&&u!=null&&u!==""?b===Number(u):!1});T!==-1&&(r==null||r(T,E,d[T].subject))};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-span-12 sm:col-span-4 lg:col-span-3",children:e.jsx(he,{items:(n||[]).map(E=>({id:E.id,name:i?i(`MARKET_FORM.${String(E.name).toUpperCase()}`):E.name})),value:u||"",onChange:x,buttonClassName:l.selectBtn,labels:{placeholder:i?i("MARKETS.CHOOSE_TEMPLATE"):"Izaberi šablon"},disabled:t})}),e.jsx("div",{className:"hidden sm:block sm:col-span-8 lg:col-span-9"}),e.jsxs("div",{className:"col-span-12",children:[e.jsxs("div",{className:"border border-[var(--mdn-border-38)] min-h-[200px]",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-[var(--mdn-border-38)] bg-[var(--mdn-form-input-bg)]",children:[e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-undo text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-redo text-[18px]"})}),e.jsx("span",{className:"mx-2 h-5 w-px bg-[var(--mdn-border-38)]"}),e.jsxs("select",{className:"text-[14px] border-none bg-transparent",children:[e.jsx("option",{children:"Paragraph"}),e.jsx("option",{children:"Heading 1"}),e.jsx("option",{children:"Heading 2"})]}),e.jsx("span",{className:"mx-2 h-5 w-px bg-[var(--mdn-border-38)]"}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded font-bold",children:"B"}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded italic",children:"I"}),e.jsx("span",{className:"mx-2 h-5 w-px bg-[var(--mdn-border-38)]"}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-format-align-left text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-format-align-center text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-format-align-right text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-format-align-justify text-[18px]"})}),e.jsx("span",{className:"mx-2 h-5 w-px bg-[var(--mdn-border-38)]"}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-code-tags text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-image text-[18px]"})})]}
9),e.jsx("textarea",{value:v,onChange:E=>N(E.target.value),className:"w-full min-h-[150px] p-3 resize-y focus:outline-none",disabled:t||!u}),e.jsx("div",{className:"flex items-center justify-end px-3 py-2 border-t border-[var(--mdn-border-38)] bg-[var(--mdn-form-input-bg)]",children:e.jsxs("span",{className:"text-[12px] text-[var(--mdn-text-54)]",children:[v.split(/\s+/).filter(Boolean).length," WORDS POWERED BY TINY"]})})]}),e.jsxs("p",{className:"mt-2 text-[12px] text-[var(--mdn-green-500)]",children:["*",i?i("EXCEPTIONS.AVAILABLE_PARAMS"):"Dostupni parametri",": (market_name), (affiliate_id), (account_balance), (username)"]})]}),_&&e.jsx("div",{className:"col-span-12",children:e.jsx("p",{className:"text-[var(--mdn-red-d2)] text-[14px]",children:_})})]})}function Ns({value:a,onChange:s,disabled:o=!1,error:r=""}){const{t:n}=D(),t=_=>i=>s==null?void 0:s({...a,[_]:i&&i.target?i.target.value:i});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"col-span-12 flex items-center justify-end gap-4",children:[e.jsx("span",{className:l.label,children:n?n("MARKETS.USSD_NUMBER"):"USSD BROJ"}),e.jsx(M,{value:a.ussd_number,onChange:t("ussd_number"),variant:"outlined",inputClassName:`${l.input} w-[200px]`,disabled:o,placeholder:"*1*(affiliate_id)"})]}),e.jsx("div",{className:"col-span-12",children:e.jsxs("div",{className:"border border-[var(--mdn-border-38)] min-h-[150px]",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-[var(--mdn-border-38)] bg-[var(--mdn-form-input-bg)]",children:[e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-undo text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-redo text-[18px]"})}),e.jsx("span",{className:"mx-2 h-5 w-px bg-[var(--mdn-border-38)]"}),e.jsxs("select",{className:"text-[14px] border-none bg-transparent",children:[e.jsx("option",{children:"Paragraph"}),e.jsx("option",{children:"Heading 1"}),e.jsx("option",{children:"Heading 2"})]}),e.jsx("span",{className:"mx-2 h-5 w-px bg-[var(--mdn-border-38)]"}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded font-bold",children:"B"}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded italic",children:"I"}),e.jsx("span",{className:"mx-2 h-5 w-px bg-[var(--mdn-border-38)]"}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-format-align-left text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-format-align-center text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-format-align-right text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-format-align-justify text-[18px]"})}),e.jsx("span",{className:"mx-2 h-5 w-px bg-[var(--mdn-border-38)]"}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-code-tags text-[18px]"})}),e.jsx("button",{type:"button",className:"p-1 hover:bg-gray-200 rounded",children:e.jsx("span",{className:"mdi mdi-image text-[18px]"})})]}),e.jsx("textarea",{value:a.ussd_content,onChange:_=>s==null?void 0:s({...a,ussd_content:_.target.value}),className:"w-full min-h-[100px] p-3 resize-y focus:outline-none",disabled:o})]})}),r&&e.jsx("div",{className:"col-span-12",children:e.jsx("p",{className:"text-[var(--mdn-red-d2)] text-[14px]",children:r})})]})}function Bs({id:a}){const{t:s}=D(),o=Ye(),r=We(),n=Ze(),t=a??(o==null?void 0:o.id)??null,_=!!t,i=!_,{data:d,isFetching:u}=qe(t,{skip:!_,refetchOnFocus:!0,refetchOnReconnect:!0}),{data:h=[]}=ls(),[v,{isLoading:m}]=ze(),[x,{isLoading:N}]=Xe(),[E,T]=f.useState(ae),[S,j]=f.useState(te),[b,F]=f.useState(ne),[P,$]=f.useState(ie),[g,G]=f.useState(re),[w,ce]=f.useState(le),[U,_e]=f.useState(oe),[O,B]=f.useState(Re),[de,pe]=f.useState(""),[q,ue]=f.useState(me),[xe,Ee]=f.useState(ye),[H,Se]=f.useState({}),[k,Ae]=f.useState(Ne);f.useEffect(()=>{const c=ps(d);c&&(T(c.websiteInfo),j(c.permissionSettings),F(c.revenueShareSections),$(c.commissionSettings),G(c.depositorsAndRegistration),ce(c.additionalExpenses),_e(c.mailConfig),B(c.emailTemplates),ue(c.ussdMarketingChannel),Ee(c.activeStatus))},[d]),f.useEffect(()=>{if(!_&&(Array.isArray(O==null?void 0:O.email_templates)?O.email_templates:[]).length===0&&Array.isArray(h)&&h.length>0){const y=h.map(R=>({subject:s?s(`MARKET_FORM.${String(R.name).toUpperCase()}`):R.name,template_type:R.name,template_type_id:R.id,content:(V==null?void 0:V[R.name])||""}));B({email_templates:y})}},[_,h,O,s]);const Ie=()=>r(-1),Oe=_?ms:os,{errors:Te,panelErrors:fe,validateField:z,validateForm:Ke}=es({schema:Oe,labelKeys:cs,PANEL_FIELDS:je,initialPanelErrors:Ne});f.useEffect(()=>{Se(Te)},[Te]),f.useEffect(()=>{Ae(fe)},[fe]);const ke=f.useCallback(c=>
9{T(c),Object.keys(c).forEach(y=>{E[y]!==c[y]&&z(y,{...c,...S,...U})})},[E,S,U,z]),Ce=(c,y,R,Y,K)=>{c===-1&&B(W=>({email_templates:[...W.email_templates,{subject:R,template_type:y,template_type_id:K,content:Y??""}]}))},Le=(c,y,R)=>{B(Y=>{const K=[...Y.email_templates];return K[c]&&(K[c].subject||(K[c].subject=R),K[c].content=y),{email_templates:K}})},Pe=c=>{j(y=>({...y,logo:c}))},Ge=async c=>{var W;if(c.preventDefault(),!await Ke({...E,...S,...b,...P,...g,...w,...q,...U}))return;const R=Array.isArray(O==null?void 0:O.email_templates)?O.email_templates:[];if(R.length>0&&R.some(I=>(I==null?void 0:I.subject)===null||(I==null?void 0:I.content)===null)){Ae(I=>({...I,emailTemplates:!0})),pe(s?s("MARKETS.SET_EMAIL_TEMPLATES"):"Set email templates");return}else de&&pe("");const K={...E,...S,...b,...P,...g,...w,...U,...O,...q,...xe};try{_?(await x({id:t,...K}).unwrap(),n({type:ee.type,payload:{notification:s?s("MESSAGE.UPDATE_MARKET"):"Market updated",notificationColor:"green"}})):(await v(K).unwrap(),n({type:ee.type,payload:{notification:s?s("MESSAGE.CREATE_MARKET"):"Market created",notificationColor:"green"}})),r("/markets")}catch(I){const Z=((W=I==null?void 0:I.data)==null?void 0:W.message)||"COMMON.ERROR",ve=typeof Z=="string"&&Z.includes(".");n({type:ee.type,payload:{notification:ve&&s?s(Z):Z,notificationColor:"red",forTranslation:!s&&ve}})}},we=()=>{var c;(c=d==null?void 0:d.landing_page_settings)!=null&&c.id?r(`/markets/${t}/landing-page/${d.landing_page_settings.id}`):r(`/markets/${t}/landing-page/new`)},De=_?s?s("MARKETS.EDIT_EXISTING_MARKET"):"IZMENA POSTOJEĆEG MARKETA":s?s("MARKETS.ADD_NEW_MARKET"):"DODAJ NOVI MARKET",Fe=b.revenue_share_sections_active||[],Ue=c=>String(c&&(c.name??c.key)||"").toLowerCase(),He=c=>c===1||c==="1"||c===!0,Ve=Fe.some(c=>Ue(c)==="ussd"&&He(c==null?void 0:c.value));let X="";try{X="true"}catch{}!X&&typeof window<"u"&&(X=window.MIX_SHOW_USSD||window.VITE_SHOW_USSD);const $e=["true","1","yes","on"].includes(String(X).trim().toLowerCase())&&Ve;return e.jsxs("div",{className:"px-4 pb-4 pt-[6px] md:px-6 md:pb-6 md:pt-[14px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h1",{className:"font-normal text-[14.4px] text-[var(--mdn-text-87)] uppercase",children:De}),_&&e.jsx(Je,{variant:"text",className:"text-[var(--mdn-text-87)] cursor-pointer text-[14px] rounded-none bg-[var(--mdn-market-landing-btn-bg)] shadow-[0px_3px_1px_-2px_rgba(0,0,0,0.2),0px_2px_2px_0px_rgba(0,0,0,0.14),0px_1px_5px_0px_rgba(0,0,0,0.12)] hover:bg-[var(--mdn-market-landing-btn-hover)]",onClick:we,children:s?s("MARKETS.MARKET_LANDING_PAGE"):"ODREDIŠNA STRANICA MARKETA"})]}),e.jsxs("form",{onSubmit:Ge,children:[e.jsx(C,{title:s?s("MARKETS.WEBSITE_INFO"):"VEB STRANICA INFORMACIJE",headerContainerClassName:l.panelHeader,titleClassName:l.panelTitle,collapsible:!0,defaultExpanded:!0,hasError:k.websiteInfo,children:e.jsx(Ss,{value:E,onChange:ke,isEdit:_,errors:H})}),e.jsx(C,{title:e.jsxs("div",{className:"flex w-full min-[961px]:flex-row flex-wrap gap-y-2",children:[e.jsx("span",{className:"w-full min-[961px]:w-1/2 max-[961px]:pt-2",children:s?s("MARKETS.SYSTEM_SETTINGS"):"PODEŠAVANJE SISTEMA"}),e.jsx("span",{className:"w-full min-[961px]:w-1/2 min-[961px]:pl-4 max-[961px]:pb-2",children:s?s("MARKETS.PERMISSION_SETTINGS"):"PODEŠAVANJE DOZVOLA"})]}),headerContainerClassName:l.panelHeader,titleClassName:l.panelTitle,collapsible:!0,defaultExpanded:i,hasError:k.permissionSettings,children:e.jsx(As,{value:S,onChange:j,onImageUpload:Pe,errors:H})}),e.jsx(C,{title:s?s("MARKETS.REVENUE_SHARE_SECTIONS"):"SEKCIJE UDELA U ZARADI",headerContainerClassName:l.panelHeader,titleClassName:l.panelTitle,collapsible:!0,defaultExpanded:i,hasError:k.revenueShareSections,children:e.jsx(Ts,{value:b,onChange:F})}),e.jsx(C,{title:s?s("MARKETS.COMMISSION_AND_CPA_DEAL_SETTINGS"):"PODEŠAVANJA PROVIZIJE I CPA DOGOVORA",headerContainerClassName:l.panelHeader,titleClassName:l.panelTitle,collapsible:!0,defaultExpanded:i,hasError:k.commissionSettings,children:e.jsx(ss,{value:P,onChange:$,availableSections:b.revenue_share_sections_active,disabled:!1,isAff:!1,errors:H,onClearError:c=>Se(y=>{const R={...y};return delete R[c],R})})}),e.jsx(C,{title:s?s("MARKETS.FIRST_DEPOSITORS_AND_REGISTRATION_SETTINGS"):"PODEŠAVANJA PRVOG DEPOZITA I REGISTRACIJE",headerContainerClassName:l.panelHeader,titleClassName:l.panelTitle,collapsible:!0,defaultExpanded:i,hasError:k.depositorsAndRegistration,children:e.jsx(ns,{value:g,onChange:G,errors:H,validateField:z,formData:{...E,...S,...b,...P,...g,...w,...U,...q}})}),e.jsx(C,{title:s?s("MARKETS.ADDITIONAL_EXPENSES"):"DODATNI TROŠKOVI",headerContainerClassName:l.panelHeader,titleClassName:l.panelTitle,collapsible:!0,defaultExpanded:i,hasError:k.additionalExpenses,children:e.jsx(fs,{value:w,onChange:ce,availableSections:b.revenue_share_sections_active,errors:H,validateField:z,formData:{...E,...S,...b,...P,...g,...w,...U,...q}})}),e.jsx(C,{title:s?s("MARKETS.MAIL_CONFIG"):"MAIL PODEŠAVANJA",headerContainerClassName:l.panelHeader,titleClassName:l.panelTitle,collapsible:!0,defaultExpanded:i,hasError:k.mailConfig,children:e.jsx(vs,{value:U,onChange:_e,errors:H})}),e.jsx(C,{title:s?s("MARKETS.EMAILS_TEMPLATES"):"ŠABLONI E-ADRESA",headerContainerClassName:l.panelHeader,titleClassName:l.panelTitle,collapsible:!0,defaultExpanded:i,hasError:k.emailTemplates,children:e.jsx(gs,{value:O,onChange:B,onAddTemplate:Ce,onChangeTemplate:Le,templateTypes:h,error:de})}),$e&&e.jsx(C,{title:s?s("MARKETS.USSD_MARKETING_CHANNEL"):"USSD MARKETING KA
9NAL",headerContainerClassName:l.panelHeader,titleClassName:l.panelTitle,collapsible:!0,defaultExpanded:i,hasError:k.ussdMarketingChannel,children:e.jsx(Ns,{value:q,onChange:ue})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 mt-6",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsx(Qe,{checked:!!xe.active,onChange:c=>Ee({active:c?1:0}),label:s?s("MARKETS.ACTIVE"):"AKTIVNO"})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("button",{type:"button",onClick:Ie,className:l.btnCancel,children:s?s("MARKETS.CANCEL"):"OTKAŽI"}),e.jsx("button",{type:"submit",disabled:m||N||u,className:l.btnSave,children:s?s("MARKETS.SAVE"):"SAČUVAJ"})]})]})]})]})}export{Bs as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.