(()=>{var e,t,o={694:()=>{function e(e){const t=document.getElementById(e);t&&t.classList.remove("d-none")}navigator.userAgent.includes("Firefox")?(e("firefoxExtension"),function(e){const t=document.getElementById(e);t&&t.classList.add("d-none")}("contactUs")):navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPad")?e("iosExtension"):navigator.userAgent.includes("Android")?e("androidExtension"):navigator.userAgent.includes("Chrome")},195:(e,t,o)=>{"use strict";var n=o(443),r=o(973);function a(e){e.style.display="none",e.style.removeProperty("height"),e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")}function i(e){e.style.removeProperty("height"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")}async function s(e,t=500){a(e),e.style.removeProperty("display");let o=window.getComputedStyle(e).display;"none"===o&&(o="block"),e.style.display=o;let n=e.offsetHeight;e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,e.offsetHeight,e.style.boxSizing="border-box",e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.height=n+"px",e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),e._currentAnimation="slide_down",await(0,r.cb)(t),"slide_down"===e._currentAnimation&&i(e)}const d=document.getElementById("tiktokUrl"),l=document.getElementById("loadVideos");function c(e){let t=e=e.replace("https://","").replace("http://","").trim().split("?")[0].split("&")[0];return t.includes("/video/")&&(t=t.split("/video/")[1]),t=t.split("/")[0],/^\d+$/.test(t)||(t=e,e.endsWith("/")&&(t=t.slice(0,-1)),t=t.split("/"),t=t[t.length-1],t&&t.match(/^[a-zA-Z0-9]+$/)&&t.length>4&&t.length<20||(t=(e.match(/\d+/g)||[]).sort(((e,t)=>t.length-e.length))[0]||!1)),t}let u,m,p,h;function f(e){u||(u=document.querySelector("#mediaList .media-loaded")),m||(m=document.querySelector("#mediaList .media-unloaded")),"loading"==e&&((0,r.Nz)(document.querySelector("#loadVideos .spinner-border")),(0,r.zN)(document.getElementById("tiktokLoader"),"d-none"),(0,r.ET)(l,"disabled"),d.setAttribute("disabled",""),(0,r.Bt)(u),(0,r.Bt)(m)),"loaded"==e&&((0,r.ET)(document.getElementById("tiktokLoader"),"d-none"),d.removeAttribute("disabled"),setTimeout((function(){s(u,650),(0,r.Bt)(m)}),50),setTimeout((function(){(0,r.zN)(l,"disabled")}),100)),"reset"==e&&((0,r.zN)(l,"disabled"),d.removeAttribute("disabled"),(0,r.Bt)(u),(0,r.kl)(m),(0,r.ET)(document.getElementById("tiktokLoader"),"d-none"),document.getElementById("watermarkMode").removeAttribute("disabled"))}async function g(e){if(!(e=e||c(d.value))){const e=d.value;return e.length>1&&(0,r.tj)({name:"LoadTikTokError",data:{load_tiktok_error:"Missing or Invalid TikTok URL",tiktok_id:e}}),(0,r.lE)({title:"Missing or Invalid TikTok URL",message:"Please enter a valid TikTok link and try again.",button:"OK"})}let t;f("loading");try{const o=await fetch(`https://api.twitterpicker.com/tiktok/mediav2?id=${e}`);if(t=await o.json(),!o.ok)throw{response:{data:t}}}catch(t){const o=(t.response?t.response.data.message:"Please make sure you are connected to the internet and try again.").replace("Sorry, that page does not exist.","Invalid TikTok").replace("Sorry, you are not authorized to see this status.","TikTok is private").replace("No status found with that ID.","Invalid TikTok").replace("Not Found","Invalid, Deleted, or Private TikTok. Please ensure you are using a valid, public TikTok.").replace("invalid id parameter","Invalid TikTok URL").replace("Tiktok not found","Invalid, Deleted, or Private TikTok. Please ensure you are using a valid, public TikTok link.");return(0,r.lE)({title:"Error Loading TikTok",message:o,button:"OK"}),(0,r.tj)({name:"LoadTikTokError",data:{load_tiktok_error:o,tiktok_id:e}}),f("reset")}const o=function(e){const t=document.querySelector("#userInfo a"),o=t.getElementsByTagName("span")[0],a=document.querySelector("#userInfo img"),i=document.querySelector("#videoPreview img"),s=document.querySelector("#videoPreview a"),d=document.getElementById("downloadNoWatermark"),l=document.getElementById("downloadWatermark"),c=document.getElementById("downloadAudio"),u=document.getElementById("watermarkMode");o.textContent=e.user.username,t.href=`https://www.tiktok.com/@${e.user.username}`,a.src=e.user.image_small||e.user.image;const m="/"==n.A.path||"/app/"==n.A.path?e.thumbnail_animated||e.thumbnail:e.thumbnail||e.thumbnail_animated;i.src=m,s.href=e.video_no_watermark?.url||e.video_watermark?.url,u.disabled=!1;let p=0;if(e.video_no_watermark?.url){p++;const t=e.video_no_watermark.size_mb=e.video_no_watermark.size_mb||e.video_watermark?.size_mb||0;(0,r.kl)(d);const o=d.querySelector("a"),n=d.querySelector(".download-button"),a=d.querySelector(".resolution-badge span");o.href=e.video_no_watermark.url;const i=t?`${(0,r.rJ)(t-.006,2)} MB`:`${(0,r.rJ)(e.video_duration_seconds||0,0)}sec`;a.textContent=i,n.dataset.mediaUrl=e.video_no_watermark.url,n.dataset.filename=`${e.user.username}_TikTok_NoWatermark.mp4`,n.dataset.filetype="video/mp4"}else u.checked=!1,u.disabled=!0;if(e.video_watermark?.url){p++;const t=e.video_watermark.size_mb=e.video_watermark.size_mb||e.video_no_watermark?.size_mb||0;(0,r.kl)(l);const o=l.getElementsByTagName("a")[0],n=l.getElementsByClassName("download-button")[0],a=l.querySelector(".resolution-badge span");o.href=e.video_watermark.url;const i=t?`${(0,r.rJ)(t-.006,2)} MB`:`${(0,r.rJ)(e.video_duration_seconds||0,0)}sec`;a.textContent=i,n.dataset.mediaUrl=e.video_watermark.url,n.dataset.filename=`${e.user.username}_TikTok_Watermark.mp4`,n.dataset.filetype="video/mp4"}else u.checked=!0,u.disabled=!0;if(e.audio?.url){p++,(0,r.kl)(c);const t=c.querySelector("a"),o=c.querySelector(".download-button"),n=c.querySelector(".resolution-badge span");t.href=e.audio.url,n.textContent=`${(0,r.rJ)(e.audio.duration_seconds,0)}sec`,o.dataset.mediaUrl=e.audio.url,o.dataset.filename=`${e.user.username}_TikTok_Audio.mp3`,o.dataset.filetype="audio/mpeg"}else(0,r.Bt)(c);return u.dispatchEvent(new Event("change")),p}(t);if(0==o)return(0,r.lE)({title:"Error Loading TikTok",message:"No video data detected in this TikTok. Please try another URL.",button:"OK"}),(0,r.tj)({name:"LoadTikTokError",data:{load_tiktok_error:"No video data detected in this TikTok. Please try another URL.",tiktok_id:t.id}}),f("reset");f("loaded"),(0,r.tj)({name:"TikTokID",data:{tiktok_id:t.id}})}document.getElementById("watermarkMode").addEventListener("change",(function(){p||(p=document.getElementById("downloadWatermark")),h||(h=document.getElementById("downloadNoWatermark")),this.checked?((0,r.Bt)(p),(0,r.kl)(h)):((0,r.kl)(p),(0,r.Bt)(h))})),d.addEventListener("keydown",(e=>{"Enter"==e.key&&g()})),l.addEventListener("click",(()=>{g()})),d.addEventListener("focus",(function(){this.select()}));try{/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&d.addEventListener("click",(async function(){try{if(!/^((?!chrome|android).)*safari/i.test(navigator.userAgent))return;if(await(0,r.cb)(50),""!=this.value)return;const e=await navigator.clipboard.read();let t,o,n={"text/plain":void 0,"text/uri-list":void 0,"text/html":void 0};for(const r of e)for(const e of r.types)try{o=await(await r.getType(e)).text(),t=c(o),t&&(n[e]=o)}catch(e){}if(t=n["text/plain"]||n["text/uri-list"]||n["text/html"],!t)return;this.value=o}catch(e){}}))}catch(e){}!function(){try{if(n.A.path.includes("/video/")||n.A.path.includes("/t/")){const e=`https://tiktok.com${n.A.path}`,t=c(e);if(!t)return;d.value=e,g(t)}}catch(e){}}(),window.loadVideosClicked&&g(),window.loadVideosClicked=!0;try{navigator.serviceWorker.getRegistrations().then((function(e){for(let t of e)!t.active.scriptURL.includes("mitm")&&t.active.scriptURL.endsWith("/sw.js")&&t.unregister()}))}catch(e){}var y=o(451),v=o.n(y);function w(e){return e.returnValue=!0,!0}let b,k;function E(e,t){b||(b=document.getElementById("progress")),k||(k=document.getElementById("progressText")),void 0!==e&&(b.style.width=e),void 0!==t&&(k.textContent=t)}let T=new bootstrap.Modal("#downloadModal");async function S(e){"loading"==e&&(await(0,r.d5)(T,"show"),document.querySelectorAll(".download-list button").forEach((e=>e.classList.add("disabled"))),window.addEventListener("beforeunload",w)),"reset"==e&&(await(0,r.cb)(500),document.querySelectorAll(".download-list button").forEach((e=>e.classList.remove("disabled"))),(0,r.d5)(T,"hide"),E("0%",""),window.removeEventListener("beforeunload",w))}async function _(e){e={url:e.url,filename:e.filename||"TwitterVID.mp4",filetype:e.filetype||"video/mp4"};const{url:t,filename:n,filetype:a}=e;let i;try{S("loading"),await async function(){if(v().mitm="/service_workers/mitm/mitm.html",!v().WritableStream){const{WritableStream:e}=await o.e(481).then(o.bind(o,481));v().WritableStream=e}}();const e=await fetch(t),s=+e.headers.get("Content-Length"),d=v().createWriteStream(n,{pathname:t,size:s,onBlob:async function(e,t){if(!r.Fr.iOS())return t();try{const t={files:[new File([e],n,{type:a,lastModified:(new Date).getTime()})]};if(!navigator.canShare||!navigator.canShare(t))throw"cant share";await Promise.race([navigator.share(t),(0,r.cb)(3e3)])}catch(e){t()}}}),l=e.body;i=d.getWriter();const c=l.getReader(),u=s/1e6,m=u>30?0:u>10?1:2,p=(0,r.rJ)(s/1e6,m);let h=0,f="",g="";const y=({value:e})=>{if(!e)return;h+=e.length;const t=Math.round(h/s*100)+"%";t!=f&&E(t,void 0),f=t;const o=(0,r.rJ)(h/1e6,m),n=0==s?`${o} MB`:`${o} / ${p} MB`;n!=g&&E(void 0,n),g=n};for(;;){const e=await c.read();if(y(e),e.done)return await i.close(),S("reset");await i.write(e.value)}}catch(e){try{await i.abort("Download Failed")}catch(e){}return await S("reset"),e.message&&("Failed to fetch"==e.message||"Load failed"==e.message||e.message.includes("NetworkError"))?window.open(t,"_blank"):alert("There was an error downloading the file. Please try again later."),S("reset")}return S("reset")}document.querySelector("#mediaList .media-loaded").addEventListener("click",(function(e){const t=e.target.closest(".download-button");if(t){const e=t.getAttribute("data-media-url");let o=t.getAttribute("data-filename");try{o=atob(o)}catch(e){}_({url:e,filename:o,filetype:t.getAttribute("data-filetype")})}}));o(694)},443:(e,t,o)=>{"use strict";o.d(t,{A:()=>r});const n={version:"1.0.0",host:window.location.host,path:window.location.pathname||"",params:Object.fromEntries(new URLSearchParams(window.location.search).entries()),setPath:function(e,t=document.title){window.history.pushState({pageTitle:t},"",e),n.path=e},redirect:function(e){window.location.href=e,location.href=e,window.location.replace(e)}},r=n},973:(e,t,o)=>{"use strict";function n(e,t=0){return e=function(e,t=0){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}(e,t).toString(),0==t?e.toString().split(".")[0]:1==e.toString().split(".").length?e+"."+"0".repeat(t):e.toString().split(".")[1].length==t?e:e+"0".repeat(t-e.toString().split(".")[1].length)}function r(e){return new Promise((t=>setTimeout(t,e)))}function a(e=!1){return e?"complete"===document.readyState:"complete"===document.readyState||"interactive"===document.readyState}async function i(e=!1){return new Promise((async function(t){if(a(e))t();else{window.onload=e=>{t()};let o=5;for(;!a(e);)await r(Math.min(o++,500));t()}}))}function s(e={}){e={title:e.title||"",message:e.message||"",size:e.size,button:e.button||e.button_right||"Continue",button_extra:e.button_extra||e.button_left,locked:e.locked||!1,close_button:null==e.close_button||e.close_button};const t=document.getElementById("messageModal"),o=new bootstrap.Modal(t,{backdrop:!e.locked||"static",keyboard:!e.locked}),n=t.querySelector(".btn-close"),r=t.querySelector(".modal-close"),a=t.querySelector(".modal-close-left"),i=t.querySelector(".modal-dialog"),s=t.querySelector(".modal-title"),d=t.querySelector(".modal-html");return n.style.display=e.close_button?"":"none",r.style.display="hidden"===e.button?"none":"",a.style.display=e.button_extra?"":"none",i.classList.remove("modal-lg","modal-sm","modal-xl"),e.size&&i.classList.add("modal-"+e.size),s.textContent=e.title,d.innerHTML=e.message,r.textContent=e.button,e.button_extra&&(a.textContent=e.button_extra),o.show(),new Promise((function(e){r.addEventListener("click",(function(){o.hide(),e("right")})),a.addEventListener("click",(function(){o.hide(),e("left")})),t.addEventListener("hidden.bs.modal",(function(t){e("left")}))}))}o.d(t,{Bt:()=>u,ET:()=>h,Fr:()=>d,Nz:()=>p,cb:()=>r,d5:()=>l,kl:()=>m,lE:()=>s,q8:()=>i,rJ:()=>n,tj:()=>c,zN:()=>f});const d={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)||navigator.userAgent.match(/WPDesktop/i)},any:function(){return d.Android()||d.BlackBerry()||d.iOS()||d.Opera()||d.Windows()}};function l(e,t){return"show"==t?new Promise((t=>{const o=()=>{e._element.removeEventListener("shown.bs.modal",o),t()};e._element.addEventListener("shown.bs.modal",o,{once:!0}),e.show()})):"hide"==t?new Promise((t=>{const o=()=>{e._element.removeEventListener("hidden.bs.modal",o),t()};e._element.addEventListener("hidden.bs.modal",o,{once:!0}),e.hide()})):void 0}function c({name:e,data:t}){try{gtag("event",e,t)}catch(e){}try{zaraz.track(e,t)}catch(e){}}function u(e){e&&(e.style.display="none")}function m(e){e&&(e.style.display="")}function p(e){e&&e.remove()}function h(e,t){e&&e.classList.add(t)}function f(e,t){e&&e.classList.remove(t)}},451:function(e){var t;t=()=>{"use strict";const e="object"==typeof window?window:this;e.HTMLElement;let t=null,o=!1;const n=e.WebStreamsPolyfill||{},r=e.isSecureContext;let a=/constructor/i.test(e.HTMLElement)||!!e.safari||!!e.WebKitPoint;const i=r||"MozAppearance"in document.documentElement.style?"iframe":"navigate",s={createWriteStream:function(n,l,c){let u={size:null,pathname:null,writableStrategy:void 0,readableStrategy:void 0,onBlob:void 0};const m=l&&l.size?l.size/1e6:0;m>300&&m<3e3&&navigator&&(navigator.userAgent.includes("Gecko/")||navigator.userAgent.includes("Firefox/"))&&(a=!0);let p=0,h=null,f=null,g=null;if(Number.isFinite(l)?([c,l]=[l,c],u.size=c,u.writableStrategy=l):l&&l.highWaterMark?(u.size=c,u.writableStrategy=l):u=l||{},!a){t||(t=r?d(s.mitm):function(t){const o="width=200,height=100",n=document.createDocumentFragment(),r={frame:e.open(t,"popup",o),loaded:!1,isIframe:!1,isPopup:!0,remove(){r.frame.close()},addEventListener(...e){n.addEventListener(...e)},dispatchEvent(...e){n.dispatchEvent(...e)},removeEventListener(...e){n.removeEventListener(...e)},postMessage(...e){r.frame.postMessage(...e)}},a=t=>{t.source===r.frame&&(r.loaded=!0,e.removeEventListener("message",a),r.dispatchEvent(new Event("load")))};return e.addEventListener("message",a),r}(s.mitm)),f=new MessageChannel,n=encodeURIComponent(n.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A");const a={transferringReadable:o,pathname:u.pathname||Math.random().toString().slice(-6)+"/"+n,headers:{"Content-Type":"application/octet-stream; charset=utf-8","Content-Disposition":"attachment; filename*=UTF-8''"+n}};u.size&&(a.headers["Content-Length"]=u.size);const l=[a,"*",[f.port2]];if(o){const e="iframe"===i?void 0:{transform(e,t){if(!(e instanceof Uint8Array))throw new TypeError("Can only write Uint8Arrays");p+=e.length,t.enqueue(e),h&&(location.href=h,h=null)},flush(){h&&(location.href=h)}};g=new s.TransformStream(e,u.writableStrategy,u.readableStrategy);const t=g.readable;f.port1.postMessage({readableStream:t},[t])}f.port1.onmessage=e=>{e.data.download?"navigate"===i?(t.remove(),t=null,p?location.href=e.data.download:h=e.data.download):(t.isPopup&&(t.remove(),t=null,"iframe"===i&&d(s.mitm)),d(e.data.download)):e.data.abort&&(y=[],f.port1.postMessage("abort"),f.port1.onmessage=null,f.port1.close(),f.port2.close(),f=null)},t.loaded?t.postMessage(...l):t.addEventListener("load",(()=>{t.postMessage(...l)}),{once:!0})}let y=[];return!a&&g&&g.writable||new s.WritableStream({write(e){if(!(e instanceof Uint8Array))throw new TypeError("Can only write Uint8Arrays");a?y.push(e):(f.port1.postMessage(e),p+=e.length,h&&(location.href=h,h=null))},close(){if(a){const e=function(e,t=10){const o=1024*t*1024,n=[];for(let t=0;tt.contentWindow.postMessage(...e),t.addEventListener("load",(()=>{t.loaded=!0}),{once:!0}),document.body.appendChild(t),t}try{new Response(new ReadableStream),r&&!("serviceWorker"in navigator)&&(a=!0)}catch(e){a=!0}return(e=>{try{e()}catch(e){}})((()=>{const{readable:e}=new TransformStream,t=new MessageChannel;t.port1.postMessage(e,[e]),t.port1.close(),t.port2.close(),o=!0,Object.defineProperty(s,"TransformStream",{configurable:!1,writable:!1,value:TransformStream})})),s},e.exports=t()}},n={};function r(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return o[e].call(a.exports,a,a.exports,r),a.exports}r.m=o,r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((t,o)=>(r.f[o](e,t),t)),[])),r.u=e=>e+".3b32400fceb3632f96ea.js",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="tiktokdownloaderfrontend:",r.l=(o,n,a,i)=>{if(e[o])e[o].push(n);else{var s,d;if(void 0!==a)for(var l=document.getElementsByTagName("script"),c=0;c{s.onerror=s.onload=null,clearTimeout(p);var r=e[o];if(delete e[o],s.parentNode&&s.parentNode.removeChild(s),r&&r.forEach((e=>e(n))),t)return t(n)},p=setTimeout(m.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=m.bind(null,s.onerror),s.onload=m.bind(null,s.onload),d&&document.head.appendChild(s)}},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");if(o.length)for(var n=o.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=o[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{var e={792:0};r.f.j=(t,o)=>{var n=r.o(e,t)?e[t]:void 0;if(0!==n)if(n)o.push(n[2]);else{var a=new Promise(((o,r)=>n=e[t]=[o,r]));o.push(n[2]=a);var i=r.p+r.u(t),s=new Error;r.l(i,(o=>{if(r.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=o&&("load"===o.type?"missing":o.type),i=o&&o.target&&o.target.src;s.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,n[1](s)}}),"chunk-"+t,t)}};var t=(t,o)=>{var n,a,[i,s,d]=o,l=0;if(i.some((t=>0!==e[t]))){for(n in s)r.o(s,n)&&(r.m[n]=s[n]);if(d)d(r)}for(t&&t(o);l{"use strict";var e=r(443),t=r(973);!async function(){await(0,t.q8)(),await(0,t.cb)(0),("/"==e.A.path||"/app/"==e.A.path||e.A.path.includes("/status/")||e.A.path.includes("/t/")||e.A.path.includes("/video/")||"/de"==e.A.path||"/es"==e.A.path||"/fr"==e.A.path||"/hi"==e.A.path||"/id"==e.A.path||"/ja"==e.A.path||"/pt"==e.A.path||"/ru"==e.A.path||"/zh"==e.A.path||"/th"==e.A.path||"/it"==e.A.path||"/tr"==e.A.path)&&Promise.resolve().then(r.bind(r,195)),"/app"==e.A.path&&e.A.redirect("/app/")}()})()})();