import{dasg,fasl}from"./format-money-e259f5e4.js";import{Gasp}from"./get-3bb14de5.js";import{pasf}from"./parse-downloaded-splits-4afea167.js";import{dasr,easm,sasw,fasy,gasb,lasv,aasA,basC,casS,hasD,iasu,jasc}from"./autocomplete-functions-ac0d2cb1.js";import{masP,iasa}from"./vendor-fca45885.js";import"./create-empty-split-fb5bda92.js";import"./get-da167d5b.js";consti=D();letL=function(){return{entries:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"edit",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},filters:{source:[],destination:[]},addedSplit(){setTimeout(()=>{constt=function(e,n,s){returne.name_with_balance+'<br><small class="text-muted">'+a.t("firefly.account_type_"+e.type)+"</small>"};r({selector:"input.ac-source",serverUrl:i.account,filters:this.filters.source,onRenderItem:t,onChange:m,onSelectItem:w}),console.log("ok"),console.log(this.entries[0].source_account.alpine_name),r({selector:"input.ac-dest",serverUrl:i.account,filters:this.filters.destination,onRenderItem:t,onChange:y,onSelectItem:b}),r({selector:"input.ac-category",serverUrl:i.category,valueField:"id",labelField:"name",onChange:u,onSelectItem:u}),r({selector:"input.ac-description",serverUrl:i.description,valueField:"id",labelField:"description",onChange:c,onSelectItem:c})},250)},changedDateTime(t){console.warn("changedDateTime, event is not used")},changedDescription(t){console.warn("changedDescription, event is not used")},changedDestinationAccount(t){console.warn("changedDestinationAccount, event is not used")},changedSourceAccount(t){console.warn("changedSourceAccount, event is not used")},formattedTotalAmount(){returnthis.entries.length===0?l(this.groupProperties.totalAmount,"EUR"):l(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},getTags(t){returnconsole.log("at get tags "+t),console.log(this.entries[t].tags),this.entries[t].tags??[]},getTransactionGroup(){this.entries=[];constt=window.location.href.split("/"),e=parseInt(t[t.length-1]);newp().show(e,{}).then(s=>{consto=s.data.data;this.groupProperties.id=parseInt(o.id),this.groupProperties.transactionType=o.attributes.transactions[0].type,this.groupProperties.title=o.attributes.title??o.attributes.transactions[0].description,this.entries=f(o.attributes.transactions),this.notifications.wait.show=!1}).then(()=>{this.groupProperties.totalAmount=0;for(letsinthis.entries)this.entries.hasOwnProperty(s)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[s].amount),this.filters.source.push(this.entries[s].source_account.type),this.filters.destination.push(this.entries[s].source_account.type));console.log(this.filters),setTimeout(()=>{P.init("select.ac-tags",{allowClear:!0,server:i.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:a.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}})},150)})},init(){this.notifications.wait.show=!0,this.notifications.wait.text=a.t("firefly.wait_loading_transaction"),this.getTransactionGroup(),v().then(t=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=t.defaultCurrency,this.formData.enabledCurrencies=t.enabledCurrencies,this.formData.nativeCurrencies=t.nativeCurrencies,this.formData.foreignCurrencies=t.foreignCurrencies}),A().then(t=>{this.formData.budgets=t,this.formStates.loadingBudgets=!1}),C().then(t=>{this.formData.piggyBanks=t,this.formStates.loadingPiggyBanks=!1}),S().then(t=>{this.formData.subscriptions=t,this.formStates.loadingSubscriptions=!1}),document.addEventListen