!function(e,t){if("object"!=typeof window[e])return;var r=window[e];const i="popup-ad";var n=function(e,t){this.init(e,t)};n.prototype={constant:{DEVICE_TYPE_DESKTOP:1,DEVICE_TYPE_SMARTPHONE:2,DEVICE_ALL:3,URL_PREFIX_PATTERN:["http://","http://www.","https://","https://www."],URL_TARGET_ALL:1,URL_TARGET_FORWARD_MATCH:2,URL_TARGET_PERFECT_MATCH:3,TIMER_NOT_AVABABLE:1,TIMER_AVABABLE:2,FREQUENCY_EVERY_TIME:1,FREQUENCY_ANY_TIME:2,STORE_KEY:"juicer_popup",ELEMENT_VIEW_ROOT_ROLE_ID:"juicer-popup",ELEMENT_VIEW_CONTAINER:".juicerPopupBanner, .popup",ELEMENT_BUTTON_CLOSE:".close",ELEMENT_ANCHOR_AD_IMAGE:".inner a",AD_DISPLAY_LIMIT_SIZE:1010},property:{core:null,device:0,displayPopupSecond:0,popupName:"",userGroupId:null,imagePath:"",transitionUrl:"",frequencyType:0,frequencyDay:0,timerType:0,timerStartTime:null,timerEndTime:null,targetType:0,url:"",id:0,siteId:0,shapeUrl:"",shapeCurrentUrl:"",rootElement:null},init:function(e,t){try{if(t=(t=e.convertStringToObject(t)).length?t[0]:t,!e.validateObjectType(e.popup,"object"))throw new Error("failed get popup-core");if(!e.validateObjectType(e.getJuicerId(),"string"))throw new Error("failed get jid");if(!e.validateObjectType(e.getUserId(),"string"))throw new Error("failed get uid");if(!e.validateObjectType(e.getId().siteId,"string"))throw new Error("failed get site id");if(!e.validateObjectType(e.getUrl(),"string"))throw new Error("failed get url");if(!e.validateObjectType(t.siteId,"number"))throw new Error("failed get data.siteId");if(!e.validateObjectType(t.targetType,"number"))throw new Error("failed get data.targetType");if(!e.validateObjectType(t.device,"number"))throw new Error("failed get data.device");if(!e.validateObjectType(t.url,"string"))throw new Error("failed get data.url");if(!e.validateObjectType(t.displayPopupSecond,"number"))throw new Error("failed get data.displayPopupSecond");if(!e.validateObjectType(t.id,"number"))throw new Error("failed get data.id");if(!e.validateObjectType(t.popupName,"string"))throw new Error("failed get data.popupName");if(!e.validateObjectType(t.userGroupId,"number"))throw new Error("failed get data.userGroupId");if(!e.validateObjectType(t.imagePath,"string"))throw new Error("failed get data.imagePath");if(!e.validateObjectType(t.transitionUrl,"string"))throw new Error("failed get data.transitionUrl");if(!e.validateObjectType(t.frequencyType,"number"))throw new Error("failed get data.frequencyType");if(!e.validateObjectType(t.frequencyDay,"number"))throw new Error("failed get data.frequencyDay");var r="/"===t.url.slice(-1)?t.url.slice(0,-1):t.url,n="/"===e.getUrl().slice(-1)?e.getUrl().slice(0,-1):e.getUrl();this.setCore(e).setSiteId(t.siteId).setTargetType(t.targetType).setDevice(t.device).setUrl(t.url).setDisplayPopupSecond(t.displayPopupSecond).setId(t.id).setPopupName(t.popupName).setUserGroupId(t.userGroupId).setImagePath(t.imagePath).setTransitionUrl(t.transitionUrl).setFrequencyType(t.frequencyType).setFrequencyDay(t.frequencyDay).setShapeUrl(r).setCurrentShapeUrl(n),e.validateObjectType(t.timerType,"number")||this.setTimerType(t.timerType),e.validateObjectType(t.timerStartTime,"string")||this.setTimerStartTime(t.timerStartTime),e.validateObjectType(t.timerEndTime,"string")||this.setTimerEndTime(t.timerEndTime),e.popup.setPopupAdInstance(this)}catch(t){e.errorReport(t,i),e.logging(t)}},setCore:function(e){return this.property.core=e,this},setSiteId:function(e){return this.getCore().validateObjectType(e,"number")?(this.property.siteId=e,this):this},setTargetType:function(e){return this.getCore().validateObjectType(e,"number")?(this.property.targetType=e,this):this},setDevice:function(e){return this.getCore().validateObjectType(e,"number")?(this.property.device=e,this):this},setUrl:function(e){return this.getCore().validateObjectType(e,"string")?(this.property.url=e,this):this},setDisplayPopupSecond:function(e){return this.getCore().validateObjectType(e,"number")?(this.property.displayPopupSecond=e,this):this},setId:function(e){return this.getCore().validateObjectType(e,"number")?(this.property.id=e,this):this},setPopupName:function(e){return this.getCore().validateObjectType(e,"string")?(this.property.popupName=e,this):this},setUserGroupId:function(e){return this.getCore().validateObjectType(e,"number")?(this.property.userGroupId=e,this):this},setImagePath:function(e){return this.getCore().validateObjectType(e,"string")?(this.property.imagePath=e,this):this},setTransitionUrl:function(e){return this.getCore().validateObjectType(e,"string")?(this.property.transitionUrl=e,this):this},setFrequencyType:function(e){return this.getCore().validateObjectType(e,"number")?(this.property.frequencyType=e,this):this},setFrequencyDay:function(e){return this.getCore().validateObjectType(e,"number")?(this.property.frequencyDay=e,this):this},setTimerType:function(e){return this.getCore().validateObjectType(e,"number")?(this.property.timerType=e,this):this},setTimerStartTime:function(e){return this.getCore().validateObjectType(e,"string")?(this.property.timerStartTime=e,this):this},setTimerEndTime:function(e){return this.getCore().validateObjectType(e,"string")?(this.property.timerEndTime=e,this):this},setShapeUrl:function(e){return this.getCore().validateObjectType(e,"string")?(this.property.shapeUrl=e,this):this},setCurrentShapeUrl:function(e){return this.getCore().validateObjectType(e,"string")?(this.property.shapeCurrentUrl=e,this):this},setRootElement:function(e){return this.property.rootElement=e,this},getCore:function(){return this.property.core},getSiteId:function(){return this.getCore().validateObjectType(this.property.siteId,"number")?this.property.siteId:0},getDevice:function(){return this.getCore().validateObjectType(this.property.device,"number")?this.property.device:0},getUrl:function(){return this.getCore().validateObjectType(this.property.url,"string")?this.property.url:""},getTargetType:function(){return this.getCore().validateObjectType(this.property.targetType,"number")?this.property.targetType:0},getDisplayPopupSecond:function(){return this.getCore().validateObjectType(this.property.displayPopupSecond,"number")?this.property.displayPopupSecond:0},getShapeUrl:function(){return this.getCore().validateObjectType(this.property.shapeUrl,"string")?this.property.shapeUrl:""},getCurrentShapeUrl:function(){return this.getCore().validateObjectType(this.property.shapeCurrentUrl,"string")?this.property.shapeCurrentUrl:""},getId:function(){return this.getCore().validateObjectType(this.property.id,"number")?this.property.id:0},getPopupName:function(){return this.getCore().validateObjectType(this.property.popupName,"string")?this.property.popupName:""},getUserGroupId:function(){return this.getCore().validateObjectType(this.property.userGroupId,"number")?this.property.userGroupId:0},getImagePath:function(){return this.getCore().validateObjectType(this.property.imagePath,"string")?this.property.imagePath:""},getTransitionUrl:function(){return this.getCore().validateObjectType(this.property.transitionUrl,"string")?this.property.transitionUrl:""},getFrequencyType:function(){return this.getCore().validateObjectType(this.property.frequencyType,"number")?this.property.frequencyType:0},getFrequencyDay:function(){return this.getCore().validateObjectType(this.property.frequencyDay,"number")?this.property.frequencyDay:0},getRootElement:function(){return null!=this.property.rootElement?this.property.rootElement:""},getTimerType:function(){return this.getCore().validateObjectType(this.property.timerType,"number")?this.property.timerType:0},getTimerStartTime:function(){return this.getCore().validateObjectType(this.property.timerStartTime,"string")?this.property.timerStartTime:null},getTimerEndTime:function(){return this.getCore().validateObjectType(this.property.timerEndTime,"string")?this.property.timerEndTime:null},isAvailable:function(){var e=this.getCore(),t=e.getDevice()==e.constant.DEVICE_TYPE_PC||e.getDevice()==e.constant.DEVICE_TYPE_TABLET?1:2;currentUrl=this.getCurrentShapeUrl(),targetType=this.getTargetType(),isAllowURL=!1;try{if(this.getDevice()!=this.constant.DEVICE_ALL&&t!=this.getDevice())throw new Error("PopupAdError : Is displayable device");if(targetType!=this.constant.URL_TARGET_ALL){for(var r=0;r<this.constant.URL_PREFIX_PATTERN.length;++r){var n=document.createElement("a");n.href=this.constant.URL_PREFIX_PATTERN[r]+this.getShapeUrl();var s=n.protocol.replace(":",""),a=n.pathname,o=s+"://"+n.host+a;if(targetType==this.constant.URL_TARGET_FORWARD_MATCH&&-1!=currentUrl.indexOf(o)){isAllowURL=!isAllowURL;break}if(targetType==this.constant.URL_TARGET_PERFECT_MATCH&&currentUrl===o){isAllowURL=!isAllowURL;break}}isAllowURL}var p=e.getLocalStorage(this.constant.STORE_KEY);if(e.validateObjectType(p,"string")&&e.getByteLength(p)){var u=(p=e.convertStringToObject(p))[this.getSiteId()];if(e.validateObjectType(u,"object")&&this.getFrequencyType()==this.constant.FREQUENCY_ANY_TIME&&u.last_show_date&&this.getFrequencyDay()>0&&function(e){var t=+e.substr(0,4),r=+e.substr(4,2),i=+e.substr(6,2);(e=new Date(t,r-1,i)).setDate(e.getDate()+this.getFrequencyDay());var n=e.getFullYear()+("0"+(e.getMonth()+1)).slice(-2)+("0"+e.getDate()).slice(-2),s=new Date;return+n>+(s.getFullYear()+("0"+(s.getMonth()+1)).slice(-2)+("0"+s.getDate()).slice(-2))}.call(this,u.last_show_date))throw new Error("PopupAdError : Out of display range")}if(this.getTimerType()==this.constant.TIMER_AVABABLE&&(null!=this.getTimerStartTime()||null!=this.getTimerEndTime())){var l=null,c=null,h=(new Date).getTime();if(null!=this.getTimerStartTime()&&(l=new Date(this.getTimerStartTime().replace(/-/g,"/")).getTime()),null!=this.getTimerEndTime()&&(c=new Date(this.getTimerEndTime().replace(/-/g,"/")).getTime()),null==l&&null!=c&&h>c)throw new Error("PopupAdError : Out of time range");if(null!=l&&null==c&&h<l)throw new Error("PopupAdError : Out of time range");if(null!=l&&null!=c&&(h<l||h>c||c<l))throw new Error("PopupAdError : Out of time range")}return!0}catch(e){this.getCore().errorReport(e,i)}return!1},isDisplayArea:function(){return document.documentElement.clientWidth-this.constant.AD_DISPLAY_LIMIT_SIZE>0},show:function(){this.setRootElement(this.generateArea());var e=this.getCore(),t=this.getRootElement(),r=this;window.setTimeout((function(){t.querySelector(r.constant.ELEMENT_VIEW_CONTAINER).classList.add("is-show"),r.setResult(),r.sendLogByTreasureData(e.constant.TD_TABLE_POPUP_AD_IMPRESSION_LOG)}),1e3*this.getDisplayPopupSecond())},generateArea:function(){var e=this.getCore(),t=document.querySelector('[data-role="'+this.constant.ELEMENT_VIEW_ROOT_ROLE_ID+'"]');if(null==t){(t=document.createElement("div")).setAttribute("data-role",this.constant.ELEMENT_VIEW_ROOT_ROLE_ID),t.setAttribute("data-site_id",this.getSiteId()),t.style.display="block",document.body.appendChild(t),t=document.querySelector('[data-role="'+this.constant.ELEMENT_VIEW_ROOT_ROLE_ID+'"]'),e.validateObjectType(document.body.attachShadow,"function")&&(t=t.attachShadow({mode:"open"}));var r='<style>@import url("'+e.getDomain()+'/assets/popup/styles/juicer-popup.css");</style>';null==e.getBrowser().match(/^ie[0-9]{1,2}$/)&&"edge"!=e.getBrowser()&&(r+='<style>@import url("'+e.getDomain()+'/assets/popup/styles/juicer-popup_sp.css");</style>'),r+='<div class="juicerPopupBanner popup"> <div class="inner"> <a href="'+this.getTransitionUrl()+'" target="_blank"><img src="'+this.getImagePath()+'" alt="'+this.getPopupName()+'"></a><img src="'+e.getDomain()+'/assets/popup/img/btn-close.png" alt="閉じる" class="close"> </div> </div>',t.innerHTML=r,this.setEvent(t)}else"function"==typeof document.body.attachShadow&&(t=t.shadowRoot);return t},setEvent:function(e){var t=this,r=this.getCore(),i=e.querySelector(this.constant.ELEMENT_VIEW_CONTAINER),n=e.querySelector(this.constant.ELEMENT_BUTTON_CLOSE),s=e.querySelector(this.constant.ELEMENT_ANCHOR_AD_IMAGE),a=!1;null!=s&&s.addEventListener("click",(function(e){var i=this.getAttribute("data-status");if(!a&&null==i){a=!a;var n=this.getAttribute("href");r.validateObjectType(n,"string")&&n.length&&(t.sendLogByTreasureData(r.constant.TD_TABLE_POPUP_AD_CLICK_LOG),this.setAttribute("data-status","through"),this.click())}return"through"===i})),n.addEventListener("click",(function(e){i.setAttribute("style","display: none")}))},setResult:function(){try{var e,t=this.getCore(),r=this.getSiteId(),n=t.getLocalStorage(this.constant.STORE_KEY),s=new Date;n=t.validateObjectType(n,"string")&&n.length?JSON.parse(n):{},e={last_show_date:s.getFullYear()+("0"+(s.getMonth()+1)).slice(-2)+("0"+s.getDate()).slice(-2),uid:t.getUserId(),jid:t.getJuicerId()},t.validateObjectType(e,"object")&&(n[r]=e,t.setLocalStorage(this.constant.STORE_KEY,JSON.stringify(n)))}catch(e){this.getCore().errorReport(e,i)}},sendLogByTreasureData:function(e){var t=this.getCore();if(!t.validateObjectType(e,"string"))throw new Error("failed get treasuredata table");var r=t.factoryTresureDataSdkInstance({host:t.getTdData().host,database:t.getTdData().database,writeKey:t.getTdData().apikey});r.set("$global","td_global_id","td_global_id");var i={sid:t.getId().siteId+"",jid:t.getJuicerId(),uid:t.getUserId(),sesid:t.getSessionId(),popup_id:this.getId()+""};r.set(e,i),r.trackPageview(e,(function(){t.logging("complete send log :: "+e)}))}},r.executeAsync((function(){try{var e=new n(r,"[{'id':19000,'siteId':238978,'userGroupId':0,'device':3,'displayPopupSecond':3,'targetType':1,'frequencyType':1,'frequencyDay':30,'timerType':2,'timerStartTime':'2021-08-25 12:00:00','timerEndTime':'','popupName':'ポップアップ施策-1','imagePath':'https://s3-ap-northeast-1.amazonaws.com/ja-popup/238978/1629862023.jpg','transitionUrl':'https://www.fujisan.co.jp/product/1281696261/campaign/noukatsu/ap-pub-ws-nk-ws01','url':'','ip':''}]");r.popup.isAvailable((function(t){(t.ad&&t.nps&&e.isDisplayArea()||t.ad&&!t.nps)&&e.show()}))}catch(e){r.errorReport(e,i),r.logging(e)}}))}("__kit__G1FvBQ/Hj0o=");