=0&&(z+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-M-z-c-.5))||0),z+r}function at(e,t,n){var o=Ke(e),p=(!d.boxSizingReliable()||n)&&"border-box"===g.css(e,"boxSizing",!1,o),M=p,b=Je(e,t,o),c="offset"+t[0].toUpperCase()+t.slice(1);if(Ve.test(b)){if(!n)return b;b="auto"}return(!d.boxSizingReliable()&&p||!d.reliableTrDimensions()&&_(e,"tr")||"auto"===b||!parseFloat(b)&&"inline"===g.css(e,"display",!1,o))&&e.getClientRects().length&&(p="border-box"===g.css(e,"boxSizing",!1,o),(M=c in e)&&(b=e[c])),(b=parseFloat(b)||0)+rt(e,t,n||(p?"border":"content"),M,o,b)+"px"}function it(e,t,n,o,p){return new it.prototype.init(e,t,n,o,p)}g.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Je(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,o){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var p,M,b,c=pe(t),z=Ye.test(t),r=e.style;if(z||(t=pt(c)),b=g.cssHooks[t]||g.cssHooks[c],void 0===n)return b&&"get"in b&&void 0!==(p=b.get(e,!1,o))?p:r[t];"string"===(M=typeof n)&&(p=se.exec(n))&&p[1]&&(n=qe(e,t,p),M="number"),null!=n&&n==n&&("number"!==M||z||(n+=p&&p[3]||(g.cssNumber[c]?"":"px")),d.clearCloneStyle||""!==n||0!==t.indexOf("background")||(r[t]="inherit"),b&&"set"in b&&void 0===(n=b.set(e,n,o))||(z?r.setProperty(t,n):r[t]=n))}},css:function(e,t,n,o){var p,M,b,c=pe(t);return Ye.test(t)||(t=pt(c)),(b=g.cssHooks[t]||g.cssHooks[c])&&"get"in b&&(p=b.get(e,!0,n)),void 0===p&&(p=Je(e,t,o)),"normal"===p&&t in ct&&(p=ct[t]),""===n||n?(M=parseFloat(p),!0===n||isFinite(M)?M||0:p):p}}),g.each(["height","width"],(function(e,t){g.cssHooks[t]={get:function(e,n,o){if(n)return!Mt.test(g.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?at(e,t,o):Ze(e,bt,(function(){return at(e,t,o)}))},set:function(e,n,o){var p,M=Ke(e),b=!d.scrollboxSize()&&"absolute"===M.position,c=(b||o)&&"border-box"===g.css(e,"boxSizing",!1,M),z=o?rt(e,t,o,c,M):0;return c&&b&&(z-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(M[t])-rt(e,t,"border",!1,M)-.5)),z&&(p=se.exec(n))&&"px"!==(p[3]||"px")&&(e.style[t]=n,n=g.css(e,t)),zt(0,n,z)}}})),g.cssHooks.marginLeft=et(d.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(Je(e,"marginLeft"))||e.getBoundingClientRect().left-Ze(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),g.each({margin:"",padding:"",border:"Width"},(function(e,t){g.cssHooks[e+t]={expand:function(n){for(var o=0,p={},M="string"==typeof n?n.split(" "):[n];o<4;o++)p[e+Ae[o]+t]=M[o]||M[o-2]||M[0];return p}},"margin"!==e&&(g.cssHooks[e+t].set=zt)})),g.fn.extend({css:function(e,t){return ee(this,(function(e,t,n){var o,p,M={},b=0;if(Array.isArray(t)){for(o=Ke(e),p=t.length;b1)}}),g.Tween=it,it.prototype={constructor:it,init:function(e,t,n,o,p,M){this.elem=e,this.prop=n,this.easing=p||g.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=o,this.unit=M||(g.cssNumber[n]?"":"px")},cur:function(){var e=it.propHooks[this.prop];return e&&e.get?e.get(this):it.propHooks._default.get(this)},run:function(e){var t,n=it.propHooks[this.prop];return this.options.duration?this.pos=t=g.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):it.propHooks._default.set(this),this}},it.prototype.init.prototype=it.prototype,it.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=g.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){g.fx.step[e.prop]?g.fx.step[e.prop](e):1!==e.elem.nodeType||!g.cssHooks[e.prop]&&null==e.elem.style[pt(e.prop)]?e.elem[e.prop]=e.now:g.style(e.elem,e.prop,e.now+e.unit)}}},it.propHooks.scrollTop=it.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},g.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},g.fx=it.prototype.init,g.fx.step={};var Ot,st,At=/^(?:toggle|show|hide)$/,ut=/queueHooks$/;function dt(){st&&(!1===q.hidden&&o.requestAnimationFrame?o.requestAnimationFrame(dt):o.setTimeout(dt,g.fx.interval),g.fx.tick())}function lt(){return o.setTimeout((function(){Ot=void 0})),Ot=Date.now()}function ft(e,t){var n,o=0,p={height:e};for(t=t?1:0;o<4;o+=2-t)p["margin"+(n=Ae[o])]=p["padding"+n]=e;return t&&(p.opacity=p.width=e),p}function qt(e,t,n){for(var o,p=(Wt.tweeners[t]||[]).concat(Wt.tweeners["*"]),M=0,b=p.length;M1)},removeAttr:function(e){return this.each((function(){g.removeAttr(this,e)}))}}),g.extend({attr:function(e,t,n){var o,p,M=e.nodeType;if(3!==M&&8!==M&&2!==M)return void 0===e.getAttribute?g.prop(e,t,n):(1===M&&g.isXMLDoc(e)||(p=g.attrHooks[t.toLowerCase()]||(g.expr.match.bool.test(t)?ht:void 0)),void 0!==n?null===n?void g.removeAttr(e,t):p&&"set"in p&&void 0!==(o=p.set(e,n,t))?o:(e.setAttribute(t,n+""),n):p&&"get"in p&&null!==(o=p.get(e,t))?o:null==(o=g.find.attr(e,t))?void 0:o)},attrHooks:{type:{set:function(e,t){if(!d.radioValue&&"radio"===t&&_(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,o=0,p=t&&t.match($);if(p&&1===e.nodeType)for(;n=p[o++];)e.removeAttribute(n)}}),ht={set:function(e,t,n){return!1===t?g.removeAttr(e,n):e.setAttribute(n,n),n}},g.each(g.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=vt[t]||g.find.attr;vt[t]=function(e,t,o){var p,M,b=t.toLowerCase();return o||(M=vt[b],vt[b]=p,p=null!=n(e,t,o)?b:null,vt[b]=M),p}}));var Rt=/^(?:input|select|textarea|button)$/i,mt=/^(?:a|area)$/i;function gt(e){return(e.match($)||[]).join(" ")}function Lt(e){return e.getAttribute&&e.getAttribute("class")||""}function _t(e){return Array.isArray(e)?e:"string"==typeof e&&e.match($)||[]}g.fn.extend({prop:function(e,t){return ee(this,g.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[g.propFix[e]||e]}))}}),g.extend({prop:function(e,t,n){var o,p,M=e.nodeType;if(3!==M&&8!==M&&2!==M)return 1===M&&g.isXMLDoc(e)||(t=g.propFix[t]||t,p=g.propHooks[t]),void 0!==n?p&&"set"in p&&void 0!==(o=p.set(e,n,t))?o:e[t]=n:p&&"get"in p&&null!==(o=p.get(e,t))?o:e[t]},propHooks:{tabIndex:{get:function(e){var t=g.find.attr(e,"tabindex");return t?parseInt(t,10):Rt.test(e.nodeName)||mt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),d.optSelected||(g.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),g.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){g.propFix[this.toLowerCase()]=this})),g.fn.extend({addClass:function(e){var t,n,o,p,M,b;return l(e)?this.each((function(t){g(this).addClass(e.call(this,t,Lt(this)))})):(t=_t(e)).length?this.each((function(){if(o=Lt(this),n=1===this.nodeType&&" "+gt(o)+" "){for(M=0;M-1;)n=n.replace(" "+p+" "," ");b=gt(n),o!==b&&this.setAttribute("class",b)}})):this:this.attr("class","")},toggleClass:function(e,t){var n,o,p,M,b=typeof e,c="string"===b||Array.isArray(e);return l(e)?this.each((function(n){g(this).toggleClass(e.call(this,n,Lt(this),t),t)})):"boolean"==typeof t&&c?t?this.addClass(e):this.removeClass(e):(n=_t(e),this.each((function(){if(c)for(M=g(this),p=0;p-1)return!0;return!1}});var Nt=/\r/g;g.fn.extend({val:function(e){var t,n,o,p=this[0];return arguments.length?(o=l(e),this.each((function(n){var p;1===this.nodeType&&(null==(p=o?e.call(this,n,g(this).val()):e)?p="":"number"==typeof p?p+="":Array.isArray(p)&&(p=g.map(p,(function(e){return null==e?"":e+""}))),(t=g.valHooks[this.type]||g.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,p,"value")||(this.value=p))}))):p?(t=g.valHooks[p.type]||g.valHooks[p.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(p,"value"))?n:"string"==typeof(n=p.value)?n.replace(Nt,""):null==n?"":n:void 0}}),g.extend({valHooks:{option:{get:function(e){var t=g.find.attr(e,"value");return null!=t?t:gt(g.text(e))}},select:{get:function(e){var t,n,o,p=e.options,M=e.selectedIndex,b="select-one"===e.type,c=b?null:[],z=b?M+1:p.length;for(o=M<0?z:b?M:0;o-1)&&(n=!0);return n||(e.selectedIndex=-1),M}}}}),g.each(["radio","checkbox"],(function(){g.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=g.inArray(g(e).val(),t)>-1}},d.checkOn||(g.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var yt=o.location,Tt={guid:Date.now()},Et=/\?/;g.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new o.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||g.error("Invalid XML: "+(n?g.map(n.childNodes,(function(e){return e.textContent})).join("\n"):e)),t};var Bt=/^(?:focusinfocus|focusoutblur)$/,Ct=function(e){e.stopPropagation()};g.extend(g.event,{trigger:function(e,t,n,p){var M,b,c,z,r,a,i,O,A=[n||q],u=s.call(e,"type")?e.type:e,d=s.call(e,"namespace")?e.namespace.split("."):[];if(b=O=c=n=n||q,3!==n.nodeType&&8!==n.nodeType&&!Bt.test(u+g.event.triggered)&&(u.indexOf(".")>-1&&(d=u.split("."),u=d.shift(),d.sort()),r=u.indexOf(":")<0&&"on"+u,(e=e[g.expando]?e:new g.Event(u,"object"==typeof e&&e)).isTrigger=p?2:3,e.namespace=d.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:g.makeArray(t,[e]),i=g.event.special[u]||{},p||!i.trigger||!1!==i.trigger.apply(n,t))){if(!p&&!i.noBubble&&!f(n)){for(z=i.delegateType||u,Bt.test(z+u)||(b=b.parentNode);b;b=b.parentNode)A.push(b),c=b;c===(n.ownerDocument||q)&&A.push(c.defaultView||c.parentWindow||o)}for(M=0;(b=A[M++])&&!e.isPropagationStopped();)O=b,e.type=M>1?z:i.bindType||u,(a=(ce.get(b,"events")||Object.create(null))[e.type]&&ce.get(b,"handle"))&&a.apply(b,t),(a=r&&b[r])&&a.apply&&Me(b)&&(e.result=a.apply(b,t),!1===e.result&&e.preventDefault());return e.type=u,p||e.isDefaultPrevented()||i._default&&!1!==i._default.apply(A.pop(),t)||!Me(n)||r&&l(n[u])&&!f(n)&&((c=n[r])&&(n[r]=null),g.event.triggered=u,e.isPropagationStopped()&&O.addEventListener(u,Ct),n[u](),e.isPropagationStopped()&&O.removeEventListener(u,Ct),g.event.triggered=void 0,c&&(n[r]=c)),e.result}},simulate:function(e,t,n){var o=g.extend(new g.Event,n,{type:e,isSimulated:!0});g.event.trigger(o,null,t)}}),g.fn.extend({trigger:function(e,t){return this.each((function(){g.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return g.event.trigger(e,t,n,!0)}});var Xt=/\[\]$/,wt=/\r?\n/g,St=/^(?:submit|button|image|reset|file)$/i,xt=/^(?:input|select|textarea|keygen)/i;function kt(e,t,n,o){var p;if(Array.isArray(t))g.each(t,(function(t,p){n||Xt.test(e)?o(e,p):kt(e+"["+("object"==typeof p&&null!=p?t:"")+"]",p,n,o)}));else if(n||"object"!==v(t))o(e,t);else for(p in t)kt(e+"["+p+"]",t[p],n,o)}g.param=function(e,t){var n,o=[],p=function(e,t){var n=l(t)?t():t;o[o.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!g.isPlainObject(e))g.each(e,(function(){p(this.name,this.value)}));else for(n in e)kt(n,e[n],t,p);return o.join("&")},g.fn.extend({serialize:function(){return g.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=g.prop(this,"elements");return e?g.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!g(this).is(":disabled")&&xt.test(this.nodeName)&&!St.test(e)&&(this.checked||!ge.test(e))})).map((function(e,t){var n=g(this).val();return null==n?null:Array.isArray(n)?g.map(n,(function(e){return{name:t.name,value:e.replace(wt,"\r\n")}})):{name:t.name,value:n.replace(wt,"\r\n")}})).get()}});var It=/%20/g,Dt=/#.*$/,Pt=/([?&])_=[^&]*/,jt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ut=/^(?:GET|HEAD)$/,Ht=/^\/\//,Ft={},Gt={},$t="*/".concat("*"),Vt=q.createElement("a");function Yt(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var o,p=0,M=t.toLowerCase().match($)||[];if(l(n))for(;o=M[p++];)"+"===o[0]?(o=o.slice(1)||"*",(e[o]=e[o]||[]).unshift(n)):(e[o]=e[o]||[]).push(n)}}function Kt(e,t,n,o){var p={},M=e===Gt;function b(c){var z;return p[c]=!0,g.each(e[c]||[],(function(e,c){var r=c(t,n,o);return"string"!=typeof r||M||p[r]?M?!(z=r):void 0:(t.dataTypes.unshift(r),b(r),!1)})),z}return b(t.dataTypes[0])||!p["*"]&&b("*")}function Zt(e,t){var n,o,p=g.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((p[n]?e:o||(o={}))[n]=t[n]);return o&&g.extend(!0,e,o),e}Vt.href=yt.href,g.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(yt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":g.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Zt(Zt(e,g.ajaxSettings),t):Zt(g.ajaxSettings,e)},ajaxPrefilter:Yt(Ft),ajaxTransport:Yt(Gt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,p,M,b,c,z,r,a,i,O,s=g.ajaxSetup({},t),A=s.context||s,u=s.context&&(A.nodeType||A.jquery)?g(A):g.event,d=g.Deferred(),l=g.Callbacks("once memory"),f=s.statusCode||{},W={},h={},v="canceled",R={readyState:0,getResponseHeader:function(e){var t;if(r){if(!b)for(b={};t=jt.exec(M);)b[t[1].toLowerCase()+" "]=(b[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=b[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return r?M:null},setRequestHeader:function(e,t){return null==r&&(e=h[e.toLowerCase()]=h[e.toLowerCase()]||e,W[e]=t),this},overrideMimeType:function(e){return null==r&&(s.mimeType=e),this},statusCode:function(e){var t;if(e)if(r)R.always(e[R.status]);else for(t in e)f[t]=[f[t],e[t]];return this},abort:function(e){var t=e||v;return n&&n.abort(t),m(0,t),this}};if(d.promise(R),s.url=((e||s.url||yt.href)+"").replace(Ht,yt.protocol+"//"),s.type=t.method||t.type||s.method||s.type,s.dataTypes=(s.dataType||"*").toLowerCase().match($)||[""],null==s.crossDomain){z=q.createElement("a");try{z.href=s.url,z.href=z.href,s.crossDomain=Vt.protocol+"//"+Vt.host!=z.protocol+"//"+z.host}catch(e){s.crossDomain=!0}}if(s.data&&s.processData&&"string"!=typeof s.data&&(s.data=g.param(s.data,s.traditional)),Kt(Ft,s,t,R),r)return R;for(i in(a=g.event&&s.global)&&0==g.active++&&g.event.trigger("ajaxStart"),s.type=s.type.toUpperCase(),s.hasContent=!Ut.test(s.type),p=s.url.replace(Dt,""),s.hasContent?s.data&&s.processData&&0===(s.contentType||"").indexOf("application/x-www-form-urlencoded")&&(s.data=s.data.replace(It,"+")):(O=s.url.slice(p.length),s.data&&(s.processData||"string"==typeof s.data)&&(p+=(Et.test(p)?"&":"?")+s.data,delete s.data),!1===s.cache&&(p=p.replace(Pt,"$1"),O=(Et.test(p)?"&":"?")+"_="+Tt.guid+++O),s.url=p+O),s.ifModified&&(g.lastModified[p]&&R.setRequestHeader("If-Modified-Since",g.lastModified[p]),g.etag[p]&&R.setRequestHeader("If-None-Match",g.etag[p])),(s.data&&s.hasContent&&!1!==s.contentType||t.contentType)&&R.setRequestHeader("Content-Type",s.contentType),R.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+("*"!==s.dataTypes[0]?", "+$t+"; q=0.01":""):s.accepts["*"]),s.headers)R.setRequestHeader(i,s.headers[i]);if(s.beforeSend&&(!1===s.beforeSend.call(A,R,s)||r))return R.abort();if(v="abort",l.add(s.complete),R.done(s.success),R.fail(s.error),n=Kt(Gt,s,t,R)){if(R.readyState=1,a&&u.trigger("ajaxSend",[R,s]),r)return R;s.async&&s.timeout>0&&(c=o.setTimeout((function(){R.abort("timeout")}),s.timeout));try{r=!1,n.send(W,m)}catch(e){if(r)throw e;m(-1,e)}}else m(-1,"No Transport");function m(e,t,b,z){var i,O,q,W,h,v=t;r||(r=!0,c&&o.clearTimeout(c),n=void 0,M=z||"",R.readyState=e>0?4:0,i=e>=200&&e<300||304===e,b&&(W=function(e,t,n){for(var o,p,M,b,c=e.contents,z=e.dataTypes;"*"===z[0];)z.shift(),void 0===o&&(o=e.mimeType||t.getResponseHeader("Content-Type"));if(o)for(p in c)if(c[p]&&c[p].test(o)){z.unshift(p);break}if(z[0]in n)M=z[0];else{for(p in n){if(!z[0]||e.converters[p+" "+z[0]]){M=p;break}b||(b=p)}M=M||b}if(M)return M!==z[0]&&z.unshift(M),n[M]}(s,R,b)),!i&&g.inArray("script",s.dataTypes)>-1&&g.inArray("json",s.dataTypes)<0&&(s.converters["text script"]=function(){}),W=function(e,t,n,o){var p,M,b,c,z,r={},a=e.dataTypes.slice();if(a[1])for(b in e.converters)r[b.toLowerCase()]=e.converters[b];for(M=a.shift();M;)if(e.responseFields[M]&&(n[e.responseFields[M]]=t),!z&&o&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),z=M,M=a.shift())if("*"===M)M=z;else if("*"!==z&&z!==M){if(!(b=r[z+" "+M]||r["* "+M]))for(p in r)if((c=p.split(" "))[1]===M&&(b=r[z+" "+c[0]]||r["* "+c[0]])){!0===b?b=r[p]:!0!==r[p]&&(M=c[0],a.unshift(c[1]));break}if(!0!==b)if(b&&e.throws)t=b(t);else try{t=b(t)}catch(e){return{state:"parsererror",error:b?e:"No conversion from "+z+" to "+M}}}return{state:"success",data:t}}(s,W,R,i),i?(s.ifModified&&((h=R.getResponseHeader("Last-Modified"))&&(g.lastModified[p]=h),(h=R.getResponseHeader("etag"))&&(g.etag[p]=h)),204===e||"HEAD"===s.type?v="nocontent":304===e?v="notmodified":(v=W.state,O=W.data,i=!(q=W.error))):(q=v,!e&&v||(v="error",e<0&&(e=0))),R.status=e,R.statusText=(t||v)+"",i?d.resolveWith(A,[O,v,R]):d.rejectWith(A,[R,v,q]),R.statusCode(f),f=void 0,a&&u.trigger(i?"ajaxSuccess":"ajaxError",[R,s,i?O:q]),l.fireWith(A,[R,v]),a&&(u.trigger("ajaxComplete",[R,s]),--g.active||g.event.trigger("ajaxStop")))}return R},getJSON:function(e,t,n){return g.get(e,t,n,"json")},getScript:function(e,t){return g.get(e,void 0,t,"script")}}),g.each(["get","post"],(function(e,t){g[t]=function(e,n,o,p){return l(n)&&(p=p||o,o=n,n=void 0),g.ajax(g.extend({url:e,type:t,dataType:p,data:n,success:o},g.isPlainObject(e)&&e))}})),g.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),g._evalUrl=function(e,t,n){return g.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){g.globalEval(e,t,n)}})},g.fn.extend({wrapAll:function(e){var t;return this[0]&&(l(e)&&(e=e.call(this[0])),t=g(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return l(e)?this.each((function(t){g(this).wrapInner(e.call(this,t))})):this.each((function(){var t=g(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=l(e);return this.each((function(n){g(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){g(this).replaceWith(this.childNodes)})),this}}),g.expr.pseudos.hidden=function(e){return!g.expr.pseudos.visible(e)},g.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},g.ajaxSettings.xhr=function(){try{return new o.XMLHttpRequest}catch(e){}};var Qt={0:200,1223:204},Jt=g.ajaxSettings.xhr();d.cors=!!Jt&&"withCredentials"in Jt,d.ajax=Jt=!!Jt,g.ajaxTransport((function(e){var t,n;if(d.cors||Jt&&!e.crossDomain)return{send:function(p,M){var b,c=e.xhr();if(c.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(b in e.xhrFields)c[b]=e.xhrFields[b];for(b in e.mimeType&&c.overrideMimeType&&c.overrideMimeType(e.mimeType),e.crossDomain||p["X-Requested-With"]||(p["X-Requested-With"]="XMLHttpRequest"),p)c.setRequestHeader(b,p[b]);t=function(e){return function(){t&&(t=n=c.onload=c.onerror=c.onabort=c.ontimeout=c.onreadystatechange=null,"abort"===e?c.abort():"error"===e?"number"!=typeof c.status?M(0,"error"):M(c.status,c.statusText):M(Qt[c.status]||c.status,c.statusText,"text"!==(c.responseType||"text")||"string"!=typeof c.responseText?{binary:c.response}:{text:c.responseText},c.getAllResponseHeaders()))}},c.onload=t(),n=c.onerror=c.ontimeout=t("error"),void 0!==c.onabort?c.onabort=n:c.onreadystatechange=function(){4===c.readyState&&o.setTimeout((function(){t&&n()}))},t=t("abort");try{c.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),g.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),g.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return g.globalEval(e),e}}}),g.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),g.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(o,p){t=g("
-
@livewireStyles
diff --git a/laravel_app/resources/views/livewire/projects/mailing-manager.blade.php b/laravel_app/resources/views/livewire/projects/mailing-manager.blade.php
index a56bcbd..d214f82 100644
--- a/laravel_app/resources/views/livewire/projects/mailing-manager.blade.php
+++ b/laravel_app/resources/views/livewire/projects/mailing-manager.blade.php
@@ -1,40 +1,107 @@
-
- Mailing Details
- ...
+
+
+ Mailing Details
+ ...
-
-
-
-
-
- | Id
- |
- Created |
- Subject |
- # |
- Attachment |
-
- Edit
- |
-
-
-
- @foreach($project->mailings as $mail)
+
+
+
+
- | {{ $mail->id }} |
- {{ $mail->created_at }} |
- {{ $mail->subject }} |
- {{ $mail->recipients()->count() }} |
- {{ $mail->attachments()->get('name')->implode(', ') }} |
-
-
- |
+
+ Id
+ |
+ Created |
+ Subject |
+ # |
+ Attachment
+ |
+
+ Edit
+ |
- @endforeach
-
-
-
-
-
-
-
+
+
+ @foreach($project->mailings as $mail)
+
+ | {{ $mail->id }} |
+ {{ $mail->created_at }} |
+ {{ $mail->subject }} |
+ {{ $mail->recipients()->count() }} |
+ {{ $mail->attachments()->pluck('name')->join( ', ') }} |
+
+
+ |
+
+ @endforeach
+
+
+
+
+
+
+
+
+
+
+
+ {{ __('Mailing') }}
+
+
+
+
+
+
+
+
+
+
+ @foreach($formData['recipients'] as $key => $recipient)
+
+
+
+
+ @endforeach
+
+
+
+
+
+
+
+
+
+ @empty($formData['attachments'])
+
+
+
+
+ @else
+ @foreach($formData['attachments'] as $key => $attachment)
+
+
+
+ @endforeach
+ @endempty
+
+
+
+ {{ __('Close') }}
+
+
+
+
+
+
diff --git a/laravel_app/tests/Unit/Models/ProjectTest.php b/laravel_app/tests/Unit/Models/ProjectTest.php
new file mode 100644
index 0000000..bb541b4
--- /dev/null
+++ b/laravel_app/tests/Unit/Models/ProjectTest.php
@@ -0,0 +1,51 @@
+create(['name' => 'Test Project']);
+ $this->assertStringEndsWith(
+ '/storage/test_project/attachments',
+ $project->attachment_path
+ );
+ }
+
+ /** @test */
+ public function it_can_add_a_mailing_and_attachment()
+ {
+ $project = Project::factory()->create();
+ $project->mailings()->create([
+ 'subject' => 'Test Subject',
+ 'message' => 'Test Message',
+ ]);
+ $fileFake = \Illuminate\Http\UploadedFile::fake()->create('test.pdf');
+ $project->mailings()->first()->addAttachment('test.pdf', $fileFake);
+
+ $this->assertCount(1, $project->mailings);
+ $this->assertCount(1, $project->mailings()->first()->attachments);
+ }
+
+
+ /** @test */
+ public function when_running_the_seeder_their_are_three_projects(): void
+ {
+ $this->seed();
+ $this->assertCount(3,Project::all());
+ }
+}