"use strict";define(["app","handlebars","View","text!/v2/webapps/FirstAccess/PatientOrientation/Templates/PatientOrientationTemplate.html","utils"],function(c,f,e,b,a){var d=e.extend({id:"patientOrientationView",overlay:null,report:"",template:f.compile(b),events:{"click #continue":"closeView"},closeView:function(g){c.instance().Cache.setPatientStatus=(this.$el.find("[name = yesno]:checked").val()==="false");this.trigger("view:close");this.overlay.close();},initialize:function(g){e.prototype.initialize.apply(this,arguments);this.options=g||{};this.overlay=this.options.parent;},dataURItoBlob:function(h){var l;if(h.split(",")[0].indexOf("base64")>=0){l=atob(h.split(",")[1]);}else{l=unescape(h.split(",")[1]);}var g=h.split(",")[0].split(":")[1].split(";")[0];var j=new Uint8Array(l.length);for(var k=0;k<l.length;k++){j[k]=l.charCodeAt(k);}return new Blob([j],{type:g});},render:function(j){e.prototype.render.apply(this,arguments);this.setParent(j.parent);this.report=j.record?j.record.Report:null;var g=false;if(this.report!==null&&this.report!==undefined){g=this.report.indexOf("wrapper-error")>=0;}this.$el.html(this.template({record:j.record,messages:j.messages}));this.overlay.render(true).$el.find("#overlay").html(this.$el);j.parent.$el.prepend(this.overlay.$el);this.overlay.$el.css("visibility","visible");$("body").css("overflow","auto");this.overlay.$el.find("#overlay").css({width:"100%",height:"100%"});j.parent.$el.css("visibility","hidden");this.$el.find("#continue").prop("disabled",true);$(window).scrollTop(0);if(!this.report||g){this.$el.find("#report").hide();var n=this.$el.find("#report-container");n.removeClass();n.css({width:"100%","background-color":"#F9F9F9","min-height":"50rem",display:"block",overflow:"auto"});}else{var p=$("iframe");var o=p.contents();var i=p.get(0);if(i){var m=p.get(0).contentDocument||(p.get(0).contentWindow?p.get(0).contentWindow.document:p.get(0).document);if(m){m.open();m.writeln(this.report);m.close();}}o.find("head").prepend('<meta name="format-detection" content="telephone=no" />');o.find("html").css("overflow","hidden");var l=o.find(".crystalstyle > div:first");l.css("max-width","1200px");var k=l.last().css("height");this.$el.find("#report").css({height:isNaN(parseInt(k,10))?0:parseInt(k,10)+100+"px",display:"block"});this.$el.find("#report").css({height:isNaN(parseInt(k,10))?0:parseInt(k,10)+100+"px",display:"block"});o.on("click",function(){$("body").trigger("mousemove");});}if(g){this.$el.find("#report-container").html(this.report);}this.$el.find("#continue").prop("disabled",false);this.overlay.hideSpinner();return this;}});return d;});