thu-vien-lam-mo/thu-vien-lam-mo.min.js · Danh thiếp công khai: hiện ảnh riêng của trợ giảng (Core getTroGiangPhoto) (18/11/2026)

var wt=Object.defineProperty;var r=(U,L)=>wt(U,"name",{value:L,configurable:!0});(function(){"use strict";if(window.OCDIdentity)return;const U=".ocdid{position:relative;isolation:isolate;display:flex;align-items:center;gap:10px;min-width:0;border-radius:14px}.ocdid.ocdid-has-bg{padding:6px 10px 6px 6px}.ocdid-bg{background-size:cover!important;background-position:center!important}.ocdid-av{position:relative;flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:var(--ocdid-s,48px);height:var(--ocdid-s,48px)}.ocdid-face{position:relative;z-index:1;width:80%;height:80%;overflow:hidden;display:flex;align-items:center;justify-content:center;border:2px solid #fff;border-radius:50%;background:#f3eee8;box-shadow:0 3px 9px rgba(15,23,42,.14);color:#8a6b50;font:700 calc(var(--ocdid-s,48px)*.36)/1 Georgia,'Times New Roman',serif}.ocdid-face img{display:block;width:100%;height:100%;object-fit:cover}.ocdid-frame{position:absolute;z-index:2;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}.ocdid-txt{display:flex;flex-direction:column;min-width:0;gap:2px}.ocdid-namewrap{max-width:100%}.ocdid-name{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;max-width:100%;overflow:hidden;overflow-wrap:anywhere;font-weight:700;line-height:1.25;color:inherit}.ocdid-meta{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;opacity:.75}.ocdid-sm{--ocdid-s:36px}.ocdid-md{--ocdid-s:48px}.ocdid-lg{--ocdid-s:68px}.ocdid-sm .ocdid-name{font-size:13px}.ocdid-md .ocdid-name{font-size:15px}.ocdid-lg .ocdid-name{font-size:18px}.reward-multitask-wrap{position:relative;display:inline-flex;align-items:center;max-width:100%}.reward-multitask-name{position:relative;color:#f59e0b!important;animation:rewardMultitaskColor 2.8s linear infinite,rewardMultitaskGlow 1.6s ease-in-out infinite alternate}.reward-multitask-star{position:absolute;z-index:30;pointer-events:none;user-select:none;line-height:1;color:#fff;text-shadow:0 0 4px rgba(255,255,255,.9),0 0 8px rgba(251,191,36,.9);animation:rewardMultitaskStar 1.6s ease-in-out infinite}.reward-multitask-star-left{left:-17px;top:-11px}.reward-multitask-star-right{right:-18px;top:-9px;animation-delay:.35s}.reward-multitask-star-bottom-left{left:-10px;bottom:-12px;animation-delay:.7s}.reward-multitask-star-bottom-right{right:-12px;bottom:-11px;animation-delay:1.05s}.reward-multitask-size-small .reward-multitask-star{font-size:10px}.reward-multitask-size-medium .reward-multitask-star{font-size:13px}.reward-multitask-size-large .reward-multitask-star{font-size:16px}@keyframes rewardMultitaskColor{0%{color:#f59e0b}25%{color:#ec4899}50%{color:#8b5cf6}75%{color:#0ea5e9}to{color:#f59e0b}}@keyframes rewardMultitaskGlow{0%{text-shadow:0 0 3px rgba(245,158,11,.35)}to{text-shadow:0 0 6px rgba(255,255,255,.85),0 0 12px rgba(245,158,11,.75)}}@keyframes rewardMultitaskStar{0%,to{opacity:.25;transform:scale(.65) rotate(0)}50%{opacity:1;transform:scale(1.15) rotate(18deg)}}@media(prefers-reduced-motion:reduce){.reward-multitask-name,.reward-multitask-star{animation:none}}",L={cache:new Map,loader:null,styled:!1};function pe(){if(L.styled||document.getElementById("ocdid-style")){L.styled=!0;return}L.styled=!0;const d=document.createElement("style");d.id="ocdid-style",d.textContent=U,(document.head||document.documentElement).appendChild(d)}r(pe,"injectCss");function F(){return window.StudentRewardSystem||null}r(F,"rs");function le(d){const s=F(),u=String(d||"").replace(/[\u200B-\u200D\uFEFF]/g,"").trim();if(s&&typeof s.normalizeCode=="function")try{return s.normalizeCode(u)||u.toUpperCase()}catch(h){}return u.replace(/\s+/g,"").toUpperCase()}r(le,"normCode");function I(d){const s=String(d||""),u=s.match(/\/file\/d\/([^/?&#]+)/i)||s.match(/\/d\/([^/?&#]+)/i)||s.match(/[?&]id=([^&#]+)/i);return u?u[1]:""}r(I,"driveId");function B(d,s){const u=F();if(!d)return"";if(u&&typeof u.convertDriveImageUrl=="function")try{const w=u.convertDriveImageUrl(d,s||200);if(w)return w}catch(w){}const h=I(d);if(h)return"https://drive.google.com/thumbnail?id="+encodeURIComponent(h)+"&sz=w"+(s||200);const p=String(d).trim();return/^https:\/\//i.test(p)?p:""}r(B,"imageUrl");function H(d){const s=String(d||"").trim().split(/\s+/).filter(Boolean),u=s.length?s[s.length-1]:"";return u?u.charAt(0).toUpperCase():"✍"}r(H,"letter");function K(d){if(!d)return{avatar:"",frame:"",background:"",multitask:!1};const s=F(),u=Array.isArray(d.ownedItems)?d.ownedItems:[],h=d.code||"";function p(A,D){for(const a of A)if(d[a])return d[a];if(D&&s&&typeof s[D]=="function"&&u.length)try{return s[D](u,h)||""}catch(a){}return""}r(p,"pick");let w=!!(d.hasMultitaskPotion||d.multitask);if(!w&&s&&typeof s.hasMultitaskPotion=="function"&&u.length)try{w=!!s.hasMultitaskPotion(u)}catch(A){}return{avatar:p(["avatar"],"getProfileAvatar"),frame:p(["avatarFrame","frame"],"getProfileAvatarFrame"),background:p(["profileBackground","background"],"getProfileBackground"),multitask:w}}r(K,"normalize");function R(d){return new Promise(function(s){const u=Date.now();r((function h(){const p=F();if(p&&typeof p.getStudentRewardProfile=="function"){s(p);return}if(Date.now()-u>(d||15e3)){s(null);return}setTimeout(h,150)}),"tick")()})}r(R,"waitForCore");async function C(d){const s={avatar:"",frame:"",background:"",multitask:!1};try{let a=function(x){const E=x?A[D(x)]:null;return E&&E.image?E.image:""};r(a,"icon");const u=window.OCDAuth,h=await R(5e3);if(!u||typeof u.lookOf!="function"||!h)return s;const p=await u.lookOf(d);if(!p)return s;const w=typeof h.loadSharedRewardData=="function"?await h.loadSharedRewardData(!1):null,A=w&&w.giftMap?w.giftMap:{},D=typeof h.normalizeText=="function"?h.normalizeText:function(x){return String(x||"").trim().toLowerCase()};s.avatar=(h.getTroGiangPhoto&&h.getTroGiangPhoto(d))||a(p.avatar),s.frame=a(p.frame),s.background=a(p.bg)}catch(u){}return s}r(C,"publicLook");const oe={publicList:!0,ocdAuthBulk:!0};async function f(d,s){let u=null;for(let h=0;h<3;h++)try{return await d.getStudentRewardProfile(s,void 0,!1,oe)}catch(p){if(p&&p.code==="STUDENT_PROTECTED")throw p;u=p,await new Promise(function(w){setTimeout(w,1200*(h+1))})}throw u}r(f,"loadWithRetry");function T(d){return!!(d&&(d.avatar||d.frame||d.background||d.multitask))}r(T,"hasLook");function se(d){const s=le(d);if(!s)return Promise.resolve(K(null));if(L.cache.has(s))return L.cache.get(s);const u=(async function(){let h=null;try{if(L.loader)h=await L.loader(s);else{const p=await R();p&&(h=await f(p,s))}}catch(p){if(p&&p.code==="STUDENT_PROTECTED")return await C(s);throw p}return!h&&L.loader?await C(s):K(h)})().catch(function(h){return console.warn("[OCD Identity]",s,h&&h.message?h.message:h),L.cache.delete(s),K(null)});return L.cache.set(s,u),u}r(se,"profile");function Y(d){const s=d.__ocdidBg;return s===!1?null:s&&s.nodeType===1?s:d}r(Y,"bgTarget");function N(d,s){if(!d||!d.querySelector)return d;const u=s&&"multitask"in s&&"background"in s?s:K(s);if(!T(u)&&d.__ocdidHas)return d;d.__ocdidHas=T(u);const h=d.querySelector(".ocdid-face"),p=d.querySelector(".ocdid-av"),w=d.querySelector(".ocdid-namewrap"),A=d.querySelector(".ocdid-name"),D=d.__ocdidName||"";h.innerHTML="";const a=B(u.avatar,200);if(a){const y=document.createElement("img");y.src=a,y.alt=D||"Học viên",y.loading="lazy",y.decoding="async",y.onerror=function(){y.remove(),h.textContent=H(D)},h.appendChild(y)}else h.textContent=H(D);const x=p.querySelector(".ocdid-frame");x&&x.remove();const E=B(u.frame,240);if(E){const y=document.createElement("img");y.className="ocdid-frame",y.src=E,y.alt="",y.loading="lazy",y.decoding="async",y.onerror=function(){y.remove()},p.appendChild(y)}const V=Y(d);if(V){const y=B(u.background,900);V.classList.toggle("ocdid-bg",!!y),d.classList.toggle("ocdid-has-bg",!!y&&V===d),V.style.backgroundImage=y?'linear-gradient(90deg,rgba(255,253,248,.9),rgba(255,253,248,.78)),url("'+y.replace(/["\\]/g,"")+'")':""}const P=F(),ae=d.classList.contains("ocdid-lg")?"large":d.classList.contains("ocdid-sm")?"small":"medium";if(P&&typeof P.clearMultitaskEffect=="function")try{P.clearMultitaskEffect(w,A)}catch(y){}if(u.multitask&&P&&typeof P.applyMultitaskEffect=="function")try{P.applyMultitaskEffect(w,A,{size:ae})}catch(y){}return d.classList.toggle("ocdid-multitask",!!u.multitask),d.setAttribute("data-ocdid-ready","1"),d}r(N,"paint");function J(d){pe();const s=d||{},u=/^(sm|md|lg)$/.test(s.size)?s.size:"md",h=document.createElement("div");h.className="ocdid ocdid-"+u+(s.className?" "+s.className:""),h.__ocdidName=s.name||"Học viên",h.__ocdidBg=s.background===void 0?!0:s.background,s.code&&h.setAttribute("data-ocdid-code",le(s.code));const p=document.createElement("span");p.className="ocdid-av";const w=document.createElement("span");w.className="ocdid-face",w.textContent=H(s.name),p.appendChild(w);const A=document.createElement("span");A.className="ocdid-txt";const D=document.createElement("span");D.className="ocdid-namewrap";const a=document.createElement("b");if(a.className="ocdid-name",a.textContent=s.name||"Học viên",a.title=s.name||"",D.appendChild(a),A.appendChild(D),s.meta){const E=document.createElement("small");E.className="ocdid-meta",E.textContent=s.meta,A.appendChild(E)}h.append(p,A);const x=s.profile?K(s.profile):null;return x&&N(h,x),s.code&&!T(x)&&se(s.code).then(function(E){N(h,E)}),h}r(J,"create"),window.OCDIdentity={version:"1.1.0",create:J,paint:N,profile:se,normalize:K,imageUrl:B,setLoader:r(function(d){L.loader=typeof d=="function"?d:null},"setLoader"),prime:r(function(d,s){const u=le(d);u&&s&&L.cache.set(u,Promise.resolve(K(s)))},"prime")}})(),(function(){var U=document.getElementById("thu-vien-lam-mo");if(!(!U||U.getAttribute("data-tvlm"))){U.setAttribute("data-tvlm","1");var L=document.createElement("style");L.textContent='#thu-vien-lam-mo{max-width:1200px;margin:30px auto;font-family:Rubik,Arial,sans-serif;color:#222}.khung{background:#faf7ef;padding:40px;border:8px solid #2b1b10;box-shadow:0 10px 30px #aaa}.tieu-de{text-align:center;font-size:40px;letter-spacing:8px;margin-bottom:30px}.khu-hoc-vien{background:#fff;border:1px solid #d8c7b2;border-radius:18px;padding:28px;margin-bottom:25px;text-align:center}.khu-hoc-vien h2{margin-top:0;color:#2b1b10;font-size:25px}.khu-hoc-vien p{line-height:1.7;color:#555}.khu-nhap-ma{display:flex;justify-content:center;align-items:center;gap:10px;flex-wrap:wrap;margin-top:15px}.khu-nhap-ma input{width:350px;max-width:90%;padding:14px 20px;border-radius:30px;border:1px solid #aaa;font-size:16px;box-sizing:border-box}#thong-tin-hoc-vien{margin-top:20px;line-height:1.8}.hv-thanh-cong{background:#eff8ed;border:1px solid #aad3a5;padding:18px;border-radius:14px}.hv-loi{background:#fff0f0;border:1px solid #dfaaaa;padding:15px;border-radius:14px}.diem-noi-bat{color:#b06b2c;font-size:25px;font-weight:700}.thong-ke-mo-khoa{text-align:center;padding:13px 20px;margin-bottom:25px;border-radius:12px;background:#f2eadc;font-size:15px;line-height:1.8}.tim-kiem{display:flex;justify-content:center;align-items:center;gap:10px;margin-bottom:25px;flex-wrap:wrap}.tim-kiem input{width:450px;max-width:90%;padding:14px 20px;border-radius:30px;border:1px solid #aaa;font-size:16px;box-sizing:border-box}.bo-loc{display:flex;justify-content:center;gap:20px;margin-bottom:35px;flex-wrap:wrap}.bo-loc select{padding:12px 20px;border-radius:30px;border:1px solid #aaa;font-size:16px;min-width:230px}.nut{background:#2b1b10;color:#fff;border:none;padding:12px 25px;border-radius:30px;cursor:pointer;font-size:16px;margin:5px}.nut:hover{background:#8b5a2b}.nut-gui{background:#b06b2c}.nut-gui:hover{background:#d28a43}.nut-phu{background:#777}.nut-phu:hover{background:#555}.danh-sach{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:25px}.the{background:#fff;padding:20px;border-radius:15px;border:1px solid #ddd;cursor:pointer;transition:.3s;position:relative}.the:hover{transform:translateY(-5px);box-shadow:0 10px 20px #ccc}.the img{width:100%;height:300px;object-fit:contain;background:#f4f4f4;border-radius:10px;display:block}.the h3{text-align:center;font-size:20px}.thong-tin{font-size:14px;line-height:1.8}.loading{text-align:center;font-size:20px;padding:30px;grid-column:1/-1}.nhan-mo-khoa{position:absolute;top:10px;right:10px;background:#b06b2c;color:#fff;padding:6px 11px;border-radius:20px;font-size:12px;font-weight:700;z-index:5}#phan-trang{text-align:center;margin-top:35px}#phan-trang .nut{min-width:45px}#chi-tiet{display:none}#ten-noi-dung{text-align:center;font-size:45px;letter-spacing:10px;margin:25px}.vung-anh{position:relative;width:100%;max-width:1000px;margin:20px auto;display:flex;justify-content:center;align-items:center;background:#fff;padding:20px;box-sizing:border-box}.anh-lon{width:100%;max-height:900px;object-fit:contain;position:relative;z-index:2;display:block}.o-me{position:absolute;z-index:3;width:90%;height:90%;left:5%;top:5%;background:linear-gradient(45deg,transparent 49.5%,#888 50%,transparent 50.5%),linear-gradient(-45deg,transparent 49.5%,#888 50%,transparent 50.5%);opacity:.35;pointer-events:none}.o-me:before{content:"";position:absolute;top:50%;left:0;width:100%;height:1px;background:#888}.o-me:after{content:"";position:absolute;left:50%;top:0;width:1px;height:100%;background:#888}.khu-vuc-nut{text-align:center;margin:20px}.thong-tin-chi-tiet{background:#f5efe3;padding:30px;margin-top:30px;border-radius:15px;line-height:2;font-size:16px}.video-box{margin-top:35px;text-align:center}.video-box iframe{width:100%;max-width:800px;height:450px;border-radius:15px;border:none}.khu-vuc-goi-y{margin-top:50px;border-top:1px solid #aaa;padding-top:30px}.ds-goi-y{display:flex;flex-wrap:nowrap;justify-content:flex-start;gap:20px;overflow-x:auto;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;padding:10px 2px 18px;max-width:100%}.dich-ban-item{width:180px;flex:0 0 180px;scroll-snap-align:start;border:0;background:transparent;font:inherit;padding:0;text-align:center;cursor:pointer;transition:.2s}.dich-ban-item img{width:180px;height:180px;object-fit:contain;background:#fff;border:1px solid #ddd;display:block}.dich-ban-item:hover{transform:scale(1.05)}#thu-vien-lam-mo [hidden]{display:none!important}.lm-slide-nav{display:flex;justify-content:flex-end;gap:8px;margin:8px 0}.lm-video-cards{display:flex;gap:12px;overflow-x:auto;padding:10px 0;scroll-snap-type:x mandatory}.lm-video-card{flex:0 0 220px;scroll-snap-align:start;border:1px solid #d6ccbb;border-radius:10px;padding:12px;box-sizing:border-box;background:#fffaf1}.lm-video-card img{width:100%;aspect-ratio:16/9;object-fit:cover}.lm-video-card button{width:100%}.lm-video-placeholder{min-height:80px;display:grid;place-items:center;background:#eee5d8}.lm-player iframe{width:100%;height:auto;aspect-ratio:16/9;max-width:800px;border:0}.lm-player a{display:block;margin:10px 0}#thu-vien-lam-mo .lm-contribution-dialog{position:fixed;inset:0;margin:auto;width:min(680px,calc(100vw - 48px));height:min(760px,calc(100vh - 48px));height:min(760px,calc(100dvh - 48px));max-height:none;max-width:none;padding:14px;border:1px solid #9b8b73;border-radius:14px;box-sizing:border-box;background:#faf7ef;overflow:hidden}#thu-vien-lam-mo .lm-contribution-dialog[open]{display:grid!important;grid-template-rows:auto minmax(0,1fr);gap:10px}#thu-vien-lam-mo .lm-contribution-dialog>button{justify-self:start;max-width:100%;white-space:normal;margin:0}#thu-vien-lam-mo .lm-show-header{min-width:0}#thu-vien-lam-mo .lm-show-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}#thu-vien-lam-mo .lm-show-actions .nut{margin:0;white-space:normal;min-height:42px}#thu-vien-lam-mo #lm-native-show-send{display:inline-flex;align-items:center;justify-content:center;gap:7px}#thu-vien-lam-mo #lm-native-show-send[hidden]{display:none!important}#thu-vien-lam-mo #lm-native-show-send:disabled{cursor:default;opacity:.75}#thu-vien-lam-mo #lm-native-show-send[data-state=done]{color:#166534;background:#e8f5e9;opacity:1;border-color:#74ac7e}#thu-vien-lam-mo .lm-submit-icon{width:20px;height:20px;flex:0 0 20px}#thu-vien-lam-mo .lm-submit-hourglass{animation:lm-hourglass-turn 1.5s ease-in-out infinite}#thu-vien-lam-mo .lm-submit-check{color:#16803c}#thu-vien-lam-mo #lm-native-show-status{margin:8px 0 0;font:14px/1.4 Arial,sans-serif;overflow-wrap:anywhere}@keyframes lm-hourglass-turn{0%,35%{transform:rotate(0)}80%,to{transform:rotate(180deg)}}@media(prefers-reduced-motion:reduce){#thu-vien-lam-mo .lm-submit-hourglass{animation:none}}@media(max-width:600px){#thu-vien-lam-mo .lm-show-actions{flex-wrap:nowrap;align-items:stretch}#thu-vien-lam-mo .lm-show-actions .nut{flex:1;min-width:0;font-size:13px;padding:9px 6px}}#thu-vien-lam-mo .lm-modal-body{position:relative;min-height:0!important;overflow-y:auto!important;overflow-x:hidden!important;touch-action:pan-y;width:100%;background:#faf7ef;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}#thu-vien-lam-mo .lm-contribution-dialog::backdrop{background:#0009}#thu-vien-lam-mo .lm-native-form{margin:0;max-width:580px;padding:18px;margin-inline:auto;font:16px/1.6 Arial,sans-serif;box-sizing:border-box}#thu-vien-lam-mo .lm-native-form h2{font:700 23px/1.3 Arial,sans-serif;letter-spacing:0;margin:0 0 12px}#thu-vien-lam-mo .lm-native-form label{display:block;margin:12px 0}#thu-vien-lam-mo .lm-native-form input:not([type=checkbox]):not([type=radio]),#thu-vien-lam-mo .lm-native-form textarea{display:block;box-sizing:border-box;width:100%;max-width:100%;font:16px/1.5 Arial,sans-serif;padding:10px;border:1px solid #c7bcaa;border-radius:8px;background:#fff;color:#352b24}#thu-vien-lam-mo .lm-native-form input[type=checkbox],#thu-vien-lam-mo .lm-native-form input[type=radio]{width:auto;display:inline-block}#thu-vien-lam-mo .lm-native-form button{font:16px/1.4 Arial,sans-serif;white-space:normal}#thu-vien-lam-mo .lm-native-form small{display:block;font-size:13px;color:#675e50;overflow-wrap:anywhere}#thu-vien-lam-mo .lm-native-form [role=status]{white-space:pre-wrap;overflow-wrap:anywhere}#thu-vien-lam-mo .lm-native-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:16px 0}#thu-vien-lam-mo .lm-native-work{min-width:0;padding:8px;border:2px solid transparent;border-radius:10px;background:#fff;cursor:pointer}#thu-vien-lam-mo .lm-native-work:has(input:checked){border-color:#a5653d}#thu-vien-lam-mo .lm-native-work img{display:block;width:100%;height:150px;object-fit:contain}@media(max-width:600px){#thu-vien-lam-mo .lm-native-form{padding:12px}#thu-vien-lam-mo .lm-native-form h2{font-size:21px}}@media(max-width:600px){#thu-vien-lam-mo .lm-contribution-dialog{width:100vw;height:100vh;height:100dvh;max-height:100dvh;margin:0;border:0;border-radius:0;padding:12px;padding-top:max(12px,env(safe-area-inset-top));padding-bottom:max(12px,env(safe-area-inset-bottom));gap:8px}#thu-vien-lam-mo .lm-contribution-dialog>button{font-size:14px;min-height:40px}}@media(prefers-reduced-motion:reduce){.ds-goi-y{scroll-behavior:auto}.dich-ban-item{transition:none}}@media(max-width:768px){.ds-goi-y{gap:12px}.dich-ban-item{width:140px;flex-basis:140px}.dich-ban-item img{width:140px;height:140px}.khung{padding:20px}#ten-noi-dung{font-size:30px;letter-spacing:3px}.anh-lon{max-height:650px}.video-box iframe{height:250px}.khu-hoc-vien{padding:20px 15px}}#thu-vien-lam-mo .lm-showcase{margin-top:35px}#thu-vien-lam-mo .lm-show-track{padding:8px 4px 14px;align-items:stretch}#thu-vien-lam-mo .lm-show-posts{display:contents}#thu-vien-lam-mo .lm-show-add{flex:0 0 180px;min-height:190px;padding:12px;border:1px dashed #b29a7b;border-radius:10px;background:#fffcf5;color:#715237;cursor:pointer;font:300 44px Arial;scroll-snap-align:start}#thu-vien-lam-mo .lm-show-add:hover{background:#f4edde}#thu-vien-lam-mo .lm-show-card{position:relative;flex:0 0 180px;background:#fffdf8;border:1px solid #e4d8c7;border-radius:10px;scroll-snap-align:start;box-sizing:border-box}#thu-vien-lam-mo .lm-show-photo{display:block;width:100%;height:280px;aspect-ratio:auto;padding:6px;border:0;border-radius:10px 10px 0 0;background:#ece5d9;cursor:zoom-in;box-sizing:border-box}#thu-vien-lam-mo .lm-show-photo img{display:block;width:100%;height:100%;max-height:100%;object-fit:contain}#thu-vien-lam-mo .lm-photo-error:after{content:"\\1ea2nh ch\\1b0 a m\\1edf  quy\\1ec1n xem";color:#79634f}#thu-vien-lam-mo .lm-show-owner{display:flex;align-items:center;gap:9px;padding:12px 10px;background-position:center;background-size:cover;border-radius:0 0 10px 10px;min-height:35px}#thu-vien-lam-mo .lm-show-owner>div:last-child{min-width:0}#thu-vien-lam-mo .lm-show-owner b{display:block;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#thu-vien-lam-mo .lm-show-owner small{display:block;color:#79634f;margin-top:3px;font-size:10px}#thu-vien-lam-mo .lm-show-avatar{position:relative;width:30px;height:30px;flex:0 0 30px;isolation:isolate}#thu-vien-lam-mo .lm-show-avatar-core{display:flex;width:100%;height:100%;align-items:center;justify-content:center;overflow:hidden;border-radius:50%;background:#efe4d0;font-size:18px}#thu-vien-lam-mo .lm-show-avatar-core img{width:100%;height:100%;object-fit:cover;border-radius:50%}#thu-vien-lam-mo .lm-show-frame{position:absolute;inset:-14%;width:128%;height:128%;max-width:none;object-fit:contain;pointer-events:none;z-index:1}#thu-vien-lam-mo .lm-show-potion{position:absolute;bottom:-4px;right:-5px;background:#fff7dc;border-radius:50%;z-index:2;font-size:11px}#thu-vien-lam-mo .lm-show-heart{position:absolute;top:6px;right:6px;border:1px solid #e5ccc1;border-radius:14px;padding:4px 7px;color:#a04538;background:#fffdf8ee;cursor:pointer;font:600 12px Arial;min-height:28px;z-index:2}#thu-vien-lam-mo .lm-show-heart:hover{background:#f9e2d7}#thu-vien-lam-mo .lm-show-heart.is-liked{color:#c33235;background:#fff0f0}#thu-vien-lam-mo .lm-show-heart:disabled{opacity:1;cursor:progress}#thu-vien-lam-mo .lm-show-heart:disabled span{display:inline-block;animation:lmHeartBeat .9s ease-in-out infinite}@keyframes lmHeartBeat{0%,to{transform:scale(1)}50%{transform:scale(1.25)}}#thu-vien-lam-mo .lm-show-image{max-width:90vw;max-height:90vh;border:0;border-radius:14px;padding:16px;background:#faf7ef}#thu-vien-lam-mo .lm-show-image img{display:block;max-width:85vw;max-height:75vh;object-fit:contain;margin:10px auto}#thu-vien-lam-mo .lm-show-image::backdrop{background:#000b}@media(max-width:600px){#thu-vien-lam-mo .lm-show-card,#thu-vien-lam-mo .lm-show-add{flex-basis:140px}#thu-vien-lam-mo .lm-show-add{min-height:170px}#thu-vien-lam-mo .lm-show-owner{padding:10px 8px;gap:8px}#thu-vien-lam-mo .lm-show-photo{height:220px;aspect-ratio:auto}#thu-vien-lam-mo .lm-show-image{width:100vw;max-width:100vw;max-height:100dvh;box-sizing:border-box;padding:12px}#thu-vien-lam-mo .lm-show-image img{max-width:100%;max-height:calc(100dvh - 90px)}}#thu-vien-lam-mo .lm-show-owner-shared{display:block}#thu-vien-lam-mo .lm-show-owner-shared .ocdid-name{color:#2f2924}',document.head.appendChild(L),U.innerHTML=`<div class="khung"> <div class="tieu-de"> <span style=" font-size:14px; font-family:Arial,sans-serif; letter-spacing:-0.5px; line-height:1; display:inline-block; "> *Tài liệu phục vụ lâm mô KHÔNG ĐƯỢC TỰ Ý sử dụng trong mục đích thương mại* </span> </div> <div id="thu-vien"> <input id="maHocVien" type="hidden" value="" autocomplete="off" > <div id="thong-tin-hoc-vien" hidden ></div> <div class="thong-ke-mo-khoa" id="thong-ke-mo-khoa" > Đang tải dữ liệu... </div> <div class="tim-kiem"> <input id="search" placeholder="Tìm theo nội dung, người viết, tác giả, chủ đề..." onkeydown="if(event.key==='Enter'){timKiem();}" > <button class="nut" onclick="timKiem()"> Tìm kiếm </button> <button class="nut" onclick="xoaTimKiem()"> Xóa </button> </div> <div class="bo-loc"> <select id="locSoLuong" onchange="locDuLieu()"> <option value="">Tất cả số lượng chữ</option> </select> <select id="locChuDe" onchange="locDuLieu()"> <option value="">Tất cả chủ đề</option> </select> <select id="locDiem" onchange="locDuLieu()"> <option value="">Tất cả mốc điểm kinh nghiệm</option> </select> </div> <div class="danh-sach" id="list"> <div class="loading">Đang tải dữ liệu...</div> </div> <div id="phan-trang"></div> </div> <div id="chi-tiet"> <button class="nut" onclick="quayLai()"> ← Quay lại </button> <h1 id="ten-noi-dung"></h1> <div class="vung-anh"> <div class="o-me" id="grid"></div> <img class="anh-lon" id="anh-chinh" alt="" > </div> <div class="khu-vuc-nut"> <button class="nut" onclick="batTatOMe()"> Bật / Tắt ô Mễ </button> <button class="nut" onclick="taoBanIn()"> Tạo bản in </button> <button class="nut nut-gui" onclick="guiBaiTap()"> Gửi bài tập ngay </button> </div> <div class="thong-tin-chi-tiet"> <h2>Thông tin lâm mô</h2> <p><b>Người viết:</b> <span id="ct-nguoi"></span></p> <p><b>Nội dung:</b> <span id="ct-noi-dung"></span></p> <p><b>Số lượng chữ:</b> <span id="ct-so-luong"></span></p> <p><b>Tác giả nội dung:</b> <span id="ct-tac-gia"></span></p> <p><b>Mô tả ngắn:</b> <span id="ct-mo-ta"></span></p> <p><b>Chủ đề:</b> <span id="ct-chu-de"></span></p> </div> <div class="video-box" id="video"></div> <dialog class="lm-contribution-dialog" id="lm-contribution-dialog" aria-label="Đóng góp video hướng dẫn"> <button class="nut" onclick="closeContributionForm()">Đóng biểu mẫu</button> <div class="lm-modal-body"><form id="lm-video-native-form" class="lm-native-form"> <h2>Đóng góp video hướng dẫn</h2><p id="lm-native-video-lesson"></p><p>Video được chấp thuận nhận <b>5 Hồng Ngọc</b> sau khi giáo viên xác minh người gửi.</p> <label>Mã học viên<input id="lm-native-video-code" required maxlength="40" autocomplete="username"></label> <label>Link YouTube, Facebook hoặc Google Drive<input id="lm-native-video-url" type="url" required maxlength="1500" placeholder="https://…"></label> <small>Dùng link video trực tiếp. Facebook cần cho phép nhúng; video Drive cần chia sẻ “Bất kỳ ai có đường liên kết” với quyền Người xem.</small> <label>Tiêu đề<input id="lm-native-video-title" required maxlength="150"></label> <label>Mô tả<textarea id="lm-native-video-description" rows="3" maxlength="1000"></textarea></label> <label><input id="lm-native-video-owns" type="checkbox" required> Tôi xác nhận quyền chia sẻ video này.</label> <button id="lm-native-video-send" type="submit" class="nut">Gửi video để duyệt</button><p id="lm-native-video-status" role="status" aria-live="polite"></p> </form></div> </dialog> <div class="khu-vuc-goi-y"> <h2>Các bản lâm khác</h2> <div class="lm-slide-nav"><button class="nut" id="ds-dich-ban-prev" onclick="moveSlider('ds-dich-ban',-1)" aria-label="Các bản trước" hidden>←</button><button class="nut" id="ds-dich-ban-next" onclick="moveSlider('ds-dich-ban',1)" aria-label="Các bản tiếp theo" hidden>→</button></div> <div class="ds-goi-y" id="ds-dich-ban" tabindex="0" aria-label="Các bản lâm khác" onscroll="updateSliderControls('ds-dich-ban')"></div> </div> <div class="khu-vuc-goi-y"> <h2>Gợi ý lâm mô cùng chủ đề</h2> <div class="lm-slide-nav"><button class="nut" id="ds-chu-de-prev" onclick="moveSlider('ds-chu-de',-1)" aria-label="Gợi ý trước" hidden>←</button><button class="nut" id="ds-chu-de-next" onclick="moveSlider('ds-chu-de',1)" aria-label="Gợi ý tiếp theo" hidden>→</button></div> <div class="ds-goi-y" id="ds-chu-de" tabindex="0" aria-label="Gợi ý cùng chủ đề" onscroll="updateSliderControls('ds-chu-de')"></div> </div> <section id="lm-showcase" class="khu-vuc-goi-y lm-showcase"> <h2>Bản lâm của học viên</h2> <div class="lm-slide-nav"><button class="nut" id="lm-show-track-prev" onclick="moveSlider('lm-show-track',-1)" aria-label="Bản lâm trước" hidden>←</button><button class="nut" id="lm-show-track-next" onclick="moveSlider('lm-show-track',1)" aria-label="Bản lâm tiếp theo" hidden>→</button></div> <div class="ds-goi-y lm-show-track" id="lm-show-track" tabindex="0" aria-label="Bản lâm học viên" onscroll="updateSliderControls('lm-show-track')"><button id="lm-show-add" class="lm-show-add" onclick="openShowcaseForm('post')" aria-label="Khoe bản lâm" title="Khoe bản lâm">+</button><div id="lm-show-posts" class="lm-show-posts"></div></div> <p id="lm-show-status" aria-live="polite" hidden></p> </section> <dialog id="lm-show-dialog" class="lm-contribution-dialog" aria-label="Khoe bản lâm"> <div class="lm-show-header"><div class="lm-show-actions"><button class="nut" type="button" onclick="closeShowcaseDialog()">Đóng và cập nhật danh sách</button><button id="lm-native-show-send" class="nut" type="button" disabled>Khoe bản lâm</button></div><p id="lm-native-show-status" role="status" aria-live="polite"></p></div> <div class="lm-modal-body"><div class="lm-native-form"><h2>Khoe bản lâm</h2><p id="lm-native-show-lesson"></p><p id="lm-native-show-identity"></p><div id="lm-native-works" class="lm-native-grid"></div><button id="lm-native-show-retry" class="nut" type="button" hidden>Thử tải lại bài</button></div></div> </dialog> <dialog id="lm-show-image" class="lm-show-image"><button class="nut" onclick="document.getElementById('lm-show-image').close()">Đóng ảnh</button><img id="lm-show-image-src" alt="Bản lâm của học viên"></dialog> </div> </div>`,(function(){"use strict";const pe="https://docs.google.com/spreadsheets/d/1MmqY19BSi8L6xdsF5cg1qZssrERSrqBH6nEGZjqOMLI/export?format=csv&gid=179109844",F="https://docs.google.com/spreadsheets/d/1GJoTRsbq0kZfZrDdh0uCC667PwS3Bgkje2fHQnwnCKs/export?format=csv&gid=1326884435",le="lammo_ma_hoc_vien";let I=[],B=[],H=[],K=[],R=0,C=null,oe=!0,f=null,T=1,se=!1,Y=!1,N=!1;const J=20,d="https://script.google.com/macros/s/AKfycbz4pa-q_ALScuiY8tbhi5bdJ0MPtl-IBu6gjZuDeFXuailbvPYhlk1TmE_Hq4DjJxHFIg/exec";let s=0,u=[],h=null,p=null,w=0;const A=12,D=250;function a(t){return document.getElementById(t)}r(a,"byId");function x(t){return String(t==null?"":t).replace(/[\u200B-\u200D\uFEFF]/g,"").trim().toUpperCase().replace(/\s+/g,"")}r(x,"chuanHoaMa");function E(t){let e=[],n=[],i="",o=!1;for(let l=0;l<t.length;l++){let c=t[l],m=t[l+1];c==='"'?o&&m==='"'?(i+='"',l++):o=!o:c===","&&!o?(n.push(i),i=""):(c===`
`||c==="\r")&&!o?(c==="\r"&&m===`
`&&l++,n.push(i),n.some(v=>String(v).trim()!=="")&&e.push(n),n=[],i=""):i+=c}return(i!==""||n.length)&&(n.push(i),n.some(l=>String(l).trim()!=="")&&e.push(n)),e}r(E,"parseCSV");function V(t){return String(t||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/đ/g,"d").replace(/Đ/g,"D").toLowerCase().trim()}r(V,"boDau");function P(t,e){let n=t.map(i=>V(i));for(let i of e){let o=V(i),l=n.findIndex(c=>c===o||c.includes(o));if(l!==-1)return l}return-1}r(P,"timCot");function ae(t){if(t==null)return 0;let e=String(t).trim().replace(/\s/g,"");/^\d{1,3}(\.\d{3})+$/.test(e)?e=e.replace(/\./g,""):/^\d{1,3}(,\d{3})+$/.test(e)?e=e.replace(/,/g,""):e=e.replace(",","."),e=e.replace(/[^\d.-]/g,"");let n=parseFloat(e);return isNaN(n)?0:n}r(ae,"docDiem");function y(t){if(!t)return"";t=String(t).trim();let e=[/\/file\/d\/([^\/?]+)/,/\/d\/([^\/?]+)/,/[?&]id=([^&]+)/,/thumbnail\?id=([^&]+)/,/uc\?.*?[?&]id=([^&]+)/];for(let n of e){let i=t.match(n);if(i&&i[1])return i[1]}return""}r(y,"layIdDrive");function de(t){if(!t)return"";t=String(t).trim();let e=y(t);return e?"https://drive.google.com/thumbnail?id="+encodeURIComponent(e)+"&sz=w1200":t}r(de,"anhDrive");function ge(t,e){if(!t||!e)return;let n=y(e);if(!n){t.onerror=null;return}let i=Number(t.getAttribute("data-thu-anh")||"0");if(i===0){t.setAttribute("data-thu-anh","1"),t.src="https://drive.google.com/uc?export=view&id="+encodeURIComponent(n);return}if(i===1){t.setAttribute("data-thu-anh","2"),t.src="https://lh3.googleusercontent.com/d/"+encodeURIComponent(n)+"=w1200";return}t.onerror=null}r(ge,"xuLyLoiAnh");function b(t){return String(t==null?"":t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}r(b,"escapeHTML");function He(){try{if(window.OCDStudentSession&&typeof window.OCDStudentSession.getState=="function")return window.OCDStudentSession.getState()}catch(t){console.warn("[Lâm Mô] Không đọc được OCDStudentSession:",t)}return null}r(He,"layMinhHongSession");function ce(){let t=He();if(!t)return"";let e=String(t.mode||"").trim().toLowerCase(),n=t.verified===!0,i=x(t.code);return e==="student"&&n&&i?i:""}r(ce,"layMaDaXacMinhTuMinhHong");function fe(){try{let t=localStorage.getItem("ocd_student_session_v1");if(!t)return"";let e=JSON.parse(t);if(!e)return"";let n=String(e.mode||"").trim().toLowerCase(),i=x(e.code);if(n==="student"&&e.verified===!0&&i)return i}catch(t){}return""}r(fe,"layMaMinhHongTuStorage");function xt(t){if(t=x(t),!!t&&!N)try{let e=He(),n=e?x(e.code):"",i=!!(e&&e.mode==="student"&&e.verified===!0);if(n===t&&i)return;if(window.OCDStudentSession&&typeof window.OCDStudentSession.confirmStudent=="function"){N=!0,window.OCDStudentSession.confirmStudent(t,"lam-mo"),setTimeout(function(){N=!1},100);return}window.OCDStudentSession&&typeof window.OCDStudentSession.rememberStudent=="function"&&(N=!0,window.OCDStudentSession.rememberStudent(t,"lam-mo"),setTimeout(function(){N=!1},100))}catch(e){N=!1,console.warn("[Lâm Mô] Không đồng bộ được mã sang Minh Hồng:",e)}}r(xt,"dongBoMaSangMinhHong");function Oe(){try{if(window.OCDMinhHongContext&&typeof window.OCDMinhHongContext.set=="function")return window.OCDMinhHongContext}catch(t){}return null}r(Oe,"layMinhHongContextAPI");function Q(){clearTimeout(p),p=null,w=0;try{window.OCDMinhHongContext&&typeof window.OCDMinhHongContext.clear=="function"&&window.OCDMinhHongContext.clear("lam-mo")}catch(t){console.warn("[Lâm Mô] Không xóa được Minh Hồng Context:",t)}}r(Q,"xoaMinhHongContext");function De(){if(!C)return null;let t=Number(I.length||0),e=Number(H.length||0),n=Math.max(0,t-e),i="",o="",l="",c=0;return f&&(i=String(f.noiDung||"").trim(),o=String(f.chuDe||"").trim(),l=String(f.nguoiViet||"").trim(),c=Number(f.diemMoKhoa||0)),{page:"LamMo",studentCode:x(C.ma),data:{studentName:String(C.ten||"").trim(),xp:Number(R||0),totalCount:t,unlockedCount:e,lockedCount:n,currentTitle:i,currentTopic:o,currentAuthor:l,currentRequiredXp:c},conditions:{has_unlocked_content:e>0,has_locked_content:t>0&&n>0,all_content_unlocked:t>0&&e===t,viewing_content:!!(f&&i)}}}r(De,"taoMinhHongContext");function q(){let t=De();if(!t)return Q(),!1;let e=Oe();if(!e)return w>=A?(w=0,!1):(w++,clearTimeout(p),p=setTimeout(q,D),!1);clearTimeout(p),p=null,w=0;try{return e.set(t,"lam-mo"),!0}catch(n){return console.warn("[Lâm Mô] Không đồng bộ được Minh Hồng Context:",n),!1}}r(q,"dongBoMinhHongContext");function be(){if(!Y)return!1;let t=ce()||fe();if(!t)return!1;let e=a("maHocVien");return e?C&&x(C.ma)===t?(e.value=t,q(),!0):(Q(),f=null,e.value=t,ue({source:"minh-hong",syncMinhHong:!1}),!0):!1}r(be,"apDungMaTuMinhHong");function Ue(){if(be())return;let t=0;const e=12;function n(){t++,!be()&&(t>=e||setTimeout(n,250))}r(n,"thuLai"),setTimeout(n,100)}r(Ue,"thuDongBoMinhHong"),window.addEventListener("ocdStudentSessionChanged",function(t){if(N)return;const e=t&&t.detail&&t.detail.current?t.detail.current:null,n=String(e&&e.mode||"").trim().toLowerCase(),i=x(e&&e.code),o=!!(e&&e.verified===!0);if(n==="student"&&o&&i){Y&&ue({ma:i,source:"minh-hong",syncMinhHong:!1});return}ze()});async function Ee(t,e=15e3){const n=new AbortController;let i;const o=new Promise((l,c)=>{i=setTimeout(()=>{n.abort(),c(Error("Nguồn dữ liệu phản hồi chậm. Vui lòng tải lại trang."))},e)});try{return await Promise.race([fetch(t,{signal:n.signal}).then(l=>{if(!l.ok)throw Error("Không tải được nguồn dữ liệu.");return l.text()}),o])}finally{clearTimeout(i)}}r(Ee,"fetchSheetText");function qe(){return Ee(pe+"&_="+Date.now()).then(t=>{let e=E(t);if(e.length<=1)throw new Error("Sheet lâm mô không có dữ liệu");return e.shift(),I=e.map((n,i)=>({id:String(n[10]||"").trim()||"lammo_"+i,nguoiViet:String(n[1]||"").trim(),hinhAnh:String(n[2]||"").trim(),noiDung:String(n[3]||"").trim(),soLuong:String(n[4]||"").trim(),tacGia:String(n[5]||"").trim(),video:String(n[6]||"").trim(),moTa:String(n[7]||"").trim(),chuDe:String(n[8]||"").trim(),diemMoKhoa:ae(n[9]||0)})).filter(n=>n.hinhAnh!==""||n.noiDung!==""),I.reverse(),se=!0,re(),C&&q(),I})}r(qe,"taiDuLieuLamMo");function Ae(){return Ee(F+"&_="+Date.now()).then(t=>{let e=E(t);if(e.length<=1)throw new Error("Sheet XepHang không có dữ liệu");let n=e[0],i=P(n,["Mã học viên","Ma hoc vien"]),o=P(n,["Họ và tên","Ho va ten"]),l=P(n,["Điểm kinh nghiệm","Diem kinh nghiem"]);if(i===-1)throw new Error("Không tìm thấy cột Mã học viên trong sheet XepHang");if(l===-1)throw new Error("Không tìm thấy cột Điểm kinh nghiệm trong sheet XepHang");return B=e.slice(1).map(c=>({ma:x(c[i]||""),ten:o!==-1?String(c[o]||"").trim():"",diem:ae(c[l])})).filter(c=>c.ma!==""),Y=!0,B})}r(Ae,"taiDuLieuHocVien"),Promise.allSettled([qe(),Ae()]).then(t=>{t[0].status==="rejected"&&(console.error("Lỗi lâm mô:",t[0].reason),a("list").innerHTML=`
        <div class="loading">
        Nguồn thư viện phản hồi chậm hoặc chưa mở quyền đọc. Hãy tải lại trang.
        </div>
        `),t[0].status==="rejected"&&(a("thong-ke-mo-khoa").textContent="Chưa tải được thư viện. Vui lòng tải lại trang."),t[1].status==="rejected"&&(console.error("Lỗi XepHang:",t[1].reason),B=[],Y=!0);let e=ce()||fe();if(e){a("maHocVien").value=e,ue({source:"minh-hong",syncMinhHong:!1});return}Ue()});async function $e(t){const e=window.StudentRewardSystem;if(!e||typeof e.assertStudentActive!="function")throw new Error("Hệ thống trạng thái học viên chưa sẵn sàng.");return e.assertStudentActive(t,{forceRefresh:!0})}r($e,"kiemTraTrangThaiHocVien");async function ue(t){t=t||{};const e=a("thong-tin-hoc-vien");e&&(e.hidden=!0,e.innerHTML="");let n=x(t.ma||ce()||fe());const i=a("maHocVien");if(i&&(i.value=n),!n){C=null,R=0,f=null,Q(),re();return}let o;try{o=await $e(n)}catch(g){console.warn("[Thu vien Lam mo Student Status Gate]",g),C=null,R=0,f=null,Q(),re();return}const l=o&&o.student?o.student:{};function c(){let g=B.find(k=>x(k.ma)===n);if(!g&&l.name){const k=V(l.name),z=B.filter(M=>V(M.ten)===k);z.length===1&&(g=z[0])}return g||null}r(c,"timHocVienTrongXepHang");let m=c();if(!m)try{await Ae(),m=c()}catch(g){console.warn("[Thu vien Lam mo] Không tải mới được điểm XepHang:",g)}m||(m={ma:n,ten:String(l.name||"").trim(),diem:0},console.warn("[Thu vien Lam mo] Học viên hợp lệ nhưng chưa có điểm trong XepHang:",n)),m.diem=ae(m.diem),C&&x(C.ma)!==x(m.ma)&&(Q(),f=null),C=m,R=m.diem;let v=m.ten?`
    <b>
    ${b(m.ten)}
    </b>
    <br>
    `:"";e&&(e.innerHTML=`
        <div class="hv-thanh-cong">


        ${v}


        Mã học viên:


        <b>
        ${b(m.ma)}
        </b>


        <br>


        Điểm kinh nghiệm:


        <span class="diem-noi-bat">


        ${b(m.diem)}


        </span>


        <br>


        Hệ thống đã mở khóa
        các bài lâm mô phù hợp
        với điểm kinh nghiệm hiện tại.


        </div>
        `,e.hidden=!1),re(),q()}r(ue,"kiemTraHocVien");function ze(){const t=a("maHocVien");t&&(t.value=""),C=null,R=0,f=null,Q();const e=a("thong-tin-hoc-vien");e&&(e.innerHTML="",e.hidden=!0),re()}r(ze,"xoaMaHocVien");let ee=(function(){try{const t=new URLSearchParams(location.search).get("lm")||(location.hash.match(/(?:^#|&)lm=([^&]+)/)||[])[1]||"";return decodeURIComponent(t).trim()}catch(t){return""}})(),ve=null;function je(){if(!ee)return;const t=ee;if(H.some(e=>e.id===t)){ee="",clearTimeout(ve),setTimeout(()=>we(t),0);return}if(!I.some(e=>e.id===t)){ee="";return}clearTimeout(ve),ve=setTimeout(()=>{ee===t&&(ee="",alert("Bản mẫu này chưa mở khóa với điểm kinh nghiệm hiện tại. Hãy đăng nhập hoặc tích thêm điểm để xem."))},8e3)}r(je,"moLamMoTuLienKet");function re(){I.length&&(H=I.filter(t=>Number(t.diemMoKhoa||0)<=Number(R||0)),T=1,a("search").value="",a("locSoLuong").innerHTML=`
    <option value="">
    Tất cả số lượng chữ
    </option>
    `,a("locChuDe").innerHTML=`
    <option value="">
    Tất cả chủ đề
    </option>
    `,a("locDiem").innerHTML=`
    <option value="">
    Tất cả mốc điểm kinh nghiệm
    </option>
    `,Xe(),me(H),Fe(),je(),C&&q())}r(re,"capNhatThuVienTheoDiem");function Fe(){let t=I.length,e=H.length,n=t-e;C?a("thong-ke-mo-khoa").innerHTML=`
        Điểm kinh nghiệm:


        <b>
        ${b(R)}
        </b>


        &nbsp;•&nbsp;


        Đã mở:


        <b>
        ${e}
        </b>


        bài


        &nbsp;•&nbsp;


        Chưa mở:


        <b>
        ${n}
        </b>


        bài
        `:a("thong-ke-mo-khoa").innerHTML=`
        Hiện đang hiển thị


        <b>
        ${e}
        </b>


        bài lâm mô mốc 0 điểm.


        Nhập mã học viên để mở thêm tài liệu.
        `}r(Fe,"capNhatThongKe");function Xe(){let t=[],e=[],n=[];H.forEach(i=>{i.soLuong&&!t.includes(i.soLuong)&&t.push(i.soLuong),i.chuDe&&!e.includes(i.chuDe)&&e.push(i.chuDe);let o=Number(i.diemMoKhoa||0);n.includes(o)||n.push(o)}),n.sort((i,o)=>i-o),t.forEach(i=>{let o=document.createElement("option");o.value=i,o.textContent=i+" chữ",a("locSoLuong").appendChild(o)}),e.forEach(i=>{let o=document.createElement("option");o.value=i,o.textContent=i,a("locChuDe").appendChild(o)}),n.forEach(i=>{let o=document.createElement("option");o.value=i,o.textContent="Mốc "+i+" điểm",a("locDiem").appendChild(o)})}r(Xe,"taoBoLoc");function me(t){K=t;let e="",n=Math.ceil(t.length/J);n>0&&T>n&&(T=1);let i=(T-1)*J,o=i+J,l=t.slice(i,o);l.length===0?e=`
        <div class="loading">
        Không tìm thấy tác phẩm
        </div>
        `:l.forEach(c=>{if(c.hinhAnh){let m="";c.diemMoKhoa>0&&(m=`
                    <div class="nhan-mo-khoa">


                    Mốc
                    ${b(c.diemMoKhoa)}
                    điểm


                    </div>
                    `);let v=de(c.hinhAnh);e+=`
                <div
                class="the"
                onclick="moLamMo('${c.id}')"
                >


                ${m}


                <img
                src="${b(v)}"
                data-thu-anh="0"
                loading="lazy"
                alt="${b(c.noiDung)}"
                onerror="xuLyLoiAnh(this,'${b(c.hinhAnh)}')"
                >


                <h3>
                ${b(c.noiDung)}
                </h3>


                <div class="thong-tin">


                <b>Người viết:</b>
                ${b(c.nguoiViet)}


                <br>


                <b>Tác giả:</b>
                ${b(c.tacGia)}


                <br>


                <b>Chủ đề:</b>
                ${b(c.chuDe)}


                </div>


                </div>
                `}}),a("list").innerHTML=e,Ge(t)}r(me,"hienThi");function Ge(t){let e=Math.ceil(t.length/J),n="";if(e<=1){a("phan-trang").innerHTML="";return}T>1&&(n+=`
        <button
        class="nut"
        onclick="doiTrang(${T-1})"
        >
        ←
        </button>
        `);let i=Math.max(1,T-3),o=Math.min(e,T+3);i>1&&(n+=`
        <button
        class="nut"
        onclick="doiTrang(1)"
        >
        1
        </button>
        `,i>2&&(n+=" ... "));for(let l=i;l<=o;l++)n+=`
        <button
        class="nut"
        onclick="doiTrang(${l})"
        style="${l===T?"background:#b06b2c;":""}"
        >
        ${l}
        </button>
        `;o<e&&(o<e-1&&(n+=" ... "),n+=`
        <button
        class="nut"
        onclick="doiTrang(${e})"
        >
        ${e}
        </button>
        `),T<e&&(n+=`
        <button
        class="nut"
        onclick="doiTrang(${T+1})"
        >
        →
        </button>
        `),a("phan-trang").innerHTML=n}r(Ge,"taoPhanTrang");function Ze(t){T=t,me(K),window.scrollTo({top:300,behavior:"smooth"})}r(Ze,"doiTrang");function Ie(){T=1;let t=a("search").value.toLowerCase().trim(),e=a("locSoLuong").value,n=a("locChuDe").value,i=a("locDiem").value,o=H.filter(l=>{let c=l.noiDung+" "+l.nguoiViet+" "+l.tacGia+" "+l.moTa+" "+l.chuDe,m=t===""||c.toLowerCase().includes(t),v=e===""||l.soLuong===e,g=n===""||l.chuDe===n,k=i===""||Number(l.diemMoKhoa||0)===Number(i);return m&&v&&g&&k});me(o)}r(Ie,"timKiem");function We(){a("search").value="",a("locSoLuong").value="",a("locChuDe").value="",a("locDiem").value="",T=1,me(H)}r(We,"xoaTimKiem");function Ye(){Ie()}r(Ye,"locDuLieu");function we(t){let e=H.find(i=>i.id===t);if(!e){alert("Bài lâm mô này chưa được mở khóa.");return}f=e,q(),a("thu-vien").style.display="none",a("chi-tiet").style.display="block",a("ten-noi-dung").textContent=e.noiDung;let n=a("anh-chinh");n.setAttribute("data-thu-anh","0"),n.onerror=function(){ge(this,e.hinhAnh)},n.src=de(e.hinhAnh),a("ct-nguoi").textContent=e.nguoiViet,a("ct-noi-dung").textContent=e.noiDung,a("ct-so-luong").textContent=e.soLuong,a("ct-tac-gia").textContent=e.tacGia,a("ct-mo-ta").textContent=e.moTa,a("ct-chu-de").textContent=e.chuDe,Je(e.video),Be(e.id,++s),Ce(),Qe(e.noiDung),et(e.chuDe,e.noiDung),window.scrollTo({top:0,behavior:"smooth"})}r(we,"moLamMo");function Je(t){const e=Re(t);a("video").innerHTML="<h2>Video hướng dẫn viết</h2>"+(e?`<button class="nut" onclick="playTeacherVideo('`+e+`')">Xem video hướng dẫn của giáo viên</button><div class="lm-player" id="lm-teacher-player"></div>`:"<p>Bài này chưa có video hướng dẫn của giáo viên.</p>")+'<p><button class="nut" onclick="openContributionForm()">Đóng góp video hướng dẫn</button></p><h3>Video hướng dẫn từ học viên</h3><p id="lm-video-status" role="status">Đang tải video đóng góp…</p><div class="lm-video-cards" id="lm-video-cards"></div><div class="lm-player" id="lm-student-player"></div>'}r(Je,"hienThiVideo");function Qe(t){const e=H.filter(n=>n.noiDung===t&&(!f||n.id!==f.id));_e("ds-dich-ban",e,"nguoiViet")}r(Qe,"hienThiCungNoiDung");function et(t,e){const n=H.filter(i=>i.chuDe===t&&i.noiDung!==e);_e("ds-chu-de",n,"noiDung")}r(et,"hienThiCungChuDe");function tt(){oe=!oe,a("grid").style.display=oe?"block":"none"}r(tt,"batTatOMe");function nt(){if(!f){alert("Chưa chọn bản lâm mô");return}let t=window.open("");if(!t){alert("Trình duyệt đang chặn cửa sổ in.");return}let e=de(f.hinhAnh);t.document.write(`


    <html>


    <head>


    <meta charset="UTF-8">


    <title>
    ${b(f.noiDung)}
    </title>


    <style>


    body{
        text-align:center;
        font-family:KaiTi,Arial,sans-serif;
    }


    h1{
        font-size:40px;
    }


    img{
        max-width:90%;
        max-height:850px;
    }


    </style>


    </head>


    <body>


    <h1>
    ${b(f.noiDung)}
    </h1>


    <img
    src="${b(e)}"
    >


    <script>


    window.onload=function(){


        setTimeout(function(){


            window.print();


        },500);


    };


    <\/script>


    </body>


    </html>


    `),t.document.close()}r(nt,"taoBanIn");function it(){window.open("https://docs.google.com/forms/d/e/1FAIpQLScfsWRNbv1h3XdJq1K_llPnkmmWOll480qRB5e8aWgvJj5eUw/viewform","_blank")}r(it,"guiBaiTap");function ot(){j++,ne&&ne(),Te(!1),a("lm-show-image").close(),s++,h&&(h(),h=null),xe(),a("video").innerHTML="",f=null,q(),a("chi-tiet").style.display="none",a("thu-vien").style.display="block",window.scrollTo({top:0,behavior:"smooth"})}r(ot,"quayLai");function _e(t,e,n){const i=a(t);i&&(i.parentElement.hidden=e.length===0,i.innerHTML=e.map(o=>'<button type="button" class="dich-ban-item" data-lammo-id="'+b(o.id)+'" aria-label="Xem '+b(o[n]||o.noiDung)+'"><img src="'+b(de(o.hinhAnh))+'" alt="'+b(o.noiDung)+'" loading="lazy" data-thu-anh="0" data-original-image="'+b(o.hinhAnh)+'"><p>'+b(o[n])+"</p></button>").join(""),i.scrollLeft=0,i.onclick=o=>{const l=o.target.closest("[data-lammo-id]");l&&i.contains(l)&&we(l.dataset.lammoId)},i.querySelectorAll&&i.querySelectorAll("img").forEach(o=>{o.onerror=()=>ge(o,o.dataset.originalImage),o.onload=()=>$(t)}),requestAnimationFrame(()=>$(t)))}r(_e,"renderSuggestionSlider");function $(t){const e=a(t),n=a(t+"-prev"),i=a(t+"-next");if(!e||!n||!i)return;const o=e.scrollWidth>e.clientWidth+2;n.hidden=i.hidden=!o,n.disabled=e.scrollLeft<=2,i.disabled=e.scrollLeft+e.clientWidth>=e.scrollWidth-2}r($,"updateSliderControls");function at(t,e){const n=a(t);n&&n.scrollBy({left:e*Math.max(140,n.clientWidth*.8),behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}r(at,"moveSlider");function Re(t){try{const e=new URL(String(t||""));if(e.protocol!=="https:")return"";let n="";return["youtu.be","www.youtu.be"].includes(e.hostname)?n=e.pathname.slice(1).replace(/\/$/,""):["youtube.com","www.youtube.com","m.youtube.com"].includes(e.hostname)&&(e.pathname==="/watch"?n=e.searchParams.get("v")||"":n=(e.pathname.match(/^\/(?:shorts|embed)\/([A-Za-z0-9_-]{11})\/?$/)||[])[1]||""),/^[A-Za-z0-9_-]{11}$/.test(n)?n:""}catch(e){return""}}r(Re,"youtubeIdForPlayer");function rt(t){if(!/^[A-Za-z0-9_-]{11}$/.test(t))return;const e=a("lm-student-player");e&&(e.innerHTML=""),a("lm-teacher-player").innerHTML='<iframe src="https://www.youtube.com/embed/'+t+'" title="Video của giáo viên" allow="fullscreen; picture-in-picture" allowfullscreen></iframe>'}r(rt,"playTeacherVideo");function X(){const t=String(d||"").trim();return/^https:\/\/script\.google\.com\/macros\/s\/[A-Za-z0-9_-]+\/exec$/.test(t)?t:""}r(X,"contributionEndpoint");function Ne(t,e){if(!["submitVideo","submitShowcase","getShowcaseChoices"].includes(t))return Promise.reject(Error("Thao tác không hợp lệ."));const n=X();return n?new Promise((i,o)=>{const l=Array.from(crypto.getRandomValues(new Uint32Array(4))).join("_"),c=document.createElement("iframe");let m=null,v=!1,g;const k=r(()=>{clearTimeout(g),window.removeEventListener("message",z),c.remove()},"cleanup"),z=r(S=>{!/^https:\/\/(?:script|[a-z0-9-]+-script)\.googleusercontent\.com$/.test(S.origin)||!S.data||S.data.nonce!==l||(S.data.type==="LM_RPC_READY"&&!v?(v=!0,m=S.source,m.postMessage({type:"LM_RPC_CALL",nonce:l,method:t,payload:e},S.origin)):S.data.type==="LM_RPC_RESULT"&&m&&S.source===m&&(k(),S.data.ok?i(S.data.result):o(Error(S.data.message||"Apps Script xử lý thất bại."))))},"receive");window.addEventListener("message",z),g=setTimeout(()=>{k(),o(Error("Chưa nhận được kết quả. Nếu vừa gửi bài/video, hãy kiểm tra danh sách trước khi gửi lại. Kiểm tra phiên bản Apps Script có Bridge.html và đã triển khai mới."))},45e3),c.title="Kết nối dữ liệu",c.setAttribute("aria-hidden","true"),c.style.cssText="position:fixed;left:-10000px;top:0;width:1px;height:1px;border:0;pointer-events:none";const M=new URL(n);M.searchParams.set("action","bridge"),M.searchParams.set("nonce",l),M.searchParams.set("parentOrigin",location.origin),c.src=M.href,document.body.appendChild(c)}):Promise.reject(Error("Chưa kết nối Apps Script."))}r(Ne,"nativeFormRpc");let te=null;function lt(t){if(t=t||f,!t||!/^LM_[A-Za-z0-9_-]+$/.test(t.id)){alert("Bài này chưa có mã cố định.");return}if(!X()){alert("Chưa kết nối Apps Script.");return}te={lessonId:t.id,requestId:"REQ_"+Array.from(crypto.getRandomValues(new Uint32Array(4))).join("_"),busy:!1,done:!1},a("lm-video-native-form").reset(),a("lm-native-video-code").value=he(),a("lm-native-video-lesson").textContent="Bản mẫu: "+t.noiDung,a("lm-native-video-status").textContent="",a("lm-native-video-send").disabled=!1;const e=a("lm-contribution-dialog");e.querySelector(".lm-modal-body").scrollTop=0,e.open||e.showModal()}r(lt,"openContributionForm");function xe(){const t=a("lm-contribution-dialog");t&&t.open&&t.close(),te=null}r(xe,"closeContributionForm"),document.addEventListener("submit",async t=>{if(t.target.id!=="lm-video-native-form")return;t.preventDefault();const e=te;if(!(!e||e.busy||e.done)){e.busy=!0,a("lm-native-video-send").disabled=!0,a("lm-native-video-status").textContent="Đang gửi video…";try{const n=await Ne("submitVideo",{lessonId:e.lessonId,studentCode:a("lm-native-video-code").value,url:a("lm-native-video-url").value,title:a("lm-native-video-title").value,description:a("lm-native-video-description").value,ownsVideo:a("lm-native-video-owns").checked,requestId:e.requestId});e.done=!0,e===te&&(a("lm-native-video-status").textContent=n.message||"Đã gửi video để duyệt.")}catch(n){e===te&&(a("lm-native-video-status").textContent=n.message,a("lm-native-video-send").disabled=!1)}finally{e.busy=!1}}});function Be(t,e){h&&(h(),h=null),xe(),u=[];const n=X();if(!n){a("lm-video-status").textContent="Chưa kết nối hệ thống đóng góp video.";return}if(!/^LM_[A-Za-z0-9_-]+$/.test(t)){a("lm-video-status").textContent="Bài chưa có mã cố định.";return}const i="LMVideo_"+e+"_"+Math.random().toString(36).slice(2),o=document.createElement("script");let l,c=!1;const m=r(()=>{c||(c=!0,clearTimeout(l),o.remove(),delete window[i])},"cleanup");h=m,window[i]=v=>{m(),ye(t,e,v)},o.onerror=()=>{m(),ye(t,e,{ok:!1})},l=setTimeout(()=>{m(),ye(t,e,{ok:!1})},3e4),o.src=n+"?action=list&lessonId="+encodeURIComponent(t)+"&callback="+i,document.head.appendChild(o)}r(Be,"loadContributionVideos");function ye(t,e,n){if(!(!f||f.id!==t||e!==s)){if(!n||!n.ok){a("lm-video-status").innerHTML='Kết nối video học viên phản hồi chậm. <button type="button" class="nut" onclick="loadContributionVideos(dangXem.id,contributionRequestToken)">Thử lại</button>';return}st(Array.isArray(n.videos)?n.videos:[])}}r(ye,"applyContributionResult");function st(t){u=t.slice(0,100),a("lm-video-status").textContent=u.length?"Các video đã được giáo viên chấp thuận.":"Chưa có video đóng góp được chấp thuận.",a("lm-video-cards").innerHTML=u.map((e,n)=>'<article class="lm-video-card">'+(e.provider==="youtube"&&/^[A-Za-z0-9_-]{11}$/.test(e.videoKey)?'<img src="https://i.ytimg.com/vi/'+e.videoKey+'/hqdefault.jpg" alt="" loading="lazy">':'<div class="lm-video-placeholder">'+(e.provider==="drive"?"Video Google Drive":"Video Facebook")+"</div>")+"<h4>"+b(e.title)+"</h4><p>Đóng góp: "+b(e.displayName)+'</p><button class="nut" onclick="playApprovedVideo('+n+')">Xem video</button></article>').join("")}r(st,"renderContributionCards");function dt(t){try{const e=new URL(String(t.canonicalUrl||"")),n=e.pathname.match(/^\/file\/d\/([A-Za-z0-9_-]{10,})\/view$/);if(e.protocol!=="https:"||e.hostname!=="drive.google.com"||!n||n[1]!==t.videoKey)return"";const i=e.searchParams.get("resourcekey");return i&&!/^[A-Za-z0-9_-]{1,200}$/.test(i)?"":"https://drive.google.com/file/d/"+n[1]+"/preview"+(i?"?resourcekey="+encodeURIComponent(i):"")}catch(e){return""}}r(dt,"drivePreviewForPlayer");function ct(t){if(!Number.isInteger(t)||t<0||t>=u.length)return;const e=u[t];if(!e)return;let n="";if(e.provider==="youtube"&&/^[A-Za-z0-9_-]{11}$/.test(e.videoKey)&&Re(e.canonicalUrl)===e.videoKey&&(n="https://www.youtube.com/embed/"+e.videoKey),e.provider==="facebook"&&/^\d{5,30}$/.test(e.videoKey)&&["https://www.facebook.com/watch/?v="+e.videoKey,"https://www.facebook.com/reel/"+e.videoKey+"/"].includes(e.canonicalUrl)&&(n="https://www.facebook.com/plugins/video.php?href="+encodeURIComponent(e.canonicalUrl)+"&show_text=false&width=560"),e.provider==="drive"&&(n=dt(e)),!n){alert("Link video không hợp lệ.");return}const i=a("lm-teacher-player");i&&(i.innerHTML=""),a("lm-student-player").innerHTML='<iframe src="'+b(n)+'" title="'+b(e.title)+'" allow="fullscreen; picture-in-picture" allowfullscreen></iframe><a href="'+b(e.canonicalUrl)+'" target="_blank" rel="noopener noreferrer">Mở video gốc nếu không phát được</a>'}r(ct,"playApprovedVideo"),window.addEventListener("resize",()=>{$("ds-dich-ban"),$("ds-chu-de"),$("lm-show-track")}),["updateSliderControls","moveSlider","playTeacherVideo","openContributionForm","closeContributionForm","playApprovedVideo","loadContributionVideos"].forEach(t=>{window[t]={updateSliderControls:$,moveSlider:at,playTeacherVideo:rt,openContributionForm:lt,closeContributionForm:xe,playApprovedVideo:ct,loadContributionVideos:Be}[t]}),document.addEventListener("close",t=>{t.target.id==="lm-contribution-dialog"&&!t.target.open&&(te=null)},!0);let O=[],j=0,ne=null;const ke=new Map;function he(){return x(C&&C.ma||ce()||"")}r(he,"showcaseActor");function Ce(){if(!f)return;const t=f.id,e=++j;O=[],a("lm-show-posts").innerHTML="",ne&&(ne(),ne=null),Te(!1),a("lm-show-image").close();const n=a("lm-show-track");n.scrollLeft=0,requestAnimationFrame(()=>$("lm-show-track"));const i=X(),o=a("lm-show-status");if(o.textContent="",o.hidden=!0,!i)return;const l="LMVideo_SHOW_"+e+"_"+Math.random().toString(36).slice(2),c=document.createElement("script");let m,v=!1;const g=r(()=>{v||(v=!0,clearTimeout(m),c.remove(),delete window[l])},"cleanup");ne=g;const k=r(z=>{if(g(),!(!f||f.id!==t||e!==j)){if(!z||!z.ok){o.textContent="Chưa tải được bản lâm học viên.",o.hidden=!1;return}Ke(Array.isArray(z.posts)?z.posts:[],e)}},"receive");window[l]=k,c.onerror=()=>k({ok:!1}),m=setTimeout(()=>k({ok:!1}),15e3),c.src=i+"?action=showcaseList&lessonId="+encodeURIComponent(t)+"&code="+encodeURIComponent(he())+"&callback="+l,document.head.appendChild(c)}r(Ce,"loadShowcaseGallery");function Ke(t,e){O=t.slice(0,100).sort((i,o)=>Number(o.hearts)-Number(i.hearts)||(Date.parse(o.date)||0)-(Date.parse(i.date)||0)||String(i.id).localeCompare(String(o.id))),a("lm-show-status").textContent="",a("lm-show-status").hidden=!0,a("lm-show-posts").innerHTML=O.map((i,o)=>'<article class="lm-show-card"><button class="lm-show-photo" onclick="openShowcaseImage('+o+')" aria-label="Xem ảnh bản lâm"><img src="https://drive.google.com/thumbnail?id='+encodeURIComponent(i.photoId)+'&sz=w320" alt="Bản lâm của '+b(i.name)+'" loading="'+(o<3?"eager":"lazy")+`" decoding="async" onerror="this.style.display='none';this.parentElement.classList.add('lm-photo-error')"></button><button class="lm-show-heart`+(i.liked?" is-liked":"")+'" onclick="toggleShowcaseHeart('+o+',this)" aria-label="Thả hoặc bỏ tim" aria-pressed="'+!!i.liked+'"><span>'+(i.liked?"♥":"♡")+"</span> "+Math.max(0,Number(i.hearts)||0)+'</button><div class="lm-show-owner" data-show-index="'+o+'"><div class="lm-show-avatar"><span class="lm-show-avatar-core">✍</span></div><div><b title="'+b(i.name)+'">'+b(i.name)+"</b><small>Tổ "+b(i.group||"—")+" · Khóa "+b(i.course||"—")+"</small></div></div></article>").join(""),requestAnimationFrame(()=>$("lm-show-track"));const n=a("lm-show-posts").querySelectorAll(".lm-show-owner");if(window.IntersectionObserver){const i=new IntersectionObserver(o=>o.forEach(l=>{l.isIntersecting&&(i.unobserve(l.target),Pe(l.target,O[Number(l.target.dataset.showIndex)],e))}));n.forEach(o=>i.observe(o))}else n.forEach(i=>Pe(i,O[Number(i.dataset.showIndex)],e))}r(Ke,"renderShowcasePosts");function Se(t){try{const e=new URL(String(t||""));return e.protocol==="https:"?e.href:""}catch(e){return""}}r(Se,"safeShowcaseImage");async function Pe(t,e,n){if(e&&window.OCDIdentity){if(n!==j||!t.isConnected)return;t.innerHTML="",t.classList.add("lm-show-owner-shared"),t.appendChild(window.OCDIdentity.create({code:e.studentCode,name:e.name,meta:"Tổ "+(e.group||"—")+" · Khóa "+(e.course||"—"),size:"sm",background:t}));return}const i=window.StudentRewardSystem;if(!(!e||!i||typeof i.getStudentRewardProfile!="function"))try{let o=ke.get(e.studentCode);o||(o=i.getStudentRewardProfile(e.studentCode),ke.set(e.studentCode,o));const l=await o;if(n!==j||!t.isConnected)return;const c=t.querySelector(".lm-show-avatar"),m=Se(l.avatar),v=Se(l.avatarFrame),g=Se(l.profileBackground);if(c.innerHTML='<span class="lm-show-avatar-core">'+(m?'<img src="'+b(m)+`" alt="Avatar học viên" loading="lazy" onerror="this.parentNode.textContent='✍'">`:"✍")+"</span>"+(v?'<img class="lm-show-frame" src="'+b(v)+'" alt="Khung avatar" loading="lazy" onerror="this.remove()">':""),g&&(t.style.backgroundImage='linear-gradient(90deg,rgba(255,253,248,.88),rgba(255,253,248,.88)),url("'+g.replace(/["\\]/g,"")+'")'),l.hasMultitaskPotion){const k=document.createElement("span");k.className="lm-show-potion",k.textContent="⚗",k.title="Đang có Thuốc đa nhiệm",c.appendChild(k)}}catch(o){ke.delete(e.studentCode),console.warn("[Bản lâm] Không tải được avatar",o)}}r(Pe,"hydrateShowcaseProfile");let _=null;const G=new Map;function ut(t,e){return new Promise((n,i)=>{const o="LMVideo_CHOICES_"+Math.random().toString(36).slice(2),l=document.createElement("script");let c,m=!1;const v=r(()=>{m||(m=!0,clearTimeout(c),l.remove(),delete window[o])},"cleanup");window[o]=g=>{v(),g&&g.ok&&g.student&&Array.isArray(g.works)?n(g):i(Error(g&&g.message||"Không tải được bài đã nộp."))},l.onerror=()=>{v(),i(Error("Mất kết nối. Hãy thử lại."))},c=setTimeout(()=>{v(),i(Error("Danh sách bài nộp phản hồi chậm. Hãy thử lại; kiểm tra Apps Script đã triển khai phiên bản mới."))},3e4),l.src=X()+"?action=showcaseChoices&code="+encodeURIComponent(t)+"&lessonId="+encodeURIComponent(e)+"&callback="+o,document.head.appendChild(l)})}r(ut,"readNativeShowChoices");function mt(t,e){const n=t+"|"+e,i=G.get(n);if(i&&(i.pending||i.until>Date.now()))return i.promise;const o={pending:!0,until:0,promise:null};return o.promise=ut(t,e).then(l=>(o.pending=!1,o.until=Date.now()+2e4,l),l=>{throw G.get(n)===o&&G.delete(n),l}),G.size>=12&&G.delete(G.keys().next().value),G.set(n,o),o.promise}r(mt,"getNativeShowChoices");async function Ve(t){a("lm-native-show-status").textContent="Đang tải bài đã nộp của bạn…",a("lm-native-works").innerHTML="",a("lm-native-show-send").hidden=!0,a("lm-native-show-retry").hidden=!0;try{const e=await mt(t.code,t.lessonId);if(t!==_)return;a("lm-native-show-identity").textContent=e.student.name+" · Tổ "+e.student.group+" · Khóa "+e.student.course,a("lm-native-show-status").textContent=e.works.length?"Chọn bản lâm phù hợp với mẫu đang xem.":"Chưa có bài nộp hợp lệ để chọn.",a("lm-native-works").innerHTML=e.works.map((n,i)=>'<label class="lm-native-work"><input type="radio" name="lm-native-work" value="'+b(n.key)+'"><img src="https://drive.google.com/thumbnail?id='+encodeURIComponent(n.photoId)+'&sz=w240" loading="'+(i<4?"eager":"lazy")+'" decoding="async" alt="Bài đã nộp"><small>'+b(n.description||"Bài chưa có mô tả")+"</small><small>"+b(n.date)+"</small></label>").join(""),a("lm-native-show-send").hidden=!e.works.length,a("lm-native-show-send").disabled=!1}catch(e){t===_&&(a("lm-native-show-status").textContent=e.message,a("lm-native-show-retry").hidden=!1)}}r(Ve,"loadNativeShowChoices");function ht(){if(!f)return;const t=he();if(!t){alert("Hãy đăng nhập trên trang thư viện trước khi khoe bài.");return}const e={code:t,lessonId:f.id,busy:!1,done:!1};_=e,Z("idle",""),a("lm-native-show-lesson").textContent="Bản mẫu: "+f.noiDung,a("lm-native-show-identity").textContent="";const n=a("lm-show-dialog");n.querySelector(".lm-modal-body").scrollTop=0,n.open||n.showModal(),Ve(e)}r(ht,"openShowcaseForm");function Te(t=!0){const e=a("lm-show-dialog");e.open&&e.close(),_=null,t&&f&&Ce()}r(Te,"closeShowcaseDialog");function Z(t,e){var l;const n=a("lm-native-show-send");n.hidden=!1,n.disabled=t!=="idle",n.dataset&&(n.dataset.state=t),(l=n.setAttribute)==null||l.call(n,"aria-busy",String(t==="busy"));const i='<svg class="lm-submit-icon lm-submit-hourglass" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 3h12M6 21h12M7 3v5l5 4-5 4v5M17 3v5l-5 4 5 4v5"/></svg>',o='<svg class="lm-submit-icon lm-submit-check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="m7 12 3 3 7-7"/></svg>';n.innerHTML=t==="busy"?i+"<span>Đang cập nhật</span>":t==="done"?o+"<span>Đã đưa lên hệ thống</span>":"Khoe bản lâm",a("lm-native-show-status").textContent=e||""}r(Z,"setShowcaseSubmitState");async function pt(){const t=_;if(!t){Z("idle","Phiên chọn bài không còn sẵn sàng. Hãy đóng và mở lại Khoe bản lâm.");return}if(t.busy||t.done)return;const e=a("lm-native-works").querySelector("input:checked");if(!e){Z("idle","Bạn chưa chọn bài.");return}t.busy=!0,Z("busy","Đang gửi bản lâm đã chọn. Vui lòng chờ hệ thống xác nhận.");try{const n=await Ne("submitShowcase",{studentCode:t.code,lessonId:t.lessonId,workKey:e.value});if(!n||n.ok!==!0||!n.id)throw Error(n&&n.message||"Hệ thống chưa xác nhận đã lưu bản lâm.");t.done=!0,t===_&&Z("done",n.message||"Bản lâm đã lưu. Bấm Đóng và cập nhật danh sách để xem.")}catch(n){t===_&&Z("idle",n.message||"Không gửi được bản lâm. Hãy thử lại.")}finally{t.busy=!1}}r(pt,"submitNativeShowcase"),document.addEventListener("change",t=>{var n,i;if(!((i=(n=t.target).closest)!=null&&i.call(n,'#lm-native-works input[name="lm-native-work"]')))return;const e=_;e&&!e.busy&&!e.done&&Z("idle","Đã chọn ảnh. Bấm Khoe bản lâm ở phía trên.")}),document.addEventListener("click",t=>{var n,i;const e=(i=(n=t.target).closest)==null?void 0:i.call(n,"#lm-native-show-send, #lm-native-show-retry");!e||e.disabled||(t.preventDefault(),e.id==="lm-native-show-send"?pt():_&&!_.busy&&Ve(_))});function gt(t){if(!Number.isInteger(t)||!O[t])return;const e=O[t],n="https://drive.google.com/thumbnail?id="+encodeURIComponent(e.photoId)+"&sz=w1600",i=a("lm-show-image");a("lm-show-image-src").src=n,i.showModal?i.showModal():window.open(n,"_blank","noopener")}r(gt,"openShowcaseImage"),document.addEventListener("close",t=>{t.target.open||(t.target.id==="lm-show-dialog"&&(_=null),t.target.id==="lm-show-image"&&a("lm-show-image-src").removeAttribute("src"))},!0);const Me=new Set;function ft(t,e,n){return new Promise((i,o)=>{const l="LMVideo_HEART_"+Math.random().toString(36).slice(2),c=document.createElement("script");let m;const v=r(()=>{clearTimeout(m),c.remove(),delete window[l]},"cleanup");window[l]=g=>{v(),g&&g.ok?i(g):o(Error(g&&g.message||"Không đọc được trạng thái tim."))},c.onerror=()=>{v(),o(Error("Mất kết nối Apps Script."))},m=setTimeout(()=>{v(),o(Error("Apps Script phản hồi chậm."))},8e3),c.src=X()+"?action=heartState&lessonId="+encodeURIComponent(t)+"&code="+encodeURIComponent(e)+"&postId="+encodeURIComponent(n)+"&callback="+l,document.head.appendChild(c)})}r(ft,"readShowcaseHeartState");async function bt(t,e){if(typeof fetch!="function"||typeof URLSearchParams!="function")return null;const n=typeof AbortController=="function"?new AbortController:null,i=n?setTimeout(()=>n.abort(),25e3):null;try{const o=await fetch(t,{method:"POST",body:new URLSearchParams(e),credentials:"omit",cache:"no-store",redirect:"follow",signal:n?n.signal:void 0}),l=JSON.parse(await o.text());return l&&typeof l=="object"?l:null}catch(o){return null}finally{i&&clearTimeout(i)}}r(bt,"showcasePostFast");async function vt(t,e){const n=O[t],i=he(),o=X();if(!n||!f||Me.has(n.id))return;if(!i||!o){alert("Phiên học viên hoặc kết nối Apps Script chưa sẵn sàng.");return}if(x(n.studentCode)===i){alert("Không thể thả tim bản lâm của chính mình.");return}const l=f.id,c=j,m=!n.liked,v=Number(n.hearts)||0;Me.add(n.id),e.disabled=!0,e.classList.toggle("is-liked",m),e.setAttribute("aria-pressed",String(m)),e.innerHTML="<span>"+(m?"♥":"♡")+"</span> "+Math.max(0,v+(m?1:-1));const g=document.createElement("iframe"),k=document.createElement("form");g.name="lmHeart_"+Math.random().toString(36).slice(2),g.hidden=!0,g.title="Đồng bộ tim",k.hidden=!0,k.method="POST",k.action=o,k.target=g.name;const z={action:"heart",studentCode:i,lessonId:l,postId:n.id,active:String(m)};Object.keys(z).forEach(M=>{const S=document.createElement("input");S.type="hidden",S.name=M,S.value=z[M],k.appendChild(S)}),document.body.appendChild(g),document.body.appendChild(k);try{let M=null,S="";const W=await bt(o,z);if(W&&W.ok===!0&&typeof W.active=="boolean")M=W;else{if(W&&W.ok===!1)throw Error(W.message||"Chưa thả được tim.");k.submit()}for(let Le=0;!M&&Le<10;Le++){await new Promise(ie=>setTimeout(ie,Le===0?800:1200));try{const ie=await ft(l,i,n.id);if(ie.active===m){M=ie;break}}catch(ie){S=ie.message}}if(!M)throw Error(S||"Chưa xác nhận được tim. Hãy tải lại bản mẫu để kiểm tra.");n.liked=M.active,n.hearts=M.hearts,f&&f.id===l&&c===j&&Ke(O,c)}catch(M){e.classList.toggle("is-liked",!!n.liked),e.setAttribute("aria-pressed",String(!!n.liked)),e.innerHTML="<span>"+(n.liked?"♥":"♡")+"</span> "+v;const S=a("lm-show-status");c===j&&(S.textContent=M.message,S.hidden=!1)}finally{Me.delete(n.id),e.disabled=!1,k.remove(),g.remove()}}r(vt,"toggleShowcaseHeart"),[Ce,ht,Te,gt,vt].forEach(t=>window[t.name]=t),window.kiemTraHocVien=ue,window.xoaMaHocVien=ze,window.timKiem=Ie,window.xoaTimKiem=We,window.locDuLieu=Ye,window.doiTrang=Ze,window.moLamMo=we,window.xuLyLoiAnh=ge,window.batTatOMe=tt,window.taoBanIn=nt,window.guiBaiTap=it,window.quayLai=ot,window.OCDLamMoLibrary={getStudent:r(function(){return C?Object.assign({},C):null},"getStudent"),getCode:r(function(){return C?C.ma:""},"getCode"),getExperience:r(function(){return Number(R||0)},"getExperience"),getUnlockState:r(function(){return{totalCount:Number(I.length||0),unlockedCount:Number(H.length||0),lockedCount:Math.max(0,Number(I.length||0)-Number(H.length||0))}},"getUnlockState"),getCurrentContent:r(function(){return f?Object.assign({},f):null},"getCurrentContent"),getMinhHongContext:r(function(){let t=De();return t?JSON.parse(JSON.stringify(t)):null},"getMinhHongContext"),syncMinhHongContext:r(function(){return q()},"syncMinhHongContext"),syncFromMinhHong:r(function(){return be()},"syncFromMinhHong")},console.log("[Thư viện lâm mô] Student Session + Minh Hồng Context Bridge ready.")})()}})();

Nhận xét

Bài đăng phổ biến từ blog này

theme/thudao-footer.kho.js · Gộp Reward Core (css v4.2.2 + js f827add) + Minh Hồng footer (css v1.5.7.4 + js 4bff33d) cho chân trang thudao.com

trang/thudao/dang-ky-hoc.html · Bản trước khi chuyển sang kho (tải từ GitHub/jsDelivr)

trang/thudao/bai-viet/benh-cua-thu-dan-duong-dai-the-trien-lam-xu-thu-va-nguy-menh-de-vuot-co-nhan.html · Bản trước khi chuyển sang kho (có video, tải từ GitHub/jsDelivr)