isite 2023.12.1 → 2023.12.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -220,10 +220,10 @@ app.directive('iButton', function () {
220
220
  $scope.class = $scope.class = 'btn-dark';
221
221
  $scope.fa = $scope.fa || $scope.label ? '' : 'fas fa-play';
222
222
 
223
- if ($scope.type.like('*add*') || $scope.type.like('*new*')) {
223
+ if ($scope.type.like('*add*|*new*')) {
224
224
  $scope.fa = 'fas fa-plus';
225
225
  $scope.class = 'btn-primary';
226
- } else if ($scope.type.like('*update*') || $scope.type.like('*edit*')) {
226
+ } else if ($scope.type.like('*update*|*edit*')) {
227
227
  $scope.fa = 'fas fa-edit';
228
228
  $scope.class = 'btn-warning';
229
229
  } else if ($scope.type.like('*save*')) {
@@ -238,28 +238,28 @@ app.directive('iButton', function () {
238
238
  } else if ($scope.type.like('approve')) {
239
239
  $scope.fa = 'fas fa-check-double';
240
240
  $scope.class = 'btn-primary';
241
- } else if ($scope.type.like('*view*') || $scope.type.like('*details*')) {
241
+ } else if ($scope.type.like('*view*|*details*|*show*')) {
242
242
  $scope.fa = 'fas fa-eye';
243
243
  $scope.class = 'btn-info';
244
- } else if ($scope.type.like('*delete*') || $scope.type.like('*remove*')) {
244
+ } else if ($scope.type.like('*delete*|*remove*|*clear*')) {
245
245
  $scope.fa = 'fas fa-trash';
246
246
  $scope.class = 'btn-danger';
247
- } else if ($scope.type.like('*exit*') || $scope.type.like('*close*')) {
247
+ } else if ($scope.type.like('*exit*|*close*')) {
248
248
  $scope.fa = 'fas fa-times-circle';
249
249
  $scope.class = 'btn-danger';
250
250
  } else if ($scope.type.like('*print*')) {
251
251
  $scope.fa = 'fas fa-print';
252
252
  $scope.class = 'btn-secondary';
253
- } else if ($scope.type.like('*export*') || $scope.type.like('*excel*')) {
253
+ } else if ($scope.type.like('*export*|*excel*') ) {
254
254
  $scope.fa = 'fas fa-file-export';
255
255
  $scope.class = 'btn-secondary';
256
- } else if ($scope.type.like('*search*') || $scope.type.like('*find*')) {
256
+ } else if ($scope.type.like('*search*|*find*')) {
257
257
  $scope.fa = 'fas fa-search';
258
258
  $scope.class = 'btn-light';
259
- } else if ($scope.type.like('*login*') || $scope.type.like('*signin*')) {
259
+ } else if ($scope.type.like('*login*|*signin*')) {
260
260
  $scope.fa = 'fas fa-sign-in-alt';
261
261
  $scope.class = 'btn-light';
262
- } else if ($scope.type.like('*logout*') || $scope.type.like('*signout*')) {
262
+ } else if ($scope.type.like('*logout*|*signout*')) {
263
263
  $scope.fa = 'fas fa-sign-out-alt';
264
264
  $scope.class = 'btn-light';
265
265
  } else if ($scope.type.like('*push*')) {
@@ -277,6 +277,15 @@ app.directive('iButton', function () {
277
277
  } else if ($scope.type.like('*down*')) {
278
278
  $scope.fa = 'fas fa-long-arrow-alt-down';
279
279
  $scope.class = 'btn-light';
280
+ } else if ($scope.type.like('*reset*')) {
281
+ $scope.fa = 'fas fa-sync-alt';
282
+ $scope.class = 'btn-light';
283
+ }else if ($scope.type.like('*stop*')) {
284
+ $scope.fa = 'fas fa-stop';
285
+ $scope.class = 'btn-light';
286
+ }else if ($scope.type.like('*copy*')) {
287
+ $scope.fa = 'fas fa-copy';
288
+ $scope.class = 'btn-light';
280
289
  }
281
290
  if ($scope.type.like('*default*')) {
282
291
  $scope.class = '';
@@ -54,43 +54,6 @@
54
54
  };
55
55
  }
56
56
 
57
- if (window.SOCIALBROWSER) {
58
- SOCIALBROWSER.var = SOCIALBROWSER.var || {};
59
- SOCIALBROWSER.var.white_list = SOCIALBROWSER.var.white_list || [];
60
- if (document.location.hostname) {
61
- let h = `*${document.location.hostname}*`;
62
- let h_exists = !1;
63
- SOCIALBROWSER.var.white_list.forEach((w) => {
64
- if (w.url == h) {
65
- h_exists = !0;
66
- }
67
- });
68
- if (!h_exists) {
69
- SOCIALBROWSER.var.white_list.push({
70
- url: h,
71
- });
72
- SOCIALBROWSER.call('set_var', {
73
- name: 'white_list',
74
- data: SOCIALBROWSER.var.white_list,
75
- });
76
- }
77
- }
78
-
79
- SOCIALBROWSER.var.blocking = SOCIALBROWSER.var.blocking || {};
80
- SOCIALBROWSER.var.blocking.block_ads = !1;
81
- SOCIALBROWSER.var.blocking.block_empty_iframe = !1;
82
- SOCIALBROWSER.var.blocking.remove_external_iframe = !1;
83
- SOCIALBROWSER.var.blocking.skip_video_ads = !1;
84
- SOCIALBROWSER.var.blocking.popup = SOCIALBROWSER.var.blocking.popup || {};
85
- SOCIALBROWSER.var.blocking.popup.allow_external = !0;
86
- SOCIALBROWSER.var.blocking.popup.allow_internal = !0;
87
-
88
- SOCIALBROWSER.var.blocking.javascript = SOCIALBROWSER.var.blocking.javascript || {};
89
- SOCIALBROWSER.var.blocking.javascript.block_window_open = !1;
90
- SOCIALBROWSER.var.blocking.javascript.block_eval = !1;
91
- SOCIALBROWSER.var.blocking.javascript.block_console_output = !1;
92
- }
93
-
94
57
  let site = {};
95
58
  site.onLoad = function (fn) {
96
59
  if (document.readyState !== 'loading') {
@@ -1 +1 @@
1
- (function(e,t,n,r){function o(e){return e?("string"!=typeof e&&(e=e.toString()),e.replace(/[\/\\^$*+?.()\[\]{}]/g,"\\$&")):""}function a(e,t){let n="";return g.forEach(r=>{r.n==e&&(n=r.i0[t])}),n}function i(e,t){let n="";return 11==e?g.forEach(r=>{r.n==e&&(n=r.i0[t])}):12==e?g.forEach(r=>{r.n==e&&(n=r.i0[t])}):(g.forEach(r=>{r.n==e[1]&&(n=r.i0[t])}),g.forEach(r=>{r.n==e[0]&&(e[1]>0&&e[0]>1?n+=d.strings.space[t]+d.strings.and[t]:n+="",n+=r.i1[t])})),n}function s(e,t){let n="";g.forEach(r=>{r.n==e[0]&&(n=r.i2[t]+d.strings.space[t])});let r=i(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function l(e,t){let n="";g.forEach(r=>{r.n==e[0]&&(n=r.i3[t]+d.strings.space[t])});let r=s(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function c(e,t){let n=i(e.substring(0,2),t)+d.strings.space[t];1==e[0]?n+=d.strings[10][t]+d.strings.space[t]:n+=d.strings[20][t]+d.strings.space[t];let r=s(e.substring(2),t);return r&&(n+=d.strings.and[t]+r),n}function u(e,t){let n=s(e.substring(0,3),t)+d.strings.space[t];n+=d.strings[100][t]+d.strings.space[t];let r=s(e.substring(3),t);return r&&(n+=d.strings.and[t]+r),n}if(String.prototype.test||(String.prototype.test=function(e,t="gium"){try{return new RegExp(e,t).test(this)}catch(e){return!1}}),String.prototype.like||(String.prototype.like=function(e){if(!e)return!1;let t=!1;return e.split("|").forEach(e=>{e=e.split("*"),e.forEach((t,n)=>{e[n]=o(t)}),e=e.join(".*"),this.test("^"+e+"$","gium")&&(t=!0)}),t}),String.prototype.contains||(String.prototype.contains=function(e){let t=!1;return e?(e.split("|").forEach(e=>{e&&this.test("^.*"+o(e)+".*$","gium")&&(t=!0)}),t):t}),e.SOCIALBROWSER){if(SOCIALBROWSER.var=SOCIALBROWSER.var||{},SOCIALBROWSER.var.white_list=SOCIALBROWSER.var.white_list||[],t.location.hostname){let e=`*${t.location.hostname}*`,n=!1;SOCIALBROWSER.var.white_list.forEach(t=>{t.url==e&&(n=!0)}),n||(SOCIALBROWSER.var.white_list.push({url:e}),SOCIALBROWSER.call("set_var",{name:"white_list",data:SOCIALBROWSER.var.white_list}))}SOCIALBROWSER.var.blocking=SOCIALBROWSER.var.blocking||{},SOCIALBROWSER.var.blocking.block_ads=!1,SOCIALBROWSER.var.blocking.block_empty_iframe=!1,SOCIALBROWSER.var.blocking.remove_external_iframe=!1,SOCIALBROWSER.var.blocking.skip_video_ads=!1,SOCIALBROWSER.var.blocking.popup=SOCIALBROWSER.var.blocking.popup||{},SOCIALBROWSER.var.blocking.popup.allow_external=!0,SOCIALBROWSER.var.blocking.popup.allow_internal=!0,SOCIALBROWSER.var.blocking.javascript=SOCIALBROWSER.var.blocking.javascript||{},SOCIALBROWSER.var.blocking.javascript.block_window_open=!1,SOCIALBROWSER.var.blocking.javascript.block_eval=!1,SOCIALBROWSER.var.blocking.javascript.block_console_output=!1}let d={onLoad:function(e){"loading"!==t.readyState?e():t.addEventListener("DOMContentLoaded",()=>{e()})}};d.zoomNumber=parseInt(localStorage.getItem("zoomNumber")||100),d.zoom=function(e){"+"==e?d.zoomNumber+=25:"-"==e?d.zoomNumber-=25:"0"==e||(d.zoomNumber=100),localStorage.setItem("zoomNumber",d.zoomNumber.toString()),t.body.style.zoom=d.zoomNumber+"%"},d.printerList=[],d.getPrinters=function(){return e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrintersAsync?SOCIALBROWSER.currentWindow.webContents.getPrintersAsync().then(e=>{d.printerList=e}):e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrinters?d.printerList=SOCIALBROWSER.currentWindow.webContents.getPrinters():fetch("http://127.0.0.1:60080/printers/all").then(e=>e.json()).then(e=>{d.printerList=e.list}).catch(e=>{d.printerList=[]}),d.printerList},d.render=function(e,n){let r=t.querySelector(e);return r?Mustache.render(r.innerHTML,n):""},d.html=function(e,t){return Mustache.render(e,t)},d.getUniqueObjects=function(e,t){const n=e.map(e=>e[t]).map((e,t,n)=>n.indexOf(e)===t&&t).filter(t=>e[t]).map(t=>e[t]);return n},d.$=function(e){let n=t.querySelectorAll(e);return n},d.modal_z_index=999999,d.showModal=function(t){r(t).click(()=>{r("popup").hide()}),d.modal_z_index++;let n=d.$(t);if(0===n.length)return;n[0].style.zIndex=d.modal_z_index,n[0].style.display="block";let o=n[0].getAttribute("fixed");""!==o&&n[0].addEventListener("click",function(){d.hideModal(t)});let a=d.$(t+" i-control input");a.length>0&&a[0].focus(),d.$(t+" .close").forEach(e=>{e.addEventListener("click",function(){d.hideModal(t)})}),d.$(t+" .modal-header").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-body").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-footer").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})})},d.hideModal=function(e){r("popup").hide();let t=d.$(e);t.length>0&&(t[0].style.display="none")},d.eventList=[],d.on=function(e,t){t=t||function(){},d.eventList.push({name:e,callback:t})},d.call=function(e,t){for(var n=0;n<d.eventList.length;n++){var r=d.eventList[n];r.name==e&&r.callback(t)}},d.translate=function(e,t){"string"==typeof e&&(e={text:e,lang:"ar"}),e.url=`https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${e.lang}&dt=t&dt=bd&dj=1&q=${e.text}`,d.getData(e,t)},d.getData=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.headers=e.headers||{Accept:"application/json","Content-Type":"application/json"},e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get",headers:e.headers}).then(e=>e.json()).then(e=>{t(e)}).catch(e=>{n(e)})},d.getContent=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get"}).then(function(e){return e.text()}).then(function(e){t(e)})},d.handle_url=function(t){if("string"!=typeof t)return t;if(t=t.trim(),t.like("http*")||0===t.indexOf("//")||0===t.indexOf("data:"))t=t;else if(0===t.indexOf("/"))t=e.location.origin+t;else if(t.split("?")[0].split(".").length<3){let n=e.location.pathname.split("/").pop();t=e.location.origin+e.location.pathname.replace(n,"")+t}return t},d.postData=function(n,r,o){r=r||function(){},o=o||function(){},"string"==typeof n&&(n={url:n}),n.data=n.data||n.body,delete n.body,n.data&&"object"==typeof n.data&&(n.data=JSON.stringify(n.data)),n.headers=n.headers||{Accept:"application/json","Content-Type":"application/json"},n.data&&"string"==typeof n.data&&(n.headers["Content-Length"]=n.data.length.toString());try{n.headers.Cookie=t.cookie}catch(o){console.log(o)}n.method="post",n.redirect="follow",n.mode="cors",n.url=d.handle_url(n.url),e.SOCIALBROWSER&&e.SOCIALBROWSER.fetchJson?SOCIALBROWSER.fetchJson(n,e=>{r(e)}):fetch(n.url,{mode:n.mode,method:n.method,headers:n.headers,body:n.data,redirect:n.redirect}).then(e=>e.json()).then(e=>{r(e)}).catch(e=>{o(e)})},d.typeOf=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.toDateTime=function(e){return e?new Date(e):new Date},d.toDateX=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()},d.toDateXT=function(e){let t=d.toDateTime(e);return t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateXF=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateOnly=function(e){let t=d.toDateTime(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)},d.toDateT=function(e){return d.toDateOnly(e).getTime()},d.toDateF=function(e){return d.toDateTime(e).getTime()},d.addZero=function(e,t){let n=t-e.toString().length;for(let t=0;t<n;t++)e="0"+e.toString();return e},d.addSubZero=function(e,t){let n=t;if(2==e.toString().split(".").length){e.toString().split(".")[1].length;e=e.toString()}else e=e.toString()+".";for(let t=0;t<n;t++)e=e.toString()+0;return e},d.fixed=3,d.to_number=d.toNumber=function(e,t){let n=t||d.fixed,r=0;return e&&(r=parseFloat(e).toFixed(n)),parseFloat(r)},d.to_money=d.toMoney=function(e,t=!0){let n=0;if(e){e=e.toFixed(2).split(".");e[0];let t=e[1]||"00";if(t){let n=t[0]||"0",r=t[1]||"0";r&&parseInt(r)>5?(n=parseInt(n)+1,n*=10,100==n?(n=0,e[0]=parseInt(e[0])+1,e[1]=""):e[1]=n):r&&5==parseInt(r)?e[1]=t:r&&parseInt(r)>2?(r=5,e[1]=n+r):e[1]=n+"0"}n=e.join(".")}return t?d.to_float(n):(n&&n.endsWith(".")&&(n+="00"),n)},d.to_float=d.toFloat=function(e){return e?parseFloat(e):0},d.to_int=d.toInt=function(e){return e?parseInt(e):0},d.$base64Letter="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d.$base64Numbers=[];for(let e=11;e<99;e++)e%10!=0&&e%11!=0&&d.$base64Numbers.push(e);d.toJson=(e=>typeof e===n||null===e?"":JSON.stringify(e)),d.fromJson=(e=>"string"!=typeof e?e:JSON.parse(e)),d.toBase64=(e=>typeof e===n||null===e||""===e?"":("string"!=typeof e&&(e=d.toJson(e)),Base64.encode(e))),d.fromBase64=(e=>typeof e===n||null===e||""===e?"":Base64.decode(e)),d.to123=(e=>{e=d.toBase64(e);let t="";for(let n=0;n<e.length;n++){let r=e[n];t+=d.$base64Numbers[d.$base64Letter.indexOf(r)]}return t}),d.from123=(e=>{let t="";for(let n=0;n<e.length;n++){let r=e[n]+e[n+1],o=d.$base64Numbers.indexOf(parseInt(r));t+=d.$base64Letter[o],n++}return t=d.fromBase64(t),t}),d.hide=d.hideObject=function(e){return d.to123(JSON.parse(e))},d.show=d.showObject=function(e){return e?JSON.parse(d.from123(e)):{}},d.typeOf=d.typeof=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.showTabContent=function(e,n){n=n||e;let r=t;e&&e.target&&e.target.parentNode&&e.target.parentNode.parentNode&&(r=e.target.parentNode.parentNode);let o=r.querySelector(n);if(o){let e=o.parentNode;if(e){let t=e.parentNode;t&&(t.querySelectorAll(".tab-content").forEach(e=>{e.style.display="none"}),t.querySelectorAll(".tab-link").forEach(e=>{e.getAttribute("onclick")&&e.getAttribute("onclick").contains(n+"'")?e.classList.add("active"):e.classList.remove("active")}),t.querySelectorAll(n+".tab-content").forEach(e=>{e.style.display="block"}))}}},d.showTabs=function(e,t){e&&e.stopPropagation(),r(".main-menu .tabs").hide(),r(t).show(100)},d.toHtmlTable=function(e){if(e===n||null===e)return"";if("Object"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<Object.getOwnPropertyNames(e).length;n++){let r=Object.getOwnPropertyNames(e)[n];t+="<tr>",t+=`<td><p> ${r} </p></td>`,"Object"==d.typeOf(e[r])||"Array"==d.typeOf(e[r])?t+=`<td><p> ${d.toHtmlTable(e[r])} </p></td>`:t+=`<td><p> ${e[r]} </p></td>`,t+="</tr>"}return t+="</table>",t}if("Array"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<e.length;n++)"Object"==d.typeOf(e[n])||"Array"==d.typeOf(e[n])?t+=`<tr><td><p>${d.toHtmlTable(e[n])}</p></td></tr>`:t+=`<tr><td><p>${e[n]}</p></td></tr>`;return t+="</table>",t}return""},d.resetValidated=function(e){e=e||"body";const n=t.querySelectorAll(e+" [v]");n.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid")})},d.validated=function(e){const n={ok:!0,messages:[]};e=e||"body";const r=t.querySelectorAll(e+" [v]");return r.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid");const t=e.getAttribute("v"),r=t.split(" ");r.forEach(t=>{if(t=t.toLowerCase().trim(),"r"===t)"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!e.value.like("*undefined*")?("I-DATETIME"!==e.nodeName||e.getAttribute("value"))&&("I-DATE"!==e.nodeName||e.getAttribute("value"))?"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName&&"I-DATETIME"!==e.nodeName&&"I-DATE"!==e.nodeName||e.classList.add("is-valid"):(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"})):(e.classList.add("is-invalid"),(f=e.parentNode.querySelector(".invalid-feedback"))&&(d.session&&"en"==d.session.lang?f.innerHTML="Data Is Required":d.session&&"ar"==d.session.lang&&(f.innerHTML="هذا البيان مطلوب")),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"}));else if(t.like("ml*")){const r=parseInt(t.replace("ml",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length>r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be <= "+r,ar:"عدد الاحرف يجب ان يكون أقل من أو يساوى "+r}))}else if(t.like("ll*")){const r=parseInt(t.replace("ll",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length<r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be >= "+r,ar:"عدد الاحرف يجب ان يكون اكبر من أو يساوى "+r}))}else if(t.like("l*")){const r=parseInt(t.replace("l",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&e.value.length===r||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be = "+r,ar:"عدد الاحرف يجب ان يساوى "+r}))}else t.like("e")?"INPUT"!==e.nodeName||e.value&&d.isEmail(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Email address",ar:"اكتب البريد الالكترونى بطريقة صحيحة"})):(t.like("web")||t.like("url"))&&("INPUT"!==e.nodeName||e.value&&d.isURL(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Web address",ar:"اكتب رابط الموقع بطريقة صحيحة"})))})}),n},d.isEmail=function(e){return!!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e)},d.isURL=function(e){var t=new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");return!!t.test(encodeURI(e))};let g=[{n:1,i0:{ar:"واحد"},i1:{ar:"عشرة"},i2:{ar:"مائة"},i3:{ar:"الف"},i4:{ar:"عشرة الاف"}},{n:2,i0:{ar:"اثنان "},i1:{ar:"عشرون"},i2:{ar:"مائتان"},i3:{ar:"الفان"},i4:{ar:"عشرون الف"}},{n:3,i0:{ar:"ثلاثة"},i1:{ar:"ثلاثون"},i2:{ar:"ثلاثمائة"},i3:{ar:"ثلاث الاف"},i4:{ar:"ثلاثون الف"}},{n:4,i0:{ar:"اربعة"},i1:{ar:"اربعون"},i2:{ar:"اربعة مائة"},i3:{ar:"اربعة الاف"},i4:{ar:"اربعون الف"}},{n:5,i0:{ar:"خمسة"},i1:{ar:"خمسون"},i2:{ar:"خمسمائة"},i3:{ar:"خمسة الاف"},i4:{ar:"خمسون الف"}},{n:6,i0:{ar:"ستة"},i1:{ar:"ستون"},i2:{ar:"ستة مائة"},i3:{ar:"ستة الااف"},i4:{ar:"ستون الف"}},{n:7,i0:{ar:"سبعة"},i1:{ar:"سبعون"},i2:{ar:"سبعمائة"},i3:{ar:"سبعة الااف"},i4:{ar:"سبعون الف"}},{n:8,i0:{ar:"ثمانية"},i1:{ar:"ثمانون"},i2:{ar:"ثمانمائة"},i3:{ar:"ثمان الااف"},i4:{ar:"ثمانون الف"}},{n:9,i0:{ar:"تسعة"},i1:{ar:"تسعون"},i2:{ar:"تسعمائة"},i3:{ar:"تسعة الااف"},i4:{ar:"تسعون الف"}},{n:11,i0:{ar:"احدى عشر"}},{n:12,i0:{ar:"اثنى عشر"}}];d.strings={and:{ar:"و"},space:{ar:" "},10:{ar:"آلاف"},20:{ar:"ألفاً"},100:{ar:"ألف"},currency:{ar:" جنيها مصريا فقط لاغير "},from10:{ar:" قروش "},from100:{ar:" قرش "},from1000:{ar:" من الف "}},d.stringfiy=function(e,t){e=e||"",t=t||"ar",e=e.toString().split(".");let n=e[0],r=e[1],o="";1==n.length?o=a(n,t):2==n.length?o=i(n,t):3==n.length?o=s(n,t):4==n.length?o=l(n,t):5==n.length?o=c(n,t):6==n.length&&(o=u(n,t));let f="";return r&&(1==r.length&&(r+="0"),1==r.length?f=a(r,t)+d.strings.from10[t]:2==r.length?f=i(r,t)+d.strings.from100[t]:3==r.length&&(f=s(r,t)+d.strings.from1000[t])),o+=d.strings.currency[t],f&&(o+=d.strings.space[t]+d.strings.and[t]+d.strings.space[t]+f),o},d.ws=function(t,n){if("WebSocket"in e){"string"==typeof t&&(t={url:t});var r=new WebSocket(t.url);let e={ws:r,options:t,closed:!0,onError:e=>{console.log("server.onError Not Implement ... ")},onClose:function(e){e.wasClean?console.log(`[ws closed] Connection closed cleanly, code=${e.code} reason=${e.reason}`):(console.warn("[ws closed] Connection died"),setTimeout(()=>{d.ws(t,n)},5e3))},onOpen:()=>{console.log("server.onOpen Not Implement ... ")},onMessage:()=>{console.log("server.onMessage Not Implement ... ")},onData:()=>{console.log("server.onData Not Implement ... ")},send:function(e){if(this.closed)return!1;"object"!=typeof e&&(e={type:"text",content:e}),this.ws.send(JSON.stringify(e))}};r.onerror=function(t){e.onError(t)},r.onclose=function(t){e.closed=!0,e.onClose(t)},r.onopen=function(){e.closed=!1,e.onOpen()},r.onmessage=function(t){t instanceof Blob?e.onData(t):e.onMessage(JSON.parse(t.data))},n(e)}else console.error("WebSocket Not Supported")},d.hex=function(e){if("string"==typeof e){const t=new TextEncoder;return Array.from(t.encode(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}if("number"==typeof e){let t=e.toString(16);return 1==t.length&&(t="0"+t),t}},d.zakat=function(e){let t="";return e.name&&(t+="01"+d.hex(e.name.length)+d.hex(e.name)),e.vat_number&&(t+="02"+d.hex(e.vat_number.length)+d.hex(e.vat_number)),e.time&&(t+="03"+d.hex(e.time.length)+d.hex(e.time)),e.total&&(t+="04"+d.hex(e.total.length)+d.hex(e.total)),e.vat_total&&(t+="05"+d.hex(e.vat_total.length)+d.hex(e.vat_total)),d.toBase64(t)},d.zakat2=function(e,t){fetch("/x-api/zakat",{method:"POST",body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{t(e)})},d.barcode=function(e){if(e&&e.selector&&e.text)return JsBarcode(e.selector,e.text,e.options);console.error("qrcode need {selector , text}")},d.qrcode=function(e){if(!e||!e.selector||!e.text)return void console.error("qrcode need {selector , text}");let n="string"==typeof e.selector?t.querySelector(e.selector):e.selector;return n?(n.innerHTML="",new QRCode(n,{text:e.text,width:e.width||256,height:e.height||256,colorDark:e.colorDark||"#000000",colorLight:e.colorLight||"#ffffff",correctLevel:e.correctLevel||QRCode.CorrectLevel.H})):void 0},d.export=function(e,n="xlsx"){var r="string"==typeof e?t.querySelector(e):e,o=XLSX.utils.table_to_book(r,{sheet:"sheet1"});XLSX.write(o,{bookType:n,bookSST:!0,type:"base64"}),XLSX.writeFile(o,(r.id||r.tagName)+"."+n)},d.isSPA=!1,d.routeContainer="[router]",d.routeList=[],d.getRoute=(e=>d.routeList.find(t=>t.name==e)||{name:e,url:e}),d.route=(e=>{e.preventDefault(),d.setRoute(d.getRoute(e.target.href))}),d.setRoute=function(t){"string"==typeof t&&(t=d.getRoute(t)),e.history.pushState({},"",t.name)},d.getRouteContent=(async e=>("string"==typeof e&&(e=d.getRoute(e)),await fetch(e.url).then(e=>e.text()))),d.showRouteContent=function(e,n){"string"==typeof n&&(n=d.getRoute(n)),d.setRoute(n.name),d.getRouteContent(n.url).then(n=>{t.querySelector(e).innerHTML=n})},t.addEventListener("click",e=>{if(d.isSPA&&e.target.hasAttribute("route")){e.preventDefault();let t=e.target.getAttribute("route")||e.target.getAttribute("href");d.showRouteContent(d.routeContainer,t)}}),e.addEventListener("hashchange",t=>{if(!d.isSPA)return;let n=e.location.hash.replace("#","");n||(n="/"),d.showRouteContent(d.routeContainer,n)}),t.querySelector("html").hasAttribute("spa")&&(d.isSPA=!0),e.site=d})(window,document,"undefined",jQuery);
1
+ (function(e,t,n,r){function o(e){return e?("string"!=typeof e&&(e=e.toString()),e.replace(/[\/\\^$*+?.()\[\]{}]/g,"\\$&")):""}function a(e,t){let n="";return g.forEach(r=>{r.n==e&&(n=r.i0[t])}),n}function i(e,t){let n="";return 11==e?g.forEach(r=>{r.n==e&&(n=r.i0[t])}):12==e?g.forEach(r=>{r.n==e&&(n=r.i0[t])}):(g.forEach(r=>{r.n==e[1]&&(n=r.i0[t])}),g.forEach(r=>{r.n==e[0]&&(e[1]>0&&e[0]>1?n+=d.strings.space[t]+d.strings.and[t]:n+="",n+=r.i1[t])})),n}function s(e,t){let n="";g.forEach(r=>{r.n==e[0]&&(n=r.i2[t]+d.strings.space[t])});let r=i(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function l(e,t){let n="";g.forEach(r=>{r.n==e[0]&&(n=r.i3[t]+d.strings.space[t])});let r=s(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function c(e,t){let n=i(e.substring(0,2),t)+d.strings.space[t];1==e[0]?n+=d.strings[10][t]+d.strings.space[t]:n+=d.strings[20][t]+d.strings.space[t];let r=s(e.substring(2),t);return r&&(n+=d.strings.and[t]+r),n}function u(e,t){let n=s(e.substring(0,3),t)+d.strings.space[t];n+=d.strings[100][t]+d.strings.space[t];let r=s(e.substring(3),t);return r&&(n+=d.strings.and[t]+r),n}String.prototype.test||(String.prototype.test=function(e,t="gium"){try{return new RegExp(e,t).test(this)}catch(e){return!1}}),String.prototype.like||(String.prototype.like=function(e){if(!e)return!1;let t=!1;return e.split("|").forEach(e=>{e=e.split("*"),e.forEach((t,n)=>{e[n]=o(t)}),e=e.join(".*"),this.test("^"+e+"$","gium")&&(t=!0)}),t}),String.prototype.contains||(String.prototype.contains=function(e){let t=!1;return e?(e.split("|").forEach(e=>{e&&this.test("^.*"+o(e)+".*$","gium")&&(t=!0)}),t):t});let d={onLoad:function(e){"loading"!==t.readyState?e():t.addEventListener("DOMContentLoaded",()=>{e()})}};d.zoomNumber=parseInt(localStorage.getItem("zoomNumber")||100),d.zoom=function(e){"+"==e?d.zoomNumber+=25:"-"==e?d.zoomNumber-=25:"0"==e||(d.zoomNumber=100),localStorage.setItem("zoomNumber",d.zoomNumber.toString()),t.body.style.zoom=d.zoomNumber+"%"},d.printerList=[],d.getPrinters=function(){return e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrintersAsync?SOCIALBROWSER.currentWindow.webContents.getPrintersAsync().then(e=>{d.printerList=e}):e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrinters?d.printerList=SOCIALBROWSER.currentWindow.webContents.getPrinters():fetch("http://127.0.0.1:60080/printers/all").then(e=>e.json()).then(e=>{d.printerList=e.list}).catch(e=>{d.printerList=[]}),d.printerList},d.render=function(e,n){let r=t.querySelector(e);return r?Mustache.render(r.innerHTML,n):""},d.html=function(e,t){return Mustache.render(e,t)},d.getUniqueObjects=function(e,t){const n=e.map(e=>e[t]).map((e,t,n)=>n.indexOf(e)===t&&t).filter(t=>e[t]).map(t=>e[t]);return n},d.$=function(e){let n=t.querySelectorAll(e);return n},d.modal_z_index=999999,d.showModal=function(t){r(t).click(()=>{r("popup").hide()}),d.modal_z_index++;let n=d.$(t);if(0===n.length)return;n[0].style.zIndex=d.modal_z_index,n[0].style.display="block";let o=n[0].getAttribute("fixed");""!==o&&n[0].addEventListener("click",function(){d.hideModal(t)});let a=d.$(t+" i-control input");a.length>0&&a[0].focus(),d.$(t+" .close").forEach(e=>{e.addEventListener("click",function(){d.hideModal(t)})}),d.$(t+" .modal-header").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-body").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-footer").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})})},d.hideModal=function(e){r("popup").hide();let t=d.$(e);t.length>0&&(t[0].style.display="none")},d.eventList=[],d.on=function(e,t){t=t||function(){},d.eventList.push({name:e,callback:t})},d.call=function(e,t){for(var n=0;n<d.eventList.length;n++){var r=d.eventList[n];r.name==e&&r.callback(t)}},d.translate=function(e,t){"string"==typeof e&&(e={text:e,lang:"ar"}),e.url=`https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${e.lang}&dt=t&dt=bd&dj=1&q=${e.text}`,d.getData(e,t)},d.getData=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.headers=e.headers||{Accept:"application/json","Content-Type":"application/json"},e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get",headers:e.headers}).then(e=>e.json()).then(e=>{t(e)}).catch(e=>{n(e)})},d.getContent=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get"}).then(function(e){return e.text()}).then(function(e){t(e)})},d.handle_url=function(t){if("string"!=typeof t)return t;if(t=t.trim(),t.like("http*")||0===t.indexOf("//")||0===t.indexOf("data:"))t=t;else if(0===t.indexOf("/"))t=e.location.origin+t;else if(t.split("?")[0].split(".").length<3){let n=e.location.pathname.split("/").pop();t=e.location.origin+e.location.pathname.replace(n,"")+t}return t},d.postData=function(n,r,o){r=r||function(){},o=o||function(){},"string"==typeof n&&(n={url:n}),n.data=n.data||n.body,delete n.body,n.data&&"object"==typeof n.data&&(n.data=JSON.stringify(n.data)),n.headers=n.headers||{Accept:"application/json","Content-Type":"application/json"},n.data&&"string"==typeof n.data&&(n.headers["Content-Length"]=n.data.length.toString());try{n.headers.Cookie=t.cookie}catch(o){console.log(o)}n.method="post",n.redirect="follow",n.mode="cors",n.url=d.handle_url(n.url),e.SOCIALBROWSER&&e.SOCIALBROWSER.fetchJson?SOCIALBROWSER.fetchJson(n,e=>{r(e)}):fetch(n.url,{mode:n.mode,method:n.method,headers:n.headers,body:n.data,redirect:n.redirect}).then(e=>e.json()).then(e=>{r(e)}).catch(e=>{o(e)})},d.typeOf=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.toDateTime=function(e){return e?new Date(e):new Date},d.toDateX=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()},d.toDateXT=function(e){let t=d.toDateTime(e);return t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateXF=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateOnly=function(e){let t=d.toDateTime(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)},d.toDateT=function(e){return d.toDateOnly(e).getTime()},d.toDateF=function(e){return d.toDateTime(e).getTime()},d.addZero=function(e,t){let n=t-e.toString().length;for(let t=0;t<n;t++)e="0"+e.toString();return e},d.addSubZero=function(e,t){let n=t;if(2==e.toString().split(".").length){e.toString().split(".")[1].length;e=e.toString()}else e=e.toString()+".";for(let t=0;t<n;t++)e=e.toString()+0;return e},d.fixed=3,d.to_number=d.toNumber=function(e,t){let n=t||d.fixed,r=0;return e&&(r=parseFloat(e).toFixed(n)),parseFloat(r)},d.to_money=d.toMoney=function(e,t=!0){let n=0;if(e){e=e.toFixed(2).split(".");e[0];let t=e[1]||"00";if(t){let n=t[0]||"0",r=t[1]||"0";r&&parseInt(r)>5?(n=parseInt(n)+1,n*=10,100==n?(n=0,e[0]=parseInt(e[0])+1,e[1]=""):e[1]=n):r&&5==parseInt(r)?e[1]=t:r&&parseInt(r)>2?(r=5,e[1]=n+r):e[1]=n+"0"}n=e.join(".")}return t?d.to_float(n):(n&&n.endsWith(".")&&(n+="00"),n)},d.to_float=d.toFloat=function(e){return e?parseFloat(e):0},d.to_int=d.toInt=function(e){return e?parseInt(e):0},d.$base64Letter="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d.$base64Numbers=[];for(let e=11;e<99;e++)e%10!=0&&e%11!=0&&d.$base64Numbers.push(e);d.toJson=(e=>typeof e===n||null===e?"":JSON.stringify(e)),d.fromJson=(e=>"string"!=typeof e?e:JSON.parse(e)),d.toBase64=(e=>typeof e===n||null===e||""===e?"":("string"!=typeof e&&(e=d.toJson(e)),Base64.encode(e))),d.fromBase64=(e=>typeof e===n||null===e||""===e?"":Base64.decode(e)),d.to123=(e=>{e=d.toBase64(e);let t="";for(let n=0;n<e.length;n++){let r=e[n];t+=d.$base64Numbers[d.$base64Letter.indexOf(r)]}return t}),d.from123=(e=>{let t="";for(let n=0;n<e.length;n++){let r=e[n]+e[n+1],o=d.$base64Numbers.indexOf(parseInt(r));t+=d.$base64Letter[o],n++}return t=d.fromBase64(t),t}),d.hide=d.hideObject=function(e){return d.to123(JSON.parse(e))},d.show=d.showObject=function(e){return e?JSON.parse(d.from123(e)):{}},d.typeOf=d.typeof=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.showTabContent=function(e,n){n=n||e;let r=t;e&&e.target&&e.target.parentNode&&e.target.parentNode.parentNode&&(r=e.target.parentNode.parentNode),r&&r.className.contains("tabs-header")&&(r=r.parentNode);let o=r.querySelector(n);if(o){let e=o.parentNode;if(e){let t=e.parentNode;t&&(t.querySelectorAll(".tab-content").forEach(e=>{e.style.display="none"}),t.querySelectorAll(".tab-link").forEach(e=>{e.getAttribute("onclick")&&e.getAttribute("onclick").contains(n+"'")?e.classList.add("active"):e.classList.remove("active")}),t.querySelectorAll(n+".tab-content").forEach(e=>{e.style.display="block"}))}}},d.showTabs=function(e,t){e&&e.stopPropagation(),r(".main-menu .tabs").hide(),r(t).show(100)},d.toHtmlTable=function(e){if(e===n||null===e)return"";if("Object"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<Object.getOwnPropertyNames(e).length;n++){let r=Object.getOwnPropertyNames(e)[n];t+="<tr>",t+=`<td><p> ${r} </p></td>`,"Object"==d.typeOf(e[r])||"Array"==d.typeOf(e[r])?t+=`<td><p> ${d.toHtmlTable(e[r])} </p></td>`:t+=`<td><p> ${e[r]} </p></td>`,t+="</tr>"}return t+="</table>",t}if("Array"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<e.length;n++)"Object"==d.typeOf(e[n])||"Array"==d.typeOf(e[n])?t+=`<tr><td><p>${d.toHtmlTable(e[n])}</p></td></tr>`:t+=`<tr><td><p>${e[n]}</p></td></tr>`;return t+="</table>",t}return""},d.resetValidated=function(e){e=e||"body";const n=t.querySelectorAll(e+" [v]");n.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid")})},d.validated=function(e){const n={ok:!0,messages:[]};e=e||"body";const r=t.querySelectorAll(e+" [v]");return r.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid");const t=e.getAttribute("v"),r=t.split(" ");r.forEach(t=>{if(t=t.toLowerCase().trim(),"r"===t)"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!e.value.like("*undefined*")?("I-DATETIME"!==e.nodeName||e.getAttribute("value"))&&("I-DATE"!==e.nodeName||e.getAttribute("value"))?"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName&&"I-DATETIME"!==e.nodeName&&"I-DATE"!==e.nodeName||e.classList.add("is-valid"):(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"})):(e.classList.add("is-invalid"),(f=e.parentNode.querySelector(".invalid-feedback"))&&(d.session&&"en"==d.session.lang?f.innerHTML="Data Is Required":d.session&&"ar"==d.session.lang&&(f.innerHTML="هذا البيان مطلوب")),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"}));else if(t.like("ml*")){const r=parseInt(t.replace("ml",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length>r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be <= "+r,ar:"عدد الاحرف يجب ان يكون أقل من أو يساوى "+r}))}else if(t.like("ll*")){const r=parseInt(t.replace("ll",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length<r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be >= "+r,ar:"عدد الاحرف يجب ان يكون اكبر من أو يساوى "+r}))}else if(t.like("l*")){const r=parseInt(t.replace("l",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&e.value.length===r||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be = "+r,ar:"عدد الاحرف يجب ان يساوى "+r}))}else t.like("e")?"INPUT"!==e.nodeName||e.value&&d.isEmail(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Email address",ar:"اكتب البريد الالكترونى بطريقة صحيحة"})):(t.like("web")||t.like("url"))&&("INPUT"!==e.nodeName||e.value&&d.isURL(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Web address",ar:"اكتب رابط الموقع بطريقة صحيحة"})))})}),n},d.isEmail=function(e){return!!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e)},d.isURL=function(e){var t=new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");return!!t.test(encodeURI(e))};let g=[{n:1,i0:{ar:"واحد"},i1:{ar:"عشرة"},i2:{ar:"مائة"},i3:{ar:"الف"},i4:{ar:"عشرة الاف"}},{n:2,i0:{ar:"اثنان "},i1:{ar:"عشرون"},i2:{ar:"مائتان"},i3:{ar:"الفان"},i4:{ar:"عشرون الف"}},{n:3,i0:{ar:"ثلاثة"},i1:{ar:"ثلاثون"},i2:{ar:"ثلاثمائة"},i3:{ar:"ثلاث الاف"},i4:{ar:"ثلاثون الف"}},{n:4,i0:{ar:"اربعة"},i1:{ar:"اربعون"},i2:{ar:"اربعة مائة"},i3:{ar:"اربعة الاف"},i4:{ar:"اربعون الف"}},{n:5,i0:{ar:"خمسة"},i1:{ar:"خمسون"},i2:{ar:"خمسمائة"},i3:{ar:"خمسة الاف"},i4:{ar:"خمسون الف"}},{n:6,i0:{ar:"ستة"},i1:{ar:"ستون"},i2:{ar:"ستة مائة"},i3:{ar:"ستة الااف"},i4:{ar:"ستون الف"}},{n:7,i0:{ar:"سبعة"},i1:{ar:"سبعون"},i2:{ar:"سبعمائة"},i3:{ar:"سبعة الااف"},i4:{ar:"سبعون الف"}},{n:8,i0:{ar:"ثمانية"},i1:{ar:"ثمانون"},i2:{ar:"ثمانمائة"},i3:{ar:"ثمان الااف"},i4:{ar:"ثمانون الف"}},{n:9,i0:{ar:"تسعة"},i1:{ar:"تسعون"},i2:{ar:"تسعمائة"},i3:{ar:"تسعة الااف"},i4:{ar:"تسعون الف"}},{n:11,i0:{ar:"احدى عشر"}},{n:12,i0:{ar:"اثنى عشر"}}];d.strings={and:{ar:"و"},space:{ar:" "},10:{ar:"آلاف"},20:{ar:"ألفاً"},100:{ar:"ألف"},currency:{ar:" جنيها مصريا فقط لاغير "},from10:{ar:" قروش "},from100:{ar:" قرش "},from1000:{ar:" من الف "}},d.stringfiy=function(e,t){e=e||"",t=t||"ar",e=e.toString().split(".");let n=e[0],r=e[1],o="";1==n.length?o=a(n,t):2==n.length?o=i(n,t):3==n.length?o=s(n,t):4==n.length?o=l(n,t):5==n.length?o=c(n,t):6==n.length&&(o=u(n,t));let f="";return r&&(1==r.length&&(r+="0"),1==r.length?f=a(r,t)+d.strings.from10[t]:2==r.length?f=i(r,t)+d.strings.from100[t]:3==r.length&&(f=s(r,t)+d.strings.from1000[t])),o+=d.strings.currency[t],f&&(o+=d.strings.space[t]+d.strings.and[t]+d.strings.space[t]+f),o},d.ws=function(t,n){if("WebSocket"in e){"string"==typeof t&&(t={url:t});var r=new WebSocket(t.url);let e={ws:r,options:t,closed:!0,onError:e=>{console.log("server.onError Not Implement ... ")},onClose:function(e){e.wasClean?console.log(`[ws closed] Connection closed cleanly, code=${e.code} reason=${e.reason}`):(console.warn("[ws closed] Connection died"),setTimeout(()=>{d.ws(t,n)},5e3))},onOpen:()=>{console.log("server.onOpen Not Implement ... ")},onMessage:()=>{console.log("server.onMessage Not Implement ... ")},onData:()=>{console.log("server.onData Not Implement ... ")},send:function(e){if(this.closed)return!1;"object"!=typeof e&&(e={type:"text",content:e}),this.ws.send(JSON.stringify(e))}};r.onerror=function(t){e.onError(t)},r.onclose=function(t){e.closed=!0,e.onClose(t)},r.onopen=function(){e.closed=!1,e.onOpen()},r.onmessage=function(t){t instanceof Blob?e.onData(t):e.onMessage(JSON.parse(t.data))},n(e)}else console.error("WebSocket Not Supported")},d.hex=function(e){if("string"==typeof e){const t=new TextEncoder;return Array.from(t.encode(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}if("number"==typeof e){let t=e.toString(16);return 1==t.length&&(t="0"+t),t}},d.zakat=function(e){let t="";return e.name&&(t+="01"+d.hex(e.name.length)+d.hex(e.name)),e.vat_number&&(t+="02"+d.hex(e.vat_number.length)+d.hex(e.vat_number)),e.time&&(t+="03"+d.hex(e.time.length)+d.hex(e.time)),e.total&&(t+="04"+d.hex(e.total.length)+d.hex(e.total)),e.vat_total&&(t+="05"+d.hex(e.vat_total.length)+d.hex(e.vat_total)),d.toBase64(t)},d.zakat2=function(e,t){fetch("/x-api/zakat",{method:"POST",body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{t(e)})},d.barcode=function(e){if(e&&e.selector&&e.text)return JsBarcode(e.selector,e.text,e.options);console.error("qrcode need {selector , text}")},d.qrcode=function(e){if(!e||!e.selector||!e.text)return void console.error("qrcode need {selector , text}");let n="string"==typeof e.selector?t.querySelector(e.selector):e.selector;return n?(n.innerHTML="",new QRCode(n,{text:e.text,width:e.width||256,height:e.height||256,colorDark:e.colorDark||"#000000",colorLight:e.colorLight||"#ffffff",correctLevel:e.correctLevel||QRCode.CorrectLevel.H})):void 0},d.export=function(e,n="xlsx"){var r="string"==typeof e?t.querySelector(e):e,o=XLSX.utils.table_to_book(r,{sheet:"sheet1"});XLSX.write(o,{bookType:n,bookSST:!0,type:"base64"}),XLSX.writeFile(o,(r.id||r.tagName)+"."+n)},d.isSPA=!1,d.routeContainer="[router]",d.routeList=[],d.getRoute=(e=>d.routeList.find(t=>t.name==e)||{name:e,url:e}),d.route=(e=>{e.preventDefault(),d.setRoute(d.getRoute(e.target.href))}),d.setRoute=function(t){"string"==typeof t&&(t=d.getRoute(t)),e.history.pushState({},"",t.name)},d.getRouteContent=(async e=>("string"==typeof e&&(e=d.getRoute(e)),await fetch(e.url).then(e=>e.text()))),d.showRouteContent=function(e,n){"string"==typeof n&&(n=d.getRoute(n)),d.setRoute(n.name),d.getRouteContent(n.url).then(n=>{t.querySelector(e).innerHTML=n})},t.addEventListener("click",e=>{if(d.isSPA&&e.target.hasAttribute("route")){e.preventDefault();let t=e.target.getAttribute("route")||e.target.getAttribute("href");d.showRouteContent(d.routeContainer,t)}}),e.addEventListener("hashchange",t=>{if(!d.isSPA)return;let n=e.location.hash.replace("#","");n||(n="/"),d.showRouteContent(d.routeContainer,n)}),t.querySelector("html").hasAttribute("spa")&&(d.isSPA=!0),e.site=d})(window,document,"undefined",jQuery);
package/index.js CHANGED
@@ -170,6 +170,8 @@ module.exports = function init(options) {
170
170
  ____0.isFileExistsSync = ____0.fsm.isFileExistsSync;
171
171
 
172
172
  ____0.readFile = ____0.fsm.readFile;
173
+ ____0.readFileRaw = ____0.fsm.readFileRaw;
174
+ ____0.readFileStream = ____0.fsm.readFileStream;
173
175
  ____0.readFiles = ____0.fsm.readFiles;
174
176
  ____0.readFileSync = ____0.fsm.readFileSync;
175
177
 
@@ -263,7 +265,7 @@ module.exports = function init(options) {
263
265
  ____0.reset = function () {};
264
266
 
265
267
  ____0.on('[any][saving data]', function () {
266
- ____0.log('Saving Data :: ' + ____0.options.savingTime + ' Minute ');
268
+ ____0.log( ____0.options.name + ' :: Saving Data :: ' + ____0.options.savingTime + ' Minute ');
267
269
  });
268
270
 
269
271
  setInterval(function () {
package/lib/app.js CHANGED
@@ -10,6 +10,8 @@ module.exports = function init(____0) {
10
10
  dir: _app.dir,
11
11
  page: _app.page,
12
12
  collectionName: _app.collectionName || _app.name,
13
+ sort: _app.sort || { id: -1 },
14
+ limit: _app.limit || 1000,
13
15
  title: _app.title || _app.name,
14
16
  images: _app.images ?? false,
15
17
  allowMemory: _app.allowMemory ?? false,
@@ -32,7 +34,7 @@ module.exports = function init(____0) {
32
34
 
33
35
  app.init = function () {
34
36
  if (app.allowMemory) {
35
- app.$collection.findMany({}, (err, docs) => {
37
+ app.$collection.findMany({ where: {}, select: {}, sort: app.sort, limit: app.limit }, (err, docs) => {
36
38
  if (!err) {
37
39
  if (docs.length == 0) {
38
40
  app.cacheList.forEach((_item, i) => {
@@ -57,7 +59,11 @@ module.exports = function init(____0) {
57
59
  callback(err, doc);
58
60
  }
59
61
  if (app.allowMemory && !err && doc) {
60
- app.memoryList.push(doc);
62
+ if (app.sort.id == -1) {
63
+ app.memoryList.unshift(doc);
64
+ } else {
65
+ app.memoryList.push(doc);
66
+ }
61
67
  }
62
68
  });
63
69
  };
@@ -78,7 +84,11 @@ module.exports = function init(____0) {
78
84
  if (index !== -1) {
79
85
  app.memoryList[index] = result.doc;
80
86
  } else {
81
- app.memoryList.push(result.doc);
87
+ if (app.sort.id == -1) {
88
+ app.memoryList.unshift(result.doc);
89
+ } else {
90
+ app.memoryList.push(result.doc);
91
+ }
82
92
  }
83
93
  } else if (app.allowCache && !err && result) {
84
94
  let index = app.cacheList.findIndex((itm) => itm.id === result.doc.id);
package/lib/collection.js CHANGED
@@ -692,6 +692,7 @@ module.exports = function init(____0, option, db) {
692
692
  }
693
693
  });
694
694
  };
695
+
695
696
  $collection.loadAll = (options, callback) => {
696
697
  callback = callback || function () {};
697
698
  ____0.mongodb.findMany(
package/lib/fsm.js CHANGED
@@ -12,21 +12,12 @@ module.exports = function init(____0) {
12
12
  fsm.list = [];
13
13
 
14
14
  fsm.isFileExistsSync = (path) => {
15
- for (let i = 0; i < fsm.list.length; i++) {
16
- let f = fsm.list[i];
17
- if (f.path === path) {
18
- return !0;
19
- }
20
- }
21
- return fs.existsSync(path);
15
+ return fsm.list.some((f) => f.path === path) || fs.existsSync(path);
22
16
  };
23
17
 
24
18
  fsm.isFileExists = (path, callback) => {
25
- callback = callback || function () {};
26
- if (fsm.isFileExistsSync(path)) {
27
- callback(!0);
28
- } else {
29
- callback(!1);
19
+ if (callback) {
20
+ callback(fsm.isFileExistsSync(path));
30
21
  }
31
22
  };
32
23
 
@@ -37,16 +28,9 @@ module.exports = function init(____0) {
37
28
  };
38
29
 
39
30
  fsm.stat = function (path, callback) {
40
- callback = callback || function () {};
41
- fsm.isFileExists(path, function (yes) {
42
- if (yes) {
43
- fs.stat(path, callback);
44
- } else {
45
- callback({
46
- message: 'file not exists',
47
- });
48
- }
49
- });
31
+ if (callback) {
32
+ callback(fsm.statSync(path));
33
+ }
50
34
  };
51
35
 
52
36
  fsm.createDirSync = fsm.mkdirSync = function (path) {
@@ -136,12 +120,6 @@ module.exports = function init(____0) {
136
120
  }, 100);
137
121
  };
138
122
 
139
- fsm.readFile = function (path, callback) {
140
- setTimeout(() => {
141
- fsm.readFileSync(path, callback);
142
- }, 100);
143
- };
144
-
145
123
  fsm.getFilePath = function (name) {
146
124
  if (____0.isFileExistsSync(name)) {
147
125
  return name;
@@ -206,66 +184,125 @@ module.exports = function init(____0) {
206
184
  }
207
185
  };
208
186
 
209
- fsm.readFileSync = function (path, callback) {
210
- callback =
211
- callback ||
212
- function (err) {
213
- if (err) {
214
- ____0.log(err);
187
+ fsm.readFileStream = function (path) {
188
+ var readerStream = fs.createReadStream(path);
189
+ readerStream.setEncoding(____0.fn.getFileEncode(path));
190
+ return readerStream;
191
+ };
192
+
193
+ fsm.readFileRaw = function (path, callback) {
194
+ var data = '';
195
+ var readerStream = fsm.readFileStream(path);
196
+ readerStream.on('data', function (chunk) {
197
+ data += chunk;
198
+ });
199
+
200
+ readerStream.on('end', function () {
201
+ callback(data);
202
+ });
203
+
204
+ readerStream.on('error', function (err) {
205
+ console.log(err.stack);
206
+ });
207
+ };
208
+
209
+ fsm.readFile = function (path, callback) {
210
+ path = fsm.getFilePath(path);
211
+
212
+ if (!path) {
213
+ if (callback) {
214
+ callback({
215
+ message: path + ' :: Error Read File Not Exists',
216
+ });
217
+ }
218
+ }
219
+
220
+ let index = fsm.list.findIndex((f) => f.path == path);
221
+ if (index !== -1) {
222
+ fsm.list[index].count++;
223
+ fsm.list[index].time = new Date().getTime();
224
+ if (callback) {
225
+ callback(null, fsm.list[index]);
226
+ }
227
+ return;
228
+ }
229
+
230
+ if (fsm.isFileExistsSync(path)) {
231
+ fsm.readFileRaw(path, (data) => {
232
+ if (data) {
233
+ let file = {
234
+ path: path,
235
+ content: data,
236
+ count: 1,
237
+ stat: fsm.statSync(path),
238
+ time: new Date().getTime(),
239
+ };
240
+
241
+ file.json = function (callback) {
242
+ try {
243
+ if (!file.isJson) {
244
+ file.content = JSON.parse(file.content);
245
+ file.isJson = true;
246
+ }
247
+ } catch (error) {
248
+ file.error = error;
249
+ console.log(error);
250
+ }
251
+ if (callback) {
252
+ callback(file);
253
+ } else {
254
+ return file;
255
+ }
256
+ };
257
+ fsm.list.push(file);
258
+ if (callback) {
259
+ callback(null, file);
260
+ }
261
+ } else {
262
+ callback({
263
+ message: path + ' :: Error Read File Not Exists',
264
+ });
215
265
  }
216
- };
266
+ });
267
+ } else {
268
+ if (callback) {
269
+ callback({
270
+ message: path + ' :: Error Read File Not Exists',
271
+ });
272
+ }
273
+ }
274
+ };
217
275
 
276
+ fsm.readFileSyncRaw = function (path) {
277
+ return fs.readFileSync(path, ____0.fn.getFileEncode(path));
278
+ };
279
+ fsm.readFileSync = function (path) {
218
280
  path = fsm.getFilePath(path);
281
+
219
282
  if (!path) {
220
283
  return '';
221
284
  }
222
- let path2 = path + '_tmp';
223
-
224
- for (let index = 0; index < fsm.list.length; index++) {
225
- let file = fsm.list[index];
226
- if (file.path == path) {
227
- file.count++;
228
- callback(null, file.content, file);
229
- return file.content;
230
- }
285
+
286
+ let index = fsm.list.findIndex((f) => f.path == path);
287
+ if (index !== -1) {
288
+ fsm.list[index].count++;
289
+ fsm.list[index].time = new Date().getTime();
290
+ return fsm.list[index].content;
231
291
  }
232
292
 
233
- let encode = 'utf8';
234
- encode = ____0.fn.getFileEncode(path);
235
293
  if (fsm.isFileExistsSync(path)) {
236
- let data = fs.readFileSync(path, encode);
237
- let file = {
238
- path: path,
239
- content: data,
240
- etag: ____0.x0md50x(data),
241
- count: 1,
242
- stat: fsm.statSync(path),
243
- encode: encode,
244
- time: Date.now(),
245
- };
246
- fsm.list.push(file);
247
- callback(null, file.content, file);
248
- return data;
249
- } else if (fsm.isFileExistsSync(path2)) {
250
- let data = fs.readFileSync(path2, encode);
251
294
  let file = {
252
295
  path: path,
253
- content: data,
254
- etag: ____0.x0md50x(data),
296
+ content: fsm.readFileSyncRaw(path),
255
297
  count: 1,
256
298
  stat: fsm.statSync(path),
257
- encode: encode,
258
- time: Date.now(),
299
+ time: new Date().getTime(),
259
300
  };
260
301
  fsm.list.push(file);
261
- callback(null, file.content, file);
262
- return data;
263
- } else {
264
- callback({
265
- message: path + ' :: Error Read File Not Exists',
266
- });
267
- return '';
302
+
303
+ return file.content;
268
304
  }
305
+ return '';
269
306
  };
270
307
 
271
308
  fsm.readFiles = function (paths, callback) {
@@ -290,12 +327,12 @@ module.exports = function init(____0) {
290
327
  callback(null, content);
291
328
  };
292
329
 
293
- fsm.isImage = function(extname){
294
- if (extname == 'png' || extname == 'jpg' || extname == 'jpeg' || extname == 'bmp' || extname == 'ico'|| extname == 'webp') {
295
- return true
330
+ fsm.isImage = function (extname) {
331
+ if (extname == 'png' || extname == 'jpg' || extname == 'jpeg' || extname == 'bmp' || extname == 'ico' || extname == 'webp') {
332
+ return true;
296
333
  }
297
- return false
298
- }
334
+ return false;
335
+ };
299
336
 
300
337
  fsm.getContent = function (name, callback) {
301
338
  callback = callback || function () {};
package/lib/parser.js CHANGED
@@ -264,9 +264,9 @@ module.exports = function init(req, res, ____0, route) {
264
264
  createdTime: req.session.createdTime,
265
265
  modifiedTime: req.session.modifiedTime,
266
266
  data: req.session.data,
267
- ip: req.session.ip,
268
267
  requestesCount: req.session.requestesCount,
269
268
  busy: req.session.$busy,
269
+ ip: req.session.ip,
270
270
  ipLookup: req.session.ip_list.find((info) => info.ip == req.session.ip),
271
271
  });
272
272
  }
package/lib/routing.js CHANGED
@@ -51,10 +51,6 @@ module.exports = function init(____0) {
51
51
  // // return;
52
52
  // }
53
53
 
54
- // if (____0.options.help) {
55
- // res.set('help-info-etag', hash);
56
- // }
57
-
58
54
  // res.set('ETag', hash);
59
55
 
60
56
  if (____0.options.cache.enabled) {
@@ -208,9 +204,9 @@ module.exports = function init(____0) {
208
204
  }
209
205
 
210
206
  if (typeof route.path == 'string') {
211
- ____0.readFile(route.path, function (err, data, file) {
207
+ ____0.readFile(route.path, function (err, file) {
212
208
  if (!err) {
213
- route.content = data.toString('utf8');
209
+ route.content = file.content.toString('utf8');
214
210
  if (route.encript && route.encript === '123') {
215
211
  route.content = ____0.f1(route.content);
216
212
  }
@@ -633,8 +629,9 @@ module.exports = function init(____0) {
633
629
  };
634
630
 
635
631
  _0xrrxo.handleServer = async function (req, res) {
636
- req.host = '';
637
- req.origin = '';
632
+ req.host = req.headers['host'] || '';
633
+ req.origin = req.headers['origin'] || req.host;
634
+ req.referer = req.headers['referer'] || '';
638
635
  req.domain = '';
639
636
  req.subDomain = '';
640
637
  req.obj = {};
@@ -696,6 +693,9 @@ module.exports = function init(____0) {
696
693
  req.socket.remoteAddress = req.socket.remoteAddress || '';
697
694
  req.acceptEncoding = req.headers[____0.strings[5]] ? req.headers[____0.strings[5]] : '';
698
695
  res.ip = req.ip = req.headers[____0.strings[6]] ? req.headers[____0.strings[6]] : req.socket.remoteAddress.replace('::ffff:', '');
696
+ if (req.ip == '::1') {
697
+ req.ip = '127.0.0.1';
698
+ }
699
699
  res.ip2 = req.ip2 = req.socket.localAddress.replace('::ffff:', '');
700
700
  res.port = req.port = req.socket.remotePort;
701
701
  res.port2 = req.port2 = req.socket.localPort;
@@ -1074,7 +1074,10 @@ module.exports = function init(____0) {
1074
1074
  return res.jsonFile(obj);
1075
1075
  } else {
1076
1076
  res.set(____0.strings[7], 'application/json');
1077
- return res.status(200).ending(time || 0, ____0.toJson(obj));
1077
+ obj = ____0.toJson(obj);
1078
+ res.status(200).ending(time || 0, obj);
1079
+ obj = null;
1080
+ return res;
1078
1081
  }
1079
1082
  };
1080
1083
 
@@ -1087,13 +1090,13 @@ module.exports = function init(____0) {
1087
1090
  res.setHeader('Access-Control-Allow-Credentials', 'true');
1088
1091
  res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || 'Origin, X-Requested-With, Content-Type, Accept , Access-Token , Authorization');
1089
1092
  res.setHeader('Access-Control-Allow-Methods', req.headers['access-control-request-method'] || 'POST,GET,DELETE,PUT,OPTIONS,VIEW,HEAD,CONNECT,TRACE');
1090
- res.setHeader('Access-Control-Allow-Origin', req.headers.host || req.headers.referer || '*');
1091
- if (req.headers.origin) {
1092
- res.setHeader('Access-Control-Allow-Origin', req.headers.origin);
1093
+ res.setHeader('Access-Control-Allow-Origin', req.host || req.referer || '*');
1094
+ if (req.origin) {
1095
+ res.setHeader('Access-Control-Allow-Origin', req.origin);
1093
1096
  }
1094
1097
 
1095
- if (____0.options.www === false && req.headers.host.contains('www')) {
1096
- res.redirect('//' + req.headers.host.replace('www.', '') + req.url, 301);
1098
+ if (____0.options.www === false && req.host.contains('www')) {
1099
+ res.redirect('//' + req.host.replace('www.', '') + req.url, 301);
1097
1100
  return;
1098
1101
  }
1099
1102
 
@@ -1144,7 +1147,7 @@ module.exports = function init(____0) {
1144
1147
 
1145
1148
  for (let i = 0; i < req.route.map.length; i++) {
1146
1149
  let map = req.route.map[i];
1147
- req.params[map.name] = decodeURIComponent(req.urlParser.arr[map.index]);
1150
+ req.params[map.name] = decodeURIComponent(req.urlParser.arr[map.index].replace(/\+/g, ' '));
1148
1151
  req.paramsRaw[map.name] = req.urlParserRaw.arr[map.index];
1149
1152
  }
1150
1153
 
@@ -1247,23 +1250,26 @@ module.exports = function init(____0) {
1247
1250
 
1248
1251
  if (req.urlParser.pathname == '/') {
1249
1252
  if (____0.options.help) {
1250
- res.set('help-eror-message', 'unhandled route ' + req.urlParser.pathname);
1253
+ res.set('help-eror-message', 'unhandled route root ' + req.urlParser.pathname);
1251
1254
  }
1252
1255
  res.htmlContent("<h1 align='center'>Base Route / Not Set</h1>");
1253
1256
  return;
1254
1257
  }
1255
1258
 
1256
1259
  if (____0.options.help) {
1257
- res.set('help-eror-message', 'unhandled route ' + req.urlParser.pathname);
1260
+ res.set('help-eror-message', 'unhandled route help' + req.urlParser.pathname);
1258
1261
  }
1262
+
1259
1263
  if (req.method.toLowerCase().like('options') || req.method.toLowerCase().like('head')) {
1260
1264
  res.status(200).end();
1261
1265
  return;
1262
1266
  }
1263
- res.set('help-eror-message', 'unhandled route ' + req.urlParser.pathname);
1267
+ ____0.handleNotRoute(req, res);
1268
+ };
1269
+ ____0.handleNotRoute = function (req, res) {
1270
+ res.set('help-eror-message', 'unhandled route fn' + req.urlParser.pathname);
1264
1271
  res.status(404).end();
1265
1272
  };
1266
-
1267
1273
  ____0.servers = [];
1268
1274
  ____0.server = null;
1269
1275
 
package/lib/security.js CHANGED
@@ -170,9 +170,9 @@ module.exports = function init(____0) {
170
170
  security.addPermissions = function (list, callback) {
171
171
  callback = callback || function () {};
172
172
  if (typeof list === 'string') {
173
- ____0.readFile(list, (err, data) => {
173
+ ____0.readFile(list, (err, file) => {
174
174
  if (!err) {
175
- let arr = ____0.fromJson(data);
175
+ let arr = ____0.fromJson(file.content);
176
176
  for (let i = 0; i < arr.length; i++) {
177
177
  security.permissions.push(arr[i]);
178
178
  }
package/lib/session.js CHANGED
@@ -27,30 +27,39 @@ module.exports = function init(req, res, ____0, callback) {
27
27
  }
28
28
  req.features.push('ip.' + req.ip);
29
29
 
30
- if (req.headers['host']) {
31
- req.host = req.headers['host'];
30
+ if (req.host) {
31
+ req.features.push('host.' + req.host);
32
32
  req.hostArray = req.host.split(':')[0].split('.').reverse();
33
33
  if (req.hostArray[0] == 'localhost') {
34
34
  req.domain = req.hostArray[0];
35
35
  req.features.push('host.' + req.hostArray[0]);
36
- if (req.hostArray[1]) {
37
- req.subDomain = req.hostArray[1];
36
+ if (req.hostArray.length == 2) {
37
+ req.domain2 = req.hostArray[1];
38
38
  req.features.push('host.' + req.hostArray[1]);
39
+ } else if (req.hostArray.length == 3) {
40
+ req.domain2 = req.hostArray[1];
41
+ req.domain3 = req.hostArray[2];
42
+ req.features.push('host.' + req.domain2);
43
+ req.features.push('host.' + req.domain3);
39
44
  }
40
45
  } else {
41
46
  if (req.hostArray.length == 2) {
42
47
  req.domain = req.hostArray[1] + '.' + req.hostArray[0];
48
+ req.features.push('host.' + req.domain);
43
49
  req.features.push('host.' + req.hostArray[0]);
44
50
  req.features.push('host.' + req.hostArray[1]);
45
51
  } else if (req.hostArray.length == 3) {
46
52
  req.domain = req.hostArray[1] + '.' + req.hostArray[0];
47
- req.subDomain = req.hostArray[2];
53
+ req.domain2 = req.hostArray[2];
54
+ req.features.push('host.' + req.domain);
48
55
  req.features.push('host.' + req.hostArray[0]);
49
56
  req.features.push('host.' + req.hostArray[1]);
50
57
  req.features.push('host.' + req.hostArray[2]);
51
58
  } else if (req.hostArray.length == 4) {
52
59
  req.domain = req.hostArray[1] + '.' + req.hostArray[0];
53
- req.subDomain = req.hostArray[2];
60
+ req.domain2 = req.hostArray[2];
61
+ req.domain3 = req.hostArray[3];
62
+ req.features.push('host.' + req.domain);
54
63
  req.features.push('host.' + req.hostArray[0]);
55
64
  req.features.push('host.' + req.hostArray[1]);
56
65
  req.features.push('host.' + req.hostArray[2]);
@@ -58,7 +67,6 @@ module.exports = function init(req, res, ____0, callback) {
58
67
  }
59
68
  }
60
69
  }
61
- req.origin = req.headers['origin'] || req.host;
62
70
 
63
71
  if (req.cookies.obj && req.cookies.obj['_ga'] && req.cookies.obj['_ga'].contains('sb')) {
64
72
  req.features.push('browser.social');
@@ -124,23 +132,11 @@ module.exports = function init(req, res, ____0, callback) {
124
132
  }
125
133
  }
126
134
 
127
- function ipInfo(session, callback) {
128
- callback(session);
129
-
130
- if (!____0.options.ipLookup) {
131
- return session;
132
- }
133
-
134
- if (session.ip == '127.0.0.1' || session.ip == 'localhost') {
135
- return session;
136
- }
137
-
138
- if (session.$busy) {
135
+ function ipInfo(session) {
136
+ if (session.$busy || !____0.options.ipLookup || session.ip == '127.0.0.1') {
139
137
  return session;
140
138
  }
141
-
142
139
  session.$busy = !0;
143
- ____0.saveSession(session);
144
140
  if (session.ip_list.length === 0 || !session.ip_list.some((info) => info.ip === session.ip)) {
145
141
  ____0
146
142
  .fetch(`http://ip-api.com/json/${session.ip}`, {
@@ -158,13 +154,8 @@ module.exports = function init(req, res, ____0, callback) {
158
154
  info.date = new Date();
159
155
  info.ip = session.ip;
160
156
  session.ip_list.unshift(info);
157
+ session.$busy = !1;
161
158
  ____0.saveSession(session);
162
- setTimeout(() => {
163
- ____0.getSession(session, (session) => {
164
- session.$busy = !1;
165
- ____0.saveSession(session);
166
- });
167
- }, 1000 * 30);
168
159
  });
169
160
  })
170
161
  .catch((err) => {
@@ -199,12 +190,14 @@ module.exports = function init(req, res, ____0, callback) {
199
190
  }
200
191
  req.features.push('login');
201
192
  }
202
- ipInfo(session, callback);
193
+ ____0.saveSession(session);
194
+ callback(session);
195
+ ipInfo(session);
203
196
  }
204
197
  }
205
198
  );
206
199
  } else {
207
- ipInfo(session, callback);
200
+ callback(session);
208
201
  }
209
202
  });
210
203
  };
package/lib/storage.js CHANGED
@@ -2,7 +2,8 @@ module.exports = function init(____0) {
2
2
  const storage = {};
3
3
  storage.list = [];
4
4
  storage.busy = true;
5
- storage.$collectoin = ____0.connectCollection('app_options');
5
+ storage.$collectoin = ____0.connectCollection({ collection: 'app_options', identity: { enabled: true } });
6
+
6
7
  storage.$collectoin.findAll({ app_name: 'storage' }, (err, docs) => {
7
8
  if (!err && docs && docs.length > 0) {
8
9
  docs.forEach((doc) => {
@@ -15,26 +16,27 @@ module.exports = function init(____0) {
15
16
  });
16
17
 
17
18
  storage.save = function () {
18
- if (storage.busy) {
19
- setTimeout(() => {
20
- storage.save();
21
- }, 1000 * 10);
22
- return;
23
- }
24
-
25
- storage.busy = true;
26
19
  storage.list.forEach((doc, i) => {
27
20
  doc.app_name = 'storage';
28
21
  if (doc.$update) {
29
22
  delete doc.$update;
30
- storage.$collectoin.update(doc);
23
+ storage.$collectoin.update(doc, (err, result) => {
24
+ if (!err && result.doc) {
25
+ let index = storage.list.findIndex((s) => s.key === result.doc.key);
26
+ if (index !== -1) {
27
+ storage.list[index] = result.doc;
28
+ }
29
+ }
30
+ });
31
31
  } else if (doc.$add) {
32
32
  delete doc.$add;
33
33
  storage.$collectoin.add(doc, (err, newDoc, oldDoc) => {
34
34
  if (!err && newDoc) {
35
35
  let index = storage.list.findIndex((s) => s.key === newDoc.key);
36
- if (index >= 0) {
36
+ if (index !== -1) {
37
37
  storage.list[index] = newDoc;
38
+ } else {
39
+ storage.list.push(newDoc);
38
40
  }
39
41
  } else if (err) {
40
42
  console.log(err.message, oldDoc);
@@ -42,15 +44,12 @@ module.exports = function init(____0) {
42
44
  });
43
45
  }
44
46
  });
45
- setTimeout(() => {
46
- storage.busy = false;
47
- }, 1000 * 5);
48
47
  };
49
48
 
50
49
  storage.fn = function (key, value) {
51
50
  if (key && value !== undefined) {
52
51
  let index = storage.list.findIndex((s) => s.key === key);
53
- if (index >= 0) {
52
+ if (index !== -1) {
54
53
  storage.list[index].value = value;
55
54
  storage.list[index].$update = true;
56
55
  } else {
@@ -60,13 +59,15 @@ module.exports = function init(____0) {
60
59
  $add: true,
61
60
  });
62
61
  }
63
- storage.save();
64
62
  } else if (key && value === undefined) {
65
63
  return storage.list.find((s) => s.key === key)?.value;
66
64
  } else {
67
65
  return null;
68
66
  }
69
67
  };
68
+ ____0.on('[any][saving data]', function () {
69
+ storage.save();
70
+ });
70
71
 
71
72
  ____0.on(____0.strings[9], () => {
72
73
  ____0.onGET('/x-api/events_list', (req, res) => {
package/lib/temp.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  storage.path = ____0.path.join(____0.options.cwd, ____0.x0md50x(____0.options.name) + '.dbz');
3
- ____0.fs.readFile(storage.path, (err, data) => {
3
+ ____0.fs.readFile(storage.path, (err, file) => {
4
4
  if (!err) {
5
- data = ____0.zlib.inflateSync(data);
5
+ data = ____0.zlib.inflateSync(file.content);
6
6
  storage.list = ____0.fromJson(Buffer.from(data, 'utf-8').toString());
7
7
 
8
8
  if (____0.typeof(storage.list) !== 'Array') {
package/lib/vars.js CHANGED
@@ -34,9 +34,9 @@ module.exports = function init(____0) {
34
34
  }
35
35
 
36
36
  ____0.addVars = function(path){
37
- ____0.readFile(path, (err, data) => {
37
+ ____0.readFile(path, (err, file) => {
38
38
  if (!err) {
39
- let vars = JSON.parse(data)
39
+ let vars = JSON.parse(file.content)
40
40
  for (let i = 0; i < vars.length; i++) {
41
41
  ____0.vars.push(vars[i])
42
42
  }
package/lib/words.js CHANGED
@@ -52,9 +52,9 @@ module.exports = function init(____0) {
52
52
  };
53
53
 
54
54
  app.addFile = function (path) {
55
- ____0.readFile(path, (err, data) => {
55
+ ____0.readFile(path, (err, file) => {
56
56
  if (!err) {
57
- let arr = ____0.fromJson(data);
57
+ let arr = ____0.fromJson(file.content);
58
58
  if (Array.isArray(arr)) {
59
59
  arr.forEach((doc) => {
60
60
  app.add(doc);
@@ -44,9 +44,9 @@ module.exports = function init(____0) {
44
44
  }
45
45
 
46
46
  ____0.addfeatures = function(path){
47
- ____0.readFile(path, (err, data) => {
47
+ ____0.readFile(path, (err, file) => {
48
48
  if (!err) {
49
- let features = JSON.parse(data)
49
+ let features = JSON.parse(file.content)
50
50
  for (let i = 0; i < features.length; i++) {
51
51
  ____0.features.push(features[i])
52
52
  }
@@ -227,26 +227,10 @@ exports = module.exports = function init(____0) {
227
227
 
228
228
  fn.getFileEncode = function (path) {
229
229
  path = path || '';
230
- if (
231
- path.endsWith('.woff2') ||
232
- path.endsWith('.woff') ||
233
- path.endsWith('.ttf') ||
234
- path.endsWith('.svg') ||
235
- path.endsWith('.otf') ||
236
- path.endsWith('.png') ||
237
- path.endsWith('.gif') ||
238
- path.endsWith('.jpg') ||
239
- path.endsWith('.jpeg') ||
240
- path.endsWith('.ico') ||
241
- path.endsWith('.bmp') ||
242
- path.endsWith('.webp') ||
243
- path.endsWith('.xls') ||
244
- path.endsWith('.xlsx') ||
245
- path.endsWith('.eot')
246
- ) {
230
+ if (path.contains('.woff|.ttf|.svg|.otf|.png|.gif|.jpg|.ico|.bmp|.webp|.xls|.eot')) {
247
231
  return 'binary';
248
232
  }
249
- return 'utf8';
233
+ return 'UTF8';
250
234
  };
251
235
 
252
236
  fn.toHtmlTable = function (obj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2023.12.01",
3
+ "version": "2023.12.15",
4
4
  "description": "Create Secure Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {