(function(n){"use strict";function i(t){var i=n("");try{i=n(t).clone()}catch(r){i=n("<span />").html(t)}return i}function r(t,i,r){var f=n.Deferred(),u,e,o;try{t=t.contentWindow||t.contentDocument||t;u=t.document||t.contentDocument||t;r.doctype&&u.write(r.doctype);u.write(i);u.close();e=!1;o=function(){if(!e){t.focus();try{t.document.execCommand("print",!1,null)||t.print();n("body").focus()}catch(i){t.print()}t.close();e=!0;f.resolve()}};n(t).on("load",o);setTimeout(o,r.timeout)}catch(s){f.reject(s)}return f}function f(i,u){var f=n(u.iframe+""),e=f.length,o;return e===0&&(f=n('<iframe height="0" width="0" border="0" wmode="Opaque"/>').prependTo("body").css({position:"absolute",top:-999,left:-999})),o=f.get(0),r(o,i,u).done(function(){setTimeout(function(){e===0&&f.remove()},1e3)}).fail(function(n){console.error("Failed to print from iframe",n);t(i,u)}).always(function(){try{u.deferred.resolve()}catch(n){console.warn("Error notifying deferred",n)}})}function t(n,t){var i=window.open();return r(i,n,t).always(function(){try{t.deferred.resolve()}catch(n){console.warn("Error notifying deferred",n)}})}function u(n){return!!(typeof Node=="object"?n instanceof Node:n&&typeof n=="object"&&typeof n.nodeType=="number"&&typeof n.nodeName=="string")}n.print=n.fn.print=function(){var r,o,h=this,a,s,e,c,l;h instanceof n&&(h=h.get(0));u(h)?(o=n(h),arguments.length>0&&(r=arguments[0])):arguments.length>0?(o=n(arguments[0]),u(o[0])?arguments.length>1&&(r=arguments[1]):(r=arguments[0],o=n("html"))):o=n("html");a={globalStyles:!0,mediaPrint:!1,stylesheet:null,noPrintSelector:".no-print",iframe:!0,append:null,prepend:null,manuallyCopyFormValues:!0,deferred:n.Deferred(),timeout:750,title:null,doctype:"<!doctype html>"};r=n.extend({},a,r||{});s=n("");r.globalStyles?s=n("style, link, meta, base, title"):r.mediaPrint&&(s=n("link[media=print]"));r.stylesheet&&(s=n.merge(s,n('<link rel="stylesheet" href="'+r.stylesheet+'">')));e=o.clone();e=n("<span/>").append(e);e.find(r.noPrintSelector).remove();e.append(s.clone());r.title&&(c=n("title",e),c.length===0&&(c=n("<title />"),e.append(c)),c.text(r.title));e.append(i(r.append));e.prepend(i(r.prepend));r.manuallyCopyFormValues&&(e.find("input").each(function(){var t=n(this);t.is("[type='radio']")||t.is("[type='checkbox']")?t.prop("checked")&&t.attr("checked","checked"):t.attr("value",t.val())}),e.find("select").each(function(){var t=n(this);t.find(":selected").attr("selected","selected")}),e.find("textarea").each(function(){var t=n(this);t.text(t.val())}));l=e.html();try{r.deferred.notify("generated_markup",l,e)}catch(y){console.warn("Error notifying deferred",y)}if(e.remove(),r.iframe)try{f(l,r)}catch(v){console.error("Failed to print from iframe",v.stack,v.message);t(l,r)}else t(l,r);return this}})(jQuery)