"use strict";!function(e){foswiki.jsonRpc=function(n){return e.jsonRpc(foswiki.getScriptUrl("jsonrpc"),n)},e.jsonRpc=function(n,o){var s=function(e){var n={jsonrpc:"2.0",method:e.method};return void 0!==e.params&&(n.params=e.params),void 0!==e.id&&(n.id=e.id),void 0!==foswiki.eventClient&&void 0===n.params.clientId&&(n.params.clientId=foswiki.eventClient.id),n}(o),r=n,t=!0;return void 0!==o.namespace&&(r+="/"+o.namespace),void 0!==o.async&&(t=o.async),e.ajax({type:"POST",dataType:"json",url:r,data:JSON.stringify(s),contentType:"application/json",processData:!1,cache:!1,async:t,beforeSend:function(e){"function"==typeof o.beforeSend&&o.beforeSend.call(o,e)},error:function(e,n,s){var r;"function"==typeof o.error&&(r=404==e.status?{jsonrpc:"2.0",error:{code:e.status,message:n}}:JSON.parse(e.responseText),o.error.call(o,r,n,e))},success:function(e,n,s){"function"==typeof o.success&&o.success.call(o,e,n,s)}})}}(jQuery);
