-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
1 lines (1 loc) · 72.6 KB
/
index.js
1
import*as ReactDOMServer from"react-dom/server";import $ from"jquery";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:t+""}function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}export function HasClass(e,t){return e.hasClass(t)||!!e.parents(`.${t}`).length}export async function DownloadFile(e){let t=e.name,i="https://cors-anywhere.herokuapp.com/",r=i+(e.url||GetFileUrl(e));fetch(r).then(e=>e.blob()).then(e=>{let i=GetFileUrl(e),r=document.createElement("a");r.style.display="none",r.href=i,r.download=t,document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(i)}).catch(()=>alert("oh no!"))}export function GetFileUrl(e){return window.URL.createObjectURL(e)}export async function Stall(e=3e3){await new Promise(t=>setTimeout(t,e))}export function FileToBase64(e,t){let i=new FileReader;i.onload=()=>t(i.result),i.readAsDataURL(e)}export function GetPrecisionCount(e){e=e||0;let t=e.toString(),i=t.indexOf(".");return -1===i?0:t.length-i-1}export function HandleBackButton(e=()=>{}){window.history.pushState({},""),window.history.pushState({},""),window.onpopstate=function(t){window.history.pushState({},""),e()}}export function ParseString(e){try{if(e.startsWith("{")||e.startsWith("["))return JSON.parse(e);if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);{let t=parseFloat(e);return isNaN(t)?e:t}}catch{return e}}export function ReOrder(e,t,i){let r=e[t],s=e.filter((e,i)=>i!==t);return s.splice(i,0,r),s}export class DragClass{constructor(e){_defineProperty(this,"over",void 0),_defineProperty(this,"dragData",void 0),_defineProperty(this,"getDragAttrs",void 0),_defineProperty(this,"getDropAttrs",void 0),_defineProperty(this,"reOrder",void 0);let{callback:t}=e;this.reOrder=(e,t,i)=>ReOrder(e,t,i),this.over=e=>{e.preventDefault()},this.getDragAttrs=e=>({onDragStart:()=>this.dragData=e,onDragOver:this.over,draggable:!0}),this.getDropAttrs=e=>({onDragOver:e=>e.preventDefault(),onDrop:i=>t(this.dragData,e)})}}export function GetClient(e){return"ontouchstart"in document.documentElement&&e.changedTouches?{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}:{x:e.clientX,y:e.clientY}}export function ExportToExcel(e,t={}){let{promptText:i="Inter Excel File Name"}=t;return({fixPersianAndArabicNumbers(e){if("string"!=typeof e)return e;let t=[/۰/g,/۱/g,/۲/g,/۳/g,/۴/g,/۵/g,/۶/g,/۷/g,/۸/g,/۹/g],i=[/٠/g,/١/g,/٢/g,/٣/g,/٤/g,/٥/g,/٦/g,/٧/g,/٨/g,/٩/g],r;for(r=0;r<10;r++)e=e.replace(t[r],r.toString()).replace(i[r],r.toString());return e},getJSON(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i],s={};for(let n in r)s[n]=this.fixPersianAndArabicNumbers(r[n]);t.push(s)}return t},export(){let t=window.prompt(i);if(!t||null===t||!t.length)return;var r=this.getJSON(e),s="object"!=typeof r?JSON.parse(r):r,n="";n+="\r\n\n";{let o="";for(let h in s[0])o+=h+",";n+=(o=o.slice(0,-1))+"\r\n"}for(var l=0;l<s.length;l++){let $="";for(let a in s[l])$+='"'+s[l][a]+'",';$.slice(0,$.length-1),n+=$+"\r\n"}if(""===n){alert("Invalid data");return}var d=t.replace(/ /g,"_"),_="data:text/csv;charset=utf-8,"+encodeURIComponent("\uFEFF"+n);let g=document.createElement("a");g.href=_,g.style="visibility:hidden",g.download=d+".csv",document.body.appendChild(g),g.click(),document.body.removeChild(g)}}).export()}export function SplitNumber(e,t,i){if(!e)return"";t=t||3,i=i||",";let r=e.toString(),s=r.indexOf(".");-1!==s&&(r=r.slice(0,s));let n="",o=0;for(let h=r.length-1;h>=0;h--)n=r[h]+n,o===t-1?(o=0,h>0&&(n=i+n)):o++;return n}export function EventHandler(e,t,i,r,s){r=r||"bind";let n={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend",click:"click"},o="ontouchstart"in document.documentElement,h=o?n[t]:t,l="window"===e?[window]:document.querySelectorAll(e);l.forEach(e=>{if("unbind"===r)e.removeEventListener(h,i);else if("bind"===r){let t=void 0!==s?{passive:s}:void 0;e.addEventListener(h,i,t)}})}export function getValueByStep(e){let{value:t,start:i,step:r,end:s}=e,n=Math.round((t-i)/r)*r+i;return n<i&&(n=i),n>s&&(n=s),n}export function URLToJSON(e){try{return JSON.parse(`{"${decodeURI(e.split("?")[1]).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')}"}`)}catch{return{}}}export function FileSize(e){return e<1024?`${e} bytes`:e>=1024&&e<1048576?`${(e/1024).toFixed(1)} KB`:e>=1048576?`${(e/1048576).toFixed(1)} MB`:void 0}function IsFileTypeValid(e){let t=["image/apng","image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"];return t.includes(e.type)}export function FilePreview(e,t){return IsFileTypeValid(e)?_jsx("img",{src:GetFileUrl(e),alt:e.name,title:e.name,objectFit:"cover",...t}):null}export function JSXToHTML(e){return ReactDOMServer.renderToStaticMarkup(e)}export async function Copy(e){window.navigator.clipboard.writeText(e)}export function IsTouch(){return"ontouchstart"in document.documentElement}export async function Paste(){try{return window.navigator.clipboard.read()}catch(e){console.log(e.message)}}export function Search(e,t,i=e=>e){if(!t)return e;function r(e,t){for(let i=0;i<e.length;i++){let r=e[i];if(-1===t.indexOf(r))return!1}return!0}let s=t.split(" ");return e.filter((e,t)=>r(s,i(e,t)))}export function GenerateComponsition(e){let{level:t=4,length:i=4,childsField:r="childs",fields:s={}}=e,n={generate(e=0,o=""){if(e>=t)return[];let h=[];for(let l=0;l<i;l++){let $=o+"-"+l,a={id:"aa"+Math.round(1e4*Math.random()),[r]:n.generate(e+1,$)};for(let d in s)a[d]=s[d]+o;h.push(a)}return h}};return n.generate()}export function CalculateDistance(e,t,i,r){let s=6371,n=toRadians(i-e),o=toRadians(r-t),h=Math.sin(n/2)*Math.sin(n/2)+Math.cos(toRadians(e))*Math.cos(toRadians(i))*Math.sin(o/2)*Math.sin(o/2),l=2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),$=s*l;return $}export function getEventAttrs(e,t){let i;return{[i=IsTouch()?({onMouseDown:"onTouchStart",onMouseMove:"onTouchMove",onMouseUp:"onTouchEnd"})[e]:e]:t}}function toRadians(e){return e*(Math.PI/180)}export function AddToAttrs(e,t){let{style:i}=t,r,s=[...(e=e||{}).className?e.className.split(" "):[],...(t.className?Array.isArray(t.className)?t.className:t.className.split(" "):[]).filter(e=>!!e)],n=s.length?s.join(" "):void 0,o={...e.style,...i};return{...e,className:n,style:o,...t.attrs}}export class Swip{constructor(e){_defineProperty(this,"p",void 0),_defineProperty(this,"geo",void 0),_defineProperty(this,"timeout",void 0),_defineProperty(this,"count",void 0),_defineProperty(this,"domLimit",void 0),_defineProperty(this,"parentLimit",void 0),_defineProperty(this,"getDom",void 0),_defineProperty(this,"getParent",void 0),_defineProperty(this,"init",void 0),_defineProperty(this,"dx",void 0),_defineProperty(this,"dy",void 0),_defineProperty(this,"cx",void 0),_defineProperty(this,"cy",void 0),_defineProperty(this,"dist",void 0),_defineProperty(this,"so",void 0),_defineProperty(this,"getPercentByValue",void 0),_defineProperty(this,"getMousePosition",void 0),_defineProperty(this,"click",void 0),_defineProperty(this,"mouseDown",void 0),_defineProperty(this,"mouseMove",void 0),_defineProperty(this,"mouseUp",void 0),_defineProperty(this,"getDOMLimit",void 0),_defineProperty(this,"change",void 0),_defineProperty(this,"getPage",void 0),_defineProperty(this,"isMoving",void 0),_defineProperty(this,"centerAngle",void 0),_defineProperty(this,"defaultLimit",void 0),_defineProperty(this,"addSelectRect",void 0),_defineProperty(this,"setSelectRect",void 0),_defineProperty(this,"removeSelectRect",void 0),_defineProperty(this,"selectRect",void 0),_defineProperty(this,"getIsInSelectRect",void 0),_defineProperty(this,"defaultChange",void 0);let{selectRect:t}=e;if(t){let{color:i="#96a9bc"}=t;this.selectRect={...t,color:i}}this.defaultChange={x:0,y:0,dx:0,dy:0,dist:0,angle:0,deltaCenterAngle:0},this.defaultLimit={width:0,height:0,left:0,top:0,right:0,bottom:0,centerX:0,centerY:0},this.domLimit=this.defaultLimit,this.parentLimit=this.defaultLimit,this.change={x:0,y:0,dx:0,dy:0,dist:0,angle:0,deltaCenterAngle:0},this.addSelectRect=()=>{},this.setSelectRect=()=>{},this.removeSelectRect=()=>{},this.so={},this.p=e,this.geo=new Geo,this.timeout=void 0,this.count=0,this.getDom=()=>e.dom(),this.getParent=()=>e.parent?e.parent():void 0,this.dx=0,this.dy=0,this.cx=0,this.cy=0,this.dist=0,this.isMoving=!1,this.centerAngle=0,this.init=()=>{if(this.count++,this.count>10){clearTimeout(this.timeout);return}this.getDom().length?(clearTimeout(this.timeout),EventHandler(this.getDom(),"mousedown",$.proxy(this.mouseDown,this)),e.onClick&&EventHandler(this.getDom(),"click",$.proxy(this.click,this))):this.timeout=setTimeout(()=>this.init(),400)},this.getPercentByValue=(e,t,i)=>100*(e-t)/(i-t),this.getPage=()=>{let{page:e}=this.p;return e?e():$(window)},this.getMousePosition=e=>{this.domLimit=this.getDOMLimit("dom");let t=this.getPage(),i=t.scrollTop(),r=t.scrollLeft(),s=GetClient(e),n=s.x-this.domLimit.left+r,o=s.y-this.domLimit.top+i,h=this.getPercentByValue(n,0,this.domLimit.width),l=this.getPercentByValue(o,0,this.domLimit.height),a=this.geo.getAngle([[this.domLimit.centerX,this.domLimit.centerY],[s.x,s.y]]);return{xp:h,yp:l,clientX:s.x,clientY:s.y,x:n,y:o,centerAngle:a}},this.getDOMLimit=e=>{let t="dom"===e?this.getDom():this.getParent(),i=t.offset(),r={width:t.width(),height:t.height(),left:i.left,top:i.top,centerX:0,centerY:0};return{...r,centerX:r.left+r.width/2,centerY:r.top+r.height/2,right:r.left+r.width,bottom:r.top+r.height}},this.click=t=>{if(this.isMoving)return;this.domLimit=this.getDOMLimit("dom"),this.parentLimit=e.parent?this.getDOMLimit("parent"):this.defaultLimit;let i=this.getMousePosition(t),r={mousePosition:i,domLimit:this.domLimit,parentLimit:this.parentLimit,event:t,change:this.defaultChange};e.onClick&&e.onClick(r)},this.addSelectRect=(e,t)=>{if(!this.selectRect||!this.selectRect.enable())return;let{color:i}=this.selectRect,r=this.getDom();this.so.tsr={left:e,top:t},this.removeSelectRect(),r.append(`<div class="swip-select-rect" style="border:1px dashed ${i};background:${i+"30"};left:${e}px;top:${t}px;position:absolute;width:0;height:0"></div>`)},this.setSelectRect=(e,t)=>{if(!this.selectRect||!this.selectRect.enable())return;let i=this.getDom().find(".swip-select-rect"),{tsr:r={left:0,top:0}}=this.so||{},s=r.left,n=r.top;e<0&&(s+=e,e=Math.abs(e)),t<0&&(n+=t,t=Math.abs(t));let o={left:s,top:n,width:e,height:t};this.so.sr=o,i.css(o)},this.removeSelectRect=()=>{if(this.selectRect&&this.selectRect.enable())this.getDom().find(".swip-select-rect").remove()},this.mouseDown=t=>{t.stopPropagation(),this.isMoving=!1,this.domLimit=this.getDOMLimit("dom"),this.parentLimit=e.parent?this.getDOMLimit("parent"):this.defaultLimit;let i=this.getMousePosition(t);this.centerAngle=i.centerAngle,this.cx=i.clientX,this.cy=i.clientY,this.so={client:{x:i.clientX,y:i.clientY}},this.addSelectRect(i.x,i.y);let r={mousePosition:i,domLimit:this.domLimit,parentLimit:this.parentLimit,event:t,change:this.defaultChange},s=(e.start||(()=>[0,0]))(r);if(!Array.isArray(s))return;let n=s[0],o=s[1];this.so={...this.so,x:n,y:o},EventHandler("window","mousemove",$.proxy(this.mouseMove,this)),EventHandler("window","mouseup",$.proxy(this.mouseUp,this))},this.mouseMove=e=>{e.stopPropagation();let{speedX:t=1,speedY:i=1,stepX:r=1,stepY:s=1,reverseX:n,reverseY:o,insideX:h,insideY:l}=this.p,a=this.getMousePosition(e),d=GetClient(e),_=d.x-this.cx,g=d.y-this.cy;_=Math.round(_*t)*(n?-1:1),g=Math.round(g*i)*(o?-1:1);let f=a.centerAngle-this.centerAngle;if("number"==typeof r&&(_=Math.round(_/r)*r),"number"==typeof s&&(g=Math.round(g/s)*s),_===this.dx&&g===this.dy)return;this.isMoving=!0,this.dx=_,this.dy=g,this.dist=Math.round(Math.sqrt(Math.pow(_,2)+Math.pow(g,2)));let u=this.geo.getAngle([[this.cx,this.cy],[d.x,d.y]]);this.setSelectRect(_,g);let p=0,y=0;if(void 0!==this.so.x&&void 0!==this.so.y){p=this.so.x+_,y=this.so.y+g;let{minX:c,minY:m,maxX:v,maxY:P}=this.p;void 0!==c&&p<c&&(p=c),void 0!==v&&p>v&&(p=v),void 0!==m&&y<m&&(y=m),void 0!==P&&y>P&&(y=P)}!0===r&&(p=Math.round(p/this.domLimit.width)*this.domLimit.width),!0===s&&(y=Math.round(y/this.domLimit.height)*this.domLimit.height),h&&(this.parentLimit?(p>this.parentLimit.width-this.domLimit.width&&(p=this.parentLimit.width-this.domLimit.width),p<0&&(p=0)):alert("Swip error => you set insideX prop but missing parent props")),l&&(this.parentLimit?(y>this.parentLimit.height-this.domLimit.height&&(y=this.parentLimit.height-this.domLimit.height),y<0&&(y=0)):alert("Swip error => you set insideY prop but missing parent props")),this.change={x:p,y,dx:_,dy:g,dist:this.dist,angle:u,deltaCenterAngle:f};let L={change:this.change,mousePosition:a,domLimit:this.domLimit,parentLimit:this.parentLimit,event:e,selectRect:this.so.sr,isInSelectRect:this.getIsInSelectRect(this.so.sr||{left:0,top:0,width:0,height:0})};this.p.move&&this.p.move(L)},this.getIsInSelectRect=e=>{let{left:t,top:i,width:r,height:s}=e;return(e,n)=>!(e<t)&&!(n<i)&&!(e>t+r)&&!(n>i+s)},this.mouseUp=e=>{e.stopPropagation(),EventHandler("window","mousemove",this.mouseMove,"unbind"),EventHandler("window","mouseup",this.mouseUp,"unbind"),setTimeout(()=>this.isMoving=!1,10);let t=this.getMousePosition(e);this.removeSelectRect();let i={change:this.change,event:e,domLimit:this.domLimit,parentLimit:this.parentLimit,mousePosition:t,selectRect:this.so.sr,isInSelectRect:this.getIsInSelectRect(this.so.sr||{left:0,top:0,width:0,height:0})};this.p.end&&this.p.end(i)},this.init()}}export class AIODate{constructor(){_defineProperty(this,"isMatch",void 0),_defineProperty(this,"convertToArray",void 0),_defineProperty(this,"isLess",void 0),_defineProperty(this,"isGreater",void 0),_defineProperty(this,"isEqual",void 0),_defineProperty(this,"isBetween",void 0),_defineProperty(this,"compaire",void 0),_defineProperty(this,"getWeekDay",void 0),_defineProperty(this,"isToday",void 0),_defineProperty(this,"isJalali",void 0),_defineProperty(this,"getWeekDays",void 0),_defineProperty(this,"toGregorian",void 0),_defineProperty(this,"toJalali",void 0),_defineProperty(this,"pattern",void 0),_defineProperty(this,"get2Digit",void 0),_defineProperty(this,"getMonths",void 0),_defineProperty(this,"getSplitter",void 0),_defineProperty(this,"getTime",void 0),_defineProperty(this,"getNextTime",void 0),_defineProperty(this,"getMonthDaysLength",void 0),_defineProperty(this,"getYearDaysLength",void 0),_defineProperty(this,"getDaysOfWeek",void 0),_defineProperty(this,"getDatesBetween",void 0),_defineProperty(this,"getDelta",void 0),_defineProperty(this,"convertMiliseconds",void 0),_defineProperty(this,"getDaysOfMonth",void 0),_defineProperty(this,"getLastDayOfMonth",void 0),_defineProperty(this,"getDateByPattern",void 0),_defineProperty(this,"getToday",void 0),_defineProperty(this,"getDayIndex",void 0),_defineProperty(this,"getYesterday",void 0),_defineProperty(this,"getTomarrow",void 0),_defineProperty(this,"toMiliseconds",void 0),_defineProperty(this,"getDateByDeltaMiliseconds",void 0),this.toMiliseconds=e=>{let{day:t=0,hour:i=0,minute:r=0,second:s=0}=e,n=0;return n+=864e5*t,n+=36e5*i,n+=6e4*r,n+=1e3*s},this.isMatch=(e,t)=>{e=this.convertToArray(e);for(let i=0;i<t.length;i++){let r=t[i],s,n;try{let o=r.split(",");s=o[0],n=o.slice(1,o.length)}catch{break}if("<"===s){for(let h=0;h<n.length;h++)if(this.isLess(e,n[h]))return!0}else if(">"===s){for(let l=0;l<n.length;l++)if(this.isGreater(e,n[l]))return!0}else if("<="===s){for(let $=0;$<n.length;$++)if(this.isEqual(e,n[$])||this.isLess(e,n[$]))return!0}else if(">="===s){for(let a=0;a<n.length;a++)if(this.isEqual(e,n[a])||this.isGreater(e,n[a]))return!0}else if("="===s){for(let d=0;d<n.length;d++)if(this.isEqual(e,n[d]))return!0}else if("!="===s){for(let _=0;_<n.length;_++)if(!this.isEqual(e,n[_]))return!0}else if("<>"===s){if(n[0]&&n[1]){let g,f;if(this.isLess(n[0],n[1])?(g=n[0],f=n[1]):(g=n[1],f=n[0]),this.isGreater(e,g)&&this.isLess(e,f))return!0}}else if("<=>"===s){if(n[0]&&n[1]){let u,p;if(this.isLess(n[0],n[1])?(u=n[0],p=n[1]):(u=n[1],p=n[0]),this.isGreater(e,u)&&this.isLess(e,p)||this.isEqual(e,u)||this.isEqual(e,p))return!0}}else if("!<>"===s){if(n[0]&&n[1]){let y,c;if(this.isLess(n[0],n[1])?(y=n[0],c=n[1]):(y=n[1],c=n[0]),!this.isGreater(e,y)||!this.isLess(e,c))return!0}}else if("!<=>"===s){if(n[0]&&n[1]){let m,v;if(this.isLess(n[0],n[1])?(m=n[0],v=n[1]):(m=n[1],v=n[0]),!this.isEqual(e,m)&&!this.isEqual(e,v)&&(this.isLess(e,m)||this.isGreater(e,v)))return!0}}else if("w"===s){let P=this.getWeekDay(e).index;for(let L=0;L<n.length;L++)if(P===+n[L])return!0}else if("!w"===s){let A=this.getWeekDay(e).index;for(let D=0;D<n.length;D++)if(A!==+n[D])return!0}}return!1},this.convertToArray=(e,t)=>{if(!e)return[];let i;if(Array.isArray(e))i=[...e];else if("string"==typeof e){if(-1!==e.indexOf("T")){let[r,s]=e.split("T"),n=s.split(".")[0].split(":");i=[...r.split("-").map(e=>+e),...n.map(e=>+e),0]}else i=e.split(this.getSplitter(e)).map(e=>+e)}else if("number"==typeof e){let o=new Date(e),h=o.getFullYear(),l=o.getMonth()+1,$=o.getDate(),a=o.getHours(),d=o.getMinutes(),_;i=[h,l,$,a,d,o.getSeconds(),Math.round(o.getMilliseconds()/100)]}else if("object"!=typeof e)return[];else if("function"==typeof e.getMonth){let g=e,f=g.getFullYear(),u=g.getMonth()+1,p=g.getDate(),y=g.getHours(),c=g.getMinutes(),m;i=[f,u,p,y,c,g.getSeconds(),Math.round(g.getMilliseconds()/100)]}else{let v=this.getToday(t),P=e;return[void 0===P.year?v[0]:P.year,void 0===P.month?v[1]:P.month,void 0===P.day?v[2]:P.day,void 0===P.hour?v[3]:P.hour,void 0===P.minute?v[4]:P.minute,void 0===P.second?v[5]:P.second]}if(t){let[L,A,D]=this.toJalali([i[0],i[1],i[2]]);i[0]=L,i[1]=A,i[2]=D}return i},this.compaire=(e,t)=>{e=this.convertToArray(e),t=this.convertToArray(t);let i="equal";for(let r=0;r<e.length;r++){isNaN(t[r])&&(t[r]=e[r]);let s=e[r],n=t[r]||0;if(s<n){i="less";break}if(s>n){i="greater";break}}return i},this.isLess=(e,t)=>"less"===this.compaire(e,t),this.isEqual=(e,t)=>"equal"===this.compaire(e,t),this.isGreater=(e,t)=>"greater"===this.compaire(e,t),this.isBetween=(e,[t,i])=>"greater"===this.compaire(e,t)&&"less"===this.compaire(e,t),this.isToday=e=>this.isEqual(e,this.getToday(this.isJalali(e))),this.getDateByDeltaMiliseconds=(e,t)=>this.convertToArray(this.getTime(e)+t),this.getWeekDay=e=>{let t=this.convertToArray(e),i=this.isJalali(t);t=this.toGregorian(e);let r=new Date(t[0],t[1]-1,t[2]).getDay();return i&&(r+=1,r%=7),{weekDay:this.getWeekDays(i)[r],index:r}},this.isJalali=e=>this.convertToArray(e)[0]<1700,this.getWeekDays=e=>[["شنبه","یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه"],["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]][e?0:1],this.toGregorian=e=>{var t,i,r,s,n;if(!e)return[];let o=this.convertToArray(e);if(!this.isJalali(o))return o;let[h,l,$]=o;for(h+=1595,i=400*~~((n=-355668+365*h+8*~~(h/33)+~~((h%33+3)/4)+$+(l<7?(l-1)*31:(l-7)*30+186))/146097),(n%=146097)>36524&&(i+=100*~~(--n/36524),(n%=36524)>=365&&n++),i+=4*~~(n/1461),(n%=1461)>365&&(i+=~~((n-1)/365),n=(n-1)%365),s=n+1,t=[0,31,i%4==0&&i%100!=0||i%400==0?29:28,31,30,31,30,31,31,30,31,30,31],r=0;r<13&&s>t[r];r++)s-=t[r];return o[0]=i,o[1]=r,o[2]=s,o},this.pattern=(e,t,i=this.isJalali(e))=>{let[r,s,n,o,h,l,$]=e=this.convertToArray(e,i);if(t=t.replace("{year}",r.toString()),"number"==typeof s&&(t=t.replace("{month}",this.get2Digit(s))),"number"==typeof n&&(t=t.replace("{day}",this.get2Digit(n))),"number"==typeof o&&(t=t.replace("{hour}",this.get2Digit(o))),"number"==typeof h&&(t=t.replace("{minute}",this.get2Digit(h))),"number"==typeof l&&(t=t.replace("{second}",this.get2Digit(l))),"number"==typeof $&&(t=t.replace("{tenthsecond}",this.get2Digit($))),-1!==t.indexOf("{monthString}")&&(t=t.replace("{monthString}",this.getMonths(i)[s-1])),-1!==t.indexOf("{weekDay}")){let a=this.getWeekDays(i),{index:d}=this.getWeekDay(e);t=t.replace("{weekDay}",a[d])}return t},this.get2Digit=e=>{let t;try{t=e.toString()}catch{return e.toString()}return 1===t.length&&(t="0"+e),t},this.getMonths=e=>[["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"]][e?0:1],this.toJalali=e=>{var t,i,r,s,n,o;let h=this.convertToArray(e);if(this.isJalali(h))return h;let[l,$,a]=h;return t=[0,31,59,90,120,151,181,212,243,273,304,334],n=$>2?l+1:l,i=-1595+33*~~((o=355666+365*l+~~((n+3)/4)-~~((n+99)/100)+~~((n+399)/400)+a+t[$-1])/12053),o%=12053,i+=4*~~(o/1461),(o%=1461)>365&&(i+=~~((o-1)/365),o=(o-1)%365),o<186?(r=1+~~(o/31),s=1+o%31):(r=7+~~((o-186)/30),s=1+(o-186)%30),h[0]=i,h[1]=r,h[2]=s,h},this.getSplitter=e=>{let t="/";for(let i=0;i<e.length;i++)if(isNaN(parseInt(e[i])))return e[i];return t},this.getTime=(e,t=this.isJalali(e))=>{if(!e)return 0;if("number"==typeof e)return e;let[i,r=1,s=1,n=0,o=0,h=0,l=0]=e=this.convertToArray(e);t&&(e=this.toGregorian([i,r,s,n,o,h,l]));let $=new Date(e[0],e[1]-1,e[2]).getTime();return $+=36e5*n,$+=6e4*o,$+=1e3*h,$+=100*l},this.getNextTime=(e,t,i=this.isJalali(e))=>{if(!t)return this.convertToArray(e);let r=this.getTime(e,i);r+=t;let s=this.convertToArray(r);if(i){let[n,o,h]=this.toJalali(s);s[0]=n,s[1]=o,s[2]=h}return s},this.getMonthDaysLength=e=>{if(!e)return 0;let[t,i]=this.convertToArray(e);return this.isJalali([t,i])?[31,31,31,31,31,31,30,30,30,30,30,-1===[1,5,9,13,17,22,26,30].indexOf(t%33)?29:30][i-1]:new Date(t,i-1,0).getDate()},this.getYearDaysLength=e=>{if(!e)return 0;let[t]=this.convertToArray(e),i=0;for(let r=1;r<=12;r++)i+=this.getMonthDaysLength([t,r]);return i},this.getYesterday=e=>{let[t,i,r]=this.convertToArray(e),s=t,n=i,o=r;return 1===r?1===i?(s-=1,n=12,o=this.getMonthDaysLength([s,n])):(n-=1,o=this.getMonthDaysLength([s,n])):o-=1,[s,n,o]},this.getTomarrow=e=>{let[t,i,r]=this.convertToArray(e),s=t,n=i,o=r,h=this.getMonthDaysLength(e);return r===h?12===i?(s+=1,n=1,o=1):(n+=1,o=1):o+=1,[s,n,o]},this.getDaysOfWeek=(e,t)=>{if(!e)return[];let i=this.convertToArray(e),{index:r}=this.getWeekDay(i),s=[...i];for(let n=0;n<r;n++)s=this.getYesterday(s);let o=[];for(let h=0;h<7;h++)o.push(s),s=this.getTomarrow(s);return t?o.map(e=>this.getDateByPattern(e,t)):o},this.getDatesBetween=(e,t,i=864e5)=>{if(!e||!t||(e=this.convertToArray(e),t=this.convertToArray(t),!this.isGreater(t,e)))return[];let r=this.getDelta(e,t).miliseconds/i;if(isNaN(r)||r>1e3)return console.error("AIODate().getDatesBetween() => too many dates"),[];let s=this.getNextTime(e,i),n=[];for(;this.isLess(s,t);)n.push(s),s=this.getNextTime(s,i);return n},this.getDelta=(e,t,i)=>{let r=this.getTime(e)-this.getTime(t||this.getToday());return this.convertMiliseconds(-r,i)},this.convertMiliseconds=(e=0,t="day")=>{let i;e<0?(i="passed",e=-e):i=e>0?"remaining":"now";let r=["day","hour","minute","second","tenthsecond","milisecond"].indexOf(t),s=0,n=0,o=0,h=0,l=0,$=e;return r<=0&&(s=Math.floor($/864e5),$-=864e5*s),r<=1&&(n=Math.floor($/36e5),$-=36e5*n),r<=2&&(o=Math.floor($/6e4),$-=6e4*o),r<=3&&(h=Math.floor($/1e3),$-=1e3*h),r<=4&&(l=Math.floor($/100)),{day:s,hour:n,minute:o,second:h,tenthsecond:l,miliseconds:e,type:i}},this.getDaysOfMonth=(e,t)=>{if(!e)return[];let i=this.convertToArray(e),r=this.getMonthDaysLength(e),s=[i[0],i[1],1],n=[];for(let o=0;o<r;o++)n.push(s),s=this.getTomarrow(s);return t?n.map(e=>this.getDateByPattern(e,t)):n},this.getLastDayOfMonth=e=>{let t=this.convertToArray(e),i=this.getMonthDaysLength(t);return[t[0],t[1],i]},this.getDateByPattern=(e,t)=>this.pattern(e,t),this.getToday=e=>{let t=new Date,i=[t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),Math.round(t.getMilliseconds()/100)];return e&&(i=this.toJalali(i)),i},this.getDayIndex=(e,t)=>{if(e=this.convertToArray(e),"week"===t){let i=this.getDaysOfWeek(e);for(let r=0;r<i.length;r++){let[s,n,o]=i[r];if(s===e[0]&&n===e[1]&&o===e[2])return r}}if("month"===t)return e[2]-1;if("year"===t){let h=0;for(let l=0;l<e[1]-1;l++)h+=this.getMonthDaysLength(e);return(h+=e[1])-1}return 0}}}export class Geo{constructor(){_defineProperty(this,"getAngle",void 0),_defineProperty(this,"getDipAngle",void 0),_defineProperty(this,"getLength",void 0),_defineProperty(this,"getPrepDip",void 0),_defineProperty(this,"getDip",void 0),_defineProperty(this,"getPrepFromLine",void 0),_defineProperty(this,"getLineBySLA",void 0),_defineProperty(this,"getArcByPoints",void 0),_defineProperty(this,"getAvg",void 0),_defineProperty(this,"getArcBy3Points",void 0),_defineProperty(this,"getYOnLineByX",void 0),_defineProperty(this,"getXOnLineByY",void 0),_defineProperty(this,"getMeet",void 0),_defineProperty(this,"getInnerMeet",void 0),_defineProperty(this,"getDLineByLine",void 0),_defineProperty(this,"getPointsByNGon",void 0),_defineProperty(this,"getLineByDLine",void 0),_defineProperty(this,"tri",void 0),_defineProperty(this,"getPrepToLine",void 0),_defineProperty(this,"getLineType",void 0),_defineProperty(this,"getLine",void 0),_defineProperty(this,"getDLine",void 0),_defineProperty(this,"setLineByLength",void 0),_defineProperty(this,"getParallelLine",void 0),_defineProperty(this,"getPointsByDivide",void 0),_defineProperty(this,"fix",void 0),_defineProperty(this,"setLineByAngle",void 0),_defineProperty(this,"getNumberByStep",void 0),_defineProperty(this,"setLineByOrtho",void 0),_defineProperty(this,"rotateSpline",void 0),_defineProperty(this,"isPointInPath",void 0),_defineProperty(this,"getDXF",void 0),this.getAngle=e=>{let[t,i]="DLine"===this.getLineType(e)?this.getLineByDLine(e):e,r=i[0]-t[0],s=i[1]-t[1],n=this.getLength([[0,0],[r,s]]),o=Math.acos(r/n)/Math.PI*180;return parseFloat((o=0>Math.sign(s)?360-o:o).toFixed(4))},this.getLineType=e=>Array.isArray(e[0])?"Line":"DLine",this.getLine=e=>"Line"===this.getLineType(e)?e:this.getLineByDLine(e),this.getDLine=e=>"DLine"===this.getLineType(e)?e:this.getDLineByLine(e),this.getDipAngle=e=>this.getAngle([0,0,e]),this.getLength=e=>Math.sqrt(Math.pow(e[0][0]-e[1][0],2)+Math.pow(e[0][1]-e[1][1],2)),this.getPrepDip=e=>-1/e,this.getDip=e=>{let t=this.getLine(e);return t[0][1]-t[1][1]/t[0][0]-t[1][0]},this.getLineByDLine=e=>{let[t,i]=e,r=this.getXOnLineByY(e,i+10),s=this.getYOnLineByX(e,r);return[[t,i],[r,s]]},this.getPrepFromLine=(e,t,i)=>{if(!i)return t;let r=this.getDLine(e),s=this.getAngle(r);return this.getLineBySLA(t,i,s-90)[1]},this.getPrepToLine=(e,t)=>{let i=this.getDLine(e),r=[t[0],t[1],this.getPrepDip(i[2])];return this.getMeet(i,r)},this.getLineBySLA=(e,t,i)=>t?[e,[e[0]+this.tri("cos",i)*t,e[1]+this.tri("sin",i)*t]]:[e,e],this.getArcByPoints=(e,t)=>{for(var i=[],r=[],s=0;s<e.length&&3!==s;s++){var n=e[s],o=n.toString();-1===r.indexOf(o)&&(r.push(o),i.push(n))}var h=i[0],l=i[1],$=i[2],a={x:0,y:0,r:0};if(1===i.length)a={r:0,x:h[0],y:h[1]};else if(2===i.length){let d=this.getAvg([h,l]),_=this.getDLineByLine([h,l]),g=this.getPrepFromLine(_,d,t||0);a=t?this.getArcBy3Points(h,g,l):{r:this.getLength([h,l])/2,x:d[0],y:d[1]}}else a=this.getArcBy3Points(h,l,$);return a},this.getAvg=e=>{for(var t=0,i=0,r=e.length,s=0;s<r;s++)t+=e[s][0],i+=e[s][1];return[t/r,i/r]},this.getArcBy3Points=(e,t,i)=>{let r=this.getPrepDip(this.getDip([e,t])),s=this.getPrepDip(this.getDip([t,i])),n=this.getAvg([e,t]),o=this.getAvg([t,i]),h=[n[0],n[1],r],l=[o[0],o[1],s],$=this.getMeet(h,l);if(!$)return{x:0,y:0,r:0};let a=$[0],d=$[1],_=this.getAngle([$,e]),g=this.getAngle([$,t]),f=this.getAngle([$,i]),u;return u=_<g&&g<f?[_,f]:g<f&&f<_?[_,f]:f<_&&_<g?[_,f]:f<g&&g<_?[f,_]:_<f&&f<g?[f,_]:g<_&&_<f?[f,_]:[0,0],{x:a,y:d,r:this.getLength([e,[a,d]]),slice:u}},this.getDLineByLine=e=>{let[t]=e;return[t[0],t[1],this.getDip(e)]},this.getMeet=(e,t)=>{let i=this.getDLine(e),r=this.getDLine(t),[s,n,o]=i,[h,l,$]=r;if(o===$)return!1;if(Math.abs(o)===1/0)return[s,this.getYOnLineByX(r,s)];if(Math.abs($)===1/0)return[h,this.getYOnLineByX(i,h)];var a=(o*s-$*h+l-n)/(o-$),d=o*(a-s)+n;return[a,d]},this.getInnerMeet=(e,t)=>{let i=this.getMeet(e,t);if(!1===i)return!1;if(t[0][0]<t[1][0]){if(i[0]<t[0][0]||i[0]>t[1][0])return!1}else if(i[0]<t[1][0]||i[0]>t[0][0])return!1;if(t[0][1]<t[1][1]){if(i[1]<t[0][1]||i[1]>t[1][1])return!1}else if(i[1]<t[1][1]||i[1]>t[0][1])return!1;if(e[0][0]<e[1][0]){if(i[0]<e[0][0]||i[0]>e[1][0])return!1}else if(i[0]<e[1][0]||i[0]>e[0][0])return!1;if(e[0][1]<e[1][1]){if(i[1]<e[0][1]||i[1]>e[1][1])return!1}else if(i[1]<e[1][1]||i[1]>e[0][1])return!1;return i},this.getYOnLineByX=(e,t)=>{let[i,r,s]=this.getDLine(e);return s===1/0?0:s*(t-i)+r},this.getXOnLineByY=(e,t)=>{let[i,r,s]=this.getDLine(e);return 0===s?0:s===1/0?i:(t-r)/s+i},this.tri=(e,t)=>Math[e](t*Math.PI/180),this.getPointsByNGon=(e,t,i)=>{let r=180-360/t,s=2*+(this.tri("cos",r/2)*e).toFixed(6),n=+(this.tri("sin",r/2)*e).toFixed(6),o=[0,-n,i],h=[0+s/2,-n,i],l=[o,h],$=360/t;for(let a=0;a<t-1;a++){let d=[l[a+1][0]+this.tri("cos",$)*s,l[a+1][1]+this.tri("sin",$)*s,i];$+=360/t,l.push(d)}return l.push(o),l},this.setLineByLength=(e,t,i="end")=>{let r=[0,0],s=[0,0],n=this.getAngle(e);if("center"===i){let o=this.getAvg(e),h=this.getLineBySLA(o,t/2,n+180),l=this.getLineBySLA(o,t/2,n);r=h[1],s=l[1]}else if("end"===i){r=e[0];s=this.getLineBySLA(r,t,n)[1]}else if("start"===i){s=e[1];r=this.getLineBySLA(s,t,n+180)[1]}return[r,s]},this.getParallelLine=(e,t)=>{let i=[],r=e.length;if(2===r){let s=this.getPrepFromLine([e[0],e[1]],e[0],t),n=this.getPrepFromLine([e[0],e[1]],e[1],t);return[s,n]}for(var o=1;o<=r;o++){var h=e[o];if(o===r)break;var l=e[o-1],$=this.getPrepFromLine([l,h],l,t),a=this.getPrepFromLine([l,h],h,t);i.push([$,a])}let d=[];r=i.length;for(let _=0;_<r;_++){let g=i[_],f=i[_-1];if(0===_){e.push([g[0][0],g[0][1]]);continue}let u=this.getMeet(f,g);u&&d.push(u),_===r-1&&e.push([g[1][0],g[1][1]])}return d},this.getPointsByDivide=(e,t)=>{let[i,r]=e,s=this.fix(r[0]-i[0]),n=this.fix(r[1]-i[1]),o=s/t,h=n/t,l=[];for(let $=1;$<t;$++)l.push([i[0]+$*o,i[1]+$*h]);return l},this.fix=e=>parseFloat(e.toFixed(6)),this.setLineByAngle=(e,t)=>{let i=this.getLength(e);return i?(t%=360,this.getLineBySLA([e[0][0],e[0][1]],i,t)):e},this.getNumberByStep=(e,t)=>Math.round(e/t)*t,this.setLineByOrtho=(e,t)=>this.setLineByAngle(e,this.getNumberByStep(this.getAngle(e),t)),this.rotateSpline=(e,t,i)=>{let r=JSON.parse(JSON.stringify(e));for(var s=0;s<r.length;s++){let n=r[s],o=[[...i],[n[0],n[1]]],h=this.getAngle(o);o=this.setLineByAngle(o,t+h),n[0]=o[1][0],n[1]=o[1][1]}return r},this.isPointInPath=(e,t)=>{let i=0;for(let r=0;r<e.length;r++){let s=e[r],n;n=r===e.length-1?e[0]:e[r+1];!1!==this.getInnerMeet([[t[0],t[1]],[9999999999,t[1]]],[[s[0],s[1]],[n[0],n[1]]])&&i++}return i%2!=0},this.getDXF=(e=[])=>{var t={line:function(e){let[t,i]=e,r="";return r+("LINE\r\n8\r\n1\r\n62\r\n0\r\n10\r\n"+t[0]+"\r\n20\r\n"+-1*t[1]+"\r\n30\r\n0.0\r\n11\r\n"+i[0]+"\r\n21\r\n"+-1*i[1]+"\r\n31\r\n0.0\r\n0\r\n")},rect:function(e){let[t,i]=e;var r="";return r+=this.line([[t[0],t[1]],[i[0],i[1]]]),r+=this.line([[i[0],t[1]],[i[0],i[1]]]),r+=this.line([[i[0],i[1]],[t[0],i[1]]]),r+=this.line([[t[0],i[1]],[t[0],t[1]]])},arc:function(e){let{x:t,y:i,r,slice:s=[0,360]}=e,n="";return n+="ARC\r\n8\r\n1\r\n62\r\n0\r\n10\r\n"+t+"\r\n20\r\n"+-1*i+"\r\n30\r\n0.0\r\n40\r\n"+r+"\r\n50\r\n"+s[0]+"\r\n51\r\n"+s[1]+"\r\n0\r\n",e}};let i="";for(let r=0;r<e.length;r++){var{type:s,obj:n}=e[r];i+=t[s](n)}var o="0\r\nSECTION\r\n2\r\nENTITIES\r\n0\r\n";return o+=i,o+="ENDSEC\r\n0\r\nEOF"}}}export function GetCities(){return{"آذربایجان شرقی":["اسکو","اهر","ایلخچی","آبش احمد","آذرشهر","آقکند","باسمنج","بخشایش","بستان آباد","بناب","بناب جدید","تبریز","ترک","ترکمانچای","تسوج","تیکمه داش","جلفا","خاروانا","خامنه","خراجو","خسروشهر","خضرلو","خمارلو","خواجه","دوزدوزان","زرنق","زنوز","سراب","سردرود","سهند","سیس","سیه رود","شبستر","شربیان","شرفخانه","شندآباد","صوفیان","عجب شیر","قره آغاج","کشکسرای","کلوانق","کلیبر","کوزه کنان","گوگان","لیلان","مراغه","مرند","ملکان","ملک کیان","ممقان","مهربان","میانه","نظرکهریزی","هادی شهر","هرگلان","هریس","هشترود","هوراند","وایقان","ورزقان","یامچی"],"آذربایجان غربی":["ارومیه","اشنویه","ایواوغلی","آواجیق","باروق","بازرگان","بوکان","پلدشت","پیرانشهر","تازه شهر","تکاب","چهاربرج","خوی","دیزج دیز","ربط","سردشت","سرو","سلماس","سیلوانه","سیمینه","سیه چشمه","شاهین دژ","شوط","فیرورق","قره ضیاءالدین","قطور","قوشچی","کشاورز","گردکشانه","ماکو","محمدیار","محمودآباد","مهاباد","میاندوآب","میرآباد","نالوس","نقده","نوشین"],اردبیل:["اردبیل","اصلاندوز","آبی بیگلو","بیله سوار","پارس آباد","تازه کند","تازه کندانگوت","جعفرآباد","خلخال","رضی","سرعین","عنبران","فخرآباد","کلور","کوراییم","گرمی","گیوی","لاهرود","مشگین شهر","نمین","نیر","هشتجین","هیر"],اصفهان:["ابریشم","ابوزیدآباد","اردستان","اژیه","اصفهان","افوس","انارک","ایمانشهر","آران وبیدگل","بادرود","باغ بهادران","بافران","برزک","برف انبار","بهاران شهر","بهارستان","بوئین و میاندشت","پیربکران","تودشک","تیران","جندق","جوزدان","جوشقان و کامو","چادگان","چرمهین","چمگردان","حبیب آباد","حسن آباد","حنا","خالدآباد","خمینی شهر","خوانسار","خور","خورزوق","داران","دامنه","درچه","دستگرد","دهاقان","دهق","دولت آباد","دیزیچه","رزوه","رضوانشهر","زاینده رود","زرین شهر","زواره","زیباشهر","سده لنجان","سفیدشهر","سگزی","سمیرم","شاهین شهر","شهرضا","طالخونچه","عسگران","علویجه","فرخی","فریدونشهر","فلاورجان","فولادشهر","قمصر","قهجاورستان","قهدریجان","کاشان","کرکوند","کلیشاد و سودرجان","کمشچه","کمه","کهریزسنگ","کوشک","کوهپایه","گرگاب","گزبرخوار","گلپایگان","گلدشت","گلشهر","گوگد","لای بید","مبارکه","مجلسی","محمدآباد","مشکات","منظریه","مهاباد","میمه","نائین","نجف آباد","نصرآباد","نطنز","نوش آباد","نیاسر","نیک آباد","هرند","ورزنه","ورنامخواست","وزوان","ونک"],البرز:["اسارا","اشتهارد","تنکمان","تهران دشت","چهارباغ","ساوجبلاغ","سعید آباد","شهر جدید هشتگرد","طالقان","فردیس","کرج","کردان","کمال شهر","کوهسار","گرمدره","گلبهار","ماهدشت","محمدشهر","مشکین دشت","نظرآباد","هشتگرد"],ایلام:["ارکواز","ایلام","ایوان","آبدانان","آسمان آباد","بدره","پهله","توحید","چوار","دره شهر","دلگشا","دهلران","زرنه","سراب باغ","سرابله","صالح آباد","لومار","مهران","مورموری","موسیان","میمه"],بوشهر:["امام حسن","انارستان","اهرم","آب پخش","آبدان","برازجان","بردخون","بندردیر","بندردیلم","بندرریگ","بندرکنگان","بندرگناوه","بنک","بوشهر","تنگ ارم","جم","چغادک","خارک","خورموج","دالکی","دلوار","ریز","سعدآباد","سیراف","شبانکاره","شنبه","عسلویه","کاکی","کلمه","نخل تقی","وحدتیه"],تهران:["ارجمند","اسلامشهر","اندیشه","آبسرد","آبعلی","باغستان","باقرشهر","بومهن","پاکدشت","پردیس","پرند","پیشوا","تهران","جوادآباد","چهاردانگه","حسن آباد","دماوند","دیزین","شهر ری","رباط کریم","رودهن","شاهدشهر","شریف آباد","شمشک","شهریار","صالح آباد","صباشهر","صفادشت","فردوسیه","فشم","فیروزکوه","قدس","قرچک","قیامدشت","کهریزک","کیلان","گلستان","لواسان","مارلیک","ملارد","میگون","نسیم شهر","نصیرآباد","وحیدیه","ورامین"],"چهارمحال و بختیاری":["اردل","آلونی","باباحیدر","بروجن","بلداجی","بن","جونقان","چلگرد","سامان","سفیددشت","سودجان","سورشجان","شلمزار","شهرکرد","طاقانک","فارسان","فرادنبه","فرخ شهر","کیان","گندمان","گهرو","لردگان","مال خلیفه","ناغان","نافچ","نقنه","هفشجان"],"خراسان جنوبی":["ارسک","اسدیه","اسفدن","اسلامیه","آرین شهر","آیسک","بشرویه","بیرجند","حاجی آباد","خضری دشت بیاض","خوسف","زهان","سرایان","سربیشه","سه قلعه","شوسف","طبس ","فردوس","قاین","قهستان","محمدشهر","مود","نهبندان","نیمبلوک"],"خراسان رضوی":["احمدآباد صولت","انابد","باجگیران","باخرز","بار","بایگ","بجستان","بردسکن","بیدخت","بینالود","تایباد","تربت جام","تربت حیدریه","جغتای","جنگل","چاپشلو","چکنه","چناران","خرو","خلیل آباد","خواف","داورزن","درگز","در رود","دولت آباد","رباط سنگ","رشتخوار","رضویه","روداب","ریوش","سبزوار","سرخس","سفیدسنگ","سلامی","سلطان آباد","سنگان","شادمهر","شاندیز","ششتمد","شهرآباد","شهرزو","صالح آباد","طرقبه","عشق آباد","فرهادگرد","فریمان","فیروزه","فیض آباد","قاسم آباد","قدمگاه","قلندرآباد","قوچان","کاخک","کاریز","کاشمر","کدکن","کلات","کندر","گلمکان","گناباد","لطف آباد","مزدآوند","مشهد","ملک آباد","نشتیفان","نصرآباد","نقاب","نوخندان","نیشابور","نیل شهر","همت آباد","یونسی"],"خراسان شمالی":["اسفراین","ایور","آشخانه","بجنورد","پیش قلعه","تیتکانلو","جاجرم","حصارگرمخان","درق","راز","سنخواست","شوقان","شیروان","صفی آباد","فاروج","قاضی","گرمه","لوجلی"],خوزستان:["اروندکنار","الوان","امیدیه","اندیمشک","اهواز","ایذه","آبادان","آغاجاری","باغ ملک","بستان","بندرامام خمینی","بندرماهشهر","بهبهان","ترکالکی","جایزان","چمران","چویبده","حر","حسینیه","حمزه","حمیدیه","خرمشهر","دارخوین","دزآب","دزفول","دهدز","رامشیر","رامهرمز","رفیع","زهره","سالند","سردشت","سوسنگرد","شادگان","شاوور","شرافت","شوش","شوشتر","شیبان","صالح شهر","صفی آباد","صیدون","قلعه تل","قلعه خواجه","گتوند","لالی","مسجدسلیمان","ملاثانی","میانرود","مینوشهر","هفتگل","هندیجان","هویزه","ویس"],زنجان:["ابهر","ارمغان خانه","آب بر","چورزق","حلب","خرمدره","دندی","زرین آباد","زرین رود","زنجان","سجاس","سلطانیه","سهرورد","صائین قلعه","قیدار","گرماب","ماه نشان","هیدج"],سمنان:["امیریه","ایوانکی","آرادان","بسطام","بیارجمند","دامغان","درجزین","دیباج","سرخه","سمنان","شاهرود","شهمیرزاد","کلاته خیج","گرمسار","مجن","مهدی شهر","میامی"],"سیستان و بلوچستان":["ادیمی","اسپکه","ایرانشهر","بزمان","بمپور","بنت","بنجار","پیشین","جالق","چابهار","خاش","دوست محمد","راسک","زابل","زابلی","زاهدان","زهک","سراوان","سرباز","سوران","سیرکان","علی اکبر","فنوج","قصرقند","کنارک","گشت","گلمورتی","محمدان","محمدآباد","محمدی","میرجاوه","نصرت آباد","نگور","نوک آباد","نیک شهر","هیدوچ"],فارس:["اردکان","ارسنجان","استهبان","اشکنان","افزر","اقلید","امام شهر","اهل","اوز","ایج","ایزدخواست","آباده","آباده طشک","باب انار","بالاده","بنارویه","بهمن","بوانات","بیرم","بیضا","جنت شهر","جهرم","جویم","زرین دشت","حسن آباد","خان زنیان","خاوران","خرامه","خشت","خنج","خور","داراب","داریان","دبیران","دژکرد","دهرم","دوبرجی","رامجرد","رونیز","زاهدشهر","زرقان","سده","سروستان","سعادت شهر","سورمق","سیدان","ششده","شهرپیر","شهرصدرا","شیراز","صغاد","صفاشهر","علامرودشت","فدامی","فراشبند","فسا","فیروزآباد","قائمیه","قادرآباد","قطب آباد","قطرویه","قیر","کارزین (فتح آباد)","کازرون","کامفیروز","کره ای","کنارتخته","کوار","گراش","گله دار","لار","لامرد","لپویی","لطیفی","مبارک آباددیز","مرودشت","مشکان","مصیری","مهر","میمند","نوبندگان","نوجین","نودان","نورآباد","نی ریز","وراوی"],قزوین:["ارداق","اسفرورین","اقبالیه","الوند","آبگرم","آبیک","آوج","بوئین زهرا","بیدستان","تاکستان","خاکعلی","خرمدشت","دانسفهان","رازمیان","سگزآباد","سیردان","شال","شریفیه","ضیاآباد","قزوین","کوهین","محمدیه","محمودآباد نمونه","معلم کلایه","نرجه"],قم:["جعفریه","دستجرد","سلفچگان","قم","قنوات","کهک"],کردستان:["آرمرده","بابارشانی","بانه","بلبان آباد","بوئین سفلی","بیجار","چناره","دزج","دلبران","دهگلان","دیواندره","زرینه","سروآباد","سریش آباد","سقز","سنندج","شویشه","صاحب","قروه","کامیاران","کانی دینار","کانی سور","مریوان","موچش","یاسوکند"],کرمان:["اختیارآباد","ارزوئیه","امین شهر","انار","اندوهجرد","باغین","بافت","بردسیر","بروات","بزنجان","بم","بهرمان","پاریز","جبالبارز","جوپار","جوزم","جیرفت","چترود","خاتون آباد","خانوک","خورسند","درب بهشت","دهج","رابر","راور","راین","رفسنجان","رودبار","ریحان شهر","زرند","زنگی آباد","زیدآباد","سیرجان","شهداد","شهربابک","صفائیه","عنبرآباد","فاریاب","فهرج","قلعه گنج","کاظم آباد","کرمان","کشکوئیه","کهنوج","کوهبنان","کیانشهر","گلباف","گلزار","لاله زار","ماهان","محمدآباد","محی آباد","مردهک","مس سرچشمه","منوجان","نجف شهر","نرماشیر","نظام شهر","نگار","نودژ","هجدک","یزدان شهر"],کرمانشاه:["ازگله","اسلام آباد غرب","باینگان","بیستون","پاوه","تازه آباد","جوان رود","حمیل","ماهیدشت","روانسر","سرپل ذهاب","سرمست","سطر","سنقر","سومار","شاهو","صحنه","قصرشیرین","کرمانشاه","کرندغرب","کنگاور","کوزران","گهواره","گیلانغرب","میان راهان","نودشه","نوسود","هرسین","هلشی"],"کهگیلویه و بویراحمد":["باشت","پاتاوه","چرام","چیتاب","دهدشت","دوگنبدان","دیشموک","سوق","سی سخت","قلعه رئیسی","گراب سفلی","لنده","لیکک","مادوان","مارگون","یاسوج"],گلستان:["انبارآلوم","اینچه برون","آزادشهر","آق قلا","بندرترکمن","بندرگز","جلین","خان ببین","دلند","رامیان","سرخنکلاته","سیمین شهر","علی آباد کتول","فاضل آباد","کردکوی","کلاله","گالیکش","گرگان","گمیش تپه","گنبدکاووس","مراوه","مینودشت","نگین شهر","نوده خاندوز","نوکنده"],لرستان:["ازنا","اشترینان","الشتر","الیگودرز","بروجرد","پلدختر","چالانچولان","چغلوندی","چقابل","خرم آباد","درب گنبد","دورود","زاغه","سپیددشت","سراب دوره","فیروزآباد","کونانی","کوهدشت","گراب","معمولان","مومن آباد","نورآباد","ویسیان"],گیلان:["احمدسرگوراب","اسالم","اطاقور","املش","آستارا","آستانه اشرفیه","بازار جمعه","بره سر","بندرانزلی","پره سر","پیربازار","تالش","توتکابن","جیرنده","چابکسر","چاف و چمخاله","چوبر","حویق","خشکبیجار","خمام","دیلمان","زیباکنار","رانکوه","رحیم آباد","رستم آباد","رشت","رضوانشهر","رودبار","رودبنه","رودسر","سنگر","سیاهکل","شفت","شلمان","صومعه سرا","فومن","کلاچای","کوچصفهان","کومله","کیاشهر","گوراب زرمیخ","لاهیجان","لشت نشا","لنگرود","لوشان","لولمان","لوندویل","لیسار","ماسال","ماسوله","مرجقل","منجیل","واجارگاه"],مازندران:["امیرکلا","ایزدشهر","آلاشت","آمل","بابل","بابلسر","بلده","بهشهر","بهنمیر","پل سفید","تنکابن","جویبار","چالوس","چمستان","خرم آباد","خلیل شهر","خوش رودپی","دابودشت","رامسر","رستمکلا","رویان","رینه","زرگرمحله","زیرآب","سادات شهر","ساری","سرخرود","سلمان شهر","سورک","شیرگاه","شیرود","عباس آباد","فریدونکنار","فریم","قائم شهر","کتالم","کلارآباد","کلاردشت","کله بست","کوهی خیل","کیاسر","کیاکلا","گتاب","گزنک","گلوگاه","محمودآباد","مرزن آباد","مرزیکلا","نشتارود","نکا","نور","نوشهر"],مرکزی:["اراک","آستانه","آشتیان","پرندک","تفرش","توره","جاورسیان","خشکرود","خمین","خنداب","داودآباد","دلیجان","رازقان","زاویه","ساروق","ساوه","سنجان","شازند","غرق آباد","فرمهین","قورچی باشی","کرهرود","کمیجان","مامونیه","محلات","مهاجران","میلاجرد","نراق","نوبران","نیمور","هندودر"],هرمزگان:["ابوموسی","بستک","بندرجاسک","بندرچارک","بندرخمیر","بندرعباس","بندرلنگه","بیکا","پارسیان","تخت","جناح","حاجی آباد","درگهان","دهبارز","رویدر","زیارتعلی","سردشت","سندرک","سوزا","سیریک","فارغان","فین","قشم","قلعه قاضی","کنگ","کوشکنار","کیش","گوهران","میناب","هرمز","هشتبندی"],همدان:["ازندریان","اسدآباد","برزول","بهار","تویسرکان","جورقان","جوکار","دمق","رزن","زنگنه","سامن","سرکان","شیرین سو","صالح آباد","فامنین","فرسفج","فیروزان","قروه درجزین","قهاوند","کبودر آهنگ","گل تپه","گیان","لالجین","مریانج","ملایر","نهاوند","همدان"],یزد:["ابرکوه","احمدآباد","اردکان","اشکذر","بافق","بفروئیه","بهاباد","تفت","حمیدیا","خضرآباد","دیهوک","رضوانشهر","زارچ","شاهدیه","طبس","عقدا","مروست","مهردشت","مهریز","میبد","ندوشن","نیر","هرات","یزد"]}}export function Get2Digit(e){let t=e.toString();return 1===t.length?"0"+t:t}function svgArcRange(e,t,i,r){let s=(r-90)*Math.PI/180;return{x:e+i*Math.cos(s),y:t+i*Math.sin(s)}}export function svgArc(e,t,i,r,s){(r===s||s-r==360)&&(r=0,s=360),360===r&&(r=359.99),360===s&&(s=359.99);let n=svgArcRange(e,t,i,s),o=svgArcRange(e,t,i,r),h;return h=s-r<-180?"0":s-r<0?"1":s-r<=180?"0":s-r<=360?"1":"0",["M",n.x,n.y,"A",i,i,0,h,0,o.x,o.y].join(" ")}export function getValueByField(data,field,def){let a;try{eval(`a = data.${field}`)}catch{}return void 0===a?def:a}export function setValueByField(e={},t,i){try{t=t.replace(/\[/g,".").replace(/\]/g,"")}catch{}let r=t.split("."),s=e;for(let n=0;n<r.length-1;n++){let o=r[n];o&&(void 0===s[o]&&(isNaN(+r[n+1])?s[o]={}:s[o]=[]),s=s[o])}return s[r[r.length-1]]=i,e}export function GetArray(e,t){return t=t||(e=>e),Array(e).fill(0).map((e,i)=>{if(t)return t(i)})}export function GetRandomNumber(e,t){return e+Math.round(Math.random()*(t-e))}export class Storage{constructor(e){_defineProperty(this,"model",void 0),_defineProperty(this,"time",void 0),_defineProperty(this,"init",void 0),_defineProperty(this,"saveStorage",void 0),_defineProperty(this,"getParent",void 0),_defineProperty(this,"removeValueByField",void 0),_defineProperty(this,"setValueByField",void 0),_defineProperty(this,"getValueByField",void 0),_defineProperty(this,"save",void 0),_defineProperty(this,"remove",void 0),_defineProperty(this,"load",void 0),_defineProperty(this,"clear",void 0),_defineProperty(this,"download",void 0),_defineProperty(this,"export",void 0),_defineProperty(this,"read",void 0),_defineProperty(this,"import",void 0),_defineProperty(this,"getModel",void 0),this.model={},this.time={},this.init=()=>{let t=localStorage.getItem("storageClass"+e),i=localStorage.getItem("storageClassTime"+e),r,s;r=null==t?{}:JSON.parse(t),s=null==i?{}:JSON.parse(i),this.model=r,this.time=s,this.saveStorage(r,s)},this.saveStorage=(t,i)=>{localStorage.setItem("storageClass"+e,JSON.stringify(t)),localStorage.setItem("storageClassTime"+e,JSON.stringify(i))},this.getParent=e=>{let t=e.split("."),i=this.model;for(let r=0;r<t.length-1;r++)if("object"!=typeof(i=i[t[r]]))return;return i},this.removeValueByField=e=>{let t=e.split("."),i=this.getParent(e),r=t[t.length-1],s={};for(let n in i)n!==r&&(s[n]=i[n]);return t.pop(),this.setValueByField(t.join("."),s)},this.setValueByField=(e,t)=>{if(!e){this.model=t;return}var i=e.split("."),r=this.model;for(let s=0;s<i.length-1;s++){let n=i[s];void 0===r[n]&&(r[n]={}),r=r[n]}return r[i[i.length-1]]=t,this.getValueByField(i[0])},this.getValueByField=e=>{let t=e.split("."),i={...this.model};for(let r=0;r<t.length-1;r++)if("object"!=typeof(i=i[t[r]]))return;return i[t[t.length-1]]},this.save=(e,t)=>{try{t=JSON.parse(JSON.stringify(t))}catch{}if(!e||null===e)return{};let i=this.setValueByField(e,t);return this.time[e]=new Date().getTime(),this.saveStorage(this.model,this.time),i},this.remove=(e,t=()=>{})=>{let i=this.removeValueByField(e),r={};for(let s in this.time)s!==e&&(r[s]=this.time[s]);return this.time=r,this.saveStorage(this.model,this.time),t(),i},this.load=(e,t,i)=>{let r=this.getValueByField(e);if(i&&void 0!==r){let s=new Date().getTime(),n=this.time[e]||s;Math.abs(s-n)>i&&(r=void 0)}return void 0===r&&void 0!==t&&(r="function"==typeof t?t():t,this.save(e,t)),r},this.clear=()=>{this.model={},this.time={},this.saveStorage(this.model,this.time)},this.download=(e,t)=>{if(!t||null===t)return;let i=JSON.stringify(e),r=document.createElement("a");r.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(i)),r.setAttribute("download",t),r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)},this.export=()=>{let e=window.prompt("Please Inter File Name");null!==e&&e&&this.download({model:this.model,time:this.time},e)},this.read=(e,t=()=>{})=>{var i=new FileReader;i.onload=()=>{try{t(JSON.parse(i.result))}catch{return}},i.readAsText(e)},this.import=(e,t=()=>{})=>{this.read(e,e=>{if(void 0===e)return;let{model:i,time:r}=e;this.model=i,this.time=r,this.saveStorage(this.model,this.time),t()})},this.getModel=()=>JSON.parse(JSON.stringify(this.model)),this.init()}}export default class DateData{constructor(e){_defineProperty(this,"data",void 0),_defineProperty(this,"getToday",void 0),_defineProperty(this,"setDayValue",void 0),_defineProperty(this,"getYearDic",void 0),_defineProperty(this,"getMonthDic",void 0),_defineProperty(this,"getDayDic",void 0),_defineProperty(this,"getDayValue",void 0),_defineProperty(this,"getMonthList",void 0),_defineProperty(this,"getYearList",void 0),_defineProperty(this,"getWeekList",void 0),_defineProperty(this,"getData",void 0),_defineProperty(this,"d",void 0),this.data=e,this.d=new AIODate,this.getToday=()=>this.d.convertToArray(this.d.getTime(this.d.getToday())-432e5,!0),this.getData=()=>this.data,this.getYearDic=([e])=>{let t=this.data[e.toString()];return t||(this.data[e.toString()]={},t=this.data[e.toString()]),t},this.getMonthDic=([e,t])=>{let i=this.getYearDic([e]),r=i[t.toString()];return r||(i[t.toString()]={},r=i[t.toString()]),r},this.getDayDic=([e,t,i])=>{let r=this.getMonthDic([e,t]),s=r[i.toString()];return s||(r[i.toString()]={},s=r[i.toString()]),s},this.getDayValue=([e,t,i],r,s)=>{let n=this.getDayDic([e,t,i]);return r?getValueByField(n,r,s):void 0===n?s:n},this.setDayValue=(e,t)=>{let i=this.getDayDic(e);for(let r in t)i[r]=t[r]},this.getMonthList=([e,t],i,r)=>{let s=this.d.getMonthDaysLength([e,t]),n=[];for(let o=1;o<=s;o++){let h=[e,t,o],l=this.getDayValue(h,i,r);void 0!==l&&n.push({date:h,value:l})}return n},this.getWeekList=([e,t,i],r,s)=>{let n=this.d.getDaysOfWeek([e,t,i]),o=[];for(let h=0;h<n.length;h++){let l=n[h],$=this.getDayValue(l,r,s);void 0!==$&&o.push({date:l,value:$})}return JSON.parse(JSON.stringify(o))},this.getYearList=([e],t,i)=>{let r=[];for(let s=1;s<=12;s++)r=r.concat(this.getMonthList([e,s],t,i));return r}}};export function DisabledContextMenu(){window.addEventListener("contextmenu",e=>e.preventDefault())}export class Validation{constructor(e){_defineProperty(this,"contain",void 0),_defineProperty(this,"startBy",void 0),_defineProperty(this,"equal",void 0),_defineProperty(this,"less",void 0),_defineProperty(this,"greater",void 0),_defineProperty(this,"between",void 0),_defineProperty(this,"getMessage",void 0),_defineProperty(this,"translate",void 0),_defineProperty(this,"getResult",void 0),_defineProperty(this,"getValidation",void 0),_defineProperty(this,"validate",void 0),_defineProperty(this,"boolKey",void 0),_defineProperty(this,"boolDic",void 0),_defineProperty(this,"getUnit",void 0);let{lang:t="en",value:i}=e,r="string"==typeof i&&-1!==i.indexOf("/");this.boolDic=r?{more:{en:"after",fa:"بعد از"},less:{en:"before",fa:"قبل از"}}:{more:{en:"more",fa:"بیشتر"},less:{en:"less",fa:"کمتر"}},this.boolKey=e=>this.boolDic[e][t];let s=new AIODate;this.contain=(e,t)=>{let i;return i=Array.isArray(t)?-1!==t.indexOf(e):"number"===e?/\d/.test(t):"letter"===e?/[a-zA-Z]/.test(t):"uppercase"===e?/[A-Z]/.test(t):"lowercase"===e?/[a-z]/.test(t):"symbol"===e?/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]+/.test(t):"function"==typeof e.test?e.test(t):-1!==t.indexOf(e),{result:i,unit:""}},this.startBy=(e,t)=>({result:0===t.indexOf(e),unit:""}),this.equal=(e,t)=>{let i=Array.isArray(t)?"array":typeof t,n=typeof e,o,h;return r?(o=s.isEqual(t,"number"==typeof e?e.toString():e),h=""):("array"===i||"string"===i)&&"number"===n?(o=t.length===e,h=this.getUnit(t)):(o=JSON.stringify(t)===JSON.stringify(e),h=""),{result:o,unit:h}},this.less=(e,t,i)=>{let n=Array.isArray(t)?"array":typeof t,o=typeof e,h,l="";return r?(h=s.isLess(t,"number"==typeof e?e.toString():e),l=""):"number"===o&&"number"===n?(h=t<e,l=""):("array"===n||"string"===n)&&"number"===o?(h=t.length<e,l=this.getUnit(t)):(h=!1,l=""),{result:i?h||this.equal(e,t).result:h,unit:l}},this.greater=(e,t,i)=>{let n=Array.isArray(t)?"array":typeof t,o=typeof e,h,l;return r?(h=s.isGreater(t,"number"==typeof e?e.toString():e),l=""):"number"===o&&"number"===n?(h=t>e,l=""):("array"===n||"string"===n)&&"number"===o?(h=t.length>e,l=this.getUnit(t)):(h=!1,l=""),{result:i?h||this.equal(e,t).result:h,unit:l}},this.between=(e,t,i)=>{let r=this.greater(e[0],t).result,s=this.less(e[1],t).result,n=!!r&&!!s;return{result:i?n||this.equal(e[0],t).result||this.equal(e[1],t).result:n,unit:""}},this.translate=(e,i)=>{let r;return(r=i?{contain:{en:"should not be contain",fa:`نمی تواند شامل`},">":{en:`could not be ${this.boolKey("more")} than`,fa:`نباید ${this.boolKey("more")} از`},">=":{en:`could not be ${this.boolKey("more")} than or equal`,fa:`نباید ${this.boolKey("more")} یا مساوی`},"<":{en:`could not be ${this.boolKey("less")} than`,fa:`نباید ${this.boolKey("less")} از`},"<=":{en:`could not be ${this.boolKey("less")} than or equal`,fa:`نباید ${this.boolKey("less")} یا مساوی`},"=":{en:"cannot be equal",fa:`نمی تواند برابر`},startBy:{en:"should not start by",fa:`نباید در ابتدا شامل`},"<>":{en:"should not be between",fa:`نباید بین`},"<=>":{en:"should not be between",fa:`نباید بین یا برابر`},required:{en:"",fa:""}}:{contain:{en:"should be contain",fa:`باید شامل`},">":{en:`should be ${this.boolKey("more")} than`,fa:`باید ${this.boolKey("more")} از`},">=":{en:`should be ${this.boolKey("more")} than or equal`,fa:`باید ${this.boolKey("more")} یا مساوی`},"<":{en:`should be ${this.boolKey("less")} than`,fa:`باید ${this.boolKey("less")} از`},"<=":{en:`should be ${this.boolKey("less")} than or equal`,fa:`باید ${this.boolKey("less")} یا مساوی`},"=":{en:"should be equal",fa:`باید برابر`},startBy:{en:"should start by",fa:`باید در ابتدا شامل`},"<>":{en:"should be between",fa:`باید بین`},"<=>":{en:"should be between",fa:`باید بین یا برابر`},required:{en:"",fa:""}})[e][t]},this.getMessage=t=>{let{translate:i,target:r,unit:s,title:n,message:o}=t;return o?o:(`${n} ${i} ${r} ${s}`+("fa"===e.lang?" باشد":"")).trim()},this.getResult=e=>{let{target:t,message:i,title:r="",value:s,operator:n,not:o,equal:h,fn:l}=e,{result:$,unit:a}=(l=this[l])(t,s,h);if(o&&$||!o&&!$){let d=this.translate(n,o);return!r||this.getMessage({translate:d,target:t,message:i,title:r,unit:a})}return!1},this.getUnit=e=>{let i="";return Array.isArray(e)?i="fa"===t?"مورد":"items(s)":"string"==typeof e&&(i="fa"===t?"کاراکتر":"character(s)"),i},this.getValidation=()=>{let{value:i,validations:r=[]}=e;for(let s=0;s<r.length;s++){let n=r[s],o,h,l,$,a,d,_;if("string"==typeof n){let g=ValidationTextToObject(n,e.title);o=g.title,h=g.target,l=g.not,$=g.equal,a=g.fn,d=g.operator,_=g.message}else{o=n.title,h=n.target,d=n.operator,_=n.message;let f=getOperatorDetails(d);$=f.equal,l=f.not,a=f.fn}if("required"===d){let u=null==i||""===i||!1===i||0===i.length;if(!l&&u){if("en"===t)return`${o} is required`;if("fa"===t)return`وارد کردن ${o} ضروری است`}else if(l&&!u){if("en"===t)return`${o} is forbidden`;if("fa"===t)return`وارد کردن ${o} مجاز نیست`}}else{let p=this.getResult({operator:d,not:l,target:h,title:o,message:_,value:i,equal:$,fn:a});if(p)return p}}return!1},this.validate=()=>{let e=!1;try{e=this.getValidation()}catch{e=!1}return e}}}function getOperatorDetails(e){let t;if("contain"===e||"startBy"===e)t=e;else{let i=e.indexOf("<"),r=e.indexOf(">");t=-1!==i&&-1!==r?"between":-1!==i?"less":-1!==r?"greater":"equal"}let s=-1!==e.indexOf("!"),n=-1!==e.indexOf("=");return{fn:t,not:s,equal:n}}export function ValidationTextToObject(e,t){let[i,r,s]=e.split(","),n,o=t,h="";s&&(0===s.indexOf("title(")&&")"===s[s.length-1]?o=s.slice(6,s.length-1):0===s.indexOf("message(")&&")"===s[s.length-1]?h=s.slice(8,s.length-1):n=ParseString(s));let l=r=ParseString(r),{fn:$,not:a,equal:d}=getOperatorDetails(i);return"between"===$&&(l=[r,n]),{title:o,target:l,not:a,equal:d,fn:$,operator:i,message:h}}export function ConvertTextToFilters(e,t){let i=e.split("."),r=[],s=new ConvertPToFilter(t);for(let n=0;n<i.length;n++){let o=s.convert(i[n]);!1!==o&&r.push(o)}return r}class ConvertPToFilter{constructor(e){_defineProperty(this,"sentence",""),_defineProperty(this,"columns",void 0),_defineProperty(this,"fields",[]),_defineProperty(this,"titlesDic",{}),_defineProperty(this,"titles",[]),_defineProperty(this,"fieldsDic",{}),_defineProperty(this,"not",!1),_defineProperty(this,"targets",[]),_defineProperty(this,"bool",void 0),_defineProperty(this,"equalWords",["مساوی ","به اندازه ","به میزان ","به مقدار ","حدود ","برابر "]),_defineProperty(this,"lessWords",["کوچکتر ","کوچک تر ","زیر ","کمتر ","کم تر ","قبل از "]),_defineProperty(this,"moreWords",["بیشتر ","بیش تر ","بالای ","بیش از ","بزرگتر ","بزرگ تر ","بعد از "]),_defineProperty(this,"betweenWords",["بین "]),_defineProperty(this,"notWords",["نباشد","نباید","نباشند","نیستند","نیست","ندارد","ندارند","نداشته باشد","نداشته باشند","نشده باشد","نشده باشند"]),_defineProperty(this,"convert",e=>{if(!e)return!1;this.sentence=e,this.getTargets();let t=this.getField();if(!t)return!1;let i=this.isNot(),r=this.getOperator();return!!r&&{field:t,validation:{operator:r,targets:this.targets,not:i,bool:this.bool}}}),_defineProperty(this,"getField",()=>{for(let e=0;e<this.fields.length;e++){let t=this.fields[e];if(-1!==this.sentence.indexOf(t))return t}for(let i=0;i<this.titles.length;i++){let r=this.titles[i];if(-1!==this.sentence.indexOf(r))return this.titlesDic[r]}}),_defineProperty(this,"getFieldsAndTitles",()=>{for(let e=0;e<this.columns.length;e++){let{title:t,field:i}=this.columns[e];void 0!==i&&(this.fieldsDic[i]=!0,this.fields.push(i),t&&(this.titlesDic[t]=i,this.titles.push(t)))}}),_defineProperty(this,"getTargets",()=>{let e=this.sentence.indexOf("(")+1,t=this.sentence.indexOf(")"),i=this.sentence.slice(e,t),{text:r,bool:s}=this.replaceAndOr(i),n=r.split(` ${s} `),o=[];for(let h=0;h<n.length;h++){let l=this.getTarget(n[h]);void 0!==l&&o.push(l)}o.length&&(this.sentence=this.sentence.replace(/\(.*?\)/g,"")),this.targets=o,this.bool=s}),_defineProperty(this,"getTarget",e=>{let t;if(this.fieldsDic[e])t=`field_${e}`;else if(this.titlesDic[e])t=`field_${this.titlesDic[e]}`;else{let i=+e;t=isNaN(i)?e.replace(/['"]/g,""):i}return t}),_defineProperty(this,"isNot",()=>{for(let e=0;e<this.notWords.length;e++){let t=this.notWords[e];if(-1!==this.sentence.indexOf(t))return this.sentence=this.sentence.replace(t,""),!0}return!1}),_defineProperty(this,"getOperator",()=>{if(!this.targets.length)return"required";if(-1!==this.sentence.indexOf("مخالف ")||-1!==this.sentence.indexOf("نا برابر "))return"=";if(-1!==this.sentence.indexOf("نا مساوی "))return"=";{if(-1!==this.sentence.indexOf("شروع شود"))return"startBy";if(-1!==this.sentence.indexOf("شامل"))return"contain";let e=!1;for(let t=0;t<this.equalWords.length;t++){let i=this.equalWords[t];if(-1!==this.sentence.indexOf(i)){e=!0;break}}for(let r=0;r<this.betweenWords.length;r++)if(-1!==this.sentence.indexOf(this.betweenWords[r])){if(e)return"<=>";return"<>"}for(let s=0;s<this.moreWords.length;s++)if(-1!==this.sentence.indexOf(this.moreWords[s])){if(e)return">=";return">"}for(let n=0;n<this.lessWords.length;n++)if(-1!==this.sentence.indexOf(this.lessWords[n])){if(e)return"<=";return"<"}return!!e&&"="}}),_defineProperty(this,"replaceAndOr",e=>{let t=e.search(/\bو\b/),i=e.search(/\bیا\b/),r,s;if(-1!==t&&(-1===i||t<i))r=/\bیا\b/g,s="و";else{if(-1===i||-1!==t&&!(i<t))return{text:e};r=/\bو\b/g,s="یا"}return{text:e.replace(r,s),bool:s}}),this.columns=e,this.getFieldsAndTitles()}}export function FilterRows(e,t){function i(e,t){return e[t]}function r(e,t,r){let s=i(e,t),{targets:n,operator:o,not:h,bool:l}=r;if("<>"===o||"<=>"===o)return new Validation({value:s,validations:[{operator:o,target:n,not:h}]}),!0;if(1===n.length)return new Validation({value:s,validations:[{operator:o,target:n[0],not:h}]}),!0;let $=!1,a=!1;for(let d=0;d<n.length;d++){let _=(new Validation({value:s,validations:[{operator:o,target:n[d],not:h}]}),!0);if(_){if(a=!0,"و"===l)return!1}else{if("یا"===l)return!0;$=!0}}return"و"===l?!a:$}function s(e,t){for(let s=0;s<e.length;s++){let{field:n,validation:o}=e[s],h,l,$,a;if("string"==typeof o){let d=ValidationTextToObject(o);h=d.operator,l=Array.isArray(d.target)?d.target:[d.target],$=d.not,a="و"}else h=o.operator,l=o.targets,$=o.not,a=o.bool;l=l.map(e=>"string"==typeof e&&0===e.indexOf("field_")?i(t,e.slice(6,e.length)):e);let _=r(t,n,{targets:l,not:$,operator:h,bool:a});if(_)return!0}return!1}let n=[],o=t;for(let h=0;h<e.length;h++){let l=!0,$=e[h];for(let a=0;a<o.length;a++){let d=o[h],_=s(d,$);if(!_){l=!1;break}}l&&n.push($)}return n}export class AIOColors{constructor(){_defineProperty(this,"number_to_hex",void 0),_defineProperty(this,"getType",void 0),_defineProperty(this,"to_array",void 0),_defineProperty(this,"between",void 0),_defineProperty(this,"getBetween",void 0),_defineProperty(this,"to_dark",void 0),_defineProperty(this,"to_light",void 0),_defineProperty(this,"brightness",void 0),_defineProperty(this,"to_hex",void 0),_defineProperty(this,"to_rgb",void 0),_defineProperty(this,"log",void 0),_defineProperty(this,"getRandomRGB",void 0),_defineProperty(this,"reverse",void 0),this.number_to_hex=e=>{let t=e.toString(16);return 1===t.length?"0"+t:t},this.getType=e=>Array.isArray(e)?"array":-1!==e.indexOf("rgb")?"rgb":"hex",this.to_array=e=>{if(Array.isArray(e))return e;if(0===e.indexOf("rgb("))return e.slice(e.indexOf("(")+1,e.indexOf(")")).split(",").map(e=>+e);let t=(e=e.substr(1)).split(""),i,r,s;return 3===e.length?(i=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),s=parseInt(t[2]+t[2],16)):6===e.length&&(i=parseInt(t[0]+t[1],16),r=parseInt(t[2]+t[3],16),s=parseInt(t[4]+t[5],16)),[i,r,s]},this.between=(e,t,i)=>{let[r,s,n]=this.to_array(e),[o,h,l]=this.to_array(t),$=(o-r)/(i-1),a=(h-s)/(i-1),d=(l-n)/(i-1),_=[];for(var g=0;g<i;g++){let f=`rgb(${Math.round(r+$*g)},${Math.round(s+a*g)},${Math.round(n+d*g)})`;_.push(f)}return _},this.getBetween=e=>{let t=[],i=[],r=[];for(let s=0;s<e.length;s++){let n=e[s],o=Array.isArray(n)?this.to_rgb(n):n;"string"==typeof o?i.push(o):"number"==typeof o&&r.push(o)}for(let h=0;h<i.length-1;h++){let l=i[h],$=i[h+1],a=r[h];t=[...t,this.between(l,$,a)]}return t},this.to_dark=(e,t)=>{let[i,r,s]=this.to_array(e);i=Math.round(i-i*(t/100)),r=Math.round(r-r*(t/100)),s=Math.round(s-s*(t/100));let n=this.getType(e),o="to_"+n,h=this[o];return h([i,r,s])},this.to_light=(e,t)=>{let[i,r,s]=this.to_array(e);i=Math.round(i+(255-i)*(t/100)),r=Math.round(r+(255-r)*(t/100)),s=Math.round(s+(255-s)*(t/100));let n=this.getType(e),o="to_"+n,h=this[o];return h([i,r,s])},this.to_hex=e=>`#${this.to_array(e).map(e=>this.number_to_hex(e)).join("")}`,this.to_rgb=e=>`rgb(${this.to_array(e).toString()})`,this.brightness=(e,t)=>0===t?e:t<0?this.to_dark(e,-1*t):t>0?this.to_light(e,t):void 0,this.log=e=>{for(let t=0;t<e.length;t++){let i=this.to_rgb(e[t]);console.log(`%c ${this.reverse(i)}`,"background: "+i+"; color: #000")}},this.getRandomRGB=(e="#000",t="#fff")=>{let i=this.to_array(e),r=this.to_array(t),s=GetRandomNumber(i[0],r[0]),n=GetRandomNumber(i[1],r[1]),o=GetRandomNumber(i[2],r[2]);return this.to_rgb([s,n,o])},this.reverse=e=>this["to_"+this.getType(e)](this.to_array(e).map(e=>255-e))}}class GetSvg{constructor(){_defineProperty(this,"getStyle",e=>{let t=e||"currentcolor";return{fill:t}}),_defineProperty(this,"getSvgStyle",e=>({width:`${1.5*(e=e||1)}rem`,height:`${1.5*e}rem`})),_defineProperty(this,"fixSvgContent",(e,t,i)=>{let{spin:r,color:s}=i||{},n=null;return n=r?_jsxs(_Fragment,{children:[_jsx("style",{children:"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }"}),_jsx("g",{style:{animation:`${r}s linear 0s infinite normal none running spin`,transformOrigin:"center center"}})]}):e,_jsx("svg",{viewBox:"0 0 24 24",role:"presentation",style:this.getSvgStyle(t),children:n})}),_defineProperty(this,"getIcon",(e,t,i)=>{let{color:r}=i||{},s=this[e](r);return this.fixSvgContent(s,t,i)}),_defineProperty(this,"mdiChevronDown",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiClose",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiLoading",e=>_jsxs(_Fragment,{children:[_jsx("path",{d:"M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",style:this.getStyle(e)}),_jsx("rect",{width:"24",height:"24",fill:"transparent"})]})),_defineProperty(this,"mdiAttachment",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M7.5,18A5.5,5.5 0 0,1 2,12.5A5.5,5.5 0 0,1 7.5,7H18A4,4 0 0,1 22,11A4,4 0 0,1 18,15H9.5A2.5,2.5 0 0,1 7,12.5A2.5,2.5 0 0,1 9.5,10H17V11.5H9.5A1,1 0 0,0 8.5,12.5A1,1 0 0,0 9.5,13.5H18A2.5,2.5 0 0,0 20.5,11A2.5,2.5 0 0,0 18,8.5H7.5A4,4 0 0,0 3.5,12.5A4,4 0 0,0 7.5,16.5H17V18H7.5Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiCircleMedium",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M12,8A4,4 0 0,0 8,12A4,4 0 0,0 12,16A4,4 0 0,0 16,12A4,4 0 0,0 12,8Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiMagnify",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiPlusThick",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M20 14H14V20H10V14H4V10H10V4H14V10H20V14Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiImage",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiEye",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiEyeOff",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiDotsHorizontal",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiChevronRight",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiChevronLeft",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiArrowDown",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiArrowUp",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiFileExcel",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M15.8,20H14L12,16.6L10,20H8.2L11.1,15.5L8.2,11H10L12,14.4L14,11H15.8L12.9,15.5L15.8,20M13,9V3.5L18.5,9H13Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiSort",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M18 21L14 17H17V7H14L18 3L22 7H19V17H22M2 19V17H12V19M2 13V11H9V13M2 7V5H6V7H2Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiDelete",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",style:this.getStyle(e)})})),_defineProperty(this,"mdiCircleSmall",e=>_jsx(_Fragment,{children:_jsx("path",{d:"M12,10A2,2 0 0,0 10,12C10,13.11 10.9,14 12,14C13.11,14 14,13.11 14,12A2,2 0 0,0 12,10Z",style:this.getStyle(e)})}))}}export{GetSvg};