window.__kol_captureList={"/api/recommend/item_list/":"foryouVideoList","/api/post/item_list":"userVideoList","/api/repost/item_list":"userRepostList","/api/favorite/item_list":"userLikeList","/api/collection/item_list":"userFavoriteList","/api/search/general/full":"searchGeneralList","/api/search/item/full/":"searchVideoList","/api/explore/item_list/":"exploreVideoList","/api/challenge/item_list/":"tagVideoList","/api/following/item_list/":"followingVideoList","/api/friends/item_list/":"friendsVideoList","/api/item/detail":"userVideoDetail","/api/shop":"shopList"};function f(){let a=!0;const c=window.fetch;window.fetch=async function(...t){var o;try{const[e]=t;if(((o=t[0])==null?void 0:o.credentials)==="omit")return c(e);let i;typeof e=="string"?i=e:e!=null&&e.url?i=e.url:i="";const p=c(e),n=Object.keys(window.__kol_captureList).find(s=>i==null?void 0:i.includes(s));if(n){const s=await p,r=await s.clone().json();setTimeout(async()=>{var u;const w=new URLSearchParams(e.url);if(s.ok&&((u=s.headers.get("Content-Type"))!=null&&u.includes("application/json"))){if(w.get("post_item_list_request_type")){const l=w.get("post_item_list_request_type");!l||l==="0"?r.tkOrder="Latest":r.tkOrder=l==="1"?"Popular":"Oldest"}}else console.error("Response is not JSON or not ok:",s);const _=new CustomEvent(window.__kol_captureList[n],{detail:r});a&&(a=!1),console.log(`send ${window.__kol_captureList[n]} event`),window.dispatchEvent(_),n==="/api/post/item_list"&&window.dispatchEvent(new CustomEvent("urlRefererGet",{detail:i}))},a?4e3:1500)}return p}catch(e){console.error("fetch error",e)}};const d=window.localStorage.getItem("fyp-feed-cache");if(d){const t=new CustomEvent("foryouVideoList",{detail:JSON.parse(d)});setTimeout(()=>{window.dispatchEvent(t)},2500)}console.log("is injected"),setTimeout(()=>{const t=new CustomEvent("refreshUserProfile");window.dispatchEvent(t)},2500),window.addEventListener("getAnalysisData",t=>{window.fetch(t.detail.url,{credentials:"omit"}).then(o=>{o.json().then(e=>{const i=new CustomEvent("analysisDataList",{detail:{data:e,requestId:t.detail.requestId}});window.dispatchEvent(i)})})})}window.__load_kol_main=!0,f();
