(()=>{let u=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),R="https://api.analytics.sales-marker.jp/event",x="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNjc4ODAxOTE5fQ.olKX9MVukd8vZypL2gTNqRApxzhgNp8uuPG9mFSMtz0",N="https://app.sales-marker.jp",w="https://marketing-marker.jp",A="https://access-site.net/static/access-net.html",k="SALES_MARKER_IFRAME_TOKEN",v="SALES_MARKER_PARENT_TOKEN",O="SALES_MARKER_ACCESS_SITE_COOKIE",M="SALES_MARKER_ACCESS_SITE_COOKIE_IFRAME",_="disablepersonintent",y=/analytics\.sales-marker\.jp/i,C=()=>{let e=document.currentScript;if(e instanceof HTMLScriptElement&&e.hasAttribute(_))return!0;let t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++){let o=t[n];if(y.test(o.src)&&o.hasAttribute(_))return!0}return!1},c,f=()=>{let e=new URL(A).origin,t=!1,n=document.createElement("iframe");n.id=M,n.src=A,n.setAttribute("aria-hidden","true"),n.style.cssText="position:absolute;width:0;height:0;border:0;visibility:hidden;pointer-events:none";let o=()=>{if(t)return;let a=n.contentWindow;if(a===null)return;t=!0;let s=u();a.postMessage({type:v,data:s},e),c=s},i=a=>{if(a.origin!==e)return;let s=a.data;if((s==null?void 0:s.type)!==k||typeof s.cookies!="object"||s.cookies===null)return;let g=s.cookies[O];g!==void 0&&g!==""?(c=g,console.log("--- cookieToken ---",c),window.removeEventListener("message",i)):o()};window.addEventListener("message",i),document.body.appendChild(n)};C()||(document.body!==null?f():document.addEventListener("DOMContentLoaded",f,{once:!0}));let L={"sales-marker-analytics-tag":N,"marketing-marker-analytics-tag":w},b="SalesMarkerAnalyticsTagTest",K="test=sales-marker-analytics-tag",h=performance.now(),I=u(),l=window.location.href,d=!1,E=0,r=null,m=()=>performance.now()-h-E,P=e=>{var o,i;let t=new URL(l),n=(i=(o=/^(?:https?:\/\/)?(?:[^@/\n]+@)?(?:www\.)?([^:/?\n]+)/gim.exec(t.hostname))==null?void 0:o[1])!=null?i:"";return{pathname:t.pathname,domain:n,search:t.search,title:document.title,userAgent:window.navigator.userAgent,createdAt:new Date().toISOString(),version:2,href:l,action:"pageview",duration:e,sessionId:I,hasFocused:document.hasFocus(),visibilityState:document.visibilityState,cookie:c}},p=e=>{let t=P(e);fetch(R,{method:"POST",body:JSON.stringify(t),keepalive:!0,mode:"cors",headers:{Authorization:`Bearer ${x}`,"Content-Type":"application/json"}}).catch(console.error)};setInterval(()=>{document.hasFocus()&&p(m())},1e4);function D(){l!==window.location.href&&(p(m()),l=window.location.href,h=performance.now(),I=u(),E=0,r=null)}let F=()=>{!document.hasFocus()&&!d?(p(m()),d=!0):document.hasFocus()&&(d=!1)};setInterval(()=>{D(),F()},100),setInterval(()=>{let e=performance.now();document.hasFocus()?r!==null&&(E+=e-r,r=null):r===null&&(r=e)},100);let[U]=K.split("="),T=new URLSearchParams(window.location.search).get(U);if(T===null)return;let S=L[T];S!==void 0&&window.opener.postMessage({action:b,message:"ok"},S)})();
