https://matrixhub.xyz/

ID da verificação
b02ecad7-c98f-4cb9-af26-f29f5a8c9995Concluído
URL enviado:
https://matrixhub.xyz/
Relatório concluído:

Ligações · 0 encontradas

Variáveis JavaScript · 34 encontradas

NomeTipo
onbeforetoggleobject
documentPictureInPictureobject
onscrollendobject
Sweetalert2function
SweetAlertfunction
Swalfunction
sweetAlertfunction
swalfunction
uidEventnumber
bootstrapobject

Mensagens de registo da consola · 0 encontradas

HTML

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MatrixHub</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script><style>.swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:"top-start     top            top-end" "center-start  center         center-end" "bottom-start  bottom-center  bottom-end";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:hsl(0,0%,33%);font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):focus-visible{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):focus-visible{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):focus-visible{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus-visible{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:0;padding:1em 1.6em .3em;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid hsl(0,0%,85%);border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:hsl(0,0%,94%);color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:rgb(249.95234375,205.965625,167.74765625);color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:rgb(156.7033492823,224.2822966507,246.2966507177);color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:rgb(200.8064516129,217.9677419355,225.1935483871);color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}</style>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
    <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async="" defer=""></script>
    <link rel="icon" type="image/x-icon" href="asset/logo.png">
    <style>
        @font-face {
            font-family: 'CustomFont';
            src: url('asset/fonticon.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }
        .post-header h1 {
            font-size: 100px;
            font-family: 'CustomFont', Arial, sans-serif;
            font-weight: bold;
            background: linear-gradient(to right, #0066cc, #add8e6);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        .post-header {
            background-color: #f8f9fa;
            padding: 20px;
            border-bottom: 1px solid #dee2e6;
            text-align: center;
        }
        .post-content {
            padding: 40px;
            position: relative;
        }
        .overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            color: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            border-radius: 5px;
            z-index: 10;
        }
        .lock-icon {
            font-size: 48px;
            margin-bottom: 20px;
        }
        .nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active {
            background-color: #f8f9fa;
            font-weight: bold;
            color: #000;
        }
        .nav-tabs .nav-link {
            font-weight: bold;
            color: #555;
        }
        .nav-link:hover
        {
            cursor: pointer;
        }
        .footer {
            background-color: #f8f9fa;
            padding: 10px;
            text-align: center;
            margin-top: 20px;
            border-top: 1px solid #dee2e6;
        }
        /* Enhanced Button Styles */
        .btn-custom {
            border: none;
            border-radius: 50px;
            padding: 10px 20px;
            font-size: 16px;
            font-weight: bold;
            text-transform: uppercase;
            transition: all 0.3s ease;
            cursor: pointer;
        }
        .btn-custom-primary {
            background-color: #007bff;
            color: white;
        }
        .btn-custom-primary:hover {
            background-color: #0056b3;
            box-shadow: 0px 4px 15px rgba(0, 123, 255, 0.4);
        }
        .btn-custom-secondary {
            background-color: #6c757d;
            color: white;
        }
        .btn-custom-secondary:hover {
            background-color: #5a6268;
            box-shadow: 0px 4px 15px rgba(108, 117, 125, 0.4);
        }
        /* Purchase Section Styles */
        .purchase-section {
            margin-top: 20px;
        }
        .purchase-section .card {
            margin-bottom: 20px;
            border: 1px solid #dee2e6;
            box-shadow: 0px 4px 8px rgba(0, 123, 255, 0.2);
        }
        .purchase-section .card-title {
            font-size: 24px;
            font-weight: bold;
        }
        .purchase-section .card-text {
            margin-bottom: 20px;
        }
        .purchase-section .btn-custom-primary {
            background-color: #28a745;
            color: white;
        }
        .purchase-section .btn-custom-primary:hover {
            background-color: #218838;
            box-shadow: 0px 4px 15px rgba(40, 167, 69, 0.4);
        }
        /* The Modal (background) */
        .modal {
            position: fixed; 
            z-index: 1; 
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto; 
            background-color: rgb(0,0,0); 
            background-color: rgba(0,0,0,0.4); 
            padding-top: 60px; 
        }

        /* Modal Content */
        .modal-content {
            background-color: #fefefe;
            margin: 5% auto;
            padding: 20px;
            border: 1px solid #888;
            width: 80%;
            max-width: 500px;
            text-align: center;
        }

        /* Modal Buttons */
        .modal-buttons {
            display: flex;
            justify-content: space-between;
            margin-top: 20px;
        }

        /* Optional Styling for Buttons */
        .btn-custom-danger {
            background-color: #ff4b4b;
            color: white;
            border: 1px solid #ff4b4b;
            padding: 10px 20px;
            cursor: pointer;
        }

        .btn-custom-danger:hover {
            background-color: #e04343;
        }



    </style>
</head>
<body>

<!-- Tab Menu -->
<div class="container" id="navmenu">
    <ul class="nav nav-tabs mt-3 flex-column flex-md-row">
        <li class="nav-item" id="navdashboard" style="display: none;">
            <a class="nav-link active" id="dashboard-tab" onclick="showDashboard()">Dashboard</a>
        </li>
        <li class="nav-item" id="navhome" style="display: none;">
            <a class="nav-link" id="home-tab" onclick="showHome()">Post</a>
        </li>
        <li class="nav-item" id="navsoftware" style="display: none;">
            <a class="nav-link" id="software-tab" onclick="showSoftware()">Software</a>
        </li>
        <li class="nav-item" id="navpurchase" style="display: none;">
            <a class="nav-link" id="purchase-tab" onclick="showPurchase()">Purchase</a>
        </li>
        <li class="nav-item" id="navlogout" style="display: none;">
            <a class="nav-link" onclick="logout()">Logout</a>
        </li>
    </ul>
</div>

<!-- Post Header -->
<div class="container-fluid post-header mt-3">
    <h1 class="display-4">MatrixHub</h1>
</div>

<!-- Post Content -->
<div class="container post-content">
    <div class="row">
        <div class="col-md-8 offset-md-2" id="post-container" style="display: none;"> 
            <!-- Home page posts will go here -->
        </div>
        <div class="col-md-8 offset-md-2" id="dashboard-container" style="display: none;">
            <!-- Dashboard content -->
            <div class="mb-3">
                <label class="form-label">Username: <text id="usernamedashboard" class="form-text"></text></label>
                
            </div>
            <div class="mb-3">
                <label class="form-label">Whitelist Expiration Date: <text id="expirationDatedashboard" class="form-text"></text></label>
            </div>
            <div class="mb-3">
                <label for="tokenInput" class="form-label">Generated Token <a href="token.html" target="_blank">What is a Token?</a></label>
                <input type="text" class="form-control" id="tokenInput" readonly="">
            </div>
            
            <!--<button class="btn btn-custom btn-custom-primary me-2" onclick="generateToken()">Generate Token</button>-->

            <!-- ปุ่มที่ใช้ในการแสดง Modal -->
            <button class="btn btn-custom btn-custom-primary me-2" onclick="showModal()">Generate Token</button>

            <!-- Modal Overlay -->
            <div id="captchaModal" class="modal" style="display:none;">
                <div class="modal-content">
                    <!-- Turnstile CAPTCHA -->
                    <div class="cf-turnstile" data-sitekey="0x4AAAAAAAhynnsEEkcq5vJ9"><div><input type="hidden" name="cf-turnstile-response" id="cf-chl-widget-buabe_response"></div></div>
                    <button class="btn btn-custom btn-custom-primary mt-3" onclick="generateToken()">Submit</button>
                    <button class="btn btn-custom btn-custom-danger mt-3" onclick="closeModal()">Cancel</button>
                </div>
            </div>

            <button class="btn btn-custom btn-custom-secondary" onclick="copyToken()">Copy Token</button>
        </div>
        
        <!-- New Software content -->
        <div class="col-md-8 offset-md-2" id="software-container" style="display: none;"><div class="card mb-4" style="min-height: 150px;"><div class="card-body"><h5 class="card-title">Cleaning RAM</h5><p class="card-text">Lightweight real-time memory management application to monitor and clean system memory on your computer.<br><br>
            The program uses <strong style="color: #007bff;">undocumented internal system features (Native API)</strong> to clear system cache (system working set, working set, standby page lists, modified page lists) with variable results of <strong style="color: #007bff;">~10-50%</strong>. 
            The application is compatible with <strong style="color: #007bff;">Windows XP SP3 and higher</strong> operating systems, but some general features are available only since Windows Vista.<br><br>
            You can download either the <strong style="color: #007bff;">installer</strong> or <strong style="color: #007bff;">portable</strong> version. 
            For correct operation, <strong style="color: #007bff;">administrator rights</strong> are required.</p><div class="overlay"><span class="lock-icon">🔒</span><p>This download is locked. Please purchase whitelist access to unlock.</p></div><a href="#" class="btn btn-custom btn-custom-primary disabled" style="pointer-events: none;">Locked</a></div></div></div>

        <!-- Purchase content -->
        <div class="col-md-8 offset-md-2" id="purchase-container" style="display: none;">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">Whitelist Access</h5>
                    <p class="card-text">
                        Gain access to <strong>exclusive content</strong> and <strong>configuration tutorials</strong>. Whitelist access is <strong>essential</strong> for using all of MatrixHub's advanced features.
                    </p>
                    <hr>
                    <p class="card-text">
                        <strong>Price:</strong> 
                        <span style="color: #007bff; ">$5.5 / Lifetime (Not include fee)</span>
                        <br>
                        <span style="font-size: 0.9em; color: #ff0000;"><strong>This is not a subscription;</strong></span>
                    </p>
                    <hr>
            
                    <!-- Checkbox for payment method selection -->
                    <strong>Select Currency</strong>
                    <div style="margin-bottom: 15px;">
                        <label class="custom-checkbox">
                            <input type="radio" name="currency" value="THB" onclick="showPaymentMethods('THB')">
                            <span class="checkmark">THB</span>
                        </label>
                        <br>
                        <label class="custom-checkbox">
                            <input type="radio" name="currency" value="USD" onclick="showPaymentMethods('USD')">
                            <span class="checkmark">USD , EUR</span>
                        </label>
                    </div>

                    <strong>Select Payment Method</strong>
                    <div id="paymentMethodsContainer" style="margin-bottom: 15px;">
                        <!-- Payment methods will be shown here based on the selected currency -->
                    </div>
            
                    <hr>
                    <div class="d-grid gap-2">
                        <a href="#" class="btn btn-custom btn-custom-primary" onclick="proceedToPayment()">Buy Whitelist</a>
                    </div>
                </div>
            </div>

            <!-- Modal Overlay -->
            <div id="whitelistModal" class="modal" style="display:none;">
                <div class="modal-content">
                    <h2><strong>Confirm Purchase</strong></h2>
                    <p>Please read and accept the <strong>Terms of Service</strong> before proceeding.</p>
                    
                    <!-- ลิงก์ไปยัง TOS -->
                    <p><a href="tos.html" target="_blank"><strong>Read Terms of Service</strong></a></p>
                    
                    <!-- Checkbox สำหรับการยอมรับ TOS -->
                    <p>
                        <input type="checkbox" id="acceptTosCheckbox"> 
                        <label for="acceptTosCheckbox">I have read and accept the Terms of Service</label>
                    </p>
                    
                    <!-- ข้อความเพิ่มเติมเกี่ยวกับการกลับมาหน้า Dashboard หลังจากการชำระเงิน -->
                    <p style="margin-top: 20px; color: #555;">
                        After completing your payment, you will be redirected back to the <strong style="color: #007bff;">Dashboard</strong>. 
                        If the <strong style="color: #007bff;">Whitelist</strong> access is not immediately added, please wait a moment and 
                        <strong style="color: #007bff;">refresh the page</strong>.
                    </p>
                    
                    <!-- ปุ่มยืนยันและปุ่มยกเลิก -->
                    <div class="modal-buttons">
                        <button class="btn btn-custom btn-custom-primary mt-3" onclick="confirmPurchase()">Confirm</button>
                        <button class="btn btn-custom btn-custom-danger mt-3" onclick="closeModalwhitelist()">Cancel</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-8 offset-md-2" id="lock-container" style="display: block;">
            <!-- Lock content -->
            <div class="lock-content text-center">
                <span class="lock-icon" style="font-size: 50px;">🔒</span>
                <p class="mt-3">You do not have permission to access this content.</p>
                <!-- Add a button to go back to login page -->
                <button class="btn btn-custom btn-custom-primary mt-3" onclick="window.location.href='login.html'">Go to Login</button>
            </div>
        </div>
    </div>
</div>


<!-- Footer with Copyright -->
<div class="footer">
    <p>© 2024 MatrixHub. All rights reserved.</p>
    <p><a href="tos.html" target="_blank">Terms of Service</a></p>
</div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>

    let IsExpire = 1;
    let methodpayment = -1;

    function showPaymentMethods(currency) {
        const container = document.getElementById('paymentMethodsContainer');
        let methodsHTML = '';

        if (currency === 'THB') {
            methodsHTML = `
                <label class="custom-checkbox">
                    <input type="radio" name="paymentMethod" value="thbPayment" onclick="selectToPayment(3)" />
                    <span class="checkmark">
                        <span>รองรับ PromptPay, TrueMoney Wallet - </span>
                        
                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/PromptPay.svg">
                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/truemoney-wallet.svg">
                    </span>
                </label>
            `;
        } else if (currency === 'USD') {
            methodsHTML = `
                <label class="custom-checkbox">
                    <input type="radio" name="paymentMethod" value="paypalUSD" onclick="selectToPayment(1)" />
                    <span class="checkmark">
                        <span>Support PayPal - </span>

                        <img alt="icon" class="arrow-icon" width="24" height="24" src="asset/paypal.svg">

                    </span>
                </label>
                <br>
                <label class="custom-checkbox">
                    <input type="radio" name="paymentMethod" value="creditCardUSD" onclick="selectToPayment(2)" />
                    <span class="checkmark">
                        <span>Support Credit Card (USD) - </span>

                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/visa.svg">
                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/mastercard.svg">
                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/jcb.svg">
                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/americanExpress.svg">
                    </span>
                </label>
                <br>
                <label class="custom-checkbox">
                    <input type="radio" name="paymentMethod" value="creditCardEUR" onclick="selectToPayment(4)" />
                    <span class="checkmark">
                        <span>Support Credit Card (EUR) - </span>

                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/visa.svg">
                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/mastercard.svg">
                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/jcb.svg">
                        <img alt="icon" class="arrow-icon" src="https://cdn.paysolutions.io/payment-img/americanExpress.svg">
                    </span>
                </label>
            `;
        }

        container.innerHTML = methodsHTML;
    }



    function selectToPayment(idx)
    {
        methodpayment = idx;
    }
    function proceedToPayment()
    {
        if(methodpayment)
        {
            showWhitelistModal();
        }
        else
        {
            Swal.fire({
                    icon: 'warning',
                    title: 'Please select payment method.'
                });
        }
    }
    function formatTimestamp(timestamp) {
        const date = new Date(timestamp * 1000);
        const options = {
            year: 'numeric',
            month: 'long',
            day: 'numeric',
            hour: '2-digit',
            minute: '2-digit',
            second: '2-digit',
            timeZoneName: 'short'
        };
        const formatter = new Intl.DateTimeFormat(undefined, options);
        return formatter.format(date);
    }
    function calculateTimeRemaining(expirationTimestamp) {
        const currentTime = Math.floor(Date.now() / 1000); // เวลาในขณะนี้เป็นวินาที
        const timeRemaining = expirationTimestamp - currentTime;

        if (timeRemaining <= 0) {
            return "Expired"; // ถ้าเวลาหมดแล้ว
        }

        const days = Math.floor(timeRemaining / (60 * 60 * 24)); // คำนวณจำนวนวัน
        const hours = Math.floor((timeRemaining % (60 * 60 * 24)) / (60 * 60)); // คำนวณจำนวนชั่วโมง
        const minutes = Math.floor((timeRemaining % (60 * 60)) / 60); // คำนวณจำนวนนาที
        const seconds = Math.floor(timeRemaining % 60); // คำนวณจำนวนวินาที

        return `${days} days, ${hours} hours, ${minutes} minutes, ${seconds} seconds remaining`;
    }
    // แสดง Modal
    function showModal() {
        document.getElementById("captchaModal").style.display = "block";
    }

    // ซ่อน Modal
    function closeModal() {
        document.getElementById("captchaModal").style.display = "none";
    }

    // กดปุ่ม "Submit" ภายใน Modal เพื่อเรียกใช้ฟังก์ชัน Generate Token
    function generateToken() {
        // Logic สำหรับสร้าง Token หรือการยืนยัน CAPTCHA
        closeModal(); // ปิด Modal หลังจากยืนยันเสร็จ
    }
    // แสดง Modal
    function showWhitelistModal() {
        document.getElementById("whitelistModal").style.display = "block";
    }

    // ซ่อน Modal
    function closeModalwhitelist() {
        document.getElementById("whitelistModal").style.display = "none";
    }

    function sendPaymentRequest(type, username) {
        const data = new URLSearchParams(); // ใช้ URLSearchParams เพื่อสร้างข้อมูลที่สามารถส่งผ่าน POST ได้แบบฟอร์มปกติ
        data.append('type', type);          // เพิ่มค่า type ลงใน data
        data.append('username', username);  // เพิ่มค่า username ลงใน data
        fetch('api/createpay.php', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded', // ระบุ Content-Type เป็นแบบฟอร์มปกติ
            },
            body: data, // ส่งข้อมูล data ที่สร้างขึ้นไปยังเซิร์ฟเวอร์
        })
        .then(response => response.json())  // รับผลลัพธ์เป็น JSON
        .then(data => {
            if (data.status === 'success' && data.url) {
                // ถ้าผลลัพธ์เป็นสถานะ success และมี URL ที่ถูกต้อง ให้เปลี่ยนเส้นทางเบราว์เซอร์ไปที่ URL นั้น
                window.location.href = data.url;
            } else {
                // ถ้ามีข้อผิดพลาดหรือไม่มี URL ให้แสดงการแจ้งเตือนด้วย SweetAlert
                Swal.fire({
                    icon: 'error',
                    title: 'Error',
                    text: data.message ,
                });
            }
        })
        .catch(error => {
            // แสดงข้อผิดพลาดด้วย SweetAlert
            Swal.fire({
                icon: 'error',
                title: 'Request Failed',
                text: 'Something went wrong. Please try again later.',
            });
            console.error('Error:', error);
        });
    }


    // การยืนยันการซื้อ
    function confirmPurchase() {
        var isChecked = document.getElementById("acceptTosCheckbox").checked;

        if(!isChecked)
        {
            Swal.fire({
                icon: 'warning',
                title: 'Warning',
                text: 'Please check the box to confirm that you have read and accept the Terms of Service.',
                showConfirmButton: false,
                timer: 1500,  // กำหนดเวลาที่จะแสดง Swal (ในหน่วยมิลลิวินาที)
                willClose: () => {
                    window.location.reload();  // รีโหลดหน้าเว็บเมื่อ Swal ปิด
                }
            });
            return;
        }
        
        
        const crypt = localStorage.getItem('crypt');

        if(methodpayment == 1)
        {
            fetch('api/createpaypal.php', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                },
                body: `crypt=${encodeURIComponent(crypt)}`
            })
            .then(response => response.json())
            .then(data => {
                if (data.status === 'success') {
                    window.location.href = data.paypal_link; // Redirect to PayPal
                } else {
                    Swal.fire({
                        icon: 'error',
                        title: 'Error',
                        text: 'error payment',
                        showConfirmButton: false,
                        timer: 1500,  // กำหนดเวลาที่จะแสดง Swal (ในหน่วยมิลลิวินาที)
                        willClose: () => {
                            window.location.reload();  // รีโหลดหน้าเว็บเมื่อ Swal ปิด
                        }
                    });
                }
            })
            .catch(error => {
                Swal.fire({
                    icon: 'error',
                    title: 'Error',
                    text: 'error internal',
                    showConfirmButton: false,
                    timer: 1500,  // กำหนดเวลาที่จะแสดง Swal (ในหน่วยมิลลิวินาที)
                    willClose: () => {
                        window.location.reload();  // รีโหลดหน้าเว็บเมื่อ Swal ปิด
                    }
                });
                console.error('Error:', error);
            });
        }
        else if(methodpayment == 2)
        {
            sendPaymentRequest("2",crypt);
        }
        else if(methodpayment == 3)
        {
            sendPaymentRequest("3",crypt);
        }
        else if(methodpayment == 4)
        {
            sendPaymentRequest("4",crypt);
        }
        // Logic สำหรับการยืนยันการซื้อ Whitelist
        //console.log("Whitelist purchased!");
        closeModalwhitelist(); // ปิด Modal หลังจากยืนยัน
    }


    document.addEventListener('DOMContentLoaded', async function() {
        const crypt = localStorage.getItem('crypt');
        await fetch('api/auth.php', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            body: `crypt=${encodeURIComponent(crypt)}`
        })
        .then(response => response.json())
        .then(data => {
            if(data.status == 'error')
            {
                document.getElementById('post-container').style.display = 'none';
                document.getElementById('dashboard-container').style.display = 'none';
                document.getElementById('navhome').style.display = 'none';
                document.getElementById('navdashboard').style.display = 'none';
                document.getElementById('navlogout').style.display = 'none';
                document.getElementById('navsoftware').style.display = 'none';
                document.getElementById('navpurchase').style.display = 'none';
                document.getElementById('lock-container').style.display = 'block';
                
                localStorage.setItem('crypt', "");
            }
            else if(data.status == 'success')
            {
                document.getElementById('usernamedashboard').innerHTML = data.data.username;
                document.getElementById('usernamedashboard').style.fontWeight = 'bold'; // ทำให้ตัวอักษรหนาขึ้น
                document.getElementById('usernamedashboard').style.fontSize = '1em'; // ปรับขนาดฟอนต์ให้ใหญ่ขึ้น
                document.getElementById('usernamedashboard').style.color = '#007bff';

                IsExpire = data.data.isexpire;
                if(data.data.isexpire)
                {
                    

                    document.getElementById('expirationDatedashboard').style.color = 'red';
                    document.getElementById('expirationDatedashboard').style.fontWeight = 'bold'; // ทำให้ตัวอักษรหนาขึ้น
                    document.getElementById('expirationDatedashboard').style.fontSize = '1em'; // ปรับขนาดฟอนต์ให้ใหญ่ขึ้น
                    document.getElementById('expirationDatedashboard').innerHTML = formatTimestamp(data.data.expiretm) + " (" +calculateTimeRemaining(data.data.expiretm,data.data.curtm) + ")";
                }
                else
                {
                    document.getElementById('expirationDatedashboard').style.color = 'green';
                    document.getElementById('expirationDatedashboard').style.textDecoration = 'none';
                    document.getElementById('expirationDatedashboard').style.fontWeight = 'bold'; // ทำให้ตัวอักษรหนาขึ้น
                    document.getElementById('expirationDatedashboard').style.fontSize = '1em'; // ปรับขนาดฟอนต์ให้ใหญ่ขึ้น
                    document.getElementById('expirationDatedashboard').innerHTML = formatTimestamp(data.data.expiretm)  + " (" +calculateTimeRemaining(data.data.expiretm,data.data.curtm) + ")";
                }

                document.getElementById('tokenInput').value = data.data.token;
            }
        })
        .catch(error => {
            document.getElementById('post-container').style.display = 'none';
            document.getElementById('dashboard-container').style.display = 'none';
            document.getElementById('navhome').style.display = 'none';
            document.getElementById('navdashboard').style.display = 'none';
            document.getElementById('navlogout').style.display = 'none';
            document.getElementById('navsoftware').style.display = 'none';
            document.getElementById('navpurchase').style.display = 'none';
            
            document.getElementById('lock-container').style.display = 'block';
            localStorage.setItem('crypt', "");
            //window.location.href = 'login.html';
        });

        await fetchData();
        await populateDownloadList();
    });

    function addPost(title, content, isLocked = true) {
        // Create card element
        const card = document.createElement('div');
        card.className = 'card mb-4';
        card.style.minHeight = '150px'; // Set the minimum height of the card

        // Create card body
        const cardBody = document.createElement('div');
        cardBody.className = 'card-body';

        // Create card title
        const cardTitle = document.createElement('h2');
        cardTitle.className = 'card-title';
        cardTitle.innerText = title;

        // Create card content
        const cardContent = document.createElement('p');
        cardContent.className = 'card-text';

        if (isLocked) {
            // If content is locked, show only part of the content and a lock icon
            cardContent.innerHTML = content.substring(0, 100) + '...'; // Show only the first 100 characters
            const lockOverlay = document.createElement('div');
            lockOverlay.className = 'overlay';
            
            const lockIcon = document.createElement('span');
            lockIcon.className = 'lock-icon';
            lockIcon.innerHTML = '&#128274;'; // Lock icon
            lockOverlay.appendChild(lockIcon);

            const overlayText = document.createElement('p');
            overlayText.innerText = 'This content is locked. Please purchase whitelist access to unlock.';
            lockOverlay.appendChild(overlayText);

            cardBody.appendChild(lockOverlay);
        } else {
            // If content is not locked, show full content
            cardContent.innerHTML = content;
        }

        // Append title and content to card body
        cardBody.appendChild(cardTitle);
        cardBody.appendChild(cardContent);

        // Append card body to card
        card.appendChild(cardBody);

        // Append card to post container
        document.getElementById('post-container').appendChild(card);
    }



    function createDownloadCard(title, description, downloadLink, isLocked = true) {
        // Create the main card div
        const cardDiv = document.createElement('div');
        cardDiv.className = 'card mb-4';
        cardDiv.style.minHeight = '150px'; // Set the minimum height of the card

        // Create the card body
        const cardBody = document.createElement('div');
        cardBody.className = 'card-body';

        // Create and set the title element
        const titleElement = document.createElement('h5');
        titleElement.className = 'card-title';
        titleElement.innerText = title;
        cardBody.appendChild(titleElement);

        // Create and set the description element
        const descriptionElement = document.createElement('p');
        descriptionElement.className = 'card-text';
        descriptionElement.innerHTML = description; // Use innerHTML to support HTML tags
        cardBody.appendChild(descriptionElement);

        // Create and set the download button
        const downloadButton = document.createElement('a');
        downloadButton.href = downloadLink;
        downloadButton.className = 'btn btn-custom btn-custom-primary';
        downloadButton.innerText = `Download ${title}`;

        if (isLocked) {
            // Disable the download button and add lock overlay
            downloadButton.classList.add('disabled');
            downloadButton.style.pointerEvents = 'none'; // Disable clicking
            downloadButton.innerText = 'Locked';

            const lockOverlay = document.createElement('div');
            lockOverlay.className = 'overlay';

            const lockIcon = document.createElement('span');
            lockIcon.className = 'lock-icon';
            lockIcon.innerHTML = '&#128274;'; // Lock icon
            lockOverlay.appendChild(lockIcon);

            const overlayText = document.createElement('p');
            overlayText.innerText = 'This download is locked. Please purchase whitelist access to unlock.';
            lockOverlay.appendChild(overlayText);

            cardBody.appendChild(lockOverlay);
        }

        cardBody.appendChild(downloadButton);

        // Append the card body to the card div
        cardDiv.appendChild(cardBody);

        return cardDiv;
    }

    function populateDownloadList() {
        const softwareContainer = document.getElementById('software-container');

        // Clear existing content (if any)
        softwareContainer.innerHTML = '';
        // Create and add download cards
        softwareContainer.appendChild(createDownloadCard(
            'Cleaning RAM',
            `Lightweight real-time memory management application to monitor and clean system memory on your computer.<br><br>
            The program uses <strong style="color: #007bff;">undocumented internal system features (Native API)</strong> to clear system cache (system working set, working set, standby page lists, modified page lists) with variable results of <strong style="color: #007bff;">~10-50%</strong>. 
            The application is compatible with <strong style="color: #007bff;">Windows XP SP3 and higher</strong> operating systems, but some general features are available only since Windows Vista.<br><br>
            You can download either the <strong style="color: #007bff;">installer</strong> or <strong style="color: #007bff;">portable</strong> version. 
            For correct operation, <strong style="color: #007bff;">administrator rights</strong> are required.`,
            '#',IsExpire
        ));
    }


    async function fetchData() {
        try {
            const jwtToken = localStorage.getItem('crypt'); // ดึง JWT จาก localStorage หรือแหล่งที่เก็บอื่นๆ
            const response = await fetch('api/querypost.php', {
                method: 'POST', // เปลี่ยนเป็น POST method
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                },
                body: `crypt=${encodeURIComponent(jwtToken)}` // ส่ง JWT token ผ่าน body
            });

            if (!response.ok) {
                throw new Error('Network response was not ok ' + response.statusText);
            }

            const data = await response.json(); // Parse the JSON data

            if (data.length > 0) {
                data.forEach(element => {
                    addPost(element.subject, element.text,IsExpire);
                });
            }
        } catch (error) {
            console.error('There has been a problem with your fetch operation:', error);
        }
    }


    // Function to show the Home page
    function showHome() {
        document.getElementById('post-container').style.display = 'block';
        document.getElementById('dashboard-container').style.display = 'none';
        document.getElementById('software-container').style.display = 'none';
        document.getElementById('purchase-container').style.display = 'none';

        setActiveTab('home-tab');
    }

    // Function to show the Dashboard page
    function showDashboard() {
        document.getElementById('post-container').style.display = 'none';
        document.getElementById('dashboard-container').style.display = 'block';
        document.getElementById('software-container').style.display = 'none';
        document.getElementById('purchase-container').style.display = 'none';

        setActiveTab('dashboard-tab');
    }
    function showSoftware() {

        document.getElementById('post-container').style.display = 'none';
        document.getElementById('dashboard-container').style.display = 'none';
        document.getElementById('software-container').style.display = 'block';
        document.getElementById('purchase-container').style.display = 'none';

        setActiveTab('software-tab');
    }

    function showPurchase() {
        document.getElementById('post-container').style.display = 'none';
        document.getElementById('dashboard-container').style.display = 'none';
        document.getElementById('software-container').style.display = 'none';
        document.getElementById('purchase-container').style.display = 'block';

        setActiveTab('purchase-tab');
    }

    function logout()
    {
        localStorage.setItem('crypt', "");
        Swal.fire({
            icon: 'success',
            title: 'You are logging out.',
            showConfirmButton: false,
            timer: 1500,
        }).then(() => {
            window.location.href = 'login.html'; // Redirect to login page
        });
    }

    // Function to set active tab
    function setActiveTab(tabId) {
        // Remove 'active' class from all tabs
        document.querySelectorAll('.nav-link').forEach(tab => {
            tab.classList.remove('active');
        });

        // Add 'active' class to the clicked tab
        document.getElementById(tabId).classList.add('active');
    }

    // Function to generate a token
    async function generateToken() {
        try {
            // เรียกค่า crypt จาก localStorage (หรือจากแหล่งที่คุณจัดเก็บไว้)
            const crypt = localStorage.getItem('crypt');
            const cf =  document.getElementsByName('cf-turnstile-response')[0].value;

            // ตรวจสอบว่ามี crypt อยู่หรือไม่
            if (!crypt) {
                Swal.fire({
                    icon: 'warning',
                    title: 'No crypt token found',
                    text: 'Please log in again.'
                });
                return;
            }

            // เตรียมข้อมูลที่ต้องส่งไปยัง API
            const formData = new URLSearchParams();
            formData.append('cf-turnstile-response', cf);
            formData.append('crypt', crypt);


            // ส่งคำขอไปยัง API
            const response = await fetch('api/generatetoken.php', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                },
                body: formData.toString()
            });

            // แปลงผลลัพธ์เป็น JSON
            const data = await response.json();

            // ตรวจสอบสถานะจาก API
            if (data.status === 'success') {
                document.getElementById('tokenInput').value = data.token;
                Swal.fire({
                    icon: 'success',
                    title: 'Token generated',
                    text: `Your token is: ${data.token}`,
                    timer: 1500,  // กำหนดเวลาที่จะแสดง Swal (ในหน่วยมิลลิวินาที)
                    willClose: () => {
                        window.location.reload();  // รีโหลดหน้าเว็บเมื่อ Swal ปิด
                    }
                });
            } else {
                if(data.status == 'period')
                {
                    Swal.fire({
                        icon: 'error',
                        title: 'Error',
                        html: `${data.message}<br>(<font style='color:red'>${calculateTimeRemaining(data.tgtm, data.curtm)}</font>)`,
                        timer: 1500,  // กำหนดเวลาที่จะแสดง Swal (ในหน่วยมิลลิวินาที)
                        willClose: () => {
                            window.location.reload();  // รีโหลดหน้าเว็บเมื่อ Swal ปิด
                        }
                    });
                }
                else
                {
                    Swal.fire({
                        icon: 'error',
                        title: 'Error',
                        text: data.message,
                        timer: 1500,  // กำหนดเวลาที่จะแสดง Swal (ในหน่วยมิลลิวินาที)
                        willClose: () => {
                            window.location.reload();  // รีโหลดหน้าเว็บเมื่อ Swal ปิด
                        }
                    });
                }
            }
        } catch (error) {
            console.error('Error:', error);
            Swal.fire({
                icon: 'error',
                title: 'An error occurred',
                text: 'Please try again.'
            });
        }
    }



    // Function to copy the token to clipboard
    function copyToken() {
        const tokenInput = document.getElementById('tokenInput');
        tokenInput.select();
        tokenInput.setSelectionRange(0, 99999); // For mobile devices
        document.execCommand('copy');

        // Show a SweetAlert notification
        Swal.fire({
            icon: 'success',
            title: 'Copied!',
            text: 'Token copied to clipboard: ' + tokenInput.value,
            confirmButtonText: 'OK'
        });
    }
</script>


</body></html>