/*! phoscon-app 2023-07-31 */

function bbInitUserParameters(){var UserParameter=Backbone.Model.extend({idAttribute:"_id",parse:function(response,options){return Array.isArray(response)&&1===response.length&&response[0].success?(response[0].success.id&&this.set({_id:response[0].success.id}),{}):response},sync:function(method,model,options){if("patch"===method&&(method="update"),"update"===method||"create"===method){let o={};_.map(model.toJSON(),(val,key)=>{"_id"!==key&&"id"!==key&&isNaN(key[0])&&(o[key]=val)}),options.data=JSON.stringify(o)}return Backbone.sync(method,model,options)}});app.UserParametersCollection=Backbone.Collection.extend({name:"userparameters",model:UserParameter,url:"//"+app.session.gw+"/api/"+app.apikey+"/userparameter",parse:function(response,options){let arr=[];return _.map(response,(item,id)=>{try{let o=JSON.parse(item);o._id=id,arr.push(o)}catch(e){console.log(e)}}),arr}}),app.userParameters=new app.UserParametersCollection}