<script>
(function() {
    const NUM_FLAKES = 150; // 雪花数量
    const flakes = [];
    let width = window.innerWidth;
    let height = window.innerHeight;

    // 创建样式
    const style = document.createElement('style');
    document.head.appendChild(style);
    style.sheet.insertRule(`
        .snowflake {
            position: fixed;
            top: 0;
            background: white;
            border-radius: 50%;
            pointer-events: none;
            z-index: 9999;
            filter: blur(1px);
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
            opacity: 0;
            will-change: transform, opacity;
        }
    `, 0);

    // 初始化雪花
    function init() {
        const fragment = document.createDocumentFragment(); // 使用文档片段减少重绘
        for (let i = 0; i < NUM_FLAKES; i++) {
            const flake = document.createElement('div');
            flake.className = 'snowflake';
            resetFlake(flake);
            fragment.appendChild(flake);
            flakes.push({
                element: flake,
                x: parseFloat(flake.style.left),
                y: parseFloat(flake.style.top),
                swing: Math.random() * Math.PI * 2,
                swingInc: Math.random() * 0.02 - 0.01,
                speed: parseFloat(flake.dataset.speed)
            });
        }
        document.body.appendChild(fragment);
        animate();
    }

    // 重置雪花位置和属性
    function resetFlake(flake) {
        const size = Math.random() * 6 + 2; // 尺寸范围：2px - 8px
        const startX = Math.random() * width;
        const startY = Math.random() * -height;

        flake.style.width = `${size}px`;
        flake.style.height = `${size}px`;
        flake.style.left = `${startX}px`;
        flake.style.top = `${startY}px`;
        flake.style.opacity = Math.random() * 0.5 + 0.3; // 随机透明度
        flake.dataset.speed = (Math.random() * 2 + 0.5).toFixed(2); // 调整下落速度，限制小数位
    }

    // 动画效果
    function animate() {
        for (let i = 0; i < flakes.length; i++) {
            const flake = flakes[i];
            flake.y += flake.speed;
            flake.swing += flake.swingInc;
            flake.x += Math.sin(flake.swing) * 0.5;

            // 检查边界
            if (flake.y > height || flake.x < -10 || flake.x > width + 10) {
                resetFlake(flake.element);
                flake.x = parseFloat(flake.element.style.left);
                flake.y = parseFloat(flake.element.style.top);
                flake.swing = Math.random() * Math.PI * 2;
                flake.swingInc = Math.random() * 0.02 - 0.01;
                flake.speed = parseFloat(flake.element.dataset.speed);
            }

            // 使用transform进行位置和旋转的更新，减少重绘
            flake.element.style.transform = `translate(${flake.x}px, ${flake.y}px) rotate(${flake.swing * 10}deg)`;
        }

        requestAnimationFrame(animate);
    }

    // 调整窗口大小
    function resize() {
        width = window.innerWidth;
        height = window.innerHeight;
    }

    // 初始化
    init();
    window.addEventListener('resize', resize);
})();

(function() {
    // 1. 定义菜单 href 到新 SVG 图标的映射
    const iconMap = {
        "/chat": `
            <svg t="1735962182491" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="56942" width="24" height="24"><path d="M381.7 985.3c-10.2 0-20.4-3.9-28.3-11.7-15.6-15.6-15.6-40.9 0-56.5L496 774.5c39-39 90.9-60.5 146.1-60.5h136.2c91.4 0 165.7-74.3 165.8-165.7V284.4c0-91.4-74.4-165.8-165.8-165.8H245.7c-91.4 0-165.8 74.4-165.8 165.8v263.9c0 91.4 74.4 165.7 165.8 165.7h74.4c22.1 0 40 17.9 40 40s-17.9 40-40 40h-74.4C110.2 793.9 0 683.7 0 548.3V284.4C0 148.9 110.2 38.7 245.7 38.7h532.6c135.5 0 245.7 110.2 245.7 245.7v263.9C1024 683.8 913.8 794 778.3 794H642.2c-33.8 0-65.7 13.2-89.6 37.1L410 973.6c-7.8 7.8-18 11.7-28.3 11.7z" p-id="56943"></path><path d="M322.965 425.019m-50.6 0a50.6 50.6 0 1 0 101.2 0 50.6 50.6 0 1 0-101.2 0Z" p-id="56944"></path><path d="M512.065 425.019m-50.6 0a50.6 50.6 0 1 0 101.2 0 50.6 50.6 0 1 0-101.2 0Z" p-id="56945"></path><path d="M701.165 425.019m-50.6 0a50.6 50.6 0 1 0 101.2 0 50.6 50.6 0 1 0-101.2 0Z" p-id="56946"></path></svg>
        `,
        "/draw": `
            <svg t="1735961816603" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="53345" width="24" height="24"><path d="M384.096 222.4L238.08 363.072l590.4 606.048 155.584-173.92-599.968-572.8z m442.368 652.96L328.832 364.512l55.456-53.408L895.072 798.72l-68.608 76.64zM205.312 321.856l140.384-134.08L286.304 129.6c-36.384-35.552-98.944-35.264-134.88 0.608a96.384 96.384 0 0 0-1.184 134.88l55.072 56.768zM416 64h64v64h-64zM320 672h64v64h-64zM32 352h64v64H32zM232.672 492.192l-60.48-20.864-16.512 47.776-48.768-15.136-18.944 61.088 46.848 14.56-15.488 44.928 60.48 20.864 16.16-46.784 45.824 14.208 18.976-61.12-43.904-13.632zM632.16 277.472l61.312 18.368 14.72-49.152 45.6 14.144 18.976-61.088-46.176-14.368 14.048-46.848-61.312-18.368-13.888 46.24-46.496-14.432-19.008 61.088 47.136 14.656z" p-id="53346"></path></svg>
        `,
        "/video": `
            <svg t="1735961126676" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="25761" width="24" height="24"><path d="M725.328 392.528L947.76 236.8a21.328 21.328 0 0 1 33.568 17.488v515.424a21.328 21.328 0 0 1-33.568 17.488l-222.432-155.728v179.2a42.672 42.672 0 0 1-42.656 42.656H85.328a42.672 42.672 0 0 1-42.656-42.656V213.328a42.672 42.672 0 0 1 42.656-42.656h597.344a42.672 42.672 0 0 1 42.656 42.656v179.2zM128 256v512h512V256H128z m768 390.784l-170.672-119.472v-30.72L896 377.136v269.648z m-601.44-60.72L276.192 640h-62.848l87.776-236.928h81.184L469.328 640h-64.16l-18.096-53.92h-92.496z m258.736-182.992V640h-60.416V403.072h60.416z m-182.608 133.84l-27.312-81.568h-4.128l-27.904 81.568h59.344z" p-id="25762"></path></svg>
        `,
        "/ppt": `
            <svg t="1735961173761" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="27780" width="24" height="24"><path d="M354.40128 0c-87.04 0-157.44 70.55872-157.44 157.59872v275.68128H78.72c-21.6576 0-39.36256 17.69984-39.36256 39.36256v236.31872c0 21.6576 17.69984 39.35744 39.36256 39.35744h118.24128v118.08256c0 87.04 70.4 157.59872 157.44 157.59872h472.63744c87.04 0 157.59872-70.55872 157.59872-157.59872V315.0336c0-41.74848-38.9888-81.93024-107.52-149.27872l-29.11744-29.12256L818.87744 107.52C751.5392 38.9888 711.39328 0 669.59872 0H354.4064z m0 78.72h287.20128c28.35456 7.0912 27.99616 42.1376 27.99616 76.8v120.16128c0 21.6576 17.69984 39.35744 39.36256 39.35744h118.07744c39.38816 0 78.87872-0.0256 78.87872 39.36256v512c0 43.32032-35.55328 78.87872-78.87872 78.87872H354.4064c-43.32544 0-78.72-35.5584-78.72-78.87872v-118.08256h393.91744c21.66272 0 39.36256-17.69472 39.36256-39.35744V472.64256c0-21.66272-17.69984-39.36256-39.36256-39.36256H275.68128V157.59872c0-43.32032 35.39456-78.87872 78.72-78.87872zM165.60128 500.96128h43.19744c20.48 0 35.84 4.48 46.08 13.44 10.24 8.32 15.36 21.12 15.36 38.4s-5.43744 31.03744-16.31744 41.27744c-10.88 9.6-26.88 14.40256-48 14.40256h-18.24256v68.15744h-22.07744V500.96128z m142.08 0h43.19744c20.48 0 35.84 4.48 46.08 13.44 10.24 8.32 15.36 21.12 15.36 38.4s-5.43744 31.03744-16.31744 41.27744c-10.88 9.6-26.88 14.40256-48 14.40256h-18.24256v68.15744h-22.07744V500.96128z m120.96 0h121.91744v20.15744h-49.92v155.52H478.5664v-155.52h-49.92v-20.15744z m-240.96256 19.2v69.12h15.36c16 0 27.20256-2.88256 33.60256-8.64256 7.04-5.76 10.55744-14.72 10.55744-26.88 0-10.88-3.51744-19.2-10.55744-24.96-6.4-5.76-16.32256-8.63744-29.76256-8.63744h-19.2z m142.08 0v69.12h15.36c16 0 27.20256-2.88256 33.60256-8.64256 7.04-5.76 10.55744-14.72 10.55744-26.88 0-10.88-3.51744-19.2-10.55744-24.96-6.4-5.76-16.32256-8.63744-29.76256-8.63744h-19.2z" p-id="27781"></path></svg>
        `,
        "/app": `
            <svg t="1735962645850" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="69005" width="24" height="24"><path d="M372 959.5H158c-8.5 0-16.7-3.4-22.7-9.4l-53.5-53.5c-6-6-9.4-14.2-9.4-22.7V660c0-8.5 3.4-16.7 9.4-22.7l53.5-53.5c6-6 14.2-9.4 22.7-9.4h214c8.5 0 16.7 3.4 22.7 9.4l53.5 53.5c6 6 9.4 14.2 9.4 22.7v214c0 8.5-3.4 16.7-9.4 22.7l-53.5 53.5c-6 5.9-14.2 9.3-22.7 9.3z m-200.6-64.2h187.4l34.7-34.7V673.3l-34.7-34.7H171.4l-34.7 34.7v187.4l34.7 34.6z m681.9 64.2h-214c-8.5 0-16.7-3.4-22.7-9.4l-53.5-53.5c-6-6-9.4-14.2-9.4-22.7V660c0-8.5 3.4-16.7 9.4-22.7l53.5-53.5c6-6 14.2-9.4 22.7-9.4h214c8.5 0 16.7 3.4 22.7 9.4l53.5 53.5c6 6 9.4 14.2 9.4 22.7v214c0 8.5-3.4 16.7-9.4 22.7L876 950.1c-6 6-14.1 9.4-22.7 9.4z m-200.6-64.2H840l34.7-34.7V673.3L840 638.6H652.7L618 673.3v187.4l34.7 34.6zM372 478.2H158c-8.5 0-16.7-3.4-22.7-9.4l-53.5-53.5c-6-6-9.4-14.2-9.4-22.7v-214c0-8.5 3.4-16.7 9.4-22.7l53.5-53.5c6-6 14.2-9.4 22.7-9.4h214c8.5 0 16.7 3.4 22.7 9.4l53.5 53.5c6 6 9.4 14.2 9.4 22.7v214c0 8.5-3.4 16.7-9.4 22.7l-53.5 53.5c-6 6-14.2 9.4-22.7 9.4zM171.4 414h187.4l34.7-34.7V192l-34.7-34.7H171.4L136.7 192v187.4l34.7 34.6z m596.7 92.8h-75.6c-8.5 0-16.7-3.4-22.7-9.4L518.5 346.1c-6-6-9.4-14.2-9.4-22.7v-75.6c0-8.5 3.4-16.7 9.4-22.7L669.8 73.9c6-6 14.2-9.4 22.7-9.4h75.6c8.5 0 16.7 3.4 22.7 9.4l151.3 151.3c6 6 9.4 14.2 9.4 22.7v75.6c0 8.5-3.4 16.7-9.4 22.7L790.8 497.4c-6 6-14.2 9.4-22.7 9.4z m-62.3-64.1h49l132.5-132.5v-49L754.8 128.7h-49L573.3 261.2v49l132.5 132.5z m213.6-119.2h0.6-0.6z" p-id="69006"></path></svg>
        `,
        "/galleries": `
            <svg t="1735961278678" class="icon" viewBox="0 0 1066 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="32038" width="24" height="24"><path d="M128 256a117.333333 117.333333 0 0 1 117.333333-117.333333h512c54.272 0 99.968 36.864 113.365334 86.912 50.389333 8.661333 89.301333 52.053333 89.301333 105.088v448c0 59.392-48.768 106.666667-107.861333 106.666666H321.194667a107.562667 107.562667 0 0 1-106.453334-89.344A117.376 117.376 0 0 1 128 682.666667V256z m85.333333 469.333333V330.666667c0-59.392 48.768-106.666667 107.861334-106.666667H800a53.248 53.248 0 0 0-42.666667-21.333333h-512c-29.44 0-53.333333 23.893333-53.333333 53.333333v426.666667c0 17.450667 8.362667 32.938667 21.333333 42.666666zM321.194667 288c-24.704 0-43.861333 19.584-43.861334 42.666667v184.917333l32.512-32a70.357333 70.357333 0 0 1 98.56 0l197.205334 194.176 83.498666-82.176a70.357333 70.357333 0 0 1 98.56 0L896 702.293333V330.666667c0-23.082667-19.157333-42.666667-43.861333-42.666667H321.194667zM894.293333 790.4l-151.552-149.205333a6.357333 6.357333 0 0 0-8.746666 0l-182.997334 180.138666h301.141334c20.352 0 36.992-13.312 42.154666-30.933333z m-434.517333 30.933333l100.266667-98.688-196.565334-193.450666a6.357333 6.357333 0 0 0-8.746666 0L277.333333 605.44v173.269333c0 23.082667 19.157333 42.666667 43.861334 42.666667h138.581333z m297.557333-421.333333a24.448 24.448 0 0 0-24.874666 24.021333c0 12.8 10.666667 23.978667 24.874666 23.978667a24.448 24.448 0 0 0 24.874667-24.021333c0-12.8-10.666667-23.978667-24.874667-23.978667z m-88.874666 24.021333c0-49.066667 40.277333-88.021333 88.874666-88.021333 48.64 0 88.874667 38.912 88.874667 88.021333 0 49.066667-40.277333 87.978667-88.874667 87.978667-48.64 0-88.874667-38.912-88.874666-88.021333z" p-id="32039"></path></svg>
        `,
        "/mind": `
            <svg t="1735962486778" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="63016" id="mx_n_1735962486778" width="24" height="24"><path d="M514.407524 229.517241c-137.22884 0-247.974922 111.548589-247.974922 247.974922 0 77.84326 36.112853 150.068966 97.905956 197.416928 15.247649 11.23511 36.915361 8.827586 48.15047-6.420063 11.23511-15.247649 8.827586-36.915361-6.420062-48.15047-44.940439-34.507837-70.62069-86.670846-70.62069-142.846395 0-98.708464 80.250784-178.959248 178.959248-178.959248s178.959248 80.250784 178.959247 178.959248c0 65.003135-35.310345 125.191223-92.288401 156.489028-0.802508 0.802508-1.605016 0.802508-1.605016 1.605016-0.802508 0.802508-1.605016 0.802508-1.605015 0.802508-12.037618 8.827586-18.45768 14.445141-20.062696 105.931034l-174.946709-40.125392c-18.45768-4.012539-36.915361 7.222571-41.730407 25.680251-4.012539 18.45768 7.222571 36.915361 25.68025 41.730408l217.479624 49.755486c2.407524 0.802508 4.815047 0.802508 8.025079 0.802507 8.025078 0 15.247649-2.407524 21.667711-7.22257 8.025078-6.420063 12.840125-16.852665 12.840126-27.285267v-18.45768c0-46.545455 1.605016-69.818182 2.407523-81.855799 70.62069-45.742947 113.956113-124.388715 113.956113-208.652038-0.802508-136.426332-112.351097-247.172414-248.777429-247.172414zM592.250784 845.84326l-193.404389-45.742947c-18.45768-4.012539-36.915361 7.222571-41.730408 25.680251-4.012539 18.45768 7.222571 36.915361 25.680251 41.730408l193.404389 45.742946c2.407524 0.802508 5.617555 0.802508 8.025078 0.802508 16.050157 0 29.69279-10.432602 33.705329-26.482758 4.815047-19.260188-7.222571-37.717868-25.68025-41.730408zM553.730408 933.316614l-133.216301-31.297805c-18.45768-4.012539-36.915361 7.222571-41.730408 25.680251-4.012539 18.45768 7.222571 36.915361 25.680251 41.730407l133.216301 31.297806c2.407524 0.802508 5.617555 0.802508 8.025078 0.802508 16.050157 0 29.69279-10.432602 33.705329-26.482759 4.815047-18.45768-7.222571-36.915361-25.68025-41.730408z" p-id="63017"></path><path d="M574.595611 477.492163c0 19.260188 15.247649 34.507837 34.507837 34.507837s34.507837-15.247649 34.507837-34.507837c0-81.855799-60.188088-138.031348-146.858934-138.031348-19.260188 0-34.507837 15.247649-34.507837 34.507837s15.247649 34.507837 34.507837 34.507837c17.655172 0 77.84326 4.815047 77.84326 69.015674zM514.407524 142.846395c19.260188 0 34.507837-15.247649 34.507837-34.507837V56.978056c0-19.260188-15.247649-34.507837-34.507837-34.507837s-34.507837 15.247649-34.507837 34.507837v51.360502c0 19.260188 15.247649 34.507837 34.507837 34.507837zM288.902821 186.984326l-36.91536-36.91536c-13.642633-13.642633-35.310345-13.642633-48.952978 0-13.642633 13.642633-13.642633 35.310345 0 48.952978l36.91536 36.91536c13.642633 13.642633 35.310345 13.642633 48.952978 0 13.642633-12.840125 13.642633-35.310345 0-48.952978zM170.131661 426.934169h-51.360501c-19.260188 0-34.507837 15.247649-34.507837 34.507837s15.247649 34.507837 34.507837 34.507837h51.360501c19.260188 0 34.507837-15.247649 34.507837-34.507837s-16.050157-34.507837-34.507837-34.507837zM824.978056 150.871473c-13.642633-13.642633-35.310345-13.642633-48.952978 0l-36.91536 36.915361c-13.642633 13.642633-13.642633 35.310345 0 48.952978 13.642633 13.642633 35.310345 13.642633 48.952978 0l36.91536-36.915361c13.642633-13.642633 13.642633-35.310345 0-48.952978zM910.846395 426.934169H858.683386c-19.260188 0-34.507837 15.247649-34.507837 34.507837s15.247649 34.507837 34.507837 34.507837h51.360501c19.260188 0 34.507837-15.247649 34.507837-34.507837 0.802508-19.260188-15.247649-34.507837-33.705329-34.507837z" p-id="63018"></path></svg>
        `,
        "/pdf": `
            <svg t="1735961401660" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1273" width="24" height="24"><path d="M354.40128 0c-87.04 0-157.44 70.55872-157.44 157.59872v275.68128H78.72c-21.6576 0-39.36256 17.69984-39.36256 39.36256v236.31872c0 21.6576 17.69984 39.35744 39.36256 39.35744h118.24128v118.08256c0 87.04 70.4 157.59872 157.44 157.59872h472.63744c87.04 0 157.59872-70.55872 157.59872-157.59872V315.0336c0-41.74848-38.9888-81.93024-107.52-149.27872l-29.11744-29.12256L818.87744 107.52C751.5392 38.9888 711.39328 0 669.59872 0H354.4064z m0 78.72h287.20128c28.35456 7.0912 27.99616 42.1376 27.99616 76.8v120.16128c0 21.6576 17.69984 39.35744 39.36256 39.35744h118.07744c39.38816 0 78.87872-0.0256 78.87872 39.36256v512c0 43.32032-35.55328 78.87872-78.87872 78.87872H354.4064c-43.32544 0-78.72-35.5584-78.72-78.87872v-118.08256h393.91744c21.66272 0 39.36256-17.69472 39.36256-39.35744V472.64256c0-21.66272-17.69984-39.36256-39.36256-39.36256H275.68128V157.59872c0-43.32032 35.39456-78.87872 78.72-78.87872zM165.60128 500.96128h43.19744c20.48 0 35.84 4.48 46.08 13.44 10.24 8.32 15.36 21.12 15.36 38.4s-5.43744 31.03744-16.31744 41.27744c-10.88 9.6-26.88 14.40256-48 14.40256h-18.24256v68.15744h-22.07744V500.96128z m142.08 0h48.95744c24.96 0 44.48256 7.68 58.56256 23.04 14.72 14.72 22.07744 35.84 22.07744 63.36 0 28.8-7.68 50.87744-23.04 66.23744-14.72 15.36-35.51744 23.04-62.39744 23.04h-44.16V500.96128z m167.99744 0h91.20256v20.15744h-69.12v61.44h64.31744v20.16256H497.7664v73.91744h-22.08256V500.96128z m-288 19.2v69.12h15.36c16 0 27.20256-2.88256 33.60256-8.64256 7.04-5.76 10.55744-14.72 10.55744-26.88 0-10.88-3.51744-19.2-10.55744-24.96-6.4-5.76-16.32256-8.63744-29.76256-8.63744h-19.2z m142.08 0v137.27744h19.2c21.76 0 37.76-5.76 48-17.28 10.88-11.52 16.32256-28.8 16.32256-51.84s-5.12-39.99744-15.36-50.87744c-9.6-11.52-24.32-17.28-44.16-17.28h-24.00256z" p-id="1274"></path></svg>
        `,
        "/promotion": `
            <svg t="1735961461485" class="icon" viewBox="0 0 1186 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4393" width="24" height="24"><path d="M1164.647082 35.191411a93.232988 93.232988 0 0 0-97.8138-31.850113L69.9948 270.645124A93.610231 93.610231 0 0 0 1.767654 343.884217a93.718015 93.718015 0 0 0 36.053682 93.340771L258.724236 602.619231v328.525025a93.825799 93.825799 0 0 0 63.969685 87.574338c10.293353 3.502974 20.856165 5.281406 31.257303 5.281406 27.808221 0 54.376928-12.287353 72.538498-34.652492l134.568075-160.328404 96.897637 72.538498a94.095258 94.095258 0 0 0 77.766012 16.383138 94.310826 94.310826 0 0 0 62.67628-48.718278l376.812168-731.690332A93.394663 93.394663 0 0 0 1164.647082 35.191411z m-61.436767 65.370875l-376.812168 731.690332a13.634651 13.634651 0 0 1-20.101678 4.634704l-236.423768-177.034893a40.418925 40.418925 0 0 0-48.50271 64.67028l74.748066 55.993685-132.089048 157.418241a12.934056 12.934056 0 0 1-15.197516 4.365244c-4.203568-1.401189-9.215515-4.796379-9.377191-12.017894v-324.6987L879.828388 290.477343a40.418925 40.418925 0 1 0-40.742277-69.843903l-537.302247 313.327509-215.567602-161.406241a12.987948 12.987948 0 0 1-5.173622-13.365192 12.934056 12.934056 0 0 1 9.754434-10.455028L1087.74334 81.37677c7.38319-1.994 11.91011 1.994 13.958002 4.526919s5.011947 7.868217 1.508973 14.658597z" p-id="4394"></path></svg>
        `,
        "/me": `
            <svg t="1735962215384" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7782" width="24" height="24"><path d="M512 70a442.13 442.13 0 0 1 172 849.29 442.13 442.13 0 0 1-344-814.58A439.11 439.11 0 0 1 512 70m0-70C229.23 0 0 229.23 0 512s229.23 512 512 512 512-229.23 512-512S794.77 0 512 0z" p-id="7783"></path><path d="M512 739.16A131.61 131.61 0 0 1 380.54 607.7a35 35 0 0 1 70 0 61.46 61.46 0 0 0 122.92 0 35 35 0 0 1 70 0A131.61 131.61 0 0 1 512 739.16z" p-id="7784"></path><path d="M329.12 425.41m-73.39 0a73.39 73.39 0 1 0 146.78 0 73.39 73.39 0 1 0-146.78 0Z" p-id="7785"></path><path d="M694.88 425.41m-73.39 0a73.39 73.39 0 1 0 146.78 0 73.39 73.39 0 1 0-146.78 0Z" p-id="7786"></path></svg>
        `
    };

    function replaceAllMenuIcons() {
        const sidebar = document.querySelector('.global-sidebar');
        if (!sidebar) {
            return false;
        }

        const menuLinks = sidebar.querySelectorAll('a._mi.aa-text');

        if (menuLinks.length === 0) {
            return false;
        }

        let replacedAtLeastOne = false;

        menuLinks.forEach(link => {
            const href = link.getAttribute('href');
            if (iconMap[href]) {
                const iconContainer = link.querySelector('i.n-icon, svg.iconify, svg');
                if (iconContainer) {
                    if (iconContainer.dataset.customIconReplaced !== 'true') {
                        iconContainer.innerHTML = iconMap[href];
                        iconContainer.dataset.customIconReplaced = 'true';
                        replacedAtLeastOne = true;
                    }
                }
            }
        });

        return replacedAtLeastOne;
    }

    function setupMutationObserver() {
        const sidebar = document.querySelector('.global-sidebar');
        if (!sidebar) {
            return;
        }

        const observer = new MutationObserver((mutationsList, observer) => {
            for (const mutation of mutationsList) {
                if (mutation.type === 'childList' || mutation.type === 'subtree') {
                    replaceAllMenuIcons();
                }
            }
        });

        const config = {
            childList: true,
            subtree: true
        };

        observer.observe(sidebar, config);
    }

    function init() {
        replaceAllMenuIcons();

        setupMutationObserver();

        const maxAttempts = 10;
        let attempts = 0;
        const intervalId = setInterval(() => {
            if (replaceAllMenuIcons()) {
                clearInterval(intervalId);
            }
            attempts++;
            if (attempts >= maxAttempts) {
                clearInterval(intervalId);
            }
        }, 1000);
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', init);
    } else {
        init();
    }

})();
</script>
