!function(P,j,n){"use strict";functionC(e){returnnull!==e&&e===e.window}functionE(e){return"function"==typeofe&&"number"!=typeofe.nodeType}j=void0!==j&&j.Math===Math?j:globalThis,P.fn.api=function(x){varA,e=E(this)?P(j):P(this),k=Date.now(),S=[],T=x,w="string"==typeofT,D=[].slice.call(arguments,1),O=function(e,t){varr;return0<=[j,n].indexOf(e)?r=P(e):0===(r=P(t.document).find(e)).length&&(r=t.frameElement?O(e,t.parent):j),r};returne.each(function(){vara,n,r,e,i,o,s=P.isPlainObject(x)?P.extend(!0,{},P.fn.api.settings,x):P.extend({},P.fn.api.settings),f=s.regExp,t=s.namespace,u=s.metadata,c=s.selector,d=s.error,l=s.className,p="."+t,g="module-"+t,m=P(this),v=m.closest(c.form),b=s.stateContext?O(s.stateContext,j):m,h=this,y=b[0],R=m.data(g),q={initialize:function(){w||(o=s.data,q.bind.events()),q.instantiate()},instantiate:function(){q.verbose("Storing instance of module",q),R=q,m.data(g,R)},destroy:function(){q.verbose("Destroying previous module for",h),m.removeData(g).off(p)},bind:{events:function(){vare=q.get.event();e?(q.verbose("Attaching API events to element",e),m.on(e+p,q.event.trigger)):"now"===s.on&&(q.debug("Querying API endpoint immediately"),q.query())}},decode:{json:function(e){if(void0!==e&&"string"==typeofe)try{e=JSON.parse(e)}catch(e){}returne}},read:{cachedResponse:function(e){vart;if(void0!==j.Storage)returnt=sessionStorage.getItem(e+q.get.normalizedData()),q.debug("Using cached response",e,s.data,t),q.decode.json(t);q.error(d.noStorage)}},write:{cachedResponse:function(e,t){void0===j.Storage?q.error(d.noStorage):(P.isPlainObject(t)&&(t=JSON.stringify(t)),sessionStorage.setItem(e+q.get.normalizedData(),t),q.verbose("Storing cached response for url",e,s.data,t))}},query:function(){if(q.is.disabled())q.debug("Element is disabled API request aborted");else{if(q.is.loading()){if(!s.interruptRequests)returnvoidq.debug("Cancelling request, previous request is still pending");q.debug("Interrupting previous request"),q.abort()}if(s.defaultData&&P.extend(!0,s.urlData,q.get.defaultData()),s.serializeForm&&(s.data=q.add.formData(o||s.data)),!1===(n=q.get.settings()))returnq.cancelled=!0,voidq.error(d.beforeSend);if(q.cancelled=!1,(r=q.get.templatedURL())||q.is.mocked()){if((r=q.add.urlData(r))||q.is.mocked()){if(n.url=s.base+r,a=P.extend(!0,{},s,{type:s.method||s.type,data:e,url:s.base+r,beforeSend:s.beforeXHR,success:function(){},failure:function(){},complete:function(){}}),q.debug("Querying URL",a.url),q.verbose("Using AJAX settings",a),"local"===s.cache&&q.read.cachedResponse(r))returnq.debug("Response returned from local cache"),q.request=q.create.request(),voidq.request.resolveWith(y,[q.read.cachedResponse(r)]);s.throttle?s.throttleFirstRequest||q.timer?(q.debug("Throttling request",s.throttle),clearTimeout(q.timer),q.timer=setTimeout(function(){q.timer&&deleteq.timer,q.debug("Sending throttled request",e,a.method),q.send.request()},s.throttle)):(q.debug("Sending request",e,a.method),q.send.request(),q.timer=setTimeout(function(){},s.throttle)):(q.debug("Sending request",e,a.method),q.send.request())}}elseq.error(d.missingURL)}},should:{removeError:function(){return!0===s.hideError||"auto"===s.hideError&&!q.is.form()}},is:{disabled:function(){return0<m.filter(c.disabled).length},expectingJSON:function(){return"json"===s.dataType||"jsonp"===s.dataType},form:function(){returnm.is("form")||b.is("form")},mocked:function(){returns.mockResponse||s.mockResponseAsync||s.response||s.responseAsync},input:function(){returnm.is("input")},loading:function(){return!!q.request&&"pending"===q.request.state()},abortedRequest:function(e){returne&&void0!==e.readyState&&0===e.readyState?(q.verbose("XHR request determined to be aborted"),!0):(q.verbose("XHR request was not aborted"),!1)},validResponse:function(e){returnq.is.expectingJSON()&&E(s.successTest)?(q.debug("Checking JSON returned success",s.successTest,e),s.successTest(e)?(q.debug("Response passed success test",e),!0):(q.debug("Response failed success test",e),!1)):(q.verbose("Response is not JSON, skipping validation",s.successTest,e)