<!DOCTYPE html>
<html class="ui-mobile">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>Split Array and Remove Duplicates</title>
    <style type="text/css">
  .keyboard {
  font-size: x-large;
}

body {
    padding: 0px;/* Amount of negative space around the outside of the body */
    margin: 0px;/* Amount of negative space around the inside of the body */
z-index:10;
/*background-color: #FAFAEF;*/
}

body,.bkgnd{ background-color: #E8D3AA;}
.devsite-top-section-wrapper,#footer2,#footer1,.tutorchuzr,#panel1,#panel2,#bibleBooks,.header,
 #calc,#refresh,#rateUs,#rechose,#client,#ticha,#exambild,#examryt,#skulbk, #calcHelper,#tconvt,#tcalc{
  background: linear-gradient(to left,#492C6B,#8837E5,#492C6B);
  color: white;
  padding: 0;
  margin: 0;
}

button{
  font-size: large; 
  text-align: center;
}

  .keyboard {
  font-size: x-large;
}
.borderPosition{
position:relative; 
border: 1px solid white; 
border-radius: 10px;
}


.ddsmoothmenu,.header{
    padding: 0;
  margin: 0;
  width:100%;
z-index:200;
position:fixed;}

/*////////////////////////*/
  .tcalc{
color: white;
right: 10px;
top: 100px;
background:  radial-gradient(#DC8D13,#DC8D13 ,#F8D57F);
border-style: outset;
box-shadow:1px 1px 5px rgba(0,0,4);
  }

.tconvt{
color: white;
right: 10px;
top: 200px;
background:  radial-gradient(#DC8D13,#DC8D13 ,#F8D57F);
border-style: outset;
box-shadow:1px 1px 5px rgba(0,0,4);
  }

  #calc{
color: white;
right: 10px;
top: 100px;
  }

 #rateUs{
  color: white;
right: 10px;
bottom: 50px;
  }

 #client{
color: white;
right: 10px;
top: 150px;
  }

#refresh{ 
color: white;
right: 10px;
bottom: 250px;
  }

#calcHelper{
 width:32px;
 height:32px;
border-radius: 15px;
}

#calc,#refresh,#rateUs,#client,#rechose,#ticha,#exambild,#examryt,#skulbk, #calcHelper,#tconvt,#tcalc{
width:32px;
height:32px;
border-radius: 10px;
z-index: 50;
position:fixed;
opacity:0.7;
}

#footer{
bottom: 8%;
z-index:200;
}

#footer2{
 bottom: 1.5%;
z-index:200; 
}

#footer1,#footer,#footer2{
color: white;
font-size: 15px;
text-align: center;
position:fixed;
width:100%;
}

#footer1{
bottom: 0;
z-index:300;
}

.CodePlatform{
  width:90%;
 bottom: 250px;
 left:2px;
 z-index: -200; 
 opacity:0;
  background-color: white;
}


#CloseSearch{
  width:30px; 
  height:30px; 
  border-radius: 15px;
  float: right;
}

.message-container {
    max-width: 100%;
    background-color: #f0f0f0;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.message-container:after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 20px;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top-color: #f0f0f0;
    border-bottom: 0;
    margin-left: -10px;
    margin-bottom: -10px;
}

.message-textarea {
    width: 100%;
    border: none;
    background-color: transparent;
    padding: 10px;
    border-radius: 10px;
    font-size: 16px;
    box-sizing: border-box;
    resize: none; /* Disable resize control */
    overflow: hidden; /* Hide overflow */
    line-height: 1.5;
}

.message-textarea:focus {
    outline: none;
    border: none;
}

.message-textarea::placeholder {
    color: #888;
}


  @keyframes marquee {
    from { transform: translateX(100%); }
    to { transform: translateX(-100%); }
  }



.fireAlert01{
    font-family: 'RobotoDraft', 'Roboto', 'Helvetica Neue, Helvetica, Arial', sans-serif;    position: fixed; /* Stay in place */
    z-index: 950; /* Sit on top */
    /*padding-top: 100px;  Location of the box */
     transition: color 200ms ease-in 50ms;
    left: 0;
    top: 0;
    width: 100%; /*Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
   /* background-color: rgb(0,0,0); /* Fallback color */
   /* background-color: rgba(0.4,0.4,0.4,0.4); /* Black w/ opacity */
  }

  .fireAlert{
    font-family: 'RobotoDraft', 'Roboto', 'Helvetica Neue, Helvetica, Arial', sans-serif;    position: fixed; /* Stay in place */
    z-index: 2000; /* Sit on top */
    /*padding-top: 100px;  Location of the box */
     transition: color 200ms ease-in 50ms;
    left: 0;
    top: 0;
    width: 100%; /*Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
   /* background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0.1,0,0.4); /* Black w/ opacity */
  }


 /* Modal Content */
  .fireAlert .fireContent{
  	background-color: grey;
    margin: auto;
    /*padding-top: 20px;*/
    border: 2px solid #ff6600;
    width: 100%;
    border-radius: 5px;
  }


.fireAlert .fireContentTimedSpin{
    background-color: #eff1f3;
    margin: auto;
    width: 10%;
    border-radius: 5px;  
  }

#fireworks-template {
 display:none;
}

#fireContainer {
 position:absolute;
 left:0px;
 top:0px;
 z-index:1120;
}

.firework {
 /* containing box which flies out first */
 position:absolute;
 left:0px;
 top:0px;
 font-size:1px;
 width:4px;
 height:4px;
 border:1px solid #333;
 background:#666;
}

.fireworkParticle {
 /* elements that explode from the container */
 position:absolute;
 font-size:1px;
 width:10px;
 height:10px;
 overflow:hidden;
}

.fireworkParticle img {
 display:block;
 width:100px;
}

.lagfont {font-size:x-large;}
#SenderCoderror,#ReceiverCoderror,#paymentidError,.errorNote{
	color:red;
}
</style>
<script type="text/javascript">
	var PriceCurrency="$";
var AppPrize="5"; //the price for the app
var payment_id;
var SoftwareVersion="1";
var APP_NAME="Velo";
var APP_VERSION="01";
var MsgPW="";
var companyName="Noril Apps";
var CELL_NUMBA1="+263774144279";emailAddress="hepiars@gmail.com";
var IOLOGIQLicenseAgreement=APP_NAME+" END USER LICENSE AGREEMENT (EULA)<br>NOTICE TO USERS: CAREFULLY READ THE FOLLOWING LEGAL AGREEMENT. USE OF "+APP_NAME+" (the 'SOFTWARE') PROVIDED WITH THIS AGREEMENT CONSTITUTES YOUR ACCEPTANCE OF THESE TERMS. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, DO NOT INSTALL AND/OR USE THIS SOFTWARE. USER'S USE OF THIS SOFTWARE IS CONDITIONED UPON COMPLIANCE BY USER WITH THE TERMS OF THIS AGREEMENT.<br><br>1. LICENSE GRANT <br>This EULA grants you the right to store, load, install, execute or display a copy of the SOFTWARE on your Device.<br>'You' means the company, entity or individual who received the SOFTWARE. “Device” must be wholly owned, rented or leased by you.<br>You may not modify the SOFTWARE or disable features of the SOFTWARE except as an intended part of the SOFTWARE's programming features.<br><br>2. RESTRICTIONS<br>You may not, lease, sub-license, or sell the SOFTWARE. You agree not to modify, adapt, translate, reverse engineer, decompile, disassemble or otherwise attempt to discover the source code of the SOFTWARE. You may not alter or modify the installer program or create a new installer for the SOFTWARE. <br><br>3. OWNERSHIP<br>The SOFTWARE is owned and copyrighted by "+companyName+". This license confers no title or ownership of the SOFTWARE and should not be construed as a grant of any right in the SOFTWARE.<br><br>4. COPYRIGHT<br>The SOFTWARE and all rights are owned by "+companyName+" and/or its suppliers and are protected by copyright law and international copyright treaties. You acknowledge that no title to the intellectual property in the SOFTWARE is transferred to you. You further acknowledge that title and full ownership rights to the SOFTWARE will remain the exclusive property of "+companyName+" and you will not acquire any rights to the SOFTWARE except as expressly set forth in this license. <br><br>5. TERMINATION <br>The License is in effect until terminated. You may terminate this License at any time by ceasing any and all use of the SOFTWARE, and deleting or destroying the SOFTWARE. This agreement shall terminate automatically upon breach of any term of this agreement.  <br><br>6. NO WARRANTY, NO LIABILITY <br>"+companyName+" AND ITS SUPPLIERS DO NOT AND CANNOT WARRANT THE PERFORMANCE OR RESULTS YOU MAY OBTAIN BY USING THE SOFTWARE OR DOCUMENTATION. "+companyName+" AND ITS SUPPLIERS MAKE NO WARRANTIES, EXPRESS OR IMPLIED, AS TO NONINFRINGEMENT OF THIRD PARTY RIGHTS, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT WILL "+companyName+" OR ITS SUPPLIERS BE LIABLE TO YOU FOR ANY CONSEQUENTIAL, INCIDENTAL OR SPECIAL DAMAGES, INCLUDING ANY LOST PROFITS OR LOST SAVINGS, EVEN IF A "+companyName+" REPRESENTATIVE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY THIRD PARTY. YOU HEREBY ASSUME THE ENTIRE RISK OF ALL USE OF THE COPIES OF SOFTWARE COVERED BY THIS LICENSE.<br><br>7. GOVERNING LAW <br>This agreement is governed by the laws of ZIMBABWE. Any claim, dispute or controversy with respect to, in connection with or arising out of this agreement shall be subject to and decided by arbitration in ZIMBABWE. If any part of this agreement is found void and unenforceable by a court of competent jurisdiction, it will not affect the validity of the balance of the agreement, which shall remain valid and enforceable according to its terms.<br><br>8. ENTIRE AGREEMENT <br>This agreement is the final, complete and exclusive agreement between you and "+companyName+" that supersedes any prior agreement or understanding, whether written or oral, relating to the subject matter of this license.<br>Copyright © 2016-2024 "+companyName+". All rights reserved.<br>";


var AryLearningVerbs=[
"shared joy is double joy. ~ Norwegian Proverbs",
"A joy that’s shared is a joy made double. ~ English Proverbs",
"sharing with others is caring for others in action. ~ Douglas M. Lawson",
"there is more happiness in giving than there is in receiving ~Bible Acts 20:35",
"The heart dances with joy when you’re sharing. ~ Debasish Mridha",
"Accept from those who have and share with those who do not. ~ Mark W. Boyer",
"We confirm our reality by sharing. ~ Barbara Grizzuti Harrison",
"There is no delight in owning anything unshared. ~ Marcus Annaeus Seneca",
"Real unselfishness consists in sharing the interests of others. ~ George Santayana",
"sharing what you have is more important than what you have. ~ Albert M. Wells",
"Talent is always conscious of its own abundance, and does not object to sharing. ~ Alexander Solzhenitsyn",
"Tell me and I forget. Teach me and I remember. Involve me and I learn. ~ Benjamin Franklin",
"A man who asks is a fool for five minutes. A man who never asks is a fool for life. ~ Chinese Proverb",
"learning never exhausts the mind.  ~ Leonardo da Vinci",
"A happy life is one spent in learning, earning, and yearning. ~ Lillian Gish",
"He who learns but does not think, is lost! He who thinks but does not learn is in great danger.- Confucius",
"You don’t learn to walk by following rules. You learn by doing, and by falling over. ~ Richard Branson",
"Every student can learn, just not on the same day, or the same way. ~ George Evans",
"Never let formal education get in the way of your learning. ~ Mark Twain",
"Share more. Enjoy the effect. ~ Hepiars Vutete",
"A good teacher can inspire hope, ignite the imagination, and instill a love of learning. ~ Brad Henry",
"I am learning all the time. The tombstone will be my diploma. ~ Eartha Kitt",
"The more that you read, the more things you will know. The more that you learn, the more places you’ll go. ~ Dr. Seuss",
"It is not that I’m so smart. But I stay with the questions much longer. ~ Albert Einstein",
"Being a student is easy. learning requires actual work. ~ William Crawford",
"In learning you will teach, and in teaching you will learn.~ Phil Collins",
"learning is not attained by chance, it must be sought for with ardor and attended to with diligence. ~ Abigail Adams",
"If you think education is expensive, try estimating the cost of ignorance. ~ Howard Gardner",
"The great aim of education is not knowledge but action. ~ Herbert Spencer",
"Wisdom…. comes not from age, but from education and learning.~ Anton Chekhov",
"The only person who is educated is the one who has learned how to learn and change. ~ Carl Rogers",
"An investment in knowledge pays the best interest. ~ Benjamin Franklin",
"Education is the power to think clearly, the power to act well in the world’s work, and the power to appreciate life. ~ Brigham Young",
"The joy that isn’t shared dies young. ~ Anne Sexton",
"Education is learning what you didn’t even know you didn’t know. ~ Daniel Boorstin",
"The world is a university and everyone in it is a teacher. Make sure when you wake up in the morning, you go to school. ~ T. D. Jakes",
"Education is the passport to the future, for tomorrow belongs to those who prepare for it today. ~Malcolm X",
"learning is not child’s play; we cannot learn without pain. ~ Aristotle",
"That is what learning is. You suddenly understand something you’ve understood all your life, but in a new way. ~ Doris Lessing",
"Children want to learn to the degree that they are unable to distinguish learning from fun. They keep this attitude until we adults convince them that learning is not fun. ~ Glenn Doman",
"A man, though wise, should never be ashamed of learning more, and must unbend his mind. ~ Sophocles",
"learning and innovation go hand in hand. The arrogance of success is to think that what you did yesterday will be sufficient for tomorrow. ~ William Pollard",
"If a person will spend one hour a day on the same subject for five years, that person will be an expert on that subject. ~ Earl Nightingale",
"Happiness is not perfected until it is shared. ~ Jane Porter",
"Knowledge is a weapon. I intend to be formidably armed. ~ Terry Goodkind",
"Formal education will make you a living. Self-education will make you a fortune. ~ Jim Rohn",
"learning is a matter of gathering knowledge; wisdom is applying that knowledge. ~ Roopleen",
"Don’t limit a child to your own learning, for he was born in another time. ~ Rabindranath Tagore",
"I never learn anything talking. I only learn things when I ask questions. ~ Lou Holtz",
"Leadership and learning are indispensable to each other.  ~ John F. Kennedy",
"learning is pleasurable but doing is the height of enjoyment. ~ Novalis",
"There is no greater joy than to share what you love with those who appreciate it. ~ Bernard Jan",
"It is what we know already that often prevents us from learning. ~ Claude Bernard",
"All the world is a laboratory to the inquiring mind.’ ~ Martin Fisher",
"I never learned from a man who agreed with me.’ ~ Robert A. Heinlein",
"The beautiful thing about learning is nobody can take it away from you. ~ B.B. King",
"The only things you learn are the things you tame ~ Antoine de Saint-Exupéry",
"Being ignorant is not so much a shame, as being unwilling to learn.’ ~ Benjamin Franklin",];

function OncePerLoadSlide(thisAry,Atplace){// slide one per load
 var Atplace=document.getElementById(Atplace);
 var randiser=Math.floor(Math.random()*(thisAry.length-1));
 //console.log("    this id "+Atplace+"   "+randiser)
Atplace.innerHTML=thisAry[randiser];

}

displayfireworks=false;

var lstorage= localStorage.getItem('mainPassword');
localStorage.getItem('paymentID');
var lisenceAgreed= localStorage.getItem('lisenceAgreed');
var USERPURCHASEDLIST=localStorage.getItem('userPurchasedList');

function closeCurrentOpenNext(cloz,opn){closeAlert(cloz);createAlert(opn);}

function createAlert(idnam){
document.getElementById(idnam).classList.remove('CodePlatform');
document.getElementById(idnam).classList.add('fireAlert');
}

function closeAlert(idnam){
document.getElementById(idnam).classList.remove('fireAlert');
document.getElementById(idnam).classList.add('CodePlatform');
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  //DEVICE id
     /*
  In JavaScript, accessing the device ID directly through the browser is restricted for privacy and security reasons. However, you can retrieve unique identifiers for the device using various techniques, though they may not be precise.
  One approach is to generate a unique identifier on the client side and store it in local storage or cookies. Here's an example:
      */
  function generateDeviceId() {
      let deviceId = localStorage.getItem('device_id');
  
      if (!localStorage.getItem('device_id')) {
          // Generate a random unique ID
          deviceId = Math.random().toString(36).substr(2, 9);
          localStorage.setItem('device_id', deviceId);
      }
      console.log("device id "+deviceId);
      return deviceId;
  }
  
  /*
  Explanation
      This function checks if a unique ID (device_id) exists in localStorage. If not, it generates a new ID, stores it in localStorage, and returns it.
      This ID will persist across browser sessions until the local storage is cleared.
  This isn't a true "device ID" but can serve as a local identifier for a specific browser instance.
  */
  </script>
</head>
<body>
<div class="container">
<div class='ddsmoothmenu'>
<table class='header' width='98%'><tr id='BtnHome' >
<td width='1%'><!-- onclick='showManu()' style=' font-size:xx-large;'  class='borderPosition'>⚙--></td>
<td width='1%' ></td>
<td width='30%' onclick='EncryptMode()' class='borderPosition'>ABC➨😀</td>
<td width=20% class='appName' ></td>
<td width=30% onclick='DecryptEnteryMode()' class='borderPosition'>😀➨ABC</td>
<td width='3%' ></td>
</tr><tr><td colspan='7' >
<div class='Menuplc' id='agree_ID' style=' text-align: center;'></div>
</td></tr></table>
</div>
  <div id='fireContainer'></div>
<div id='AlertFireWorks'></div>
<!--<div id='client' class='tutorchuzr' onclick='PeerToPeerPassword()'><img src='img/add user.png'></div> ✆
<div id='rateUs' class='tutorchuzr' onclick='AppShare()'><img src='img/sharethis.svg'  style='width:20px; height:20px;'></div>-->
<br><br><br><br><br><br><br><br>
<div id= 'baser1' style=' text-align: center;'><span style='font-size: xx-large;'>Open using Chrome</span></div>
 <div id='footer1'  ></div>
 
<script>
/////////////////////////////////////////////root/////////////////////////////////////////////////////////////////////////
ChecklisenceAgreed();
function ChecklisenceAgreed(){
  //createAlert('indexRoot');
if(lisenceAgreed==null){
document.getElementById('baser1').innerHTML = "<h>Wellcome</h><br>Since this is your first time to use "+APP_NAME+" "+APP_VERSION+" Lets do a few checks";
document.getElementById('footer1').innerHTML = "";//"<span onclick='AppShare()'>share <img src='img/sharethis.svg'  style='width:20px; height:20px;'>";
setTimeout('GotoLicenseAg()',6000);}
else{LisenceNext();}
}
//function GotoLicenseAg(){ closeCurrentOpenNext('indexRoot','License_Agreement');}

    function GotoLicenseAg(){
    document.getElementById('agree_ID').innerHTML = " Lisence Agreement<br>Please read the following Lisence Agreement. You must accept the terms of this agreement before continuing with the installation.";
document.getElementById('baser1').innerHTML = IOLOGIQLicenseAgreement;
document.getElementById('footer1').innerHTML = "<table width='98%'><tr><td width='20%'><input id='Agree' checked='true' name='Agree' type='radio' onclick='IAgree()'></td><td><label>I accept the agreement</label></td></tr><tr><td><form><input id='Disagree' name='Disagree' type='radio' onclick='IDisagree()'></td><td><label>I do not accept the agreement</label></td></tr></table><br></TD></TR><TR><TD id='showVerses' ><button id='btnCancel' onclick='ExitApp()'>Cancel</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <button id='btnNext' onclick='LisenceNext()'>Next</button>";}
//document.getElementById("LisenceAgreement").value=IOLOGIQLicenseAgreement;
//document.getElementById('LisenceAgreement').readOnly = true;//This will allow the user to see the text but not to edit it
 
 function IDisagree(){
  document.getElementById("Disagree").checked = true;
  document.getElementById("Agree").checked = false;
  document.getElementById('btnNext').disabled=true;
  document.getElementById('btnCancel').disabled=false;
 }

function IAgree(){
  document.getElementById("Disagree").checked = false;
  document.getElementById("Agree").checked = true;
  document.getElementById('btnCancel').disabled=true;
  document.getElementById('btnNext').disabled=false;
}

function LisenceNext(){
document.getElementById('agree_ID').innerHTML = "";
document.getElementById('baser1').innerHTML ="";
document.getElementById('footer1').innerHTML = "";
localStorage.setItem('lisenceAgreed', "agreed");
if(FreeMode()==true){
document.getElementById('baser1').innerHTML ="";
}
else{document.getElementById('baser1').innerHTML ="";
purchaseApp();
}
}




    
    function FreeMode() {// Get today's date in YYYY-MM-DD format
    const targetDate = "2025-01-01";
      const today = new Date();
      let formattedToday = today.toISOString().split('T')[0];
      let Tadays_Date = localStorage.getItem('TadaysDate');
console.log(Tadays_Date)

if(Tadays_Date<=formattedToday||!localStorage.getItem('TadaysDate')){localStorage.setItem('TadaysDate', formattedToday);}// avoid haking
Tadays_Date = localStorage.getItem('TadaysDate');
      // Compare today's date with the target date
      if (Tadays_Date === targetDate||Tadays_Date > targetDate) {
        //alert(Tadays_Date+" Today is the target date: " + targetDate);
        return false;
      }  


else if (Tadays_Date < targetDate||Tadays_Date < targetDate) {
       // alert(Tadays_Date+" Today is in the future " + targetDate);
        return true;
      } 
    }


    





  </script>

<!-- purchase OutputDeviceID -->
<TABLE class='CodePlatform' id='purchase_OutputDeviceID'  width='98%' ><TR><TD><div class='fireContent'><table width='98%' cellpadding='8'  border=1 rules='all'><tr><td colspan='2'><!--<span  id='CloseSearch' onclick="closeAlert('purchase_OutputDeviceID')" />❌</span>--></td></tr><tr class='bkgnd'><td colspan='2'>
  <h2>Purchase Apps</h2>

 <TABLE width='98%' ><TR><TD><div >
  <div class='textSmall'>Copy the device ID and Ecocash payment ID and send to the Agent <span class="myCell"></span></div><br><div id='paymentidError'></div>
 <div class="message-container"><textarea  type="text" id="outputPay_Device" class="message-textarea" style='width: 85%;' wrap='virtual' maxlength=200  placeholder='' cols="5" rows="3"></textarea></div><br><br>
 <button onclick='copyToClipboard()' class='borderPosition'>Copy to Clipboard</button><br><br><br><br><br><br>
 <table width='98%'><tr><td width='50%'><button  style=' float: left' onclick="ShowEcocashCashoutID()">Back</button></td><td width='50%'><button  style=' float: right' onclick="EnterProductKey()">Next</button></td></tr></table><br><br>
 </div></TD></TR></TABLE>
</td></tr></table>
</div></TD></TR></TABLE>
<script type="text/javascript">
var deviceID=generateDeviceId();
var payID=localStorage.getItem('paymentID');
//document.getElementById("prodID").innerHTML="prodID "+payID;
//document.getElementById("devisID").innerHTML="devisID "+generateDeviceId();
document.getElementById('outputPay_Device').value = "payment Id: "+payID+"   device ID "+deviceID;
console.log("payment Id: "+payID+"   device ID "+deviceID);
function ShowEcocashCashoutID(){closeCurrentOpenNext('purchase_OutputDeviceID','purchase_EcocashCashoutID');}


function EnterProductKey(){closeCurrentOpenNext('purchase_OutputDeviceID','purchase_EnterProductKey');}
var listOfUsersPaid = "";
document.querySelector(".myCell").innerHTML=CELL_NUMBA1;
var deviceID=generateDeviceId();
 </script>


<!-- purchase EnterProductKey -->
<TABLE class='CodePlatform' id='purchase_EnterProductKey'  width='98%' ><TR><TD><div class='fireContent'><table width='98%' cellpadding='8'  border=1 rules='all'><tr><td colspan='2'><!--<span  id='CloseSearch' onclick="closeAlert('purchase_EnterProductKey')" />❌</span>--></td></tr><tr class='bkgnd'><td colspan='2'>
  <h2>Purchase Apps</h2>
    <!-- < id='EnterProductKey' > -->
     <div >
      <div class='textSmall'>Enter the Product Key You have received from the Agent</div>
    <br>
    <input type="text" id="productKey" placeholder="Type the product key" style="width: 200px">&nbsp;<br><br><button onclick="Verify()">Verify Product Key</button><br><br>
    <table width='98%'><tr><td width='50%'><button  style=' float: left'  onclick="backToOut()">Back</button>
    </td><td width='50%'><button  style=' float: right' onclick="ToMainApp()">Exit</button></td></tr></table><br><br>
    <div id='prodID'></div><br>
<!--<div id='devisID'></div><br>
<div id='payID'></div> -->
</td></tr></table>
</div></TD></TR></TABLE>
 <script type="text/javascript">
function ToMainApp(){closeAlert('purchase_EnterProductKey');}
function backToOut(){closeCurrentOpenNext('productKey','purchase_OutputDeviceID');}
var deviceID=generateDeviceId();
var payID=localStorage.getItem('paymentID');
var generatdProdCode;

//  document.getElementById("payID").innerHTML="payID "+payID;
//   document.getElementById("devisID").innerHTML="devisID "+deviceID;
 async function Verify(){
 let prodKy = document.getElementById("productKey").value;
 generatdProdCode = await getSecretCode(payID, deviceID);
 if(prodKy== generatdProdCode){
    alert("App is Purchased","<br>App was succcessfully purchased <br> enjoy a full year Purchase License increased text encryption + amaizing updates");
    appPurchased=localStorage.setItem('appPurchased', true);
    closeAlert('purchase_EnterProductKey');
 }
 //var vix= await getSecretCode(payID, deviceID);
 console.log("payment Id: "+payID+"   device ID "+deviceID+"  prodKy "+prodKy+" check "+generatdProdCode);
 alert("Input error","<br> Input error");
}
    </script>


<!-- purchase -->
<TABLE class='CodePlatform' id='purchase_id'  width='98%' ><TR><TD><div class='fireContent'><table width='98%' cellpadding='8'  border=1 rules='all'><tr><td colspan='2'><!--<span  id='CloseSearch' onclick="closeAlert('purchase_id')" >❌</span>--></td></tr><tr class='bkgnd'><td colspan='2'>
	<h2>Purchase Apps</h2>
<h3>1</h3><div class='textSmall'>Make an Ecocash payment of USD $<span id='AppPrice'></span> to Agent <span class='myCell'>+263 774 144 279</span></div><hr><br>
<h3>2</h3><div class='textSmall'>Type the Ecocash payment ID you have received from Econet here</div><br>
  <input type="text" id="paymentiD" placeholder="Type the Ecocash payment ID here" style="width: 200px"><div class="errorNote" id='payidError'>&nbsp;</div><hr>
 <h3>3</h3>Enter your cell number. This must be the same number used for the ecocash payment<br><br>
  <input type="text" id="clientCell" placeholder="+263..." style="width: 200px"><div class="errorNote" id='cellError'>&nbsp;</div><br>
<br>Your cell number is only used to identfy the your app version<hr>
<table width='98%'><tr><td width='50%'> &nbsp;</td><td width='50%'><button style=' float: right' onclick="ShowDeviceID()">Next</button></td></tr></table><br>
    
<!--<div id='prodID'></div><br>
<div id='devisID'></div><br>-->
</td></tr></table>
</div></TD></TR></TABLE>
<script type="text/javascript">
    document.getElementById("AppPrice").innerHTML=AppPrize;
   document.querySelector(".myCell").innerHTML=CELL_NUMBA1;
document.getElementById('cellError').innerHTML= "";
document.getElementById('payidError').innerHTML= "";
function ShowDeviceID(){
var clientCell_id=document.getElementById("clientCell").value;
var payment_id=document.getElementById("paymentiD").value;
if(payment_id=="08790727m12"){closeCurrentOpenNext('purchase_id','create_password');}

else if(payment_id.length!=0&&clientCell_id.length!=0){
localStorage.setItem('paymentID', payment_id);
localStorage.setItem('clientCellID', clientCell_id);
closeCurrentOpenNext('purchase_id','purchase_OutputDeviceID');
}
else if(payment_id.length>0&&clientCell_id.length!=0){document.getElementById('cellError').innerHTML= "Input error";}
else if(payment_id.length!=0&&clientCell_id.length>0){document.getElementById('payidError').innerHTML= "Input error";}
else{
document.getElementById('cellError').innerHTML= "Input error";
document.getElementById('payidError').innerHTML= "Input error";
}
}
</script>



<!-- update -->
<TABLE class='CodePlatform' id='update'  width='98%' ><TR><TD><div class='fireContent'><table width='98%' cellpadding='8'  border=1 rules='all'><tr><td colspan='2'><span  id='CloseSearch' onclick="closeAlert('update')" />❌</span></td></tr><tr class='bkgnd'><td colspan='2'><p style='width: 100%; text-align: center; font-size: x-large;'>Enjoy the latest features of the app after updating!</p><div id='updateApp'   style='width: 100%; text-align: center;'></div>
</td></tr></table>
</div></TD></TR></TABLE>
<script type="text/javascript">
document.getElementById('updateApp').innerHTML="whatsapp "+CELL_NUMBA1;
 </script>
<!-- app expired -->

<!-- showMenu -->
 <TABLE class='CodePlatform' id='showMenu'  width='98%' ><TR><TD><div class='fireContent'><table width='98%' cellpadding='8'  border=1 rules='all'><tr ><td colspan='2'><span  id='CloseSearch' onclick="closeAlert('showMenu')" />❌</span></td></tr><tr><td colspan='2'><table width='98%' style=' background: linear-gradient(to left,#492C6B,#8837E5,#492C6B); color:white;  font-size: large; text-align: center;' border=1 rules='all'><tr><td colspan=4 onclick=''></td></tr><tr><td colspan=4 onclick='showContacUs()' ><br><br><br>About us</td></tr></table>
  </td></tr></table>
</div></TD></TR></TABLE>
<script type="text/javascript">
function purchaseApp(){
closeCurrentOpenNext('showMenu','purchase_id');}
</script>

<!-- Decypt-->
<TABLE class='CodePlatform' id='AlertDecypt'  width='98%' ><TR><TD><div class='fireContent'><table width='98%' cellpadding='8'  border=1 rules='all'><tr><td><span  id='CloseSearch' onclick="closeAlert('AlertDecypt')" />❌</span></td><td><b>😀➨ABC Extract Text</b></td></tr><tr class='bkgnd'><td colspan='2'>
    <input type="file" id="decrypt_loadImg" accept="image/png"><br><br>
Input Sender Password To View Embed Text<br><div colspan='2' id='SenderCoderror' class='textSmall'></div><br><br>Password: <input style='width: 110px;' type='text' value='' id='InputSenderCode' maxlength='4' placeholder='Enter a 4 digit code'>&nbsp;<button id="extractButton">Enter</button><br><br>
<div class="message-container"><textarea type="text" id="extractedText" placeholder="Extracted text" class="message-textarea" style='width: 85%;' wrap='virtual' name='EncryptedText' rows=5 cols=30 maxlength=200  cols="45" rows="5"></textarea></div><br><canvas id="canvas"></canvas>
</td></tr></table>
</div></TD></TR></TABLE>

<!-- Encrypt-->
<TABLE class='CodePlatform' id='AlertEncrypt'  width='98%' ><TR><TD><div class='fireContent'><table width='98%' cellpadding='8'  border=1 rules='all'><tr><td><span  id='CloseSearch' onclick="closeAlert('AlertEncrypt')" />❌</span></td><td><b>ABC➨😀 Embed Text</b></td></tr><tr class='bkgnd'><td colspan='2'>
<form action='/cgi-bin/test.cgi' name="post">
	
<fieldset name="Group1"  style="width: 80%">
  <legend>Select Img</legend>
  <input id='select_uploadImage' checked='true' name='select_uploadImage' type='radio' onclick='Option_uploadImage()'><br>
    <input type="file" id="uploadImage" accept="image/png"></fieldset><br>
<fieldset name="Group1" style="width: 80%">
  <legend>Make Emojie</legend>
   <input id='select_OptionEmojie' name='select_SelectEmojie' type='radio' onclick='Option_SelectEmojie()'><br>
<select id="SelectEmojie" name="SelectEmojie" class='lagfont' style=' font-size:xx-large;'>
  <option>🤐</option><option>🤑</option><option>🤒</option><option>🤓</option><option>🤔</option><option>🤕</option><option>🤖</option><option>🤗</option><option>🤘</option><option>🤙</option><option>🤚</option><option>🤛</option><option selected="selected">🤜</option><option>🤝</option><option>🤞</option><option>🤟</option><option>🤠</option><option>🤡</option><option>🤢</option><option>🤣</option><option>🤤</option><option>🤥</option><option>🤦</option><option>🤧</option><option>🤨</option><option>🤩</option><option>🤪</option><option>🤫</option><option>🤬</option><option>🤭</option><option>🤮</option><option>🤯</option><option>🤰</option><option>🤱</option><option>🤲</option><option>🤳</option><option>🤴</option><option>🤵</option><option>🤶</option><option>🤷</option><option>🤸</option><option>🤹</option><option>🤺</option><option>🤻</option><option>🤼</option><option>🤽</option><option>🤾</option><option>🤿</option><option>+</option><option>😀</option><option>😁</option><option>😂</option><option>😃</option><option>😄</option><option>😅</option><option>😆</option><option>😇</option><option>😈</option><option>😉</option><option>😊</option><option>😋</option><option>😌</option><option>😍</option><option>😎</option><option>😏</option><option>😐</option><option>😑</option><option>😒</option><option>😓</option><option>😔</option><option>😕</option><option>😖</option><option>😗</option><option>😘</option><option>😙</option><option>😚</option><option>😛</option><option>😜</option><option>😝</option><option>😞</option><option>😟</option><option>😠</option><option>😡</option><option>😢</option><option>😣</option><option>😤</option><option>😥</option><option>😦</option><option>😧</option><option>😨</option><option>😩</option><option>😪</option><option>😫</option><option>😬</option><option>😭</option><option>😮</option><option>😯</option><option>😰</option><option>😱</option><option>😲</option><option>😳</option><option>😴</option><option>😵</option><option>😶</option><option>😷</option><option>😸</option><option>😹</option><option>😺</option><option>😻</option><option>😼</option><option>😽</option><option>😾</option><option>😿</option><option>🙀</option><option>🙁</option><option>🙂</option><option>🙃</option><option>🙄</option><option>🙅</option><option>🙆</option></select> 

   </fieldset>
</form>
<br><br>
<div class="message-container"><textarea type="text" id="textInput" placeholder="input text you want to send"class="message-textarea" style='width: 85%;' wrap='virtual' name='EncryptedText' rows=3 cols=10 maxlength=200  cols="45" rows="5"></textarea></div><br><br>
Input a 4 digit password the receiver must enter to view your text<br><div colspan='2' id='ReceiverCoderror' class='textSmall'></div><br><span>Password: <input style='width: 110px;' type='text' value='' id='InputReceiverCode' maxlength='4' placeholder='Enter 4 digit code'>&nbsp;<button id="convertImage" class="button">Enter</button></span>
<br>
<div ><canvas id="myCanvas"></canvas></div>
</td></tr></table>
</div></TD></TR></TABLE>

<!-- createMainPW   -->
<TABLE class='CodePlatform' id='createMainPWPlatform'  width='98%' ><TR><TD><div class='fireContent'><table  cellpadding='8'  border=1 rules='all'><tr><td><span  id='CloseSearch' onclick='CloseMainPassword()' />❌</span></td><td><b>Welcome 🙂</b></td></tr><tr class='bkgnd'><td colspan='2'><br><span class='appName' ></span>Create your password<br>You will use the password to open the app</td></tr><tr><td></td><td><!--<input type='text' id='userName' placeholder='Alias Name' maxlength='20'>--><br></td></tr><tr><td></td><td><br></td></tr><tr><td>Password: </td><td><input type='password' value='' id='myInput1' maxlength='4' style='width: 96px;'>&nbsp;<button onclick='ShowPassword1()'>👁</button><br></td></tr><tr><td>Re Enter Password: </td><td><input type='password' value='' id='myInput2' maxlength='4' style='width: 96px;'>&nbsp;&nbsp;<button onclick='ShowPassword2()'>👁</button><br></td></tr><tr><td> </td><td><button onclick='EnterCreateMainPassword()'>Next</button></td></tr></table>
</div></TD></TR></TABLE>


    </div>


<!-- create password -->
<TABLE class='CodePlatform' id='create_password'  width='98%' ><TR><TD><div class='fireContent'><table width='98%' cellpadding='8'  border=1 rules='all'><tr><td colspan='2'><span  id='CloseSearch' onclick="closeAlert('create_password')" />❌</span></td></tr><tr class='bkgnd'><td colspan='2'>
  <h2>Secret Code Generator</h2>
   <label for="userNumber">Device ID:</label>
   <input type="text" id="DeviceID" placeholder="Device ID">
   <br><br>
   <label for='paymentID'>Enter Your Payment ID:</label>
   <input type="text" id='paymentID' placeholder="Ecocash payment ID">
   <br><br>
   <button onclick="generateSecretCode()">Generate Secret Code</button>
   <br><br>
   <div class="message-container">
       <textarea id="outputgenCode" class="message-textarea" style="width: 85%;" wrap="virtual" maxlength="200" placeholder="" cols="5" rows="5"></textarea>
   </div>
   <br>
   <button onclick='genpassw_Back()'>Back</button><br>
<!--<div id='payID'></div><br>
<div id='devisID'></div><br>-->
   <div id="printOut"></div>
</td></tr></table>
</div></TD></TR></TABLE>
<script type="text/javascript">
   var listOfUsersPaid = "";
function genpassw_Back(){closeCurrentOpenNext('create_password','purchase_EcocashCashoutID');}
   async function generateSecretCode() {
       let divID = document.getElementById("DeviceID").value;
       let pyID = document.getElementById('paymentID').value;
       const secretCode = await getSecretCode(pyID, divID);
       document.getElementById('outputgenCode').value = secretCode;
       if (localStorage.getItem('userPurchasedList') != null) {
           listOfUsersPaid = localStorage.getItem('userPurchasedList');
       }

 document.getElementById("payID").innerHTML="prodID "+pyID;
  document.getElementById("devisID").innerHTML="devisID "+divID;
       localStorage.removeItem('userPurchasedList');
       listOfUsersPaid += "cell: " + divID + " payment: " + pyID + " code: " + secretCode + " ||<br>";
       localStorage.setItem('userPurchasedList', listOfUsersPaid);
   }

   function viewFromMemory() {
       let PaidArry = [];
       let Alen = 0;
       if (localStorage.getItem('userPurchasedList') != null) {
           PaidArry = localStorage.getItem('userPurchasedList');
           Alen = PaidArry.length;
       } 
       document.getElementById('printOut').innerHTML = Alen + " users who have purchased app<br> " + PaidArry;
   }
</script>




</body>
<script type="text/javascript">

  async function getSecretCode(payment_id, diviD) {
    console.log("payment Id: "+payment_id+"   device ID "+diviD);
       if (!diviD || !payment_id) {
           alert("Please enter both number and payment ID.");
           return;}
       let combinedString = diviD + payment_id;
       const encoder = new TextEncoder();
       const data = encoder.encode(combinedString);
       const hashBuffer = await crypto.subtle.digest('SHA-256', data);
       const hashArray = Array.from(new Uint8Array(hashBuffer));
       let codarry = [];
       codarry.push(hashArray[0], hashArray[1], hashArray[2], hashArray[3]);
       const secretCode = codarry.map(byte => byte.toString(16).padStart(2, '0')).join('');
       console.log("::" + secretCode);
       return secretCode;
  }


function ExitApp(){}
var createMainPWPlatform=document.getElementById('createMainPWPlatform');
var ReceiverCodePlatform=document.getElementById('ReceiverCodePlatform');
var SenderCodePlatform=document.getElementById('SenderCodePlatform');
var Sender_Coderror=document.getElementById('SenderCoderror');
var Receiver_Coderror=document.getElementById('ReceiverCoderror');
var Alert_Decypt=document.getElementById('AlertDecypt');
var Alert_Encrypt=document.getElementById('AlertEncrypt');



function showManu(){if(lisenceAgreed!=null){createAlert('showMenu');}}
function DecryptEnteryMode(){
  if(lisenceAgreed!=null){
document.getElementById('InputSenderCode').value="";
Sender_Coderror.innerHTML="";
document.getElementById('InputReceiverCode').placeholder = "Enter a 4 digit code";
  createAlert('AlertDecypt');}}

function EncryptMode(){
  if(lisenceAgreed!=null){
document.getElementById("textInput").value="";
Receiver_Coderror.innerHTML="";
  document.getElementById('textInput').placeholder = "input text you want to send";
  createAlert('AlertEncrypt');}}

function EncryptModeEmojie(){
  document.getElementById('textInput').placeholder = "input text you want to send";
  createAlert('AlertEncryptEmoji');}

function EncryptModePic(){
  document.getElementById('textInput').placeholder = "input text you want to send";
  createAlert('AlertEncryptPic');}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////encrypt///////////////////////////////////////////////////////////////////////
let imageData1;
const canvas1 = document.getElementById('myCanvas');
const ctx1 = canvas1.getContext('2d');
let img1 = new Image();



let UploadImg_MakeEmoji="";
document.getElementById("select_OptionEmojie").checked = false;
document.getElementById("select_uploadImage").checked = false;
document.getElementById('uploadImage').disabled=true;
document.getElementById('SelectEmojie').disabled=true;

function Option_SelectEmojie(){
  document.getElementById("select_OptionEmojie").checked = true;
  document.getElementById("select_uploadImage").checked = false;
 document.getElementById('uploadImage').disabled=true;
  document.getElementById('SelectEmojie').disabled=false;
  UploadImg_MakeEmoji="makeEmoji";
 //clearScreen();
 }

function Option_uploadImage(){
  document.getElementById("select_OptionEmojie").checked = false;
  document.getElementById("select_uploadImage").checked = true;
  document.getElementById('SelectEmojie').disabled=true;
document.getElementById('uploadImage').disabled=false;
UploadImg_MakeEmoji="uploadImg";
clearScreen();
}

function clearScreen(){
  location.reload(true);
  console.log('reloaded')
}

// Convert canvas to PNG and show the image
document.getElementById('convertImage').addEventListener('click', () => {
  //makePNG()
  EnterReceiverCode();
});

function EnterReceiverCode(){
var ReceivPW=document.getElementById('InputReceiverCode').value;
if(isFourDigitNumber(ReceivPW)==true){MsgPW=ReceivPW;
    console.log("app version= "+APP_VERSION+" receiver code= "+MsgPW);
      if(UploadImg_MakeEmoji=="makeEmoji"){makePNG();}
  else{embedButton();}
}
else{Receiver_Coderror.innerHTML="Input a 4 digit password the receiver must enter to view your text";}
}

document.getElementById('uploadImage').addEventListener('change', function(event) {//  UploadImg_MakeEmoji="uploadImg";
            const file = event.target.files[0];
            const reader = new FileReader();
            reader.onload = function(e) {
                img1.src = e.target.result;
                img1.onload = function() {// Set canvas size to 50% of the original image size
 console.log(" img width: "+img1.width+" img height: "+img1.height);
  console.log(" window width: "+window.innerWidth+" window height: "+window.innerHeight);
  var imgWidth_Proportionate=(window.innerWidth/img1.width);// proportionate to windw width
  var imgHeight_Proportionate=(img1.height/(img1.width+img1.height))*imgWidth_Proportionate;
 console.log(" window width: "+imgWidth_Proportionate+" window height: "+imgHeight_Proportionate);
            const width = img1.width* imgWidth_Proportionate;
            const height = img1.height* imgWidth_Proportionate;
            canvas1.width = width;
            canvas1.height = height;
            // Draw the image on the canvas at 50% scale
            ctx1.drawImage(img1, 0, 0, width, height);
                    imageData1 = ctx1.getImageData(0, 0, canvas1.width, canvas1.height);
                }
            };
            reader.readAsDataURL(file);
        });


	function makePNG(){
  if(document.getElementById("textInput").value.length!=0){
    UploadImg_MakeEmoji="makeEmoji";
 let formTimer=document.post;
  const faketext =formTimer.SelectEmojie.options[formTimer.SelectEmojie.selectedIndex].value;
  // Draw something on the canvas
  ctx1.fillStyle = "white";
  ctx1.fillRect(0, 0, 200, 200);
  ctx1.fillStyle = "black";
  ctx1.font = "150px Arial";
  ctx1.fillText(faketext, 00, 150);
  // Get imageData1 after drawing
  imageData1 = ctx1.getImageData(0, 0, canvas1.width, canvas1.height);
embedButton();
}
 else{alert("Input text");}
}

// Enable share buttons
function enableShareButtons() {
    downloadImage(canvas1.toDataURL('image/png')); // Use data URL
}

// Function to download the image locally
function downloadImage(dataUrl) {
  const link = document.createElement('a');
  link.href = dataUrl;
  link.download = 'image.png';
  link.click();
   alert('Text has been embedded into the image.');
}

// Convert text to binary
function textToBinary(text) {
  return text.split('')
    .map(char => char.charCodeAt(0).toString(2).padStart(8, '0'))
    .join('');
}

// Convert binary to text
function binaryToText(binary) {
  const binaryChunks = binary.match(/.{1,8}/g);
  return binaryChunks.map(byte => String.fromCharCode(parseInt(byte, 2))).join('');
}


// Embed binary text into image
function embedText(binaryText) {
  const data = imageData1.data;
  for (let i = 0; i < binaryText.length; i++) {
    data[i * 4 + 2] = (data[i * 4 + 2] & 0xFE) | parseInt(binaryText[i]);
  }
  ctx1.putImageData(imageData1, 0, 0);
  enableShareButtons();
}




// Embed Button Click Event
function embedButton(){
  const text = document.getElementById('textInput').value;
  if (!text || !imageData1) {
    alert('Please upload an image and enter some text.');
    return;
  }
  const binaryText = textToBinary(APP_VERSION+MsgPW+text);
  if (binaryText.length > imageData1.data.length / 4) {
    alert('Text is too long to fit in this image.');
    return;
  }
  embedText(binaryText);
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////decrypt/////////////////////////////////////////////////////////////////////////////
       const canvas = document.getElementById('canvas');
        const ctx = canvas.getContext('2d');
        let img = new Image();
        let imageData;

        // Extract binary text from image
        function extractText(binaryLength) {
            let data = imageData.data;
            let binaryText = '';
            for (let i = 0; i < binaryLength; i++) {
                binaryText += (data[i * 4 + 2] & 1).toString(); // Extract from the blue channel LSB
            }
            return binaryText;
        }




        // Load PNG image into canvas
        document.getElementById('decrypt_loadImg').addEventListener('change', function(event) {
            const file = event.target.files[0];
            const reader = new FileReader();
            
            reader.onload = function(e) {
                img.src = e.target.result;
                img.onload = function() {
 // Set canvas size to 50% of the original image size
  console.log(" img width: "+img.width+" img height: "+img.height);
  console.log(" window width: "+window.innerWidth+" window height: "+window.innerHeight);
  var imgWidth_Proportionate2=(window.innerWidth/img.width);// proportionate to windw width
  var imgHeight_Proportionate2=(img.height/(img.width+img.height))*imgWidth_Proportionate2;
 console.log(" window width: "+imgWidth_Proportionate2+" window height: "+imgHeight_Proportionate2);
            const width = img.width* imgWidth_Proportionate2;
            const height = img.height* imgWidth_Proportionate2;
            canvas.width = width;
            canvas.height = height;

            // Draw the image on the canvas at 50% scale
            ctx.drawImage(img, 0, 0, width, height);

             imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
                }
            };
            reader.readAsDataURL(file);
        });





        // Extract Button Click Event
        document.getElementById('extractButton').addEventListener('click', function() {
        	document.getElementById('extractedText').textContent ="";
            if (!imageData) {
        alert('Please upload an image with embedded text.');
                return;
            }
            const maxTextLength = 30; // Adjust this based on the expected length
            console.log("^^  "+maxTextLength);
            const binaryText = extractText(maxTextLength * 8); // Extract binary data for text length
            const extractedText = binaryToText(binaryText);
  if(CheckExtractedTexPW(extractedText)==true){document.getElementById('extractedText').textContent = StripJunk(extractedText);}
  else{alert("wrong password")}
        });

function StripJunk(n){
return n=n.substring(6);//remove AppCode & PW
//need to remove more junk
}
function CheckExtractedTexPW(n){
if(checkforDecryption(n)==true){return EnterSenderCode(n);   }
else{return false;}
}


function checkforDecryption(n){
if(n.length>0){return true;//checkStringPattern(str);
}
else{return false;}
}

function EnterSenderCode(n){
var SenderPW=document.getElementById('InputSenderCode').value;
if(isFourDigitNumber(SenderPW)==true){
    console.log("is number   "+SenderPW);
    var chekVn=n.substring(0,2);
	var chekCd=n.substring(2,6);
	console.log(" chekVn "+chekVn+" chekCd+"+chekCd+" SenderPW "+SenderPW);
if(SenderPW==chekCd&&APP_VERSION==chekVn){console.log("receiverCode and app version correct");
Sender_Coderror.innerHTML="";
return true;}
else if(SenderPW!=chekCd&&APP_VERSION==chekVn){Sender_Coderror.innerHTML="receiverCode is not correct";return false;}
else if(SenderPW==chekCd&&APP_VERSION!=chekVn){Sender_Coderror.innerHTML="app version not correct";return false;}
else if(SenderPW!=chekCd&&APP_VERSION!=chekVn){Sender_Coderror.innerHTML="receiverCode and app version not correct";return false;}
}
else{alert("Input a 4 digit password the receiver must enter to view your text");
return false;}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//<script type="text/javascript" src='js/updateTimer.js'>



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//<script type="text/javascript" src='js/memory.js'>
document.querySelector('.appName').innerHTML=APP_NAME+" "+APP_VERSION;
var appPurchased=false;
function ISappPurchased() {
    appPurchased = localStorage.getItem('appPurchased');
    if (!appPurchased) {
        // Generate a random unique ID
        appPurchased = false;
        localStorage.setItem('appPurchased', appPurchased);
    }
    console.log("appPurchased"+appPurchased);
}

function StartUpMainPassword(){
if(lstorage==null){createMainPassword();}
        else{window.location.replace("TextToEmoji.html");}
}

function CheckUserPWTrue(){
var myInput1 = document.getElementById('myInput1').value;
var myInput2 = document.getElementById('myInput2').value; 
if(myInput1===myInput2&&myInput2.length!=0){
CloseMainPassword();
localStorage.setItem('mainPassword', myInput2);
window.location.replace("TextToEmoji.html");
}
else{}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function StartUpCheck() {
  var startUpPW = document.getElementById('startUpPW').value;
  if(startUpPW==localStorage.getItem('mainPassword')){breakAlert();}
    else{alert("Input Error");}
}

function PeerToPeerPassword(){
breakAlert();
 alert("Peer To Peer Password","<table class='settest-table'><tr><td>MainPassword: </td><td><input type='password' value='' id='mainPw' maxlength='4'><button onclick='ShowPassword1()'>👁</button><br></td></tr><tr><td><br></td></tr><tr><td>Peer Name: </td><td><input type='text' id='peerName' placeholder='Alias Name' maxlength='20'><br></td></tr><tr><td> <tr></tr><tr><td>Peer 2 Peer Password: </td><td><input type='password' value='' id='p2pPW' maxlength='4'><button type='checkbox' onclick='ShowPassword2()'>👁</button><br></td></tr></table><button onclick='PeerToPeerPasswordCheck()' width='95%' >Enter</button><br>");
}

function PeerToPeerPasswordCheck(){
  var mainPw = document.getElementById('mainPw').value;
var peerName = document.getElementById('peerName').value;
var p2pPW=document.getElementById('p2pPW').value;
if(peerName==MAINUSER){EnterUserID_GetPurchaseCode()}
  else if(mainPw==lstorage){
localStorage.setItem('mainPassword', peerName);
localStorage.setItem('peerToPeer1', p2pPW);

breakAlert();
}
    else{alert("Input Error");}
}

function createSetMainPassword(){
  if(lstorage==null){createMainPassword();}
    else{SetNewUserPass();}
}

function EnterCreateMainPassword() {
  var myInput1 = document.getElementById('myInput1').value;
var myInput2 = document.getElementById('myInput2').value;
var userName=document.getElementById('userName').value;
var userCell=document.getElementById('userCell').value;
if(userName==MAINUSER){EnterUserID_GetPurchaseCode()}
  else if(checkInputCorrect()==true){
localStorage.setItem('mainPassword', myInput2);
localStorage.setItem('userCellphone', userCell);
localStorage.setItem('USERName', userName);
console.log('PW '+myInput2);
breakAlert();
}
    else{alert("Input Error");}
}


function ShowPassword1() {
var myInput1 = document.getElementById('myInput1');
  if (myInput1.type === 'password') { myInput1.type = 'text';} else { myInput1.type = 'password';}}

function ShowPassword2() {
var myInput2 = document.getElementById('myInput2');
  if (myInput2.type === 'password') {myInput2.type = 'text';} else {myInput2.type = 'password';}}


function checkInputCorrect(){
var myInput1 = document.getElementById('myInput1').value;
var myInput2 = document.getElementById('myInput2').value;
var userName=document.getElementById('userName').value;
var userCell=document.getElementById('userCell').value;
  var checker=false;
if(myInput1==myInput2&&myInput2.length==4&&userCell.length==10&&userName.length!=0){checker=true;}
return checker
}

function SetNewUserPass4(){
alert();
}

function EnterUserID_GetPurchaseCode5(){
window.location.replace("Admin.html");}

function passwordsForYourContacts(){}
function PurchaseApp(){}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//<script type="text/javascript" src='js/receiverSenderCode.js'>

function isFourDigitNumber(value) {// Check if the value is a number and has exactly 4 digits
    return /^\d{4}$/.test(value.toString());
}

   // Function to copy textarea content to clipboard
    function copyToClipboard() {
      // Get the content of the textarea
      const text = document.getElementById("outputPay_Device").value;
      // Use the clipboard API to copy the text
      navigator.clipboard.writeText(text).then(() => {
        alert("Text copied to clipboard!");
      }).catch(err => {
        console.error("Failed to copy text: ", err);
      });
    }

      // Function to enable textarea input
    function enableInput() {
      document.getElementById("myTextarea").disabled = false;
    }

    // Function to disable textarea input
    function disableInput() {
      document.getElementById("myTextarea").disabled = true;
    }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//<script type="text/javascript" src='js/check.js'>
function escapeSpecialChars(str) { return str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');}//

function checkforEncrypt(){
  var str= escapeSpecialChars(document.getElementById('inputArray').value);
  return isAllASCII(str);}


function isAllASCII(str) {
  if(str.length>0){
          for (let i = 0; i < str.length; i++) {
            // Get the character code of each character
            let charCode = str.charCodeAt(i);
            
            // Check if the character code is within the ASCII range
            if (charCode > 127) {
              return false; // Return false if a non-ASCII character is found
            }
            else{
          return true; // Return true if all characters are ASCII    
            }
          }}
  else{return false; // Return true if all characters are ASCII}
}}


function checkStringPattern(str) {//js code to check if all eventh chars in a string are vowels and oddth chars are not vowels
  // Define vowels
  const vowels = emojToned;
  // Loop through the string
  for (let i = 0; i < str.length; i++) {
    const char = str[i];
    // Check even-indexed characters (i.e., i % 2 === 0 in 0-based index)
    if (i % 2 === 0) {
      if (!vowels.includes(char)) {
        return false; // Even-indexed char must be a vowel
      }
    } 
    // Check odd-indexed characters (i.e., i % 2 === 1 in 0-based index)
    else {
      if (vowels.includes(char)) {
        return false; // Odd-indexed char must not be a vowel
      }
    }
  }
  // If no issues found, return true
  return true;
}
 </script>
</html>