formue-crud 0.2.15 → 0.2.16
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.
- package/dist/formue-crud.js +140 -139
- package/dist/formue-crud.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/formue-crud.umd.cjs
CHANGED
|
@@ -50,4 +50,4 @@ Data: `,e),!1}loadData(e){var t={data:e};this.loadSheet(this.newSheet(t))}de
|
|
|
50
50
|
Expecting: array
|
|
51
51
|
Received: `,typeof e,`
|
|
52
52
|
Data: `,e)}_wipeElements(){this.dispatch("rows-wipe"),this.destroy(),this.adjustTableSize(),this.dispatch("rows-wiped")}destroy(){this.rows.forEach(e=>{e.wipe()}),this.rows=[],this.activeRows=[],this.activeRowsPipeline=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0}deleteRow(e,t){var i=this.rows.indexOf(e),n=this.activeRows.indexOf(e);n>-1&&this.activeRows.splice(n,1),i>-1&&this.rows.splice(i,1),this.setActiveRows(this.activeRows),this.displayRowIterator(s=>{var a=s.indexOf(e);a>-1&&s.splice(a,1)}),t||this.reRenderInPosition(),this.regenerateRowPositions(),this.dispatchExternal("rowDeleted",e.getComponent()),this.displayRowsCount||this.tableEmpty(),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.getData())}addRow(e,t,i,n){var s=this.addRowActual(e,t,i,n);return s}addRows(e,t,i,n){var s=[];return new Promise((a,u)=>{t=this.findAddRowPos(t),Array.isArray(e)||(e=[e]),(typeof i>"u"&&t||typeof i<"u"&&!t)&&e.reverse(),e.forEach((d,p)=>{var g=this.addRow(d,t,i,!0);s.push(g),this.dispatch("row-added",g,d,t,i)}),this.refreshActiveData(n?"displayPipeline":!1,!1,!0),this.regenerateRowPositions(),this.displayRowsCount&&this._clearPlaceholder(),a(s)})}findAddRowPos(e){return typeof e>"u"&&(e=this.table.options.addRowPos),e==="pos"&&(e=!0),e==="bottom"&&(e=!1),e}addRowActual(e,t,i,n){var s=e instanceof He?e:new He(e||{},this),a=this.findAddRowPos(t),u=-1,d,p;return i||(p=this.chain("row-adding-position",[s,a],null,{index:i,top:a}),i=p.index,a=p.top),typeof i<"u"&&(i=this.findRow(i)),i=this.chain("row-adding-index",[s,i,a],null,i),i&&(u=this.rows.indexOf(i)),i&&u>-1?(d=this.activeRows.indexOf(i),this.displayRowIterator(function(g){var w=g.indexOf(i);w>-1&&g.splice(a?w:w+1,0,s)}),d>-1&&this.activeRows.splice(a?d:d+1,0,s),this.rows.splice(a?u:u+1,0,s)):a?(this.displayRowIterator(function(g){g.unshift(s)}),this.activeRows.unshift(s),this.rows.unshift(s)):(this.displayRowIterator(function(g){g.push(s)}),this.activeRows.push(s),this.rows.push(s)),this.setActiveRows(this.activeRows),this.dispatchExternal("rowAdded",s.getComponent()),this.subscribedExternal("dataChanged")&&this.dispatchExternal("dataChanged",this.table.rowManager.getData()),n||this.reRenderInPosition(),s}moveRow(e,t,i){this.dispatch("row-move",e,t,i),this.moveRowActual(e,t,i),this.regenerateRowPositions(),this.dispatch("row-moved",e,t,i),this.dispatchExternal("rowMoved",e.getComponent())}moveRowActual(e,t,i){this.moveRowInArray(this.rows,e,t,i),this.moveRowInArray(this.activeRows,e,t,i),this.displayRowIterator(n=>{this.moveRowInArray(n,e,t,i)}),this.dispatch("row-moving",e,t,i)}moveRowInArray(e,t,i,n){var s,a,u,d;if(t!==i&&(s=e.indexOf(t),s>-1&&(e.splice(s,1),a=e.indexOf(i),a>-1?n?e.splice(a+1,0,t):e.splice(a,0,t):e.splice(s,0,t)),e===this.getDisplayRows())){u=s<a?s:a,d=a>s?a:s+1;for(let p=u;p<=d;p++)e[p]&&this.styleRow(e[p],p)}}clearData(){this.setData([])}getRowIndex(e){return this.findRowIndex(e,this.rows)}getDisplayRowIndex(e){var t=this.getDisplayRows().indexOf(e);return t>-1?t:!1}nextDisplayRow(e,t){var i=this.getDisplayRowIndex(e),n=!1;return i!==!1&&i<this.displayRowsCount-1&&(n=this.getDisplayRows()[i+1]),n&&(!(n instanceof He)||n.type!="row")?this.nextDisplayRow(n,t):n}prevDisplayRow(e,t){var i=this.getDisplayRowIndex(e),n=!1;return i&&(n=this.getDisplayRows()[i-1]),t&&n&&(!(n instanceof He)||n.type!="row")?this.prevDisplayRow(n,t):n}findRowIndex(e,t){var i;return e=this.findRow(e),e&&(i=t.indexOf(e),i>-1)?i:!1}getData(e,t){var i=[],n=this.getRows(e);return n.forEach(function(s){s.type=="row"&&i.push(s.getData(t||"data"))}),i}getComponents(e){var t=[],i=this.getRows(e);return i.forEach(function(n){t.push(n.getComponent())}),t}getDataCount(e){var t=this.getRows(e);return t.length}scrollHorizontal(e){this.scrollLeft=e,this.element.scrollLeft=e,this.dispatch("scroll-horizontal",e)}registerDataPipelineHandler(e,t){typeof t<"u"?(this.dataPipeline.push({handler:e,priority:t}),this.dataPipeline.sort((i,n)=>i.priority-n.priority)):console.error("Data pipeline handlers must have a priority in order to be registered")}registerDisplayPipelineHandler(e,t){typeof t<"u"?(this.displayPipeline.push({handler:e,priority:t}),this.displayPipeline.sort((i,n)=>i.priority-n.priority)):console.error("Display pipeline handlers must have a priority in order to be registered")}refreshActiveData(e,t,i){var n=this.table,s="",a=0,u=["all","dataPipeline","display","displayPipeline","end"];if(!this.table.destroyed){if(typeof e=="function")if(a=this.dataPipeline.findIndex(d=>d.handler===e),a>-1)s="dataPipeline",t&&(a==this.dataPipeline.length-1?s="display":a++);else if(a=this.displayPipeline.findIndex(d=>d.handler===e),a>-1)s="displayPipeline",t&&(a==this.displayPipeline.length-1?s="end":a++);else{console.error("Unable to refresh data, invalid handler provided",e);return}else s=e||"all",a=0;if(this.redrawBlock){(!this.redrawBlockRestoreConfig||this.redrawBlockRestoreConfig&&(this.redrawBlockRestoreConfig.stage===s&&a<this.redrawBlockRestoreConfig.index||u.indexOf(s)<u.indexOf(this.redrawBlockRestoreConfig.stage)))&&(this.redrawBlockRestoreConfig={handler:e,skipStage:t,renderInPosition:i,stage:s,index:a});return}else ge.elVisible(this.element)?i?this.reRenderInPosition(this.refreshPipelines.bind(this,e,s,a,i)):(this.refreshPipelines(e,s,a,i),e||this.table.columnManager.renderer.renderColumns(),this.renderTable(),n.options.layoutColumnsOnNewData&&this.table.columnManager.redraw(!0)):this.refreshPipelines(e,s,a,i),this.dispatch("data-refreshed")}}refreshPipelines(e,t,i,n){switch(this.dispatch("data-refreshing"),(!e||!this.activeRowsPipeline[0])&&(this.activeRowsPipeline[0]=this.rows.slice(0)),t){case"all":case"dataPipeline":for(let s=i;s<this.dataPipeline.length;s++){let a=this.dataPipeline[s].handler(this.activeRowsPipeline[s].slice(0));this.activeRowsPipeline[s+1]=a||this.activeRowsPipeline[s].slice(0)}this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);case"display":i=0,this.resetDisplayRows();case"displayPipeline":for(let s=i;s<this.displayPipeline.length;s++){let a=this.displayPipeline[s].handler((s?this.getDisplayRows(s-1):this.activeRows).slice(0),n);this.setDisplayRows(a||this.getDisplayRows(s-1).slice(0),s)}case"end":this.regenerateRowPositions()}this.getDisplayRows().length&&this._clearPlaceholder()}regenerateRowPositions(){var e=this.getDisplayRows(),t=1;e.forEach(i=>{i.type==="row"&&(i.setPosition(t),t++)})}setActiveRows(e){this.activeRows=this.activeRows=Object.assign([],e),this.activeRowsCount=this.activeRows.length}resetDisplayRows(){this.displayRows=[],this.displayRows.push(this.activeRows.slice(0)),this.displayRowsCount=this.displayRows[0].length}setDisplayRows(e,t){this.displayRows[t]=e,t==this.displayRows.length-1&&(this.displayRowsCount=this.displayRows[this.displayRows.length-1].length)}getDisplayRows(e){return typeof e>"u"?this.displayRows.length?this.displayRows[this.displayRows.length-1]:[]:this.displayRows[e]||[]}getVisibleRows(e,t){var i=Object.assign([],this.renderer.visibleRows(!t));return e&&(i=this.chain("rows-visible",[t],i,i)),i}displayRowIterator(e){this.activeRowsPipeline.forEach(e),this.displayRows.forEach(e),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length}getRows(e){var t=[];switch(e){case"active":t=this.activeRows;break;case"display":t=this.table.rowManager.getDisplayRows();break;case"visible":t=this.getVisibleRows(!1,!0);break;default:t=this.chain("rows-retrieve",e,null,this.rows)||this.rows}return t}reRenderInPosition(e){this.redrawBlock?e?e():this.redrawBlockRenderInPosition=!0:(this.dispatchExternal("renderStarted"),this.renderer.rerenderRows(e),this.fixedHeight||this.adjustTableSize(),this.scrollBarCheck(),this.dispatchExternal("renderComplete"))}scrollBarCheck(){var e=0;this.element.scrollHeight>this.element.clientHeight&&(e=this.element.offsetWidth-this.element.clientWidth),e!==this.scrollbarWidth&&(this.scrollbarWidth=e,this.dispatch("scrollbar-vertical",e))}initializeRenderer(){var e,t={virtual:Db,basic:Lb};typeof this.table.options.renderVertical=="string"?e=t[this.table.options.renderVertical]:e=this.table.options.renderVertical,e?(this.renderMode=this.table.options.renderVertical,this.renderer=new e(this.table,this.element,this.tableElement),this.renderer.initialize(),(this.table.element.clientHeight||this.table.options.height)&&!(this.table.options.minHeight&&this.table.options.maxHeight)?this.fixedHeight=!0:this.fixedHeight=!1):console.error("Unable to find matching renderer:",this.table.options.renderVertical)}getRenderMode(){return this.renderMode}renderTable(){this.dispatchExternal("renderStarted"),this.element.scrollTop=0,this._clearTable(),this.displayRowsCount?(this.renderer.renderRows(),this.firstRender&&(this.firstRender=!1,this.fixedHeight||this.adjustTableSize(),this.layoutRefresh(!0))):this.renderEmptyScroll(),this.fixedHeight||this.adjustTableSize(),this.dispatch("table-layout"),this.displayRowsCount||this._showPlaceholder(),this.scrollBarCheck(),this.dispatchExternal("renderComplete")}renderEmptyScroll(){this.placeholder?this.tableElement.style.display="none":this.tableElement.style.minWidth=this.table.columnManager.getWidth()+"px"}_clearTable(){this._clearPlaceholder(),this.scrollTop=0,this.scrollLeft=0,this.renderer.clearRows()}tableEmpty(){this.renderEmptyScroll(),this._showPlaceholder()}checkPlaceholder(){this.displayRowsCount?this._clearPlaceholder():this.tableEmpty()}_showPlaceholder(){this.placeholder&&(this.placeholder&&this.placeholder.parentNode&&this.placeholder.parentNode.removeChild(this.placeholder),this.initializePlaceholder(),this.placeholder.setAttribute("tabulator-render-mode",this.renderMode),this.getElement().appendChild(this.placeholder),this._positionPlaceholder(),this.adjustTableSize())}_clearPlaceholder(){this.placeholder&&this.placeholder.parentNode&&this.placeholder.parentNode.removeChild(this.placeholder),this.tableElement.style.minWidth="",this.tableElement.style.display=""}_positionPlaceholder(){this.placeholder&&this.placeholder.parentNode&&(this.placeholder.style.width=this.table.columnManager.getWidth()+"px",this.placeholderContents.style.width=this.table.rowManager.element.clientWidth+"px",this.placeholderContents.style.marginLeft=this.scrollLeft+"px")}styleRow(e,t){var i=e.getElement();t%2?(i.classList.add("tabulator-row-even"),i.classList.remove("tabulator-row-odd")):(i.classList.add("tabulator-row-odd"),i.classList.remove("tabulator-row-even"))}normalizeHeight(e){this.activeRows.forEach(function(t){t.normalizeHeight(e)})}adjustTableSize(){let e=this.element.clientHeight,t,i=!1;if(this.renderer.verticalFillMode==="fill"){let n=Math.floor(this.table.columnManager.getElement().getBoundingClientRect().height+(this.table.footerManager&&this.table.footerManager.active&&!this.table.footerManager.external?this.table.footerManager.getElement().getBoundingClientRect().height:0));if(this.fixedHeight){t=isNaN(this.table.options.minHeight)?this.table.options.minHeight:this.table.options.minHeight+"px";const s="calc(100% - "+n+"px)";this.element.style.minHeight=t||"calc(100% - "+n+"px)",this.element.style.height=s,this.element.style.maxHeight=s}else this.element.style.height="",this.element.style.height=this.table.element.clientHeight-n+"px",this.element.scrollTop=this.scrollTop;this.renderer.resize(),!this.fixedHeight&&e!=this.element.clientHeight&&(i=!0,this.subscribed("table-resize")?this.dispatch("table-resize"):this.redraw()),this.scrollBarCheck()}return this._positionPlaceholder(),i}reinitialize(){this.rows.forEach(function(e){e.reinitialize(!0)})}blockRedraw(){this.redrawBlock=!0,this.redrawBlockRestoreConfig=!1}restoreRedraw(){this.redrawBlock=!1,this.redrawBlockRestoreConfig?(this.refreshActiveData(this.redrawBlockRestoreConfig.handler,this.redrawBlockRestoreConfig.skipStage,this.redrawBlockRestoreConfig.renderInPosition),this.redrawBlockRestoreConfig=!1):this.redrawBlockRenderInPosition&&this.reRenderInPosition(),this.redrawBlockRenderInPosition=!1}redraw(e){this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,e?this.renderTable():(this.reRenderInPosition(),this.scrollHorizontal(this.scrollLeft))}resetScroll(){if(this.element.scrollLeft=0,this.element.scrollTop=0,this.table.browser==="ie"){var e=document.createEvent("Event");e.initEvent("scroll",!1,!0),this.element.dispatchEvent(e)}else this.element.dispatchEvent(new Event("scroll"))}}class Fb extends ze{constructor(e){super(e),this.active=!1,this.element=this.createElement(),this.containerElement=this.createContainerElement(),this.external=!1}initialize(){this.initializeElement()}createElement(){var e=document.createElement("div");return e.classList.add("tabulator-footer"),e}createContainerElement(){var e=document.createElement("div");return e.classList.add("tabulator-footer-contents"),this.element.appendChild(e),e}initializeElement(){if(this.table.options.footerElement)switch(typeof this.table.options.footerElement){case"string":this.table.options.footerElement[0]==="<"?this.containerElement.innerHTML=this.table.options.footerElement:(this.external=!0,this.containerElement=document.querySelector(this.table.options.footerElement));break;default:this.element=this.table.options.footerElement;break}}getElement(){return this.element}append(e){this.activate(),this.containerElement.appendChild(e),this.table.rowManager.adjustTableSize()}prepend(e){this.activate(),this.element.insertBefore(e,this.element.firstChild),this.table.rowManager.adjustTableSize()}remove(e){e.parentNode.removeChild(e),this.deactivate()}deactivate(e){(!this.element.firstChild||e)&&(this.external||this.element.parentNode.removeChild(this.element),this.active=!1)}activate(){this.active||(this.active=!0,this.external||(this.table.element.appendChild(this.getElement()),this.table.element.style.display=""))}redraw(){this.dispatch("footer-redraw")}}class zb extends ze{constructor(e){super(e),this.el=null,this.abortClasses=["tabulator-headers","tabulator-table"],this.previousTargets={},this.listeners=["click","dblclick","contextmenu","mouseenter","mouseleave","mouseover","mouseout","mousemove","mouseup","mousedown","touchstart","touchend"],this.componentMap={"tabulator-cell":"cell","tabulator-row":"row","tabulator-group":"group","tabulator-col":"column"},this.pseudoTrackers={row:{subscriber:null,target:null},cell:{subscriber:null,target:null},group:{subscriber:null,target:null},column:{subscriber:null,target:null}},this.pseudoTracking=!1}initialize(){this.el=this.table.element,this.buildListenerMap(),this.bindSubscriptionWatchers()}buildListenerMap(){var e={};this.listeners.forEach(t=>{e[t]={handler:null,components:[]}}),this.listeners=e}bindPseudoEvents(){Object.keys(this.pseudoTrackers).forEach(e=>{this.pseudoTrackers[e].subscriber=this.pseudoMouseEnter.bind(this,e),this.subscribe(e+"-mouseover",this.pseudoTrackers[e].subscriber)}),this.pseudoTracking=!0}pseudoMouseEnter(e,t,i){this.pseudoTrackers[e].target!==i&&(this.pseudoTrackers[e].target&&this.dispatch(e+"-mouseleave",t,this.pseudoTrackers[e].target),this.pseudoMouseLeave(e,t),this.pseudoTrackers[e].target=i,this.dispatch(e+"-mouseenter",t,i))}pseudoMouseLeave(e,t){var i=Object.keys(this.pseudoTrackers),n={row:["cell"],cell:["row"]};i=i.filter(s=>{var a=n[e];return s!==e&&(!a||a&&!a.includes(s))}),i.forEach(s=>{var a=this.pseudoTrackers[s].target;this.pseudoTrackers[s].target&&(this.dispatch(s+"-mouseleave",t,a),this.pseudoTrackers[s].target=null)})}bindSubscriptionWatchers(){var e=Object.keys(this.listeners),t=Object.values(this.componentMap);for(let i of t)for(let n of e){let s=i+"-"+n;this.subscriptionChange(s,this.subscriptionChanged.bind(this,i,n))}this.subscribe("table-destroy",this.clearWatchers.bind(this))}subscriptionChanged(e,t,i){var n=this.listeners[t].components,s=n.indexOf(e),a=!1;i?s===-1&&(n.push(e),a=!0):this.subscribed(e+"-"+t)||s>-1&&(n.splice(s,1),a=!0),(t==="mouseenter"||t==="mouseleave")&&!this.pseudoTracking&&this.bindPseudoEvents(),a&&this.updateEventListeners()}updateEventListeners(){for(let e in this.listeners){let t=this.listeners[e];t.components.length?t.handler||(t.handler=this.track.bind(this,e),this.el.addEventListener(e,t.handler)):t.handler&&(this.el.removeEventListener(e,t.handler),t.handler=null)}}track(e,t){var i=t.composedPath&&t.composedPath()||t.path,n=this.findTargets(i);n=this.bindComponents(e,n),this.triggerEvents(e,t,n),this.pseudoTracking&&(e=="mouseover"||e=="mouseleave")&&!Object.keys(n).length&&this.pseudoMouseLeave("none",t)}findTargets(e){var t={};let i=Object.keys(this.componentMap);for(let n of e){let s=n.classList?[...n.classList]:[];if(s.filter(d=>this.abortClasses.includes(d)).length)break;let u=s.filter(d=>i.includes(d));for(let d of u)t[this.componentMap[d]]||(t[this.componentMap[d]]=n)}return t.group&&t.group===t.row&&delete t.row,t}bindComponents(e,t){var i=Object.keys(t).reverse(),n=this.listeners[e],s={},a={},u={};for(let d of i){let p,g=t[d],w=this.previousTargets[d];if(w&&w.target===g)p=w.component;else switch(d){case"row":case"group":(n.components.includes("row")||n.components.includes("cell")||n.components.includes("group"))&&(p=this.table.rowManager.getVisibleRows(!0).find(C=>C.getElement()===g),t.row&&t.row.parentNode&&t.row.parentNode.closest(".tabulator-row")&&(t[d]=!1));break;case"column":n.components.includes("column")&&(p=this.table.columnManager.findColumn(g));break;case"cell":n.components.includes("cell")&&(s.row instanceof He?p=s.row.findCell(g):t.row&&console.warn("Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?"));break}p&&(s[d]=p,u[d]={target:g,component:p})}return this.previousTargets=u,Object.keys(t).forEach(d=>{let p=s[d];a[d]=p}),a}triggerEvents(e,t,i){var n=this.listeners[e];for(let s in i)i[s]&&n.components.includes(s)&&this.dispatch(s+"-"+e,t,i[s])}clearWatchers(){for(let e in this.listeners){let t=this.listeners[e];t.handler&&(this.el.removeEventListener(e,t.handler),t.handler=null)}}}class Pb{constructor(e){this.table=e,this.bindings={}}bind(e,t,i){this.bindings[e]||(this.bindings[e]={}),this.bindings[e][t]?console.warn("Unable to bind component handler, a matching function name is already bound",e,t,i):this.bindings[e][t]=i}handle(e,t,i){if(this.bindings[e]&&this.bindings[e][i]&&typeof this.bindings[e][i].bind=="function")return this.bindings[e][i].bind(null,t);i!=="then"&&typeof i=="string"&&!i.startsWith("_")&&this.table.options.debugInvalidComponentFuncs&&console.error("The "+e+" component does not have a "+i+" function, have you checked that you have the correct Tabulator module installed?")}}class Ob extends ze{constructor(e){super(e),this.requestOrder=0,this.loading=!1}initialize(){}load(e,t,i,n,s,a){var u=++this.requestOrder;if(this.table.destroyed)return Promise.resolve();if(this.dispatchExternal("dataLoading",e),e&&(e.indexOf("{")==0||e.indexOf("[")==0)&&(e=JSON.parse(e)),this.confirm("data-loading",[e,t,i,s])){this.loading=!0,s||this.alertLoader(),t=this.chain("data-params",[e,i,s],t||{},t||{}),t=this.mapParams(t,this.table.options.dataSendParams);var d=this.chain("data-load",[e,t,i,s],!1,Promise.resolve([]));return d.then(p=>{if(this.table.destroyed)console.warn("Data Load Response Blocked - Table has been destroyed");else{!Array.isArray(p)&&typeof p=="object"&&(p=this.mapParams(p,this.objectInvert(this.table.options.dataReceiveParams)));var g=this.chain("data-loaded",[p],null,p);u==this.requestOrder?(this.clearAlert(),g!==!1&&(this.dispatchExternal("dataLoaded",g),this.table.rowManager.setData(g,n,typeof a>"u"?!n:a))):console.warn("Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made")}}).catch(p=>{console.error("Data Load Error: ",p),this.dispatchExternal("dataLoadError",p),s||this.alertError(),setTimeout(()=>{this.clearAlert()},this.table.options.dataLoaderErrorTimeout)}).finally(()=>{this.loading=!1})}else return this.dispatchExternal("dataLoaded",e),e||(e=[]),this.table.rowManager.setData(e,n,typeof a>"u"?!n:a),Promise.resolve()}mapParams(e,t){var i={};for(let n in e)i[t.hasOwnProperty(n)?t[n]:n]=e[n];return i}objectInvert(e){var t={};for(let i in e)t[e[i]]=i;return t}blockActiveLoad(){this.requestOrder++}alertLoader(){var e=typeof this.table.options.dataLoader=="function"?this.table.options.dataLoader():this.table.options.dataLoader;e&&this.table.alertManager.alert(this.table.options.dataLoaderLoading||this.langText("data|loading"))}alertError(){this.table.alertManager.alert(this.table.options.dataLoaderError||this.langText("data|error"),"error")}clearAlert(){this.table.alertManager.clear()}}class Hb{constructor(e,t,i){this.table=e,this.events={},this.optionsList=t||{},this.subscriptionNotifiers={},this.dispatch=i?this._debugDispatch.bind(this):this._dispatch.bind(this),this.debug=i}subscriptionChange(e,t){this.subscriptionNotifiers[e]||(this.subscriptionNotifiers[e]=[]),this.subscriptionNotifiers[e].push(t),this.subscribed(e)&&this._notifySubscriptionChange(e,!0)}subscribe(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t),this._notifySubscriptionChange(e,!0)}unsubscribe(e,t){var i;if(this.events[e])if(t)if(i=this.events[e].findIndex(n=>n===t),i>-1)this.events[e].splice(i,1);else{console.warn("Cannot remove event, no matching event found:",e,t);return}else delete this.events[e];else{console.warn("Cannot remove event, no events set on:",e);return}this._notifySubscriptionChange(e,!1)}subscribed(e){return this.events[e]&&this.events[e].length}_notifySubscriptionChange(e,t){var i=this.subscriptionNotifiers[e];i&&i.forEach(n=>{n(t)})}_dispatch(){var e=Array.from(arguments),t=e.shift(),i;return this.events[t]&&this.events[t].forEach((n,s)=>{let a=n.apply(this.table,e);s||(i=a)}),i}_debugDispatch(){var e=Array.from(arguments),t=e[0];return e[0]="ExternalEvent:"+e[0],(this.debug===!0||this.debug.includes(t))&&console.log(...e),this._dispatch(...arguments)}}class Bb{constructor(e){this.events={},this.subscriptionNotifiers={},this.dispatch=e?this._debugDispatch.bind(this):this._dispatch.bind(this),this.chain=e?this._debugChain.bind(this):this._chain.bind(this),this.confirm=e?this._debugConfirm.bind(this):this._confirm.bind(this),this.debug=e}subscriptionChange(e,t){this.subscriptionNotifiers[e]||(this.subscriptionNotifiers[e]=[]),this.subscriptionNotifiers[e].push(t),this.subscribed(e)&&this._notifySubscriptionChange(e,!0)}subscribe(e,t,i=1e4){this.events[e]||(this.events[e]=[]),this.events[e].push({callback:t,priority:i}),this.events[e].sort((n,s)=>n.priority-s.priority),this._notifySubscriptionChange(e,!0)}unsubscribe(e,t){var i;if(this.events[e]){if(t)if(i=this.events[e].findIndex(n=>n.callback===t),i>-1)this.events[e].splice(i,1);else{console.warn("Cannot remove event, no matching event found:",e,t);return}}else{console.warn("Cannot remove event, no events set on:",e);return}this._notifySubscriptionChange(e,!1)}subscribed(e){return this.events[e]&&this.events[e].length}_chain(e,t,i,n){var s=i;return Array.isArray(t)||(t=[t]),this.subscribed(e)?(this.events[e].forEach((a,u)=>{s=a.callback.apply(this,t.concat([s]))}),s):typeof n=="function"?n():n}_confirm(e,t){var i=!1;return Array.isArray(t)||(t=[t]),this.subscribed(e)&&this.events[e].forEach((n,s)=>{n.callback.apply(this,t)&&(i=!0)}),i}_notifySubscriptionChange(e,t){var i=this.subscriptionNotifiers[e];i&&i.forEach(n=>{n(t)})}_dispatch(){var e=Array.from(arguments),t=e.shift();this.events[t]&&this.events[t].forEach(i=>{i.callback.apply(this,e)})}_debugDispatch(){var e=Array.from(arguments),t=e[0];return e[0]="InternalEvent:"+t,(this.debug===!0||this.debug.includes(t))&&console.log(...e),this._dispatch(...arguments)}_debugChain(){var e=Array.from(arguments),t=e[0];return e[0]="InternalEvent:"+t,(this.debug===!0||this.debug.includes(t))&&console.log(...e),this._chain(...arguments)}_debugConfirm(){var e=Array.from(arguments),t=e[0];return e[0]="InternalEvent:"+t,(this.debug===!0||this.debug.includes(t))&&console.log(...e),this._confirm(...arguments)}}class Nb extends ze{constructor(e){super(e)}_warnUser(){this.options("debugDeprecation")&&console.warn(...arguments)}check(e,t,i){var n="";return typeof this.options(e)<"u"?(n="Deprecated Setup Option - Use of the %c"+e+"%c option is now deprecated",t?(n=n+", Please use the %c"+t+"%c option instead",this._warnUser(n,"font-weight: bold;","font-weight: normal;","font-weight: bold;","font-weight: normal;"),i&&(this.table.options[t]=this.table.options[e])):this._warnUser(n,"font-weight: bold;","font-weight: normal;"),!1):!0}checkMsg(e,t){return typeof this.options(e)<"u"?(this._warnUser("%cDeprecated Setup Option - Use of the %c"+e+" %c option is now deprecated, "+t,"font-weight: normal;","font-weight: bold;","font-weight: normal;"),!1):!0}msg(e){this._warnUser(e)}}class Ib extends ze{constructor(e){super(e),this.deps={},this.props={}}initialize(){this.deps=Object.assign({},this.options("dependencies"))}lookup(e,t,i){if(Array.isArray(e)){for(const s of e){var n=this.lookup(s,t,!0);if(n)break}if(n)return n;this.error(e)}else return t?this.lookupProp(e,t,i):this.lookupKey(e,i)}lookupProp(e,t,i){var n;if(this.props[e]&&this.props[e][t])return this.props[e][t];if(n=this.lookupKey(e,i),n)return this.props[e]||(this.props[e]={}),this.props[e][t]=n[t]||n,this.props[e][t]}lookupKey(e,t){var i;return this.deps[e]?i=this.deps[e]:window[e]?(this.deps[e]=window[e],i=this.deps[e]):t||this.error(e),i}error(e){console.error("Unable to find dependency",e,"Please check documentation and ensure you have imported the required library into your project")}}function Vb(l,e){e&&this.table.columnManager.renderer.reinitializeColumnWidths(l),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()}function fh(l,e){l.forEach(function(t){t.reinitializeWidth()}),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()}function Wb(l,e){var t=0,i=this.table.rowManager.element.clientWidth,n=0,s=!1;l.forEach((a,u)=>{a.widthFixed||a.reinitializeWidth(),(this.table.options.responsiveLayout?a.modules.responsive.visible:a.visible)&&(s=a),a.visible&&(t+=a.getWidth())}),s?(n=i-t+s.getWidth(),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&(s.setWidth(0),this.table.modules.responsiveLayout.update()),n>0?s.setWidth(n):s.reinitializeWidth()):this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()}function $b(l,e){var t=this.table.rowManager.element.getBoundingClientRect().width,i=0,n=0,s=0,a=0,u=[],d=[],p=0,g=0,w=0;function b(_){var S;return typeof _=="string"?_.indexOf("%")>-1?S=t/100*parseInt(_):S=parseInt(_):S=_,S}function C(_,S,F,L){var U=[],H=0,N=0,O=0,oe=s,V=0,W=0,pe=[];function Y(j){return F*(j.column.definition.widthGrow||1)}function he(j){return b(j.width)-F*(j.column.definition.widthShrink||0)}return _.forEach(function(j,xe){var Re=L?he(j):Y(j);j.column.minWidth>=Re?U.push(j):j.column.maxWidth&&j.column.maxWidth<Re?(j.width=j.column.maxWidth,S-=j.column.maxWidth,oe-=L?j.column.definition.widthShrink||1:j.column.definition.widthGrow||1,oe&&(F=Math.floor(S/oe))):(pe.push(j),W+=L?j.column.definition.widthShrink||1:j.column.definition.widthGrow||1)}),U.length?(U.forEach(function(j){H+=L?j.width-j.column.minWidth:j.column.minWidth,j.width=j.column.minWidth}),N=S-H,O=W?Math.floor(N/W):N,V=C(pe,N,O,L)):(V=W?S-Math.floor(S/W)*W:S,pe.forEach(function(j){j.width=L?he(j):Y(j)})),V}this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(t-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),l.forEach(function(_){var S,F,L;_.visible&&(S=_.definition.width,F=parseInt(_.minWidth),S?(L=b(S),i+=L>F?L:F,_.definition.widthShrink&&(d.push({column:_,width:L>F?L:F}),p+=_.definition.widthShrink)):(u.push({column:_,width:0}),s+=_.definition.widthGrow||1))}),n=t-i,a=Math.floor(n/s),w=C(u,n,a,!1),u.length&&w>0&&(u[u.length-1].width+=w),u.forEach(function(_){n-=_.width}),g=Math.abs(w)+n,g>0&&p&&(w=C(d,g,Math.floor(g/p),!0)),w&&d.length&&(d[d.length-1].width-=w),u.forEach(function(_){_.column.setWidth(_.width)}),d.forEach(function(_){_.column.setWidth(_.width)})}var Gb={fitData:Vb,fitDataFill:fh,fitDataTable:fh,fitDataStretch:Wb,fitColumns:$b};const Bi=class Bi extends ee{constructor(e){super(e,"layout"),this.mode=null,this.registerTableOption("layout","fitData"),this.registerTableOption("layoutColumnsOnNewData",!1),this.registerColumnOption("widthGrow"),this.registerColumnOption("widthShrink")}initialize(){var e=this.table.options.layout;Bi.modes[e]?this.mode=e:(console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : "+e),this.mode="fitData"),this.table.element.setAttribute("tabulator-layout",this.mode),this.subscribe("column-init",this.initializeColumn.bind(this))}initializeColumn(e){e.definition.widthGrow&&(e.definition.widthGrow=Number(e.definition.widthGrow)),e.definition.widthShrink&&(e.definition.widthShrink=Number(e.definition.widthShrink))}getMode(){return this.mode}layout(e){var t=this.table.columnManager.columnsByIndex.find(i=>i.definition.variableHeight||i.definition.formatter==="textarea");this.dispatch("layout-refreshing"),Bi.modes[this.mode].call(this,this.table.columnManager.columnsByIndex,e),t&&this.table.rowManager.normalizeHeight(!0),this.dispatch("layout-refreshed")}};P(Bi,"moduleName","layout"),P(Bi,"modes",Gb);let lo=Bi;var Ub={default:{groups:{item:"item",items:"items"},columns:{},data:{loading:"Loading",error:"Error"},pagination:{page_size:"Page Size",page_title:"Show Page",first:"First",first_title:"First Page",last:"Last",last_title:"Last Page",prev:"Prev",prev_title:"Prev Page",next:"Next",next_title:"Next Page",all:"All",counter:{showing:"Showing",of:"of",rows:"rows",pages:"pages"}},headerFilters:{default:"filter column...",columns:{}}}};const Cn=class Cn extends ee{constructor(e){super(e),this.locale="default",this.lang=!1,this.bindings={},this.langList={},this.registerTableOption("locale",!1),this.registerTableOption("langs",{})}initialize(){this.langList=ge.deepClone(Cn.langs),this.table.options.columnDefaults.headerFilterPlaceholder!==!1&&this.setHeaderFilterPlaceholder(this.table.options.columnDefaults.headerFilterPlaceholder);for(let e in this.table.options.langs)this.installLang(e,this.table.options.langs[e]);this.setLocale(this.table.options.locale),this.registerTableFunction("setLocale",this.setLocale.bind(this)),this.registerTableFunction("getLocale",this.getLocale.bind(this)),this.registerTableFunction("getLang",this.getLang.bind(this))}setHeaderFilterPlaceholder(e){this.langList.default.headerFilters.default=e}installLang(e,t){this.langList[e]?this._setLangProp(this.langList[e],t):this.langList[e]=t}_setLangProp(e,t){for(let i in t)e[i]&&typeof e[i]=="object"?this._setLangProp(e[i],t[i]):e[i]=t[i]}setLocale(e){e=e||"default";function t(i,n){for(var s in i)typeof i[s]=="object"?(n[s]||(n[s]={}),t(i[s],n[s])):n[s]=i[s]}if(e===!0&&navigator.language&&(e=navigator.language.toLowerCase()),e&&!this.langList[e]){let i=e.split("-")[0];this.langList[i]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",e,i),e=i):(console.warn("Localization Error - Matching locale not found, using default: ",e),e="default")}this.locale=e,this.lang=ge.deepClone(this.langList.default||{}),e!="default"&&t(this.langList[e],this.lang),this.dispatchExternal("localized",this.locale,this.lang),this._executeBindings()}getLocale(e){return this.locale}getLang(e){return e?this.langList[e]:this.lang}getText(e,t){var i=t?e+"|"+t:e,n=i.split("|"),s=this._getLangElement(n,this.locale);return s||""}_getLangElement(e,t){var i=this.lang;return e.forEach(function(n){var s;i&&(s=i[n],typeof s<"u"?i=s:i=!1)}),i}bind(e,t){this.bindings[e]||(this.bindings[e]=[]),this.bindings[e].push(t),t(this.getText(e),this.lang)}_executeBindings(){for(let e in this.bindings)this.bindings[e].forEach(t=>{t(this.getText(e),this.lang)})}};P(Cn,"moduleName","localize"),P(Cn,"langs",Ub);let ho=Cn;class ph extends ee{constructor(e){super(e)}initialize(){this.registerTableFunction("tableComms",this.receive.bind(this))}getConnections(e){var t=[],i;return i=this.table.constructor.registry.lookupTable(e),i.forEach(n=>{this.table!==n&&t.push(n)}),t}send(e,t,i,n){var s=this.getConnections(e);s.forEach(a=>{a.tableComms(this.table.element,t,i,n)}),!s.length&&e&&console.warn("Table Connection Error - No tables matching selector found",e)}receive(e,t,i,n){if(this.table.modExists(t))return this.table.modules[t].commsReceived(e,i,n);console.warn("Inter-table Comms Error - no such module:",t)}}P(ph,"moduleName","comms");var jb=Object.freeze({__proto__:null,CommsModule:ph,LayoutModule:lo,LocalizeModule:ho});const Ze=class Ze{static findTable(e){var t=Ze.registry.lookupTable(e,!0);return Array.isArray(t)&&!t.length?!1:t}};P(Ze,"registry",{tables:[],register(e){Ze.registry.tables.push(e)},deregister(e){var t=Ze.registry.tables.indexOf(e);t>-1&&Ze.registry.tables.splice(t,1)},lookupTable(e,t){var i=[],n,s;if(typeof e=="string"){if(n=document.querySelectorAll(e),n.length)for(var a=0;a<n.length;a++)s=Ze.registry.matchElement(n[a]),s&&i.push(s)}else typeof HTMLElement<"u"&&e instanceof HTMLElement||e instanceof Ze?(s=Ze.registry.matchElement(e),s&&i.push(s)):Array.isArray(e)?e.forEach(function(u){i=i.concat(Ze.registry.lookupTable(u))}):t||console.warn("Table Connection Error - Invalid Selector",e);return i},matchElement(e){return Ze.registry.tables.find(function(t){return e instanceof Ze?t===e:t.element===e})}});let uo=Ze;const fe=class fe extends uo{constructor(){super()}static initializeModuleBinder(e){fe.modulesRegistered||(fe.modulesRegistered=!0,fe._registerModules(jb,!0),e&&fe._registerModules(e))}static _extendModule(e,t,i){if(fe.moduleBindings[e]){var n=fe.moduleBindings[e][t];if(n)if(typeof i=="object")for(let s in i)n[s]=i[s];else console.warn("Module Error - Invalid value type, it must be an object");else console.warn("Module Error - property does not exist:",t)}else console.warn("Module Error - module does not exist:",e)}static _registerModules(e,t){var i=Object.values(e);t&&i.forEach(n=>{n.prototype.moduleCore=!0}),fe._registerModule(i)}static _registerModule(e){Array.isArray(e)||(e=[e]),e.forEach(t=>{fe._registerModuleBinding(t),fe._registerModuleExtensions(t)})}static _registerModuleBinding(e){e.moduleName?fe.moduleBindings[e.moduleName]=e:console.error("Unable to bind module, no moduleName defined",e.moduleName)}static _registerModuleExtensions(e){var t=e.moduleExtensions;if(e.moduleExtensions)for(let i in t){let n=t[i];if(fe.moduleBindings[i])for(let s in n)fe._extendModule(i,s,n[s]);else{fe.moduleExtensions[i]||(fe.moduleExtensions[i]={});for(let s in n)fe.moduleExtensions[i][s]||(fe.moduleExtensions[i][s]={}),Object.assign(fe.moduleExtensions[i][s],n[s])}}fe._extendModuleFromQueue(e)}static _extendModuleFromQueue(e){var t=fe.moduleExtensions[e.moduleName];if(t)for(let i in t)fe._extendModule(e.moduleName,i,t[i])}_bindModules(){var e=[],t=[],i=[];this.modules={};for(var n in fe.moduleBindings){let s=fe.moduleBindings[n],a=new s(this);this.modules[n]=a,s.prototype.moduleCore?this.modulesCore.push(a):s.moduleInitOrder?s.moduleInitOrder<0?e.push(a):t.push(a):i.push(a)}e.sort((s,a)=>s.moduleInitOrder>a.moduleInitOrder?1:-1),t.sort((s,a)=>s.moduleInitOrder>a.moduleInitOrder?1:-1),this.modulesRegular=e.concat(i.concat(t))}};P(fe,"moduleBindings",{}),P(fe,"moduleExtensions",{}),P(fe,"modulesRegistered",!1),P(fe,"defaultModules",!1);let co=fe;class Kb extends ze{constructor(e){super(e),this.element=this._createAlertElement(),this.msgElement=this._createMsgElement(),this.type=null,this.element.appendChild(this.msgElement)}_createAlertElement(){var e=document.createElement("div");return e.classList.add("tabulator-alert"),e}_createMsgElement(){var e=document.createElement("div");return e.classList.add("tabulator-alert-msg"),e.setAttribute("role","alert"),e}_typeClass(){return"tabulator-alert-state-"+this.type}alert(e,t="msg"){if(e){for(this.clear(),this.dispatch("alert-show",t),this.type=t;this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.add(this._typeClass()),typeof e=="function"&&(e=e()),e instanceof HTMLElement?this.msgElement.appendChild(e):this.msgElement.innerHTML=e,this.table.element.appendChild(this.element)}}clear(){this.dispatch("alert-hide",this.type),this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.msgElement.classList.remove(this._typeClass())}}const Dt=class Dt extends co{static extendModule(){Dt.initializeModuleBinder(),Dt._extendModule(...arguments)}static registerModule(){Dt.initializeModuleBinder(),Dt._registerModule(...arguments)}constructor(e,t,i){super(),Dt.initializeModuleBinder(i),this.options={},this.columnManager=null,this.rowManager=null,this.footerManager=null,this.alertManager=null,this.vdomHoz=null,this.externalEvents=null,this.eventBus=null,this.interactionMonitor=!1,this.browser="",this.browserSlow=!1,this.browserMobile=!1,this.rtl=!1,this.originalElement=null,this.componentFunctionBinder=new Pb(this),this.dataLoader=!1,this.modules={},this.modulesCore=[],this.modulesRegular=[],this.deprecationAdvisor=new Nb(this),this.optionsList=new ch(this,"table constructor"),this.dependencyRegistry=new Ib(this),this.initialized=!1,this.destroyed=!1,this.initializeElement(e)&&(this.initializeCoreSystems(t),setTimeout(()=>{this._create()})),this.constructor.registry.register(this)}initializeElement(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement?(this.element=e,!0):typeof e=="string"?(this.element=document.querySelector(e),this.element?!0:(console.error("Tabulator Creation Error - no element found matching selector: ",e),!1)):(console.error("Tabulator Creation Error - Invalid element provided:",e),!1)}initializeCoreSystems(e){this.columnManager=new Mb(this),this.rowManager=new Ab(this),this.footerManager=new Fb(this),this.dataLoader=new Ob(this),this.alertManager=new Kb(this),this._bindModules(),this.options=this.optionsList.generate(Dt.defaultOptions,e),this._clearObjectPointers(),this._mapDeprecatedFunctionality(),this.externalEvents=new Hb(this,this.options,this.options.debugEventsExternal),this.eventBus=new Bb(this.options.debugEventsInternal),this.interactionMonitor=new zb(this),this.dataLoader.initialize(),this.footerManager.initialize(),this.dependencyRegistry.initialize()}_mapDeprecatedFunctionality(){}_clearSelection(){this.element.classList.add("tabulator-block-select"),window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty(),this.element.classList.remove("tabulator-block-select")}_create(){this.externalEvents.dispatch("tableBuilding"),this.eventBus.dispatch("table-building"),this._rtlCheck(),this._buildElement(),this._initializeTable(),this.initialized=!0,this._loadInitialData().finally(()=>{this.eventBus.dispatch("table-initialized"),this.externalEvents.dispatch("tableBuilt")})}_rtlCheck(){var e=window.getComputedStyle(this.element);switch(this.options.textDirection){case"auto":if(e.direction!=="rtl")break;case"rtl":this.element.classList.add("tabulator-rtl"),this.rtl=!0;break;case"ltr":this.element.classList.add("tabulator-ltr");default:this.rtl=!1}}_clearObjectPointers(){this.options.columns=this.options.columns.slice(0),Array.isArray(this.options.data)&&!this.options.reactiveData&&(this.options.data=this.options.data.slice(0))}_buildElement(){var e=this.element,t=this.options,i;if(e.tagName==="TABLE"){this.originalElement=this.element,i=document.createElement("div");var n=e.attributes;for(var s in n)typeof n[s]=="object"&&i.setAttribute(n[s].name,n[s].value);e.parentNode.replaceChild(i,e),this.element=e=i}for(e.classList.add("tabulator"),e.setAttribute("role","grid");e.firstChild;)e.removeChild(e.firstChild);t.height&&(t.height=isNaN(t.height)?t.height:t.height+"px",e.style.height=t.height),t.minHeight!==!1&&(t.minHeight=isNaN(t.minHeight)?t.minHeight:t.minHeight+"px",e.style.minHeight=t.minHeight),t.maxHeight!==!1&&(t.maxHeight=isNaN(t.maxHeight)?t.maxHeight:t.maxHeight+"px",e.style.maxHeight=t.maxHeight)}_initializeTable(){var e=this.element,t=this.options;this.interactionMonitor.initialize(),this.columnManager.initialize(),this.rowManager.initialize(),this._detectBrowser(),this.modulesCore.forEach(i=>{i.initialize()}),e.appendChild(this.columnManager.getElement()),e.appendChild(this.rowManager.getElement()),t.footerElement&&this.footerManager.activate(),t.autoColumns&&t.data&&this.columnManager.generateColumnsFromRowData(this.options.data),this.modulesRegular.forEach(i=>{i.initialize()}),this.columnManager.setColumns(t.columns),this.eventBus.dispatch("table-built")}_loadInitialData(){return this.dataLoader.load(this.options.data).finally(()=>{this.columnManager.verticalAlignHeaders()})}destroy(){var e=this.element;for(this.destroyed=!0,this.constructor.registry.deregister(this),this.eventBus.dispatch("table-destroy"),this.rowManager.destroy();e.firstChild;)e.removeChild(e.firstChild);e.classList.remove("tabulator"),this.externalEvents.dispatch("tableDestroyed")}_detectBrowser(){var e=navigator.userAgent||navigator.vendor||window.opera;e.indexOf("Trident")>-1?(this.browser="ie",this.browserSlow=!0):e.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):e.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):e.indexOf("Mac OS")>-1?(this.browser="safari",this.browserSlow=!1):(this.browser="other",this.browserSlow=!1),this.browserMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(e.slice(0,4))}initGuard(e,t){var i,n;return this.options.debugInitialization&&!this.initialized&&(e||(i=new Error().stack.split(`
|
|
53
|
-
`),n=i[0]=="Error"?i[2]:i[1],n[0]==" "?e=n.trim().split(" ")[1].split(".")[1]:e=n.trim().split("@")[0]),console.warn("Table Not Initialized - Calling the "+e+" function before the table is initialized may result in inconsistent behavior, Please wait for the `tableBuilt` event before calling this function."+(t?" "+t:""))),this.initialized}blockRedraw(){this.initGuard(),this.eventBus.dispatch("redraw-blocking"),this.rowManager.blockRedraw(),this.columnManager.blockRedraw(),this.eventBus.dispatch("redraw-blocked")}restoreRedraw(){this.initGuard(),this.eventBus.dispatch("redraw-restoring"),this.rowManager.restoreRedraw(),this.columnManager.restoreRedraw(),this.eventBus.dispatch("redraw-restored")}setData(e,t,i){return this.initGuard(!1,"To set initial data please use the 'data' property in the table constructor."),this.dataLoader.load(e,t,i,!1)}clearData(){this.initGuard(),this.dataLoader.blockActiveLoad(),this.rowManager.clearData()}getData(e){return this.rowManager.getData(e)}getDataCount(e){return this.rowManager.getDataCount(e)}replaceData(e,t,i){return this.initGuard(),this.dataLoader.load(e,t,i,!0,!0)}updateData(e){var t=0;return this.initGuard(),new Promise((i,n)=>{this.dataLoader.blockActiveLoad(),typeof e=="string"&&(e=JSON.parse(e)),e&&e.length>0?e.forEach(s=>{var a=this.rowManager.findRow(s[this.options.index]);a?(t++,a.updateData(s).then(()=>{t--,t||i()}).catch(u=>{n("Update Error - Unable to update row",s,u)})):n("Update Error - Unable to find row",s)}):(console.warn("Update Error - No data provided"),n("Update Error - No data provided"))})}addData(e,t,i){return this.initGuard(),new Promise((n,s)=>{this.dataLoader.blockActiveLoad(),typeof e=="string"&&(e=JSON.parse(e)),e?this.rowManager.addRows(e,t,i).then(a=>{var u=[];a.forEach(function(d){u.push(d.getComponent())}),n(u)}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})}updateOrAddData(e){var t=[],i=0;return this.initGuard(),new Promise((n,s)=>{this.dataLoader.blockActiveLoad(),typeof e=="string"&&(e=JSON.parse(e)),e&&e.length>0?e.forEach(a=>{var u=this.rowManager.findRow(a[this.options.index]);i++,u?u.updateData(a).then(()=>{i--,t.push(u.getComponent()),i||n(t)}):this.rowManager.addRows(a).then(d=>{i--,t.push(d[0].getComponent()),i||n(t)})}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})}getRow(e){var t=this.rowManager.findRow(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)}getRowFromPosition(e){var t=this.rowManager.getRowFromPosition(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)}deleteRow(e){var t=[];this.initGuard(),Array.isArray(e)||(e=[e]);for(let i of e){let n=this.rowManager.findRow(i,!0);if(n)t.push(n);else return console.error("Delete Error - No matching row found:",i),Promise.reject("Delete Error - No matching row found")}return t.sort((i,n)=>this.rowManager.rows.indexOf(i)>this.rowManager.rows.indexOf(n)?1:-1),t.forEach(i=>{i.delete()}),this.rowManager.reRenderInPosition(),Promise.resolve()}addRow(e,t,i){return this.initGuard(),typeof e=="string"&&(e=JSON.parse(e)),this.rowManager.addRows(e,t,i,!0).then(n=>n[0].getComponent())}updateOrAddRow(e,t){var i=this.rowManager.findRow(e);return this.initGuard(),typeof t=="string"&&(t=JSON.parse(t)),i?i.updateData(t).then(()=>i.getComponent()):this.rowManager.addRows(t).then(n=>n[0].getComponent())}updateRow(e,t){var i=this.rowManager.findRow(e);return this.initGuard(),typeof t=="string"&&(t=JSON.parse(t)),i?i.updateData(t).then(()=>Promise.resolve(i.getComponent())):(console.warn("Update Error - No matching row found:",e),Promise.reject("Update Error - No matching row found"))}scrollToRow(e,t,i){var n=this.rowManager.findRow(e);return n?this.rowManager.scrollToRow(n,t,i):(console.warn("Scroll Error - No matching row found:",e),Promise.reject("Scroll Error - No matching row found"))}moveRow(e,t,i){var n=this.rowManager.findRow(e);this.initGuard(),n?n.moveToRow(t,i):console.warn("Move Error - No matching row found:",e)}getRows(e){return this.rowManager.getComponents(e)}getRowPosition(e){var t=this.rowManager.findRow(e);return t?t.getPosition():(console.warn("Position Error - No matching row found:",e),!1)}setColumns(e){this.initGuard(!1,"To set initial columns please use the 'columns' property in the table constructor"),this.columnManager.setColumns(e)}getColumns(e){return this.columnManager.getComponents(e)}getColumn(e){var t=this.columnManager.findColumn(e);return t?t.getComponent():(console.warn("Find Error - No matching column found:",e),!1)}getColumnDefinitions(){return this.columnManager.getDefinitionTree()}showColumn(e){var t=this.columnManager.findColumn(e);if(this.initGuard(),t)t.show();else return console.warn("Column Show Error - No matching column found:",e),!1}hideColumn(e){var t=this.columnManager.findColumn(e);if(this.initGuard(),t)t.hide();else return console.warn("Column Hide Error - No matching column found:",e),!1}toggleColumn(e){var t=this.columnManager.findColumn(e);if(this.initGuard(),t)t.visible?t.hide():t.show();else return console.warn("Column Visibility Toggle Error - No matching column found:",e),!1}addColumn(e,t,i){var n=this.columnManager.findColumn(i);return this.initGuard(),this.columnManager.addColumn(e,t,n).then(s=>s.getComponent())}deleteColumn(e){var t=this.columnManager.findColumn(e);return this.initGuard(),t?t.delete():(console.warn("Column Delete Error - No matching column found:",e),Promise.reject())}updateColumnDefinition(e,t){var i=this.columnManager.findColumn(e);return this.initGuard(),i?i.updateDefinition(t):(console.warn("Column Update Error - No matching column found:",e),Promise.reject())}moveColumn(e,t,i){var n=this.columnManager.findColumn(e),s=this.columnManager.findColumn(t);this.initGuard(),n?s?this.columnManager.moveColumn(n,s,i):console.warn("Move Error - No matching column found:",s):console.warn("Move Error - No matching column found:",e)}scrollToColumn(e,t,i){return new Promise((n,s)=>{var a=this.columnManager.findColumn(e);return a?this.columnManager.scrollToColumn(a,t,i):(console.warn("Scroll Error - No matching column found:",e),Promise.reject("Scroll Error - No matching column found"))})}redraw(e){this.initGuard(),this.columnManager.redraw(e),this.rowManager.redraw(e)}setHeight(e){this.options.height=isNaN(e)?e:e+"px",this.element.style.height=this.options.height,this.rowManager.initializeRenderer(),this.rowManager.redraw(!0)}on(e,t){this.externalEvents.subscribe(e,t)}off(e,t){this.externalEvents.unsubscribe(e,t)}dispatchEvent(){var e=Array.from(arguments);e.shift(),this.externalEvents.dispatch(...arguments)}alert(e,t){this.initGuard(),this.alertManager.alert(e,t)}clearAlert(){this.initGuard(),this.alertManager.clear()}modExists(e,t){return this.modules[e]?!0:(t&&console.error("Tabulator Module Not Installed: "+e),!1)}module(e){var t=this.modules[e];return t||console.error("Tabulator module not installed: "+e),t}};P(Dt,"defaultOptions",Tb);let fo=Dt;var pn=fo;class qb extends pn{static extendModule(){pn.initializeModuleBinder(ao),pn._extendModule(...arguments)}static registerModule(){pn.initializeModuleBinder(ao),pn._registerModule(...arguments)}constructor(e,t,i){super(e,t,ao)}}var Xb=qb;const gh={__name:"ActionButton",props:{data:{},index:{}},setup(l){const{can:e}=Os(),t=l;return(i,n)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.unref(e)("delete")?(c.openBlock(),c.createElementBlock("button",{key:0,class:"mx-2 inline-flex items-center justify-center w-5 h-5 rounded-full text-gray-500 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500","data-tooltip":"حذف",onClick:n[0]||(n[0]=s=>c.unref(se).event("deleteBtn",t.data))},n[2]||(n[2]=[c.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash-2"><path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line></svg>',1)]))):c.createCommentVNode("",!0),c.unref(e)("update")?(c.openBlock(),c.createElementBlock("button",{key:1,class:"mx-2 inline-flex items-center justify-center w-5 h-5 rounded-full text-gray-500 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500","data-tooltip":"ویرایش",onClick:n[1]||(n[1]=s=>c.unref(se).event("editBtn",t.data))},n[3]||(n[3]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-file-pen-line"},[c.createElementVNode("path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2"}),c.createElementVNode("path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z"}),c.createElementVNode("path",{d:"M8 18h1"})],-1)]))):c.createCommentVNode("",!0)],64))}},mh={__name:"SelectColumn",props:{data:{default:()=>({})},index:{default:-1},all:{default:!1}},setup(l){const e=l,t=c.ref(!1);se.listen("batch.removed",()=>{t.value=!1}),se.listen("toggle.select.all",n=>{e.all||(t.value=n,se.event("toggle.select",e.data.id))});function i(n){if(e.all)return se.event("toggle.select.all",t.value);se.event("toggle.select",e.data.id)}return(n,s)=>c.withDirectives((c.openBlock(),c.createElementBlock("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>t.value=a),class:"rounded",type:"checkbox",onChange:i,style:{border:"1px dashed rgba(0, 0, 0, 0.2)"}},null,544)),[[c.vModelCheckbox,t.value]])}};let lr;const Yb=({element:l,headers:e,options:t}={element:null,headers:[],options:{}})=>(lr=new Xb(l,{pagination:!1,paginationMode:"remote",layout:"fitDataStretch",resizableColumnFit:!0,paginationSize:5,paginationInitialPage:1,paginationSizeSelector:[3,6,8,10],paginationCounter:"rows",ajaxLoaderLoading:"<div style='display:inline-block; border:4px solid #333; border-radius:10px; background:#fff; font-weight:bold; font-size:16px; color:#000; padding:10px 20px;'>Loading Data</div>",columns:bh(e),...t}),lr);function bh(l){const e=["type","value","align","rules","isHeader","placeholder","text","columns","clearOnSearch","valueProp","labelProp","normalizer","onChange","items","filterResults","label"],t={_select_:{formatter:Zb,formatterParams:{component:mh},titleFormatter:Qb},_actions_:{formatter:Jb,formatterParams:{component:gh}}};return $.cloneDeep(l).map(n=>n.field in t?{...t[n.field],...n}:n).map(n=>{for(const s of e)s in n&&delete n[s];return{...n,headerSort:!1}})}function Jb(l,e){const t=l.getRow().getData(),i=l.getRow().getPosition(),n=document.createElement("div"),s=e.component;return c.createApp(s,{data:t,index:i}).mount(n),n}function Zb(l,e){const t=l.getRow().getData(),i=l.getRow().getPosition(),n=document.createElement("div"),s=e.component;return c.createApp(s,{data:t,index:i}).mount(n),n}function Qb(){const l=document.createElement("div");return c.createApp(mh,{all:!0}).mount(l),l}function vh(l){lr.setData(l)}function ev(l){lr.setColumns(l)}const tv={up:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuNC4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIzIEZvbnRpY29ucywgSW5jLiAtLT48cGF0aCBkPSJNMjEyLjcgMTQ4LjdjNi4yLTYuMiAxNi40LTYuMiAyMi42IDBsMTYwIDE2MGM2LjIgNi4yIDYuMiAxNi40IDAgMjIuNnMtMTYuNCA2LjItMjIuNiAwTDIyNCAxODIuNiA3NS4zIDMzMS4zYy02LjIgNi4yLTE2LjQgNi4yLTIyLjYgMHMtNi4yLTE2LjQgMC0yMi42bDE2MC0xNjB6Ii8+PC9zdmc+",down:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuNC4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIzIEZvbnRpY29ucywgSW5jLiAtLT48cGF0aCBkPSJNMjEyLjcgMzMxLjNjNi4yIDYuMiAxNi40IDYuMiAyMi42IDBsMTYwLTE2MGM2LjItNi4yIDYuMi0xNi40IDAtMjIuNnMtMTYuNC02LjItMjIuNiAwTDIyNCAyOTcuNCA3NS4zIDE0OC43Yy02LjItNi4yLTE2LjQtNi4yLTIyLjYgMHMtNi4yIDE2LjQgMCAyMi42bDE2MCAxNjB6Ii8+PC9zdmc+"},wh=(l="up")=>{const e=document.createElement("img");return e.src=tv[l],e.style.width="10px",e.style.height="10px",e.style.marginLeft="5px",e},yh=(l,e)=>{l._column.titleHolderElement.style.display="flex",l._column.titleHolderElement.style.alignItems="center",l._column.titleHolderElement.appendChild(e)},Ch=l=>{l._column.titleHolderElement.lastChild.remove()};function iv(l,e){let t=[];e.on("tableBuilt",function(){c.watch(()=>l.mainItems,i=>{vh(i)},{immediate:!0}),c.watch(()=>l.flatFields,()=>{const i=bh(l.headers);ev(i)},{deep:!0}),c.watch(()=>l.loadings.mainLoading,i=>{i&&vh([])},{deep:!0})}),e.on("headerClick",(i,n)=>{const s=n.getField();if(!["_index_","_select_","_actions_"].includes(s)){if(t.includes(s+":asc")){let a=t.indexOf(s+":asc");t[a]=s+":desc",Ch(n),yh(n,wh("down"))}else if(t.includes(s+":desc")){let a=t.indexOf(s+":desc");t.splice(a,1),Ch(n)}else yh(n,wh()),t.push(s+":asc");l.sorts=t,l.loadItems()}})}const zT="",Mt=(l,e)=>{const t=l.__vccOpts||l;for(const[i,n]of e)t[i]=n;return t},nv={key:0,id:"paginate"},rv={class:"flex items-center justify-center py-2 lg:px-0 sm:px-6 px-4"},sv={class:"lg:w-5/5 bg-white w-full flex items-center justify-between rounded-lg border pb-3"},ov={class:"sm:flex hidden mx-auto"},av=["onClick"],lv=Mt({__name:"MTablePagination",setup(l){const e=c.inject("store");function t(u){e.paginate(u)}function i(){e.mainPagination.currentPage>1&&t(e.mainPagination.currentPage-1)}function n(u){t(u)}function s(){e.mainPagination.currentPage<e.mainPagination.lastPage&&t(e.mainPagination.currentPage+1)}function a(){let u=[];if(e.mainPagination.lastPage>10){let d=e.mainPagination.currentPage,p=d-1,g=d+1;d!=1&&u.push(1),d!=1&&d!=2&&p!=2&&u.push("..."),p>1&&u.push(p),u.push(d),g<e.mainPagination.lastPage&&u.push(g),d!=e.mainPagination.lastPage&&d!=e.mainPagination.lastPage-1&&g!=e.mainPagination.lastPage-1&&u.push("..."),e.mainPagination.lastPage!=d&&u.push(e.mainPagination.lastPage)}else u=e.mainPagination.lastPage;return u}return(u,d)=>c.unref(e).mainPagination.lastPage?(c.openBlock(),c.createElementBlock("div",nv,[c.createElementVNode("div",rv,[c.createElementVNode("div",sv,[c.createElementVNode("div",ov,[c.createElementVNode("div",{onClick:i,class:"flex items-center px-2 pt-3 text-gray-600 hover:text-indigo-700 cursor-pointer"},d[0]||(d[0]=[c.createElementVNode("svg",{class:"rtl:rotate-180 w-[10px] fill-muted-600",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512"},[c.createElementVNode("path",{d:"M15 239c-9.4 9.4-9.4 24.6 0 33.9L207 465c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L65.9 256 241 81c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L15 239z"})],-1)])),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a(),p=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:p},[typeof p=="number"?(c.openBlock(),c.createElementBlock("p",{key:0,class:c.normalizeClass(c.unref(e).mainPagination.currentPage===p?"text-sm font-medium leading-none cursor-pointer text-indigo-700 !border-indigo-400 border-t-[1px] pt-3 mr-4 px-2":"text-sm font-medium leading-none cursor-pointer text-gray-600 hover:text-indigo-700 border-t-[1px] border-transparent hover:border-indigo-400 pt-3 mr-4 px-2"),onClick:g=>n(p)},c.toDisplayString(p),11,av)):(c.openBlock(),c.createElementBlock("p",{key:1,class:c.normalizeClass(["text-sm font-medium leading-none text-gray-600 pt-3 px-2",{"mr-4":a()>1}])},c.toDisplayString(p),3))],64))),128)),c.createElementVNode("div",{onClick:s,class:"flex items-center px-2 pt-3 text-gray-600 hover:text-indigo-700 cursor-pointer"},d[1]||(d[1]=[c.createElementVNode("svg",{class:"ltr:rotate-180 w-[10px] fill-muted-600",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512"},[c.createElementVNode("path",{d:"M15 239c-9.4 9.4-9.4 24.6 0 33.9L207 465c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L65.9 256 241 81c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L15 239z"})],-1)]))])])])])):c.createCommentVNode("",!0)}},[["__scopeId","data-v-7f626758"]]),hv={key:0,class:"mt-[-20px]"},uv={class:"flex animate-pulse flex-row items-center h-full justify-center"},dv={class:"w-full flex flex-row items-start rtl:mr-8 ltr:ml-8"},cv={key:1,class:"padding: 100px; mt-[-20px] rounded-b-xl bg-white text-center p-[100px] dark:bg-muted-800"},fv={class:"dark:text-muted-200 text-muted-600"},pv={__name:"MTable",setup(l){const e=c.ref(null),t=c.inject("store"),i=c.inject("tableOptions"),n=c.computed(()=>t.mainItems.length===0&&!t.loadings.mainLoading);return c.onMounted(()=>{const s=Yb({options:i,element:e.value,headers:t.headers});iv(t,s)}),(s,a)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.createElementVNode("div",{ref_key:"table",ref:e,class:"mt-2 w-full overflow-x-auto"},null,512),c.unref(t).loadings.mainLoading?(c.openBlock(),c.createElementBlock("div",hv,[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(10,u=>c.createElementVNode("div",{key:u,class:c.normalizeClass([{"border-t-0":u===1,"border-b-0":u===10,"bg-muted-50 dark:bg-muted-700":u%2!==0,"bg-white dark:bg-muted-800":u%2===0},"w-full py-4 mx-auto border-b-1"])},[c.createElementVNode("div",uv,[c.createElementVNode("div",dv,[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(9,d=>c.createElementVNode("div",{key:d,class:"mx-1 w-[10%] bg-muted-300 dark:bg-muted-900 h-2.5 rounded-md"})),64))])])],2)),64))])):c.createCommentVNode("",!0),n.value?(c.openBlock(),c.createElementBlock("div",cv,[c.createElementVNode("h2",fv,c.toDisplayString(s.$fcTr("not_load_or_existing_data")),1)])):c.createCommentVNode("",!0),c.createVNode(lv)],64))}},gv="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXgiPjxwYXRoIGQ9Ik0xOCA2IDYgMTgiLz48cGF0aCBkPSJtNiA2IDEyIDEyIi8+PC9zdmc+",OT="",mv={key:0,class:"w-full rounded-lg bg-white shadow-secondary-1 shadow-lg border border-muted-300 dark:bg-surface-dark"},bv={class:"border-b-2 flex justify-between border--100 px-6 py-3 text-surface dark:border-white/10 dark:text-white"},vv={key:0,class:"text-primerr-700"},wv={key:1,class:"text-primerr-700"},yv=["src"],Cv={class:"p-6"},Ev={class:"flex justify-end p-3 bg-gray-100 rounded-lg"},xv=Mt({__name:"MTabForm",setup(l){const e=c.inject("store");return(t,i)=>(c.openBlock(),c.createBlock(c.Transition,{name:"fade",appear:""},{default:c.withCtx(()=>[c.unref(e).dialog?(c.openBlock(),c.createElementBlock("div",mv,[c.createElementVNode("div",bv,[c.unref(e).isEditing?(c.openBlock(),c.createElementBlock("b",vv,c.toDisplayString(t.$fcTr("edit")),1)):(c.openBlock(),c.createElementBlock("b",wv,c.toDisplayString(t.$fcTr("add")),1)),c.createElementVNode("img",{style:{"max-width":"18px",cursor:"pointer"},src:c.unref(gv),onClick:i[0]||(i[0]=n=>c.unref(e).dialog=!1)},null,8,yv)]),c.createElementVNode("div",Cv,[c.renderSlot(t.$slots,"default",{},void 0,!0),c.createElementVNode("div",Ev,[c.renderSlot(t.$slots,"actions",{},void 0,!0)])])])):c.createCommentVNode("",!0)]),_:3}))}},[["__scopeId","data-v-305ba86b"]]),Rv={class:"flex flex-col text-right mt-4"},_v={class:"mb-5"},Tv={__name:"FormCore",setup(l){const e=c.inject("store"),t=c.ref(null),i=()=>{e.isEditing?e.editItem({...e.form}):e.addItem({...e.form})},n=async()=>{try{t.value.validate().then(()=>{if(!t.value.invalid)return i()})}catch{return}};return se.listen("saveForm",()=>{n()}),(s,a)=>{const u=c.resolveComponent("Vueform");return c.openBlock(),c.createElementBlock("div",Rv,[c.createElementVNode("div",_v,[c.createVNode(u,c.mergeProps({modelValue:c.unref(e).form,"onUpdate:modelValue":a[0]||(a[0]=d=>c.unref(e).form=d)},c.unref(e).structure,{schema:c.unref(e).formFields,columns:{label:12},ref_key:"form$",ref:t,sync:""}),null,16,["modelValue","schema"])])])}}},BT="",kv={class:"fixed z-50 inset-0 overflow-hidden pointer-events-none"},Sv={class:"text-lg font-semibold text-gray-900 flex items-center gap-2 pointer-events-none"},Mv={key:0,class:"text-sm text-gray-500 font-normal"},Lv={class:"flex items-center gap-1 pointer-events-auto"},Dv=["title"],Av={class:"w-4 h-4 text-gray-600 group-hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Fv={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 12H4"},zv={key:1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 15l7-7 7 7"},Pv=["title"],Ov={class:"w-4 h-4 text-gray-600 group-hover:text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Hv={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8V6a2 2 0 012-2h2M4 16v2a2 2 0 002 2h2m8-16h2a2 2 0 012 2v2m-4 12h2a2 2 0 002-2v-2"},Bv={key:1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 9h6v6H9V9zm0 0V7a2 2 0 012-2h2a2 2 0 012 2v2M9 15v2a2 2 0 002 2h2a2 2 0 002-2v-2"},Nv={class:"flex-shrink-0 bg-gray-50 px-4 py-3 border-t border-gray-200 rounded-b-xl"},Iv={class:"flex justify-end gap-2"},Vv=Mt({__name:"TailwindDialog",props:{title:{default:""},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:e}){c.inject("store");const t=e,i=l,n=c.ref(null),s=c.ref(null),a=c.ref({x:0,y:0}),u=c.ref({width:512,height:window.innerHeight>1080?window.innerHeight*.5:window.innerHeight-100}),d=c.ref(!1),p=c.ref(!1),g=c.ref(!1),w=c.ref(!1),b=c.ref({position:{x:0,y:0},size:{width:512,height:window.innerHeight>1080?window.innerHeight*.5:window.innerHeight-100}});let C=null;const _=c.computed(()=>g.value?{bottom:"1rem",left:"1rem",width:"300px",height:"auto",transform:"none"}:w.value?{top:"1rem",left:"1rem",width:"calc(100vw - 2rem)",height:"calc(100vh - 2rem)",transform:"none"}:{left:"50%",top:"50%",transform:`translate(calc(-50% + ${a.value.x}px), calc(-50% + ${a.value.y}px))`,width:`${u.value.width}px`,height:`${u.value.height}px`,minWidth:"300px",minHeight:"200px",maxWidth:"90vw",maxHeight:"90vh"}),S=c.computed(()=>w.value?{height:"calc(100vh - 2rem - 50px)"}:{height:`${u.value.height-50}px`}),F=c.computed(()=>({minHeight:"100px"}));function L(){t("update:modelValue",!1),U()}function U(){a.value={x:0,y:0};const V=Math.min(window.innerHeight*.9,window.innerHeight>1080?window.innerHeight*.5:window.innerHeight-100);u.value={width:512,height:V},g.value=!1,w.value=!1}function H(){g.value?(a.value={...b.value.position},u.value={...b.value.size},g.value=!1):(b.value={position:{...a.value},size:{...u.value}},g.value=!0,w.value=!1)}function N(){if(!w.value)b.value={position:{...a.value},size:{...u.value}};else{const V=b.value.size.width,W=b.value.size.height,pe=window.innerWidth*.05,Y=window.innerHeight*.05,he=window.innerWidth/2-V/2-pe,j=-(window.innerWidth/2)+V/2+pe,xe=window.innerHeight/2-W/2-Y,Re=-(window.innerHeight/2)+W/2+Y;a.value={x:Math.max(j,Math.min(he,b.value.position.x)),y:Math.max(Re,Math.min(xe,b.value.position.y))},u.value={...b.value.size}}w.value=!w.value,g.value=!1}function O(V){if(w.value||V.target.closest("button"))return;V.preventDefault(),d.value=!0;const W=V.clientX,pe=V.clientY,Y=a.value.x,he=a.value.y;function j(Re){d.value&&(C&&cancelAnimationFrame(C),C=requestAnimationFrame(()=>{const Ve=Re.clientX-W,gt=Re.clientY-pe,Be=Y+Ve,We=he+gt;if(g.value)return;const At=u.value.width,Qe=u.value.height,$e=window.innerWidth*.05,Ni=window.innerHeight*.05,mo=window.innerWidth/2-At/2-$e,bo=-(window.innerWidth/2)+At/2+$e,Zt=window.innerHeight/2-Qe/2-Ni,Ii=-(window.innerHeight/2)+Qe/2+Ni;a.value={x:Math.max(bo,Math.min(mo,Be)),y:Math.max(Ii,Math.min(Zt,We))}}))}function xe(){d.value=!1,C&&(cancelAnimationFrame(C),C=null),document.removeEventListener("mousemove",j,{passive:!0}),document.removeEventListener("mouseup",xe)}document.addEventListener("mousemove",j,{passive:!0}),document.addEventListener("mouseup",xe)}function oe(V){V.preventDefault(),V.stopPropagation(),p.value=!0;const W=V.clientX,pe=V.clientY,Y=u.value.width,he=u.value.height;function j(Re){p.value&&(C&&cancelAnimationFrame(C),C=requestAnimationFrame(()=>{const Ve=Re.clientX-W,gt=Re.clientY-pe,Be=window.innerWidth/2+a.value.x,We=window.innerHeight/2+a.value.y,At=Math.min(window.innerWidth*.9,(Be-window.innerWidth*.05)*2,(window.innerWidth*.95-Be)*2),Qe=Math.min(window.innerHeight*.9,(We-window.innerHeight*.05)*2,(window.innerHeight*.95-We)*2),$e=Math.max(300,Math.min(At,Y+Ve)),Ni=Math.max(200,Math.min(Qe,he+gt));u.value={width:$e,height:Ni}}))}function xe(){p.value=!1,C&&(cancelAnimationFrame(C),C=null),document.removeEventListener("mousemove",j,{passive:!0}),document.removeEventListener("mouseup",xe)}document.addEventListener("mousemove",j,{passive:!0}),document.addEventListener("mouseup",xe)}return c.onMounted(async()=>{await c.nextTick(),a.value={x:0,y:0}}),c.onUnmounted(()=>{C&&cancelAnimationFrame(C)}),(V,W)=>(c.openBlock(),c.createBlock(c.Transition,{name:"fade",appear:""},{default:c.withCtx(()=>[l.modelValue?(c.openBlock(),c.createElementBlock("div",{key:0,onKeydown:c.withKeys(L,["escape"]),class:"relative z-50",role:"dialog"},[g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-30 transition-opacity backdrop-blur-sm",onClick:L})),c.createElementVNode("div",kv,[c.createElementVNode("div",{ref_key:"dialogRef",ref:n,class:c.normalizeClass(["absolute bg-white shadow-2xl border border-gray-200 pointer-events-auto transition-all duration-300",d.value?"select-none":"",p.value?"select-none":"",g.value?"rounded-t-xl shadow-lg":"rounded-xl"]),style:c.normalizeStyle(_.value)},[c.createElementVNode("div",{ref_key:"headerRef",ref:s,class:c.normalizeClass(["flex items-center justify-between px-4 py-3 border-gray-200",g.value?"border-b-0 rounded-t-xl bg-gradient-to-r from-blue-100 to-indigo-100":"border-b rounded-t-xl bg-gradient-to-r from-blue-50 to-indigo-50",d.value?"cursor-grabbing":"cursor-grab"]),onMousedown:O,onDblclick:W[0]||(W[0]=pe=>g.value?H():N())},[c.createElementVNode("h3",Sv,[c.createElementVNode("div",{class:c.normalizeClass(["w-2 h-2 rounded-full",g.value?"bg-orange-500 animate-pulse":"bg-blue-500 animate-pulse"])},null,2),c.createTextVNode(" "+c.toDisplayString(i.title)+" ",1),g.value?(c.openBlock(),c.createElementBlock("span",Mv,"(minimized)")):c.createCommentVNode("",!0)]),c.createElementVNode("div",Lv,[c.createElementVNode("button",{onClick:H,class:"p-1.5 rounded-full hover:bg-white/70 transition-colors group",title:g.value?"Restore":"Minimize"},[(c.openBlock(),c.createElementBlock("svg",Av,[g.value?(c.openBlock(),c.createElementBlock("path",zv)):(c.openBlock(),c.createElementBlock("path",Fv))]))],8,Dv),g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("button",{key:0,onClick:N,class:"p-1.5 rounded-full hover:bg-white/70 transition-colors group",title:w.value?"Restore":"Maximize"},[(c.openBlock(),c.createElementBlock("svg",Ov,[w.value?(c.openBlock(),c.createElementBlock("path",Bv)):(c.openBlock(),c.createElementBlock("path",Hv))]))],8,Pv)),c.createElementVNode("button",{onClick:L,class:"p-1.5 rounded-full hover:bg-red-100 transition-colors group",title:"Close"},W[1]||(W[1]=[c.createElementVNode("svg",{class:"w-4 h-4 text-gray-600 group-hover:text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[c.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])],34),c.createVNode(c.Transition,{name:"slide-down"},{default:c.withCtx(()=>[g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"flex flex-col overflow-hidden",style:c.normalizeStyle(S.value)},[c.createElementVNode("div",{class:"flex-1 px-4 py-4 overflow-y-auto",style:c.normalizeStyle(F.value)},[c.renderSlot(V.$slots,"default",{},void 0,!0)],4),c.createElementVNode("div",Nv,[c.createElementVNode("div",Iv,[c.renderSlot(V.$slots,"actions",{},()=>[c.createElementVNode("button",{type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 transition-colors",onClick:L}," لغو "),c.createElementVNode("button",{type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 transition-colors",onClick:L}," تایید ")],!0)])])],4))]),_:3}),!g.value&&!w.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize hover:bg-blue-100 rounded-tl-lg transition-colors z-10",onMousedown:oe,title:"Resize"},W[2]||(W[2]=[c.createElementVNode("svg",{class:"w-full h-full text-gray-400 p-0.5",fill:"currentColor",viewBox:"0 0 24 24"},[c.createElementVNode("path",{d:"M22 22H20V20h2v2zm0-4H18v-2h4v2zm0-4H16v-2h6v2zm0-4H14v-2h8v2z"})],-1)]),32)):c.createCommentVNode("",!0)],6)])],32)):c.createCommentVNode("",!0)]),_:3}))}},[["__scopeId","data-v-cc2284ca"]]),IT="",Eh=Mt({__name:"MDialogForm",setup(l){const e=c.inject("store");return(t,i)=>(c.openBlock(),c.createBlock(Vv,{modelValue:c.unref(e).dialog,"onUpdate:modelValue":i[0]||(i[0]=n=>c.unref(e).dialog=n),title:c.unref(e).isEditing?t.$fcTr("edit"):t.$fcTr("add")},{actions:c.withCtx(()=>[c.renderSlot(t.$slots,"actions",{},void 0,!0)]),default:c.withCtx(()=>[c.renderSlot(t.$slots,"default",{},void 0,!0)]),_:3},8,["modelValue","title"]))}},[["__scopeId","data-v-3c50400f"]]);function Wv(l,e){return Array.isArray(l)?$.every(l,t=>$.isType(t,e)):!1}const $v=(l,e)=>{const t=$.get(l,"field"),i=$.get(l,"valueProp");return Wv(e,"object")?e.map(n=>$.get(n,i)):$.get(e,t)},xh=(l,e)=>$.get(e,l.field),Gv={select:$v,text:xh};function Rh(l,e="",t={}){for(const i in l){const n=l[i],s=e?`${e}.${i}`:i;typeof n=="object"&&n!==null&&(typeof n.normalizer=="function"&&(t.value=n.normalizer),Rh(n,s,t))}return t}const Uv=(l,e)=>{if(typeof l.normalizer=="function")return l.normalizer(e);const t=Rh(l);if(typeof t.value=="function")return t.value(e);const i=Gv[l.type];return i?i(l,e):xh(l,e)},WT="",jv=["disabled"],Kv={key:0},qv={key:1},Xv={key:2},Yv={class:"w-full"},Jv={__name:"MList",setup(l){const e=c.inject("store"),t=c.inject("tableComponent"),i=c.inject("form.save.key"),n=c.computed(()=>{const d={tab:xv,dialog:Eh};return $.get(d,e.options.formMode)||Eh});function s(){return{}}const a=d=>{let p={...d};for(const g of e.flatFieldsWithoutActions)p[g.field]=Uv(g,d);return p};return(()=>{se.listen("formue.dialog",d=>{e.dialog=d}),se.listen("toggle.select",d=>{if(e.selected.has(d))return e.selected.delete(d);e.selected.add(d)}),se.listen("createBtn",()=>{e.dialog=!0,e.editItemId=!1,e.isEditing=!1,e.form={}}),se.listen("fillForm",d=>{e.dialog=!0,e.editItemId=!1,e.isEditing=!1,e.form=a(d)}),se.listen("editBtn",d=>{e.dialog=!0,e.editItemId=d.id,e.isEditing=!0,e.form=a(d)}),se.listen("handleDialogForm",d=>{e.dialog=d}),se.listen("editTheItem",d=>{edit(d)}),se.listen("addTheItem",d=>{add(d)})})(),(d,p)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(n.value),null,{actions:c.withCtx(()=>[c.createElementVNode("button",{disabled:c.unref(e).loadings.mainLoading,onClick:p[0]||(p[0]=g=>c.unref(se).event("saveForm")),className:"btn mt-1 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 !bg-green-500 text-base font-medium text-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"},[c.unref(e).loadings.mainLoading?(c.openBlock(),c.createElementBlock("span",Kv,p[2]||(p[2]=[c.createElementVNode("b",null,null,-1),c.createElementVNode("b",null,null,-1),c.createElementVNode("b",null,null,-1)]))):c.unref(e).isEditing?(c.openBlock(),c.createElementBlock("span",qv,c.toDisplayString(d.$fcTr("edit")),1)):(c.openBlock(),c.createElementBlock("span",Xv,c.toDisplayString(c.unref(i)||d.$fcTr("save")),1))],8,jv),c.createElementVNode("button",{onClick:p[1]||(p[1]=g=>c.unref(e).dialog=!1),className:"mt-1 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"},c.toDisplayString(d.$fcTr("cancel")),1)]),default:c.withCtx(()=>[c.createVNode(Tv)]),_:1})),c.createElementVNode("div",Yv,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(t)||pv),c.normalizeProps(c.guardReactiveProps(s())),null,16))])],64))}},Zv={TextFilter:()=>{const l=Ti();return{op:{placeholder:l.translate("operator"),columns:4,items:[{value:"$eq",text:l.translate("equal_to")},{value:"$ne",text:l.translate("not_equal_to")},{value:"$gt",text:l.translate("greater_than")},{value:"$lt",text:l.translate("less_than")},{value:"$contains",text:l.translate("look_like")}],"label-prop":"text","value-prop":"value",native:!1,type:"select"},value:{placeholder:l.translate("value"),type:"text",columns:4}}},DateFilter:()=>{const l=Ti();return{op:{placeholder:l.translate("operator"),columns:4,items:[{value:"$eq",text:l.translate("equal_to")},{value:"$between",text:l.translate("between")},{value:"$gt",text:l.translate("greater_than")},{value:"$lt",text:l.translate("less_than")}],labelProp:"text",valueProp:"value",native:!1,type:"select"},value:Bl({placeholder:l.translate("value"),columns:4})}},NullFilter:()=>{const l=Ti();return{op:{placeholder:l.translate("operator"),columns:4,items:[{value:"$notNull",text:l.translate("not_null")},{value:"$null",text:l.translate("null")}],labelProp:"text",valueProp:"value",native:!1,type:"select"},value:{type:"hidden",default:!0,columns:4}}},SelectFilter:l=>{const e=Ti();return{op:{placeholder:e.translate("operator"),columns:4,items:[{value:"$in",text:e.translate("in")},{value:"$notIn",text:e.translate("not_in")}],labelProp:"text",valueProp:"value",native:!1,type:"select"},value:Hl({placeholder:e.translate("value"),items:"filterItems"in l?l.filterItems:l.items,search:!0,columns:4,labelProp:l.labelProp,valueProp:l.valueProp,object:!1})}}};function Qv(l){return c.getCurrentScope()?(c.onScopeDispose(l),!0):!1}function po(l){return typeof l=="function"?l():c.unref(l)}const _h=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ew=Object.prototype.toString,tw=l=>ew.call(l)==="[object Object]",hr=()=>{},iw=nw();function nw(){var l,e;return _h&&((l=window==null?void 0:window.navigator)==null?void 0:l.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function rw(l,e){function t(...i){return new Promise((n,s)=>{Promise.resolve(l(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(n).catch(s)})}return t}const Th=l=>l();function sw(l=Th){const e=c.ref(!0);function t(){e.value=!1}function i(){e.value=!0}const n=(...s)=>{e.value&&l(...s)};return{isActive:c.readonly(e),pause:t,resume:i,eventFilter:n}}function ow(l){return l||c.getCurrentInstance()}function aw(l,e,t={}){const{eventFilter:i=Th,...n}=t;return c.watch(l,rw(i,e),n)}function lw(l,e,t={}){const{eventFilter:i,...n}=t,{eventFilter:s,pause:a,resume:u,isActive:d}=sw(i);return{stop:aw(l,e,{...n,eventFilter:s}),pause:a,resume:u,isActive:d}}function hw(l,e=!0,t){ow()?c.onMounted(l,t):e?l():c.nextTick(l)}function gn(l){var e;const t=po(l);return(e=t==null?void 0:t.$el)!=null?e:t}const ur=_h?window:void 0;function mn(...l){let e,t,i,n;if(typeof l[0]=="string"||Array.isArray(l[0])?([t,i,n]=l,e=ur):[e,t,i,n]=l,!e)return hr;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const s=[],a=()=>{s.forEach(g=>g()),s.length=0},u=(g,w,b,C)=>(g.addEventListener(w,b,C),()=>g.removeEventListener(w,b,C)),d=c.watch(()=>[gn(e),po(n)],([g,w])=>{if(a(),!g)return;const b=tw(w)?{...w}:w;s.push(...t.flatMap(C=>i.map(_=>u(g,C,_,b))))},{immediate:!0,flush:"post"}),p=()=>{d(),a()};return Qv(p),p}let kh=!1;function uw(l,e,t={}){const{window:i=ur,ignore:n=[],capture:s=!0,detectIframe:a=!1}=t;if(!i)return hr;iw&&!kh&&(kh=!0,Array.from(i.document.body.children).forEach(b=>b.addEventListener("click",hr)),i.document.documentElement.addEventListener("click",hr));let u=!0;const d=b=>n.some(C=>{if(typeof C=="string")return Array.from(i.document.querySelectorAll(C)).some(_=>_===b.target||b.composedPath().includes(_));{const _=gn(C);return _&&(b.target===_||b.composedPath().includes(_))}}),g=[mn(i,"click",b=>{const C=gn(l);if(!(!C||C===b.target||b.composedPath().includes(C))){if(b.detail===0&&(u=!d(b)),!u){u=!0;return}e(b)}},{passive:!0,capture:s}),mn(i,"pointerdown",b=>{const C=gn(l);u=!d(b)&&!!(C&&!b.composedPath().includes(C))},{passive:!0}),a&&mn(i,"blur",b=>{setTimeout(()=>{var C;const _=gn(l);((C=i.document.activeElement)==null?void 0:C.tagName)==="IFRAME"&&!(_!=null&&_.contains(i.document.activeElement))&&e(b)},0)})].filter(Boolean);return()=>g.forEach(b=>b())}const dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},cr="__vueuse_ssr_handlers__",dw=cw();function cw(){return cr in dr||(dr[cr]=dr[cr]||{}),dr[cr]}function fw(l,e){return dw[l]||e}function pw(l){return l==null?"any":l instanceof Set?"set":l instanceof Map?"map":l instanceof Date?"date":typeof l=="boolean"?"boolean":typeof l=="string"?"string":typeof l=="object"?"object":Number.isNaN(l)?"any":"number"}const gw={boolean:{read:l=>l==="true",write:l=>String(l)},object:{read:l=>JSON.parse(l),write:l=>JSON.stringify(l)},number:{read:l=>Number.parseFloat(l),write:l=>String(l)},any:{read:l=>l,write:l=>String(l)},string:{read:l=>l,write:l=>String(l)},map:{read:l=>new Map(JSON.parse(l)),write:l=>JSON.stringify(Array.from(l.entries()))},set:{read:l=>new Set(JSON.parse(l)),write:l=>JSON.stringify(Array.from(l))},date:{read:l=>new Date(l),write:l=>l.toISOString()}},Sh="vueuse-storage";function mw(l,e,t,i={}){var n;const{flush:s="pre",deep:a=!0,listenToStorageChanges:u=!0,writeDefaults:d=!0,mergeDefaults:p=!1,shallow:g,window:w=ur,eventFilter:b,onError:C=Y=>{console.error(Y)},initOnMounted:_}=i,S=(g?c.shallowRef:c.ref)(typeof e=="function"?e():e);if(!t)try{t=fw("getDefaultStorage",()=>{var Y;return(Y=ur)==null?void 0:Y.localStorage})()}catch(Y){C(Y)}if(!t)return S;const F=po(e),L=pw(F),U=(n=i.serializer)!=null?n:gw[L],{pause:H,resume:N}=lw(S,()=>oe(S.value),{flush:s,deep:a,eventFilter:b});w&&u&&hw(()=>{mn(w,"storage",W),mn(w,Sh,pe),_&&W()}),_||W();function O(Y,he){w&&w.dispatchEvent(new CustomEvent(Sh,{detail:{key:l,oldValue:Y,newValue:he,storageArea:t}}))}function oe(Y){try{const he=t.getItem(l);if(Y==null)O(he,null),t.removeItem(l);else{const j=U.write(Y);he!==j&&(t.setItem(l,j),O(he,j))}}catch(he){C(he)}}function V(Y){const he=Y?Y.newValue:t.getItem(l);if(he==null)return d&&F!=null&&t.setItem(l,U.write(F)),F;if(!Y&&p){const j=U.read(he);return typeof p=="function"?p(j,F):L==="object"&&!Array.isArray(j)?{...F,...j}:j}else return typeof he!="string"?he:U.read(he)}function W(Y){if(!(Y&&Y.storageArea!==t)){if(Y&&Y.key==null){S.value=F;return}if(!(Y&&Y.key!==l)){H();try{(Y==null?void 0:Y.newValue)!==U.write(S.value)&&(S.value=V(Y))}catch(he){C(he)}finally{Y?c.nextTick(N):N()}}}}function pe(Y){W(Y.detail)}return S}const bw={class:"relative"},go={__name:"MMenu",setup(l){const e=c.ref(null);uw(e,s=>t.value=!1);const t=c.ref(!1),i={isOpen:t.value},n={click:()=>t.value=!t.value};return(s,a)=>(c.openBlock(),c.createElementBlock("div",bw,[c.renderSlot(s.$slots,"activator",c.normalizeProps(c.guardReactiveProps({on:n,props:i})),()=>[c.createElementVNode("button",c.mergeProps({class:"bg-blue-500 text-white px-4 py-2 rounded-md"},c.toHandlers(n,!0))," Open Menu "+c.toDisplayString(t.value),17)]),t.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"absolute top-[35px] left-0 mt-2 w-48 rounded-md shadow-lg z-[1]",ref_key:"target",ref:e},[c.renderSlot(s.$slots,"default",{},()=>[a[0]||(a[0]=c.createElementVNode("ul",{class:"py-2"},[c.createElementVNode("li",{class:"px-4 py-2 hover:bg-gray-100 cursor-pointer"},"Item 1"),c.createElementVNode("li",{class:"px-4 py-2 hover:bg-gray-100 cursor-pointer"},"Item 2"),c.createElementVNode("li",{class:"px-4 py-2 hover:bg-gray-100 cursor-pointer"},"Item 3")],-1))])],512)):c.createCommentVNode("",!0)]))}},KT="",vw={class:"border-muted-200 dark:border-muted-700 dark:bg-muted-800 relative mb-4 w-full rounded-lg border bg-white p-6 transition-all duration-300"},ww={class:"flex flex-col ml-1 border-[rgba(0,0,0,.1)] pb-4"},yw={class:"flex flex-row justify-between mb-4 items-center"},Cw={class:"font-heading text-base font-semibold leading-tight text-muted-800 dark:text-white"},Ew={class:"flex items-center"},xw={class:"z-[1]"},Rw={class:"fc-drop-down-content"},_w={key:0,class:"p-2 text-center"},Tw=["onClick"],kw={class:"text-muted-400 font-sans text-sm"},Sw={class:"flex w-full justify-between align-start"},Mw={class:"w-[12%] flex justify-center items-center"},Lw=["disabled"],Dw={class:"flex border-t dark:border-muted-600 flex-col p-2 mt-2"},Aw={class:"flex items-center"},Fw={class:"font-heading text-base font-semibold leading-tight text-muted-800 dark:text-white"},zw={class:"group-hover:text-red-500"},Pw={class:"my-2 flex overflow-x-auto slimscroll"},Ow={class:"flex"},Hw=["onClick"],Bw={class:"mt-[0px]"},Nw=["onClick"],Iw={key:0,class:"flex items-center mx-2 text-[0.75rem]"},Vw={class:"flex w-full gap-x-2 justify-between !items-end"},Ww={class:"pt-4 md:pt-6"},$w={class:"flex gap-x-2"},Gw=["placeholder"],Uw=Mt({__name:"MFilter",setup(l){const e=c.inject("store");let t=-1;const i=c.ref(!1),n=c.ref({field:""}),s=c.ref(!1),a=c.ref(""),u=b(),d=c.ref(null);function p(N){if(!N)return!1;const O={text:"TextFilter",date:"DateFilter",select:"SelectFilter",map:"NullFilter"},oe=$.get(O,N.type),V=$.get(Zv,oe);return typeof V=="function"?V(N):!1}const g={field:{placeholder:"field",type:"select",native:!1,items:e.headersWithoutActions,"label-prop":"title","value-prop":"field",object:!0,search:!0,trackBy:["title"],columns:2,onChange(N,O,oe){const V=p(N)||[];for(const W in n.value)W!=="field"&&delete n.value[W];w.value={...g,...V},c.nextTick(()=>{try{const W=oe.form$.el$("value");W&&"clear"in W&&W.clear(),W&&"updateItems"in W&&W.updateItems()}catch{}})}}},w=c.ref({...g});function b(){const N=window.location.pathname.replace(/^\/|\/$/g,"")+"-filters";return mw(N,{},localStorage,{mergeDefaults:!0})}function C(){e.filters.push($.cloneDeep(n.value)),n.value={}}function _(){t!==-1&&e.filters.splice(t,1,n.value),i.value=!1,n.value={}}function S(N,O){i.value=!0,t=O,n.value=N,c.nextTick(()=>{n.value.op=N.op,n.value.value=N.value})}function F(N){e.filters=e.filters.filter(O=>O!==N)}function L(){e.filters=[],e.loadItems()}function U(){if(!s.value)return s.value=!0,d.value.focus();a.value&&(u.value[a.value]={...e.filters},s.value=!1,a.value="",d.value.blur())}function H(){e.loadItems()}return(N,O)=>{const oe=c.resolveComponent("Vueform");return c.withDirectives((c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["accordion-content",{hide:c.unref(e).panel!=="filters"}])},[c.createElementVNode("div",vw,[c.createElementVNode("div",ww,[c.createElementVNode("div",yw,[c.createElementVNode("h3",Cw,c.toDisplayString(N.$fcTr("filter_data")),1),c.createElementVNode("div",Ew,[c.createVNode(go,null,{activator:c.withCtx(({props:V,on:W})=>[c.createElementVNode("button",c.mergeProps(c.toHandlers(W,!0),{class:[V.isOpen?"before:hidden":"before:block","fc-filter-choose is-button rounded is-button-default min-w-[130px]"]}),[c.createElementVNode("span",xw,c.toDisplayString(N.$fcTr("choose_filter")),1)],16)]),default:c.withCtx(()=>[c.createElementVNode("div",Rw,[Object.keys(c.unref(u)).length===0?(c.openBlock(),c.createElementBlock("p",_w,c.toDisplayString(N.$fcTr("not_filter_create_yes")),1)):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(u),(V,W)=>(c.openBlock(),c.createElementBlock("a",{class:"group rounded flex w-full items-center py-3 text-sm duration-300 text-muted-500 hover:bg-muted-100 dark:hover:bg-muted-700 justify-between rtl:pl-4 rtl:pr-5",key:W,onClick:c.withModifiers(pe=>c.unref(e).filters=Object.values(V),["stop"])},[c.createElementVNode("p",kw,c.toDisplayString(W),1),O[6]||(O[6]=c.createElementVNode("svg",{"data-v-74b3417a":"","aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 text-muted-500"},[c.createElementVNode("path",{"data-v-74b3417a":"",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6 6 18M6 6l12 12"})],-1))],8,Tw))),128))])]),_:1})])]),c.createElementVNode("div",Sw,[c.createVNode(oe,{modelValue:n.value,"onUpdate:modelValue":O[0]||(O[0]=V=>n.value=V),schema:w.value,sync:!0,class:"w-[100%] justify-between ml-4",columns:{label:12}},null,8,["modelValue","schema"]),c.createElementVNode("div",Mw,[i.value?(c.openBlock(),c.createElementBlock("button",{key:1,class:"!border-dashed is-button-default is-button w-full rounded-full font-bold py-1 px-2 !border-green-400 !text-green-400 hover:!bg-green-50",onClick:_},[c.createTextVNode(c.toDisplayString(N.$fcTr("edit_filter"))+" ",1),O[8]||(O[8]=c.createElementVNode("svg",{class:"icon h-4 w-4",viewBox:"0 0 24 24"},[c.createElementVNode("path",{stroke:"currentColor","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1))])):(c.openBlock(),c.createElementBlock("button",{key:0,disabled:!n.value.field,class:"disabled:cursor-not-allowed disabled:hover:bg-transparent !border-dashed !h-[86%] is-button-default is-button w-full rounded font-bold py-1 px-2 !border-green-400 !text-green-400 dark:active:hover:bg-muted-600 active:hover:!bg-green-50",onClick:C},[O[7]||(O[7]=c.createElementVNode("svg",{class:"icon h-4 ml-1 w-4",viewBox:"0 0 24 24"},[c.createElementVNode("path",{stroke:"currentColor","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),c.createTextVNode(" "+c.toDisplayString(N.$fcTr("add_filter")),1)],8,Lw))])])]),c.withDirectives(c.createElementVNode("div",Dw,[c.createElementVNode("div",Aw,[c.createElementVNode("h3",Fw,c.toDisplayString(N.$fcTr("active_filter")),1),c.createElementVNode("button",{onClick:L,class:"is-button group hover:text-red-500 hover:border-red-500 w-fit text-muted-600 dark:text-muted-400 !text-xs border !px-3 !py-0 !h-[1.5rem] mx-2 !rounded-full"},[c.createElementVNode("span",zw,c.toDisplayString(N.$fcTr("clear_all")),1),O[9]||(O[9]=c.createElementVNode("svg",{stroke:"currentColor",width:"1em",height:"1em",class:"ml-1 rtl:ml-1 rtl:mr-1 group-hover:fill-red-500 dark:fill-muted-400 fill-muted-600",viewBox:"0 0 512 512"},[c.createElementVNode("path",{d:"M340 148L488 0l24 24L364 172l52 52L257.2 483.9 240 512l-23.3-23.3L23.3 295.3 0 272l28.1-17.2L288 96l52 52zM51.4 278.1l47.9 47.9 33.4-33.4L144 281.4 166.6 304l-11.3 11.3-33.4 33.4L233.9 460.6l89.6-146.6L197.9 188.6 51.4 278.1zM340.6 286l34.9-57.2-92.4-92.4L226 171.4 340.6 286z"})],-1))])]),c.createElementVNode("div",Pw,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(e).filters,(V,W)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:W},[c.createElementVNode("div",Ow,[c.createElementVNode("span",{class:"flex px-3 font-sans transition-shadow duration-300 py-1 text-[0.75rem] cursor-pointer rounded-full bg-primary-100 text-primary-500 border-primary-100 dark:border-primary-500 dark:text-primary-500 border dark:bg-transparent",onClick:pe=>S(V,W)},[c.createElementVNode("span",Bw,c.toDisplayString(c.unref($.get)(V,"field.title")),1),c.createElementVNode("button",{class:"text-white font-bold rounded px-1 hover:bg-primary-500 hover:text-black-500",onClick:c.withModifiers(pe=>F(V),["stop"])},O[10]||(O[10]=[c.createElementVNode("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 text-primary-500"},[c.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6 6 18M6 6l12 12"})],-1)]),8,Nw)],8,Hw)]),c.unref(e).filters.length-1!==W?(c.openBlock(),c.createElementBlock("span",Iw,c.toDisplayString(N.$fcTr("&")),1)):c.createCommentVNode("",!0)],64))),128))])],512),[[c.vShow,c.unref(e).filters.length>0]]),c.createElementVNode("div",Vw,[c.createElementVNode("button",{onClick:O[1]||(O[1]=V=>c.unref(e).panel=""),class:"is-button text-muted-500 rounded hover:text-red-500 !underline focus-within:!outline-none"},c.toDisplayString(N.$fcTr("cancel")),1),c.createElementVNode("div",Ww,[c.createElementVNode("div",$w,[c.createElementVNode("button",{onClick:O[5]||(O[5]=c.withModifiers(V=>Object.keys(c.unref(e).filters).length!==0?U():"",["self"])),class:c.normalizeClass([{"!bg-muted-100 dark:!bg-muted-700 ltr:pr-1":s.value," focus:outline-none !cursor-not-allowed":Object.keys(c.unref(e).filters).length===0},"transitionX-inp is-button rounded is-button-default"])},[c.createElementVNode("span",{onClick:O[2]||(O[2]=c.withModifiers(V=>Object.keys(c.unref(e).filters).length!==0?U():"",["self"])),class:c.normalizeClass({" bg-green-500 px-2 py-1 rounded text-muted-50":s.value," focus:outline-none !cursor-not-allowed":Object.keys(c.unref(e).filters).length===0})},c.toDisplayString(N.$fcTr("save")),3),c.createElementVNode("span",{class:c.normalizeClass(["transitionX-inp overflow-hidden flex items-center justify-between",s.value?"w-[221px] opacity-1 ltr:pl-3 rtl:mr-3":"opacity-0 w-[0px]"])},[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":O[3]||(O[3]=V=>a.value=V),class:c.normalizeClass(["fc-focus py-1 rounded px-2 dark:bg-muted-800",s.value?" border border-1":"flex "]),placeholder:N.$fcTr("filter_save_placeholder"),ref_key:"filterNameInp",ref:d},null,10,Gw),[[c.vModelText,a.value]]),c.createElementVNode("span",{class:"px-2",onClick:O[4]||(O[4]=V=>s.value=!1)},O[11]||(O[11]=[c.createElementVNode("svg",{"data-v-74b3417a":"","aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 text-primary-500"},[c.createElementVNode("path",{"data-v-74b3417a":"",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6 6 18M6 6l12 12"})],-1)]))],2)],2),c.createElementVNode("button",{onClick:H,class:"is-button rounded bg-primary-500 dark:bg-primary-500 hover:enabled:bg-primary-400 dark:hover:enabled:bg-primary-400 text-white hover:enabled:shadow-lg hover:enabled:shadow-primary-500/50 dark:hover:enabled:shadow-primary-800/20 focus-visible:outline-primary-400/70 focus-within:outline-primary-400/70 focus-visible:bg-primary-500 active:enabled:bg-primary-500 dark:focus-visible:outline-primary-400 dark:focus-within:outline-primary-400 dark:focus-visible:bg-primary-500 dark:active:enabled:bg-primary-500"},c.toDisplayString(N.$fcTr("filter")),1)])])])])],2)),[[c.vShow,c.unref(e).panel==="filters"]])}}},[["__scopeId","data-v-c58a2751"]]),XT="",jw={id:"tooltip",class:"tooltip"},Kw=Mt({__name:"MTooltip",setup(l){return c.onMounted(()=>{const e=document.getElementById("tooltip");function t(n){const s=n.target.closest("[data-tooltip]");if(s){const a=s.getAttribute("data-tooltip");e.textContent=a,e.style.left=`${n.pageX+10}px`,e.style.top=`${n.pageY+10}px`,e.classList.add("visible")}}function i(){e.classList.remove("visible")}document.addEventListener("mouseover",t),document.addEventListener("mouseout",i)}),(e,t)=>(c.openBlock(),c.createElementBlock("div",jw))}},[["__scopeId","data-v-d7c03134"]]),JT="",qw={key:0,class:"w-full border bg-white rounded p-2 flex align-center mt-2"},Xw=["onClick"],Yw={__name:"MHeaderBox",setup(l){const e=c.inject("store");let t=null;c.watch(()=>e.panel,n=>{e.panel==="headerBox"&&e.headersWithoutActions.forEach(s=>{t=document.querySelector(`[tabulator-field="${s.field}"]`),t.innerHTML=t.innerHTML+'<span class="fc-remove"><button class="text-white font-bold rounded px-1" onclick=""><svg aria-hidden="true" viewBox="0 0 24 24" class="h-4 w-4 text-primary-500"><path data-v-74b3417a="" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6 6 18M6 6l12 12"></path></svg></button></span>'})});function i(n){n.isHeader=!n.isHeader}return(n,s)=>c.unref(e).panel==="headerBox"?(c.openBlock(),c.createElementBlock("div",qw,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(e).flatFields,a=>(c.openBlock(),c.createElementBlock("div",{key:a.field,class:c.normalizeClass(["px-1 mx-1 cursor-pointer divide-y rounded",{"bg-primary-600 text-white":a.isHeader}]),onClick:u=>i(a)},c.toDisplayString(a.title),11,Xw))),128))])):c.createCommentVNode("",!0)}},Jw=["disabled"],Zw={__name:"BatchActions",setup(l){const e=c.inject("store"),t=c.ref([]);se.listen("toggle.select",n=>{t.value.includes(n)?t.value=t.value.filter(s=>s!==n):t.value.push(n)});function i(){se.event("dialog.confirm",{description:" آیا از حذف این "+t.value.length+" آیتم ، مطمئن هستید؟ ",title:"حذف دسته جمعی",icon:"fluent:delete-dismiss-24-regular",confirmFunc:async()=>{const n=await e.remove(t.value);return t.value=[],se.event("batch.removed"),n}})}return(n,s)=>(c.openBlock(),c.createBlock(c.Transition,{name:"fade"},{default:c.withCtx(()=>[c.createElementVNode("button",{class:"fc-header-icon-btn !bg-red-100","data-tooltip":"حذف دسته جمعی",disabled:!t.value.length,onClick:i},s[0]||(s[0]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},[c.createElementVNode("rect",{width:"16",height:"16",fill:"none"}),c.createElementVNode("path",{fill:"#f00",d:"M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5M11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1zm1.958 1l-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47M8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5"})],-1)]),8,Jw)]),_:1}))}},Qw={class:"flex items-center gap-3 relative hover:bg-muted-200 dark:hover:bg-muted-700 rounded-lg px-5 pl-3 rtl:pl-8 rtl:pr-5 py-2 duration-300"},ey=["modelValue"],ty={class:"text-success-500 peer-disabled:opacity-75"},iy={class:"font-heading text-muted-800 text-xs font-semibold leading-tight dark:text-white"},ny={__name:"SelectColumnItem",props:{checked:{default:!1},columnName:{default:""}},setup(l){return(e,t)=>(c.openBlock(),c.createElementBlock("div",Qw,[c.createElementVNode("div",{class:c.normalizeClass(["nui-focus block focus-within:outline-current rounded-full",JSON.parse(l.checked)?"is-checked":"is-unchecked"])},[c.createElementVNode("input",{modelValue:l.checked,type:"checkbox",class:"peer cursor-pointer disabled:cursor-not-allowed","true-value":"true","false-value":"false",onClick:t[0]||(t[0]=i=>e.$emit("toggle"))},null,8,ey),c.createElementVNode("label",ty,[c.createElementVNode("div",{class:c.normalizeClass(["rtl:left-[auto] rtl:!right-0 ltr:right-[auto] ltr:left-0",JSON.parse(l.checked)?"is-opaque":""])},null,2),t[1]||(t[1]=c.createElementVNode("svg",{"aria-hidden":"true",viewBox:"0 0 52 52","data-v-3e8a7b5f":""},[c.createElementVNode("circle",{cx:"26",cy:"26",r:"25",fill:"none",stroke:"currentColor"}),c.createElementVNode("path",{fill:"none",stroke:"currentColor",d:"m14.1 27.2 7.1 7.2 16.7-16.8"})],-1))])],2),c.createElementVNode("div",null,[c.createElementVNode("h6",iy,c.toDisplayString(l.columnName),1)])]))}},ZT="",ry={class:"fc-header"},sy={class:"fc-header-left-sid"},oy={class:"z-[1]"},ay={class:"bg-muted-200 dark:bg-muted-800 cursor-pointer rounded-xl fm-light-shadow"},ly={class:"text-muted-400 font-sans text-xs"},hy={class:"bg-white dark:bg-muted-800 rounded-xl pt-1 rtl:text-right ltr:text-left fm-light-shadow"},uy={class:"m-3 mt-2 text-muted-600 dark:text-muted-200"},dy={class:"p-2"},cy={key:0,"data-tooltip":"فیلتر",class:"fm-header-rigth-sid flex w-full sm:w-auto rtl:flex-row-reverse rtl:justify-end"},fy={key:0},py={class:"group/nui-input relative rtl:"},gy=["placeholder"],my={class:"ltr:left-0 text-muted-400 group-focus-within/nui-input:text-primary-500 absolute end-0 rtl:start-0 top-0 flex items-center justify-center transition-colors duration-300 peer-disabled:cursor-not-allowed peer-disabled:opacity-75 h-10 w-10"},by={key:0,class:"icon h-[1.15rem] w-[1.15rem]",width:"1em",height:"1em",viewBox:"0 0 24 24"},vy={key:1,xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512",class:"icon animate-spin"},wy=Mt({__name:"MButtonBox",setup(l){const{can:e}=Os(),t=c.inject("store");function i(b){b===t.panel?t.panel="":t.panel=b}const n=c.ref(null);c.onMounted(()=>{n.value=document.body.getAttribute("dir")});const s=c.computed(()=>t.flatFields.find(b=>b.field==="_select_")),a=c.computed(()=>!!s.value.isHeader);function u(){s.value.isHeader=!s.value.isHeader,s.value.isHeader||t.selected.clear()}const d=c.ref(!1);function p(){d.value=!0,t.loadItems().finally(()=>d.value=!1)}const g=$.debounce(p,600);function w(){window.open(ye.defaults.baseURL+t.generateQuery())}return(b,C)=>(c.openBlock(),c.createElementBlock("div",ry,[c.createElementVNode("div",sy,[c.unref(e)("create")?(c.openBlock(),c.createElementBlock("button",{key:0,class:"fc-plus-btn","data-tooltip":"افزودن",onClick:C[0]||(C[0]=_=>c.unref(se).event("createBtn"))},C[5]||(C[5]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-plus"},[c.createElementVNode("path",{d:"M5 12h14"}),c.createElementVNode("path",{d:"M12 5v14"})],-1)]))):c.createCommentVNode("",!0),c.createVNode(go,null,{activator:c.withCtx(({on:_,props:S})=>[c.createElementVNode("button",c.mergeProps({class:S.isOpen?"before:block":"before:hidden"},S,c.toHandlers(_,!0),{class:"fc-header-icon-btn fc-drop-down-btn min-w-[130px]"}),[c.createElementVNode("span",oy,c.toDisplayString(b.$fcTr("export")),1)],16)]),default:c.withCtx(()=>[c.createElementVNode("div",ay,[c.createElementVNode("a",{class:"group flex w-full items-center py-3 text-sm duration-300 text-muted-500 hover:bg-muted-300 dark:hover:bg-muted-700 rounded-xl justify-end flex-row-reverse",onClick:w},[c.createElementVNode("p",ly,c.toDisplayString(b.$fcTr("export_as_excel")),1),C[6]||(C[6]=c.createElementVNode("svg",{class:"fill-muted-400 w-3.5 mx-2",viewBox:"0 0 512 512"},[c.createElementVNode("path",{d:"M48 448V64c0-8.8 7.2-16 16-16H224v80c0 17.7 14.3 32 32 32h80V448c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16zM64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V154.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0H64zm90.9 233.3c-8.1-10.5-23.2-12.3-33.7-4.2s-12.3 23.2-4.2 33.7L161.6 320l-44.5 57.3c-8.1 10.5-6.3 25.5 4.2 33.7s25.5 6.3 33.7-4.2L192 359.1l37.1 47.6c8.1 10.5 23.2 12.3 33.7 4.2s12.3-23.2 4.2-33.7L222.4 320l44.5-57.3c8.1-10.5 6.3-25.5-4.2-33.7s-25.5-6.3-33.7 4.2L192 280.9l-37.1-47.6z"})],-1))])])]),_:1}),c.createElementVNode("button",{class:"fc-header-icon-btn","data-tooltip":"رفرش",onClick:C[1]||(C[1]=(..._)=>c.unref(t).reloadData&&c.unref(t).reloadData(..._))},[(c.openBlock(),c.createElementBlock("svg",{class:c.normalizeClass({spin:c.unref(t).loadings.mainLoading}),viewBox:"0 0 512 512"},C[7]||(C[7]=[c.createElementVNode("path",{d:"M371.2 122.9C340.3 96.2 300 80 256 80C158.8 80 80 158.8 80 256s78.8 176 176 176c39.7 0 76.2-13.1 105.6-35.2c10.6-8 25.6-5.8 33.6 4.8s5.8 25.6-4.8 33.6C353 463.3 306.4 480 256 480C132.3 480 32 379.7 32 256S132.3 32 256 32c57.3 0 109.6 21.5 149.2 56.9l30.5-30.5c6.6-6.6 15.6-10.3 25-10.3C480.2 48 496 63.8 496 83.3V200c0 13.3-10.7 24-24 24H355.3c-19.5 0-35.3-15.8-35.3-35.3c0-9.4 3.7-18.3 10.3-25l40.8-40.8zm76.8-9L385.9 176H448V113.9z"},null,-1)]),2))]),c.createElementVNode("button",{class:c.normalizeClass(["fc-header-icon-btn",{"fm-active-btn":a.value}]),"data-tooltip":"انتخاب گروهی",onClick:u},C[8]||(C[8]=[c.createElementVNode("svg",{viewBox:"0 0 512 512"},[c.createElementVNode("path",{d:"M384 48c8.8 0 16 7.2 16 16V448c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16H384zM64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H64zM80 112v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V112c0-8.8-7.2-16-16-16H96c-8.8 0-16 7.2-16 16zM96 352c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V368c0-8.8-7.2-16-16-16H96zm80-224c0 13.3 10.7 24 24 24H344c13.3 0 24-10.7 24-24s-10.7-24-24-24H200c-13.3 0-24 10.7-24 24zm32 128c0 13.3 10.7 24 24 24H344c13.3 0 24-10.7 24-24s-10.7-24-24-24H232c-13.3 0-24 10.7-24 24zM176 384c0 13.3 10.7 24 24 24H344c13.3 0 24-10.7 24-24s-10.7-24-24-24H200c-13.3 0-24 10.7-24 24zm-4.7-140.7c6.2-6.2 6.2-16.4 0-22.6s-16.4-6.2-22.6 0L112 257.4 99.3 244.7c-6.2-6.2-16.4-6.2-22.6 0s-6.2 16.4 0 22.6l24 24c6.2 6.2 16.4 6.2 22.6 0l48-48z"})],-1)]),2),a.value?(c.openBlock(),c.createBlock(Zw,{key:1})):c.createCommentVNode("",!0),c.createVNode(go,{"close-on-content-click":!0},{activator:c.withCtx(({props:_,on:S})=>[c.createElementVNode("button",c.mergeProps(c.toHandlers(S,!0),{class:["fc-header-icon-btn",[_.isOpen?"light:!bg-white dark:bg-muted-800":"",_.isOpen?n.value==="rtl"?"expanded-rtl":"expanded2":""]],"data-tooltip":"انتخاب سرستون"}),C[9]||(C[9]=[c.createElementVNode("svg",{viewBox:"0 0 448 512",class:"z-[1]"},[c.createElementVNode("path",{d:"M64 448c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32H384c17.7 0 32 14.3 32 32V416c0 17.7-14.3 32-32 32H64zM0 416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64C28.7 32 0 60.7 0 96V416zM128 288c8.8 0 16-7.2 16-16V144c0-8.8-7.2-16-16-16s-16 7.2-16 16V272c0 8.8 7.2 16 16 16zm176 48c0 8.8 7.2 16 16 16s16-7.2 16-16V144c0-8.8-7.2-16-16-16s-16 7.2-16 16V336zm-80-80c8.8 0 16-7.2 16-16V144c0-8.8-7.2-16-16-16s-16 7.2-16 16v96c0 8.8 7.2 16 16 16z"})],-1)]),16)]),default:c.withCtx(()=>[c.createElementVNode("div",hy,[c.createElementVNode("div",uy,c.toDisplayString(b.$fcTr("custom_column")),1),c.createElementVNode("ul",dy,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(t).flatFieldsWithoutActions,_=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:_.field},[_.title?(c.openBlock(),c.createBlock(ny,{key:0,"column-name":_.title,checked:_.isHeader,onToggle:S=>_.isHeader=!_.isHeader},null,8,["column-name","checked","onToggle"])):c.createCommentVNode("",!0)],64))),128))])])]),_:1})]),c.unref(e)("filter")?(c.openBlock(),c.createElementBlock("div",cy,[c.createElementVNode("button",{class:c.normalizeClass(["test fc-header-icon-btn transform transition-all",c.unref(t).panel==="filters"?"!bg-white dark:!bg-muted-800 !rounded-b-none ":""]),onClick:C[2]||(C[2]=_=>i("filters"))},[c.createVNode(c.Transition,{name:"scale"},{default:c.withCtx(()=>[c.unref(t).panel==="filters"?(c.openBlock(),c.createElementBlock("div",fy,C[10]||(C[10]=[c.createElementVNode("span",null,null,-1)]))):c.createCommentVNode("",!0)]),_:1}),(c.openBlock(),c.createElementBlock("svg",{class:c.normalizeClass(c.unref(t).panel==="filters"?"light:!fill-primary-700":""),stroke:"currentColor",viewBox:"0 0 512 512"},C[11]||(C[11]=[c.createElementVNode("path",{d:"M0 73.7C0 50.7 18.7 32 41.7 32H470.3c23 0 41.7 18.7 41.7 41.7c0 9.6-3.3 18.9-9.4 26.3L336 304.5V447.7c0 17.8-14.5 32.3-32.3 32.3c-7.3 0-14.4-2.5-20.1-7l-92.5-73.4c-9.6-7.6-15.1-19.1-15.1-31.3V304.5L9.4 100C3.3 92.6 0 83.3 0 73.7zM55 80L218.6 280.8c3.5 4.3 5.4 9.6 5.4 15.2v68.4l64 50.8V296c0-5.5 1.9-10.9 5.4-15.2L457 80H55z"},null,-1)]),2))],2),c.createElementVNode("div",py,[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":C[3]||(C[3]=_=>c.unref(t).searchParam=_),type:"text",class:"nui-focus px-4! border-muted-300 text-muted-600 placeholder:text-muted-300 dark:border-muted-700 dark:bg-muted-900/75 dark:text-muted-200 dark:placeholder:text-muted-500 dark:focus:border-muted-700 peer w-full border bg-white font-sans transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-75 h-10 py-2 text-sm leading-5 pe-4 ps-9 rounded-full",placeholder:b.$fcTr("search"),onKeyup:C[4]||(C[4]=(..._)=>c.unref(g)&&c.unref(g)(..._))},null,40,gy),[[c.vModelText,c.unref(t).searchParam]]),c.createElementVNode("div",my,[d.value?(c.openBlock(),c.createElementBlock("svg",vy,C[13]||(C[13]=[c.createElementVNode("path",{d:"M457 372c11.5 6.6 26.3 2.7 31.8-9.3C503.7 330.2 512 294.1 512 256C512 122.7 410.1 13.2 280 1.1C266.8-.1 256 10.7 256 24v0c0 13.3 10.8 23.9 24 25.4C383.5 61.2 464 149.2 464 256c0 29.3-6.1 57.3-17 82.6c-5.3 12.2-1.5 26.8 10 33.5v0z"},null,-1)]))):(c.openBlock(),c.createElementBlock("svg",by,C[12]||(C[12]=[c.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[c.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),c.createElementVNode("path",{d:"m21 21l-4.35-4.35"})],-1)])))])])])):c.createCommentVNode("",!0)]))}},[["__scopeId","data-v-121187ed"]]),yy={};function Cy(l,e){return c.openBlock(),c.createElementBlock("div")}const Ey=Mt(yy,[["render",Cy]]),ek="",xy={class:"fixed z-50 inset-0 overflow-hidden pointer-events-none"},Ry={class:"absolute bg-white shadow-2xl border border-gray-200 pointer-events-auto transition-all duration-300 rounded-xl",style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"400px","max-width":"90vw"}},_y={class:"flex items-center justify-between px-4 py-3 border-gray-200 border-b rounded-t-xl bg-gradient-to-r from-red-50 to-orange-50"},Ty={class:"flex flex-col overflow-hidden"},ky={class:"px-4 py-4 overflow-y-auto"},Sy={class:"mb-5 flex flex-row flex-wrap"},My={class:"flex-shrink-0 bg-gray-50 px-4 py-3 border-t border-gray-200 rounded-b-xl"},Ly={class:"flex justify-end gap-2"},Dy=["disabled"],Ay={key:0},Fy={key:1},zy=Mt({__name:"MDeleteDialog",setup(l){const e=c.inject("store"),t=c.ref(!1);let i="";return se.listen("deleteBtn",n=>{t.value=!0,i=n.id}),se.listen("handleDeleteDialog",n=>{t.value=n}),(n,s)=>(c.openBlock(),c.createBlock(c.Transition,{name:"fade",appear:""},{default:c.withCtx(()=>[t.value?(c.openBlock(),c.createElementBlock("div",{key:0,onKeydown:s[4]||(s[4]=c.withKeys(a=>t.value=!1,["escape"])),class:"relative z-50",role:"dialog"},[c.createElementVNode("div",{class:"fixed inset-0 bg-black bg-opacity-30 transition-opacity backdrop-blur-sm",onClick:s[0]||(s[0]=a=>t.value=!1)}),c.createElementVNode("div",xy,[c.createElementVNode("div",Ry,[c.createElementVNode("div",_y,[s[6]||(s[6]=c.createElementVNode("h3",{class:"text-lg font-semibold text-gray-900 flex items-center gap-2"},[c.createElementVNode("div",{class:"w-2 h-2 rounded-full bg-red-500 animate-pulse"}),c.createTextVNode(" حذف ")],-1)),c.createElementVNode("button",{onClick:s[1]||(s[1]=a=>t.value=!1),class:"p-1.5 rounded-full hover:bg-red-100 transition-colors group",title:"Close"},s[5]||(s[5]=[c.createElementVNode("svg",{class:"w-4 h-4 text-gray-600 group-hover:text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[c.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),c.createElementVNode("div",Ty,[c.createElementVNode("div",ky,[c.createElementVNode("div",Sy,c.toDisplayString(n.$fcTr("alert_to_delete")),1)]),c.createElementVNode("div",My,[c.createElementVNode("div",Ly,[c.createElementVNode("button",{onClick:s[2]||(s[2]=a=>t.value=!1),class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-1 transition-colors"},c.toDisplayString(n.$fcTr("no")),1),c.createElementVNode("button",{disabled:c.unref(e).loadings.mainLoading,class:"px-4 py-2 text-sm font-medium text-white bg-red-600 border border-transparent rounded-lg hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-1 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:s[3]||(s[3]=a=>c.unref(e).remove(c.unref(i)))},[c.unref(e).loadings.mainLoading?(c.openBlock(),c.createElementBlock("span",Fy,"loading")):(c.openBlock(),c.createElementBlock("span",Ay,c.toDisplayString(n.$fcTr("yes")),1))],8,Dy)])])])])])],32)):c.createCommentVNode("",!0)]),_:1}))}},[["__scopeId","data-v-144e4312"]]),Py=({listen:l,store:e})=>{se.listen("reloadData",()=>{e.reloadData()})},Oy={__name:"MCrud",props:{options:{default:()=>({})},structure:{default:()=>({})},hiddenActions:{default:()=>[]},fields:{default:()=>[]},tableOptions:{default:()=>({})},tableComponent:{default:null},dir:{default:()=>Ti().dir},route:{default:"route"}},emits:["mounted"],setup(l,{emit:e}){const t=l,i=e,n=kg({fields:t.fields,hiddenActions:t.hiddenActions,options:t.options,structure:t.structure,route:t.route,query:c.inject("formue.query")||!1});return c.provide("store",n),c.provide("tableOptions",{dir:t.dir,...t.tableOptions}),c.provide("tableComponent",t.tableComponent),document.body.setAttribute("dir",t.dir),c.onMounted(()=>{i("mounted")}),Py({store:n}),c.onUnmounted(()=>{n.$dispose(),n.reset()}),(s,a)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.createVNode(wy),c.createVNode(Uw),c.createVNode(Yw),c.createVNode(Jv),c.createVNode(Ey),c.createVNode(zy),c.createVNode(Kw),c.renderSlot(s.$slots,"extra")],64))}};Te.ActionButton=gh,Te.MCrud=Oy,Te.emitter=se,Te.fields=Nl,Te.install=Sg,Te.registerFields=Wl,Te.setEmitter=Na,Object.defineProperty(Te,Symbol.toStringTag,{value:"Module"})});
|
|
53
|
+
`),n=i[0]=="Error"?i[2]:i[1],n[0]==" "?e=n.trim().split(" ")[1].split(".")[1]:e=n.trim().split("@")[0]),console.warn("Table Not Initialized - Calling the "+e+" function before the table is initialized may result in inconsistent behavior, Please wait for the `tableBuilt` event before calling this function."+(t?" "+t:""))),this.initialized}blockRedraw(){this.initGuard(),this.eventBus.dispatch("redraw-blocking"),this.rowManager.blockRedraw(),this.columnManager.blockRedraw(),this.eventBus.dispatch("redraw-blocked")}restoreRedraw(){this.initGuard(),this.eventBus.dispatch("redraw-restoring"),this.rowManager.restoreRedraw(),this.columnManager.restoreRedraw(),this.eventBus.dispatch("redraw-restored")}setData(e,t,i){return this.initGuard(!1,"To set initial data please use the 'data' property in the table constructor."),this.dataLoader.load(e,t,i,!1)}clearData(){this.initGuard(),this.dataLoader.blockActiveLoad(),this.rowManager.clearData()}getData(e){return this.rowManager.getData(e)}getDataCount(e){return this.rowManager.getDataCount(e)}replaceData(e,t,i){return this.initGuard(),this.dataLoader.load(e,t,i,!0,!0)}updateData(e){var t=0;return this.initGuard(),new Promise((i,n)=>{this.dataLoader.blockActiveLoad(),typeof e=="string"&&(e=JSON.parse(e)),e&&e.length>0?e.forEach(s=>{var a=this.rowManager.findRow(s[this.options.index]);a?(t++,a.updateData(s).then(()=>{t--,t||i()}).catch(u=>{n("Update Error - Unable to update row",s,u)})):n("Update Error - Unable to find row",s)}):(console.warn("Update Error - No data provided"),n("Update Error - No data provided"))})}addData(e,t,i){return this.initGuard(),new Promise((n,s)=>{this.dataLoader.blockActiveLoad(),typeof e=="string"&&(e=JSON.parse(e)),e?this.rowManager.addRows(e,t,i).then(a=>{var u=[];a.forEach(function(d){u.push(d.getComponent())}),n(u)}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})}updateOrAddData(e){var t=[],i=0;return this.initGuard(),new Promise((n,s)=>{this.dataLoader.blockActiveLoad(),typeof e=="string"&&(e=JSON.parse(e)),e&&e.length>0?e.forEach(a=>{var u=this.rowManager.findRow(a[this.options.index]);i++,u?u.updateData(a).then(()=>{i--,t.push(u.getComponent()),i||n(t)}):this.rowManager.addRows(a).then(d=>{i--,t.push(d[0].getComponent()),i||n(t)})}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})}getRow(e){var t=this.rowManager.findRow(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)}getRowFromPosition(e){var t=this.rowManager.getRowFromPosition(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)}deleteRow(e){var t=[];this.initGuard(),Array.isArray(e)||(e=[e]);for(let i of e){let n=this.rowManager.findRow(i,!0);if(n)t.push(n);else return console.error("Delete Error - No matching row found:",i),Promise.reject("Delete Error - No matching row found")}return t.sort((i,n)=>this.rowManager.rows.indexOf(i)>this.rowManager.rows.indexOf(n)?1:-1),t.forEach(i=>{i.delete()}),this.rowManager.reRenderInPosition(),Promise.resolve()}addRow(e,t,i){return this.initGuard(),typeof e=="string"&&(e=JSON.parse(e)),this.rowManager.addRows(e,t,i,!0).then(n=>n[0].getComponent())}updateOrAddRow(e,t){var i=this.rowManager.findRow(e);return this.initGuard(),typeof t=="string"&&(t=JSON.parse(t)),i?i.updateData(t).then(()=>i.getComponent()):this.rowManager.addRows(t).then(n=>n[0].getComponent())}updateRow(e,t){var i=this.rowManager.findRow(e);return this.initGuard(),typeof t=="string"&&(t=JSON.parse(t)),i?i.updateData(t).then(()=>Promise.resolve(i.getComponent())):(console.warn("Update Error - No matching row found:",e),Promise.reject("Update Error - No matching row found"))}scrollToRow(e,t,i){var n=this.rowManager.findRow(e);return n?this.rowManager.scrollToRow(n,t,i):(console.warn("Scroll Error - No matching row found:",e),Promise.reject("Scroll Error - No matching row found"))}moveRow(e,t,i){var n=this.rowManager.findRow(e);this.initGuard(),n?n.moveToRow(t,i):console.warn("Move Error - No matching row found:",e)}getRows(e){return this.rowManager.getComponents(e)}getRowPosition(e){var t=this.rowManager.findRow(e);return t?t.getPosition():(console.warn("Position Error - No matching row found:",e),!1)}setColumns(e){this.initGuard(!1,"To set initial columns please use the 'columns' property in the table constructor"),this.columnManager.setColumns(e)}getColumns(e){return this.columnManager.getComponents(e)}getColumn(e){var t=this.columnManager.findColumn(e);return t?t.getComponent():(console.warn("Find Error - No matching column found:",e),!1)}getColumnDefinitions(){return this.columnManager.getDefinitionTree()}showColumn(e){var t=this.columnManager.findColumn(e);if(this.initGuard(),t)t.show();else return console.warn("Column Show Error - No matching column found:",e),!1}hideColumn(e){var t=this.columnManager.findColumn(e);if(this.initGuard(),t)t.hide();else return console.warn("Column Hide Error - No matching column found:",e),!1}toggleColumn(e){var t=this.columnManager.findColumn(e);if(this.initGuard(),t)t.visible?t.hide():t.show();else return console.warn("Column Visibility Toggle Error - No matching column found:",e),!1}addColumn(e,t,i){var n=this.columnManager.findColumn(i);return this.initGuard(),this.columnManager.addColumn(e,t,n).then(s=>s.getComponent())}deleteColumn(e){var t=this.columnManager.findColumn(e);return this.initGuard(),t?t.delete():(console.warn("Column Delete Error - No matching column found:",e),Promise.reject())}updateColumnDefinition(e,t){var i=this.columnManager.findColumn(e);return this.initGuard(),i?i.updateDefinition(t):(console.warn("Column Update Error - No matching column found:",e),Promise.reject())}moveColumn(e,t,i){var n=this.columnManager.findColumn(e),s=this.columnManager.findColumn(t);this.initGuard(),n?s?this.columnManager.moveColumn(n,s,i):console.warn("Move Error - No matching column found:",s):console.warn("Move Error - No matching column found:",e)}scrollToColumn(e,t,i){return new Promise((n,s)=>{var a=this.columnManager.findColumn(e);return a?this.columnManager.scrollToColumn(a,t,i):(console.warn("Scroll Error - No matching column found:",e),Promise.reject("Scroll Error - No matching column found"))})}redraw(e){this.initGuard(),this.columnManager.redraw(e),this.rowManager.redraw(e)}setHeight(e){this.options.height=isNaN(e)?e:e+"px",this.element.style.height=this.options.height,this.rowManager.initializeRenderer(),this.rowManager.redraw(!0)}on(e,t){this.externalEvents.subscribe(e,t)}off(e,t){this.externalEvents.unsubscribe(e,t)}dispatchEvent(){var e=Array.from(arguments);e.shift(),this.externalEvents.dispatch(...arguments)}alert(e,t){this.initGuard(),this.alertManager.alert(e,t)}clearAlert(){this.initGuard(),this.alertManager.clear()}modExists(e,t){return this.modules[e]?!0:(t&&console.error("Tabulator Module Not Installed: "+e),!1)}module(e){var t=this.modules[e];return t||console.error("Tabulator module not installed: "+e),t}};P(Dt,"defaultOptions",Tb);let fo=Dt;var pn=fo;class qb extends pn{static extendModule(){pn.initializeModuleBinder(ao),pn._extendModule(...arguments)}static registerModule(){pn.initializeModuleBinder(ao),pn._registerModule(...arguments)}constructor(e,t,i){super(e,t,ao)}}var Xb=qb;const gh={__name:"ActionButton",props:{data:{},index:{}},setup(l){const{can:e}=Os(),t=l;return(i,n)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.unref(e)("delete")?(c.openBlock(),c.createElementBlock("button",{key:0,class:"mx-2 inline-flex items-center justify-center w-5 h-5 rounded-full text-gray-500 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500","data-tooltip":"حذف",onClick:n[0]||(n[0]=s=>c.unref(se).event("deleteBtn",t.data))},n[2]||(n[2]=[c.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash-2"><path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line></svg>',1)]))):c.createCommentVNode("",!0),c.unref(e)("update")?(c.openBlock(),c.createElementBlock("button",{key:1,class:"mx-2 inline-flex items-center justify-center w-5 h-5 rounded-full text-gray-500 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500","data-tooltip":"ویرایش",onClick:n[1]||(n[1]=s=>c.unref(se).event("editBtn",t.data))},n[3]||(n[3]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-file-pen-line"},[c.createElementVNode("path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2"}),c.createElementVNode("path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z"}),c.createElementVNode("path",{d:"M8 18h1"})],-1)]))):c.createCommentVNode("",!0)],64))}},mh={__name:"SelectColumn",props:{data:{default:()=>({})},index:{default:-1},all:{default:!1}},setup(l){const e=l,t=c.ref(!1);se.listen("batch.removed",()=>{t.value=!1}),se.listen("toggle.select.all",n=>{e.all||(t.value=n,se.event("toggle.select",e.data.id))});function i(n){if(e.all)return se.event("toggle.select.all",t.value);se.event("toggle.select",e.data.id)}return(n,s)=>c.withDirectives((c.openBlock(),c.createElementBlock("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>t.value=a),class:"rounded",type:"checkbox",onChange:i,style:{border:"1px dashed rgba(0, 0, 0, 0.2)"}},null,544)),[[c.vModelCheckbox,t.value]])}};let lr;const Yb=({element:l,headers:e,options:t}={element:null,headers:[],options:{}})=>(lr=new Xb(l,{pagination:!1,paginationMode:"remote",layout:"fitDataStretch",resizableColumnFit:!0,paginationSize:5,paginationInitialPage:1,paginationSizeSelector:[3,6,8,10],paginationCounter:"rows",ajaxLoaderLoading:"<div style='display:inline-block; border:4px solid #333; border-radius:10px; background:#fff; font-weight:bold; font-size:16px; color:#000; padding:10px 20px;'>Loading Data</div>",columns:bh(e),...t}),lr);function bh(l){const e=["type","value","align","rules","isHeader","placeholder","text","columns","clearOnSearch","valueProp","labelProp","normalizer","onChange","items","filterResults","label"],t={_select_:{formatter:Zb,formatterParams:{component:mh},titleFormatter:Qb},_actions_:{formatter:Jb,formatterParams:{component:gh}}};return $.cloneDeep(l).map(n=>n.field in t?{...t[n.field],...n}:n).map(n=>{for(const s of e)s in n&&delete n[s];return{...n,headerSort:!1}})}function Jb(l,e){const t=l.getRow().getData(),i=l.getRow().getPosition(),n=document.createElement("div"),s=e.component;return c.createApp(s,{data:t,index:i}).mount(n),n}function Zb(l,e){const t=l.getRow().getData(),i=l.getRow().getPosition(),n=document.createElement("div"),s=e.component;return c.createApp(s,{data:t,index:i}).mount(n),n}function Qb(){const l=document.createElement("div");return c.createApp(mh,{all:!0}).mount(l),l}function vh(l){lr.setData(l)}function ev(l){lr.setColumns(l)}const tv={up:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuNC4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIzIEZvbnRpY29ucywgSW5jLiAtLT48cGF0aCBkPSJNMjEyLjcgMTQ4LjdjNi4yLTYuMiAxNi40LTYuMiAyMi42IDBsMTYwIDE2MGM2LjIgNi4yIDYuMiAxNi40IDAgMjIuNnMtMTYuNCA2LjItMjIuNiAwTDIyNCAxODIuNiA3NS4zIDMzMS4zYy02LjIgNi4yLTE2LjQgNi4yLTIyLjYgMHMtNi4yLTE2LjQgMC0yMi42bDE2MC0xNjB6Ii8+PC9zdmc+",down:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuNC4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIzIEZvbnRpY29ucywgSW5jLiAtLT48cGF0aCBkPSJNMjEyLjcgMzMxLjNjNi4yIDYuMiAxNi40IDYuMiAyMi42IDBsMTYwLTE2MGM2LjItNi4yIDYuMi0xNi40IDAtMjIuNnMtMTYuNC02LjItMjIuNiAwTDIyNCAyOTcuNCA3NS4zIDE0OC43Yy02LjItNi4yLTE2LjQtNi4yLTIyLjYgMHMtNi4yIDE2LjQgMCAyMi42bDE2MCAxNjB6Ii8+PC9zdmc+"},wh=(l="up")=>{const e=document.createElement("img");return e.src=tv[l],e.style.width="10px",e.style.height="10px",e.style.marginLeft="5px",e},yh=(l,e)=>{l._column.titleHolderElement.style.display="flex",l._column.titleHolderElement.style.alignItems="center",l._column.titleHolderElement.appendChild(e)},Ch=l=>{l._column.titleHolderElement.lastChild.remove()};function iv(l,e){let t=[];e.on("tableBuilt",function(){c.watch(()=>l.mainItems,i=>{vh(i)},{immediate:!0}),c.watch(()=>l.flatFields,()=>{const i=bh(l.headers);ev(i)},{deep:!0}),c.watch(()=>l.loadings.mainLoading,i=>{i&&vh([])},{deep:!0})}),e.on("headerClick",(i,n)=>{const s=n.getField();if(!["_index_","_select_","_actions_"].includes(s)){if(t.includes(s+":asc")){let a=t.indexOf(s+":asc");t[a]=s+":desc",Ch(n),yh(n,wh("down"))}else if(t.includes(s+":desc")){let a=t.indexOf(s+":desc");t.splice(a,1),Ch(n)}else yh(n,wh()),t.push(s+":asc");l.sorts=t,l.loadItems()}})}const nv={key:0,class:"mt-[-20px]"},rv={class:"flex animate-pulse flex-row items-center h-full justify-center"},sv={class:"w-full flex flex-row items-start rtl:mr-8 ltr:ml-8"},ov={key:1,class:"padding: 100px; mt-[-20px] rounded-b-xl bg-white text-center p-[100px] dark:bg-muted-800"},av={class:"dark:text-muted-200 text-muted-600"},lv={__name:"MTable",setup(l){const e=c.ref(null),t=c.inject("store"),i=c.inject("tableOptions"),n=c.computed(()=>t.mainItems.length===0&&!t.loadings.mainLoading);return c.onMounted(()=>{const s=Yb({options:i,element:e.value,headers:t.headers});iv(t,s)}),(s,a)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.createElementVNode("div",{ref_key:"table",ref:e,class:"mt-2 w-full overflow-x-auto"},null,512),c.unref(t).loadings.mainLoading?(c.openBlock(),c.createElementBlock("div",nv,[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(10,u=>c.createElementVNode("div",{key:u,class:c.normalizeClass([{"border-t-0":u===1,"border-b-0":u===10,"bg-muted-50 dark:bg-muted-700":u%2!==0,"bg-white dark:bg-muted-800":u%2===0},"w-full py-4 mx-auto border-b-1"])},[c.createElementVNode("div",rv,[c.createElementVNode("div",sv,[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(9,d=>c.createElementVNode("div",{key:d,class:"mx-1 w-[10%] bg-muted-300 dark:bg-muted-900 h-2.5 rounded-md"})),64))])])],2)),64))])):c.createCommentVNode("",!0),n.value?(c.openBlock(),c.createElementBlock("div",ov,[c.createElementVNode("h2",av,c.toDisplayString(s.$fcTr("not_load_or_existing_data")),1)])):c.createCommentVNode("",!0)],64))}},hv="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXgiPjxwYXRoIGQ9Ik0xOCA2IDYgMTgiLz48cGF0aCBkPSJtNiA2IDEyIDEyIi8+PC9zdmc+",zT="",Mt=(l,e)=>{const t=l.__vccOpts||l;for(const[i,n]of e)t[i]=n;return t},uv={key:0,class:"w-full rounded-lg bg-white shadow-secondary-1 shadow-lg border border-muted-300 dark:bg-surface-dark"},dv={class:"border-b-2 flex justify-between border--100 px-6 py-3 text-surface dark:border-white/10 dark:text-white"},cv={key:0,class:"text-primerr-700"},fv={key:1,class:"text-primerr-700"},pv=["src"],gv={class:"p-6"},mv={class:"flex justify-end p-3 bg-gray-100 rounded-lg"},bv=Mt({__name:"MTabForm",setup(l){const e=c.inject("store");return(t,i)=>(c.openBlock(),c.createBlock(c.Transition,{name:"fade",appear:""},{default:c.withCtx(()=>[c.unref(e).dialog?(c.openBlock(),c.createElementBlock("div",uv,[c.createElementVNode("div",dv,[c.unref(e).isEditing?(c.openBlock(),c.createElementBlock("b",cv,c.toDisplayString(t.$fcTr("edit")),1)):(c.openBlock(),c.createElementBlock("b",fv,c.toDisplayString(t.$fcTr("add")),1)),c.createElementVNode("img",{style:{"max-width":"18px",cursor:"pointer"},src:c.unref(hv),onClick:i[0]||(i[0]=n=>c.unref(e).dialog=!1)},null,8,pv)]),c.createElementVNode("div",gv,[c.renderSlot(t.$slots,"default",{},void 0,!0),c.createElementVNode("div",mv,[c.renderSlot(t.$slots,"actions",{},void 0,!0)])])])):c.createCommentVNode("",!0)]),_:3}))}},[["__scopeId","data-v-305ba86b"]]),vv={class:"flex flex-col text-right mt-4"},wv={class:"mb-5"},yv={__name:"FormCore",setup(l){const e=c.inject("store"),t=c.ref(null),i=()=>{e.isEditing?e.editItem({...e.form}):e.addItem({...e.form})},n=async()=>{try{t.value.validate().then(()=>{if(!t.value.invalid)return i()})}catch{return}};return se.listen("saveForm",()=>{n()}),(s,a)=>{const u=c.resolveComponent("Vueform");return c.openBlock(),c.createElementBlock("div",vv,[c.createElementVNode("div",wv,[c.createVNode(u,c.mergeProps({modelValue:c.unref(e).form,"onUpdate:modelValue":a[0]||(a[0]=d=>c.unref(e).form=d)},c.unref(e).structure,{schema:c.unref(e).formFields,columns:{label:12},ref_key:"form$",ref:t,sync:""}),null,16,["modelValue","schema"])])])}}},OT="",Cv={class:"fixed z-50 inset-0 overflow-hidden pointer-events-none"},Ev={class:"text-lg font-semibold text-gray-900 flex items-center gap-2 pointer-events-none"},xv={key:0,class:"text-sm text-gray-500 font-normal"},Rv={class:"flex items-center gap-1 pointer-events-auto"},_v=["title"],Tv={class:"w-4 h-4 text-gray-600 group-hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},kv={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 12H4"},Sv={key:1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 15l7-7 7 7"},Mv=["title"],Lv={class:"w-4 h-4 text-gray-600 group-hover:text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Dv={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8V6a2 2 0 012-2h2M4 16v2a2 2 0 002 2h2m8-16h2a2 2 0 012 2v2m-4 12h2a2 2 0 002-2v-2"},Av={key:1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 9h6v6H9V9zm0 0V7a2 2 0 012-2h2a2 2 0 012 2v2M9 15v2a2 2 0 002 2h2a2 2 0 002-2v-2"},Fv={class:"flex-shrink-0 bg-gray-50 px-4 py-3 border-t border-gray-200 rounded-b-xl"},zv={class:"flex justify-end gap-2"},Pv=Mt({__name:"TailwindDialog",props:{title:{default:""},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:e}){c.inject("store");const t=e,i=l,n=c.ref(null),s=c.ref(null),a=c.ref({x:0,y:0}),u=c.ref({width:512,height:window.innerHeight>1080?window.innerHeight*.5:window.innerHeight-100}),d=c.ref(!1),p=c.ref(!1),g=c.ref(!1),w=c.ref(!1),b=c.ref({position:{x:0,y:0},size:{width:512,height:window.innerHeight>1080?window.innerHeight*.5:window.innerHeight-100}});let C=null;const _=c.computed(()=>g.value?{bottom:"1rem",left:"1rem",width:"300px",height:"auto",transform:"none"}:w.value?{top:"1rem",left:"1rem",width:"calc(100vw - 2rem)",height:"calc(100vh - 2rem)",transform:"none"}:{left:"50%",top:"50%",transform:`translate(calc(-50% + ${a.value.x}px), calc(-50% + ${a.value.y}px))`,width:`${u.value.width}px`,height:`${u.value.height}px`,minWidth:"300px",minHeight:"200px",maxWidth:"90vw",maxHeight:"90vh"}),S=c.computed(()=>w.value?{height:"calc(100vh - 2rem - 50px)"}:{height:`${u.value.height-50}px`}),F=c.computed(()=>({minHeight:"100px"}));function L(){t("update:modelValue",!1),U()}function U(){a.value={x:0,y:0};const V=Math.min(window.innerHeight*.9,window.innerHeight>1080?window.innerHeight*.5:window.innerHeight-100);u.value={width:512,height:V},g.value=!1,w.value=!1}function H(){g.value?(a.value={...b.value.position},u.value={...b.value.size},g.value=!1):(b.value={position:{...a.value},size:{...u.value}},g.value=!0,w.value=!1)}function N(){if(!w.value)b.value={position:{...a.value},size:{...u.value}};else{const V=b.value.size.width,W=b.value.size.height,pe=window.innerWidth*.05,Y=window.innerHeight*.05,he=window.innerWidth/2-V/2-pe,j=-(window.innerWidth/2)+V/2+pe,xe=window.innerHeight/2-W/2-Y,Re=-(window.innerHeight/2)+W/2+Y;a.value={x:Math.max(j,Math.min(he,b.value.position.x)),y:Math.max(Re,Math.min(xe,b.value.position.y))},u.value={...b.value.size}}w.value=!w.value,g.value=!1}function O(V){if(w.value||V.target.closest("button"))return;V.preventDefault(),d.value=!0;const W=V.clientX,pe=V.clientY,Y=a.value.x,he=a.value.y;function j(Re){d.value&&(C&&cancelAnimationFrame(C),C=requestAnimationFrame(()=>{const Ve=Re.clientX-W,gt=Re.clientY-pe,Be=Y+Ve,We=he+gt;if(g.value)return;const At=u.value.width,Qe=u.value.height,$e=window.innerWidth*.05,Ni=window.innerHeight*.05,mo=window.innerWidth/2-At/2-$e,bo=-(window.innerWidth/2)+At/2+$e,Zt=window.innerHeight/2-Qe/2-Ni,Ii=-(window.innerHeight/2)+Qe/2+Ni;a.value={x:Math.max(bo,Math.min(mo,Be)),y:Math.max(Ii,Math.min(Zt,We))}}))}function xe(){d.value=!1,C&&(cancelAnimationFrame(C),C=null),document.removeEventListener("mousemove",j,{passive:!0}),document.removeEventListener("mouseup",xe)}document.addEventListener("mousemove",j,{passive:!0}),document.addEventListener("mouseup",xe)}function oe(V){V.preventDefault(),V.stopPropagation(),p.value=!0;const W=V.clientX,pe=V.clientY,Y=u.value.width,he=u.value.height;function j(Re){p.value&&(C&&cancelAnimationFrame(C),C=requestAnimationFrame(()=>{const Ve=Re.clientX-W,gt=Re.clientY-pe,Be=window.innerWidth/2+a.value.x,We=window.innerHeight/2+a.value.y,At=Math.min(window.innerWidth*.9,(Be-window.innerWidth*.05)*2,(window.innerWidth*.95-Be)*2),Qe=Math.min(window.innerHeight*.9,(We-window.innerHeight*.05)*2,(window.innerHeight*.95-We)*2),$e=Math.max(300,Math.min(At,Y+Ve)),Ni=Math.max(200,Math.min(Qe,he+gt));u.value={width:$e,height:Ni}}))}function xe(){p.value=!1,C&&(cancelAnimationFrame(C),C=null),document.removeEventListener("mousemove",j,{passive:!0}),document.removeEventListener("mouseup",xe)}document.addEventListener("mousemove",j,{passive:!0}),document.addEventListener("mouseup",xe)}return c.onMounted(async()=>{await c.nextTick(),a.value={x:0,y:0}}),c.onUnmounted(()=>{C&&cancelAnimationFrame(C)}),(V,W)=>(c.openBlock(),c.createBlock(c.Transition,{name:"fade",appear:""},{default:c.withCtx(()=>[l.modelValue?(c.openBlock(),c.createElementBlock("div",{key:0,onKeydown:c.withKeys(L,["escape"]),class:"relative z-50",role:"dialog"},[g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-30 transition-opacity backdrop-blur-sm",onClick:L})),c.createElementVNode("div",Cv,[c.createElementVNode("div",{ref_key:"dialogRef",ref:n,class:c.normalizeClass(["absolute bg-white shadow-2xl border border-gray-200 pointer-events-auto transition-all duration-300",d.value?"select-none":"",p.value?"select-none":"",g.value?"rounded-t-xl shadow-lg":"rounded-xl"]),style:c.normalizeStyle(_.value)},[c.createElementVNode("div",{ref_key:"headerRef",ref:s,class:c.normalizeClass(["flex items-center justify-between px-4 py-3 border-gray-200",g.value?"border-b-0 rounded-t-xl bg-gradient-to-r from-blue-100 to-indigo-100":"border-b rounded-t-xl bg-gradient-to-r from-blue-50 to-indigo-50",d.value?"cursor-grabbing":"cursor-grab"]),onMousedown:O,onDblclick:W[0]||(W[0]=pe=>g.value?H():N())},[c.createElementVNode("h3",Ev,[c.createElementVNode("div",{class:c.normalizeClass(["w-2 h-2 rounded-full",g.value?"bg-orange-500 animate-pulse":"bg-blue-500 animate-pulse"])},null,2),c.createTextVNode(" "+c.toDisplayString(i.title)+" ",1),g.value?(c.openBlock(),c.createElementBlock("span",xv,"(minimized)")):c.createCommentVNode("",!0)]),c.createElementVNode("div",Rv,[c.createElementVNode("button",{onClick:H,class:"p-1.5 rounded-full hover:bg-white/70 transition-colors group",title:g.value?"Restore":"Minimize"},[(c.openBlock(),c.createElementBlock("svg",Tv,[g.value?(c.openBlock(),c.createElementBlock("path",Sv)):(c.openBlock(),c.createElementBlock("path",kv))]))],8,_v),g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("button",{key:0,onClick:N,class:"p-1.5 rounded-full hover:bg-white/70 transition-colors group",title:w.value?"Restore":"Maximize"},[(c.openBlock(),c.createElementBlock("svg",Lv,[w.value?(c.openBlock(),c.createElementBlock("path",Av)):(c.openBlock(),c.createElementBlock("path",Dv))]))],8,Mv)),c.createElementVNode("button",{onClick:L,class:"p-1.5 rounded-full hover:bg-red-100 transition-colors group",title:"Close"},W[1]||(W[1]=[c.createElementVNode("svg",{class:"w-4 h-4 text-gray-600 group-hover:text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[c.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])],34),c.createVNode(c.Transition,{name:"slide-down"},{default:c.withCtx(()=>[g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"flex flex-col overflow-hidden",style:c.normalizeStyle(S.value)},[c.createElementVNode("div",{class:"flex-1 px-4 py-4 overflow-y-auto",style:c.normalizeStyle(F.value)},[c.renderSlot(V.$slots,"default",{},void 0,!0)],4),c.createElementVNode("div",Fv,[c.createElementVNode("div",zv,[c.renderSlot(V.$slots,"actions",{},()=>[c.createElementVNode("button",{type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 transition-colors",onClick:L}," لغو "),c.createElementVNode("button",{type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 transition-colors",onClick:L}," تایید ")],!0)])])],4))]),_:3}),!g.value&&!w.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize hover:bg-blue-100 rounded-tl-lg transition-colors z-10",onMousedown:oe,title:"Resize"},W[2]||(W[2]=[c.createElementVNode("svg",{class:"w-full h-full text-gray-400 p-0.5",fill:"currentColor",viewBox:"0 0 24 24"},[c.createElementVNode("path",{d:"M22 22H20V20h2v2zm0-4H18v-2h4v2zm0-4H16v-2h6v2zm0-4H14v-2h8v2z"})],-1)]),32)):c.createCommentVNode("",!0)],6)])],32)):c.createCommentVNode("",!0)]),_:3}))}},[["__scopeId","data-v-cc2284ca"]]),BT="",Eh=Mt({__name:"MDialogForm",setup(l){const e=c.inject("store");return(t,i)=>(c.openBlock(),c.createBlock(Pv,{modelValue:c.unref(e).dialog,"onUpdate:modelValue":i[0]||(i[0]=n=>c.unref(e).dialog=n),title:c.unref(e).isEditing?t.$fcTr("edit"):t.$fcTr("add")},{actions:c.withCtx(()=>[c.renderSlot(t.$slots,"actions",{},void 0,!0)]),default:c.withCtx(()=>[c.renderSlot(t.$slots,"default",{},void 0,!0)]),_:3},8,["modelValue","title"]))}},[["__scopeId","data-v-3c50400f"]]);function Ov(l,e){return Array.isArray(l)?$.every(l,t=>$.isType(t,e)):!1}const Hv=(l,e)=>{const t=$.get(l,"field"),i=$.get(l,"valueProp");return Ov(e,"object")?e.map(n=>$.get(n,i)):$.get(e,t)},xh=(l,e)=>$.get(e,l.field),Bv={select:Hv,text:xh};function Rh(l,e="",t={}){for(const i in l){const n=l[i],s=e?`${e}.${i}`:i;typeof n=="object"&&n!==null&&(typeof n.normalizer=="function"&&(t.value=n.normalizer),Rh(n,s,t))}return t}const Nv=(l,e)=>{if(typeof l.normalizer=="function")return l.normalizer(e);const t=Rh(l);if(typeof t.value=="function")return t.value(e);const i=Bv[l.type];return i?i(l,e):xh(l,e)},IT="",Iv={key:0,id:"paginate"},Vv={class:"flex items-center justify-center py-2 lg:px-0 sm:px-6 px-4"},Wv={class:"lg:w-5/5 bg-white w-full flex items-center justify-between rounded-lg border pb-3"},$v={class:"sm:flex hidden mx-auto"},Gv=["onClick"],Uv=Mt({__name:"MTablePagination",setup(l){const e=c.inject("store");function t(u){e.paginate(u)}function i(){e.mainPagination.currentPage>1&&t(e.mainPagination.currentPage-1)}function n(u){t(u)}function s(){e.mainPagination.currentPage<e.mainPagination.lastPage&&t(e.mainPagination.currentPage+1)}function a(){let u=[];if(e.mainPagination.lastPage>10){let d=e.mainPagination.currentPage,p=d-1,g=d+1;d!=1&&u.push(1),d!=1&&d!=2&&p!=2&&u.push("..."),p>1&&u.push(p),u.push(d),g<e.mainPagination.lastPage&&u.push(g),d!=e.mainPagination.lastPage&&d!=e.mainPagination.lastPage-1&&g!=e.mainPagination.lastPage-1&&u.push("..."),e.mainPagination.lastPage!=d&&u.push(e.mainPagination.lastPage)}else u=e.mainPagination.lastPage;return u}return(u,d)=>c.unref(e).mainPagination.lastPage?(c.openBlock(),c.createElementBlock("div",Iv,[c.createElementVNode("div",Vv,[c.createElementVNode("div",Wv,[c.createElementVNode("div",$v,[c.createElementVNode("div",{onClick:i,class:"flex items-center px-2 pt-3 text-gray-600 hover:text-indigo-700 cursor-pointer"},d[0]||(d[0]=[c.createElementVNode("svg",{class:"rtl:rotate-180 w-[10px] fill-muted-600",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512"},[c.createElementVNode("path",{d:"M15 239c-9.4 9.4-9.4 24.6 0 33.9L207 465c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L65.9 256 241 81c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L15 239z"})],-1)])),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a(),p=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:p},[typeof p=="number"?(c.openBlock(),c.createElementBlock("p",{key:0,class:c.normalizeClass(c.unref(e).mainPagination.currentPage===p?"text-sm font-medium leading-none cursor-pointer text-indigo-700 !border-indigo-400 border-t-[1px] pt-3 mr-4 px-2":"text-sm font-medium leading-none cursor-pointer text-gray-600 hover:text-indigo-700 border-t-[1px] border-transparent hover:border-indigo-400 pt-3 mr-4 px-2"),onClick:g=>n(p)},c.toDisplayString(p),11,Gv)):(c.openBlock(),c.createElementBlock("p",{key:1,class:c.normalizeClass(["text-sm font-medium leading-none text-gray-600 pt-3 px-2",{"mr-4":a()>1}])},c.toDisplayString(p),3))],64))),128)),c.createElementVNode("div",{onClick:s,class:"flex items-center px-2 pt-3 text-gray-600 hover:text-indigo-700 cursor-pointer"},d[1]||(d[1]=[c.createElementVNode("svg",{class:"ltr:rotate-180 w-[10px] fill-muted-600",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512"},[c.createElementVNode("path",{d:"M15 239c-9.4 9.4-9.4 24.6 0 33.9L207 465c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L65.9 256 241 81c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L15 239z"})],-1)]))])])])])):c.createCommentVNode("",!0)}},[["__scopeId","data-v-7f626758"]]),WT="",jv=["disabled"],Kv={key:0},qv={key:1},Xv={key:2},Yv={class:"w-full"},Jv={__name:"MList",setup(l){const e=c.inject("store"),t=c.inject("tableComponent"),i=c.inject("form.save.key"),n=c.computed(()=>{const d={tab:bv,dialog:Eh};return $.get(d,e.options.formMode)||Eh});function s(){return{}}const a=d=>{let p={...d};for(const g of e.flatFieldsWithoutActions)p[g.field]=Nv(g,d);return p};return(()=>{se.listen("formue.dialog",d=>{e.dialog=d}),se.listen("toggle.select",d=>{if(e.selected.has(d))return e.selected.delete(d);e.selected.add(d)}),se.listen("createBtn",()=>{e.dialog=!0,e.editItemId=!1,e.isEditing=!1,e.form={}}),se.listen("fillForm",d=>{e.dialog=!0,e.editItemId=!1,e.isEditing=!1,e.form=a(d)}),se.listen("editBtn",d=>{e.dialog=!0,e.editItemId=d.id,e.isEditing=!0,e.form=a(d)}),se.listen("handleDialogForm",d=>{e.dialog=d}),se.listen("editTheItem",d=>{edit(d)}),se.listen("addTheItem",d=>{add(d)})})(),(d,p)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(n.value),null,{actions:c.withCtx(()=>[c.createElementVNode("button",{disabled:c.unref(e).loadings.mainLoading,onClick:p[0]||(p[0]=g=>c.unref(se).event("saveForm")),className:"btn mt-1 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 !bg-green-500 text-base font-medium text-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"},[c.unref(e).loadings.mainLoading?(c.openBlock(),c.createElementBlock("span",Kv,p[2]||(p[2]=[c.createElementVNode("b",null,null,-1),c.createElementVNode("b",null,null,-1),c.createElementVNode("b",null,null,-1)]))):c.unref(e).isEditing?(c.openBlock(),c.createElementBlock("span",qv,c.toDisplayString(d.$fcTr("edit")),1)):(c.openBlock(),c.createElementBlock("span",Xv,c.toDisplayString(c.unref(i)||d.$fcTr("save")),1))],8,jv),c.createElementVNode("button",{onClick:p[1]||(p[1]=g=>c.unref(e).dialog=!1),className:"mt-1 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"},c.toDisplayString(d.$fcTr("cancel")),1)]),default:c.withCtx(()=>[c.createVNode(yv)]),_:1})),c.createElementVNode("div",Yv,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(t)||lv),c.normalizeProps(c.guardReactiveProps(s())),null,16)),c.createVNode(Uv)])],64))}},Zv={TextFilter:()=>{const l=Ti();return{op:{placeholder:l.translate("operator"),columns:4,items:[{value:"$eq",text:l.translate("equal_to")},{value:"$ne",text:l.translate("not_equal_to")},{value:"$gt",text:l.translate("greater_than")},{value:"$lt",text:l.translate("less_than")},{value:"$contains",text:l.translate("look_like")}],"label-prop":"text","value-prop":"value",native:!1,type:"select"},value:{placeholder:l.translate("value"),type:"text",columns:4}}},DateFilter:()=>{const l=Ti();return{op:{placeholder:l.translate("operator"),columns:4,items:[{value:"$eq",text:l.translate("equal_to")},{value:"$between",text:l.translate("between")},{value:"$gt",text:l.translate("greater_than")},{value:"$lt",text:l.translate("less_than")}],labelProp:"text",valueProp:"value",native:!1,type:"select"},value:Bl({placeholder:l.translate("value"),columns:4})}},NullFilter:()=>{const l=Ti();return{op:{placeholder:l.translate("operator"),columns:4,items:[{value:"$notNull",text:l.translate("not_null")},{value:"$null",text:l.translate("null")}],labelProp:"text",valueProp:"value",native:!1,type:"select"},value:{type:"hidden",default:!0,columns:4}}},SelectFilter:l=>{const e=Ti();return{op:{placeholder:e.translate("operator"),columns:4,items:[{value:"$in",text:e.translate("in")},{value:"$notIn",text:e.translate("not_in")}],labelProp:"text",valueProp:"value",native:!1,type:"select"},value:Hl({placeholder:e.translate("value"),items:"filterItems"in l?l.filterItems:l.items,search:!0,columns:4,labelProp:l.labelProp,valueProp:l.valueProp,object:!1})}}};function Qv(l){return c.getCurrentScope()?(c.onScopeDispose(l),!0):!1}function po(l){return typeof l=="function"?l():c.unref(l)}const _h=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ew=Object.prototype.toString,tw=l=>ew.call(l)==="[object Object]",hr=()=>{},iw=nw();function nw(){var l,e;return _h&&((l=window==null?void 0:window.navigator)==null?void 0:l.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function rw(l,e){function t(...i){return new Promise((n,s)=>{Promise.resolve(l(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(n).catch(s)})}return t}const Th=l=>l();function sw(l=Th){const e=c.ref(!0);function t(){e.value=!1}function i(){e.value=!0}const n=(...s)=>{e.value&&l(...s)};return{isActive:c.readonly(e),pause:t,resume:i,eventFilter:n}}function ow(l){return l||c.getCurrentInstance()}function aw(l,e,t={}){const{eventFilter:i=Th,...n}=t;return c.watch(l,rw(i,e),n)}function lw(l,e,t={}){const{eventFilter:i,...n}=t,{eventFilter:s,pause:a,resume:u,isActive:d}=sw(i);return{stop:aw(l,e,{...n,eventFilter:s}),pause:a,resume:u,isActive:d}}function hw(l,e=!0,t){ow()?c.onMounted(l,t):e?l():c.nextTick(l)}function gn(l){var e;const t=po(l);return(e=t==null?void 0:t.$el)!=null?e:t}const ur=_h?window:void 0;function mn(...l){let e,t,i,n;if(typeof l[0]=="string"||Array.isArray(l[0])?([t,i,n]=l,e=ur):[e,t,i,n]=l,!e)return hr;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const s=[],a=()=>{s.forEach(g=>g()),s.length=0},u=(g,w,b,C)=>(g.addEventListener(w,b,C),()=>g.removeEventListener(w,b,C)),d=c.watch(()=>[gn(e),po(n)],([g,w])=>{if(a(),!g)return;const b=tw(w)?{...w}:w;s.push(...t.flatMap(C=>i.map(_=>u(g,C,_,b))))},{immediate:!0,flush:"post"}),p=()=>{d(),a()};return Qv(p),p}let kh=!1;function uw(l,e,t={}){const{window:i=ur,ignore:n=[],capture:s=!0,detectIframe:a=!1}=t;if(!i)return hr;iw&&!kh&&(kh=!0,Array.from(i.document.body.children).forEach(b=>b.addEventListener("click",hr)),i.document.documentElement.addEventListener("click",hr));let u=!0;const d=b=>n.some(C=>{if(typeof C=="string")return Array.from(i.document.querySelectorAll(C)).some(_=>_===b.target||b.composedPath().includes(_));{const _=gn(C);return _&&(b.target===_||b.composedPath().includes(_))}}),g=[mn(i,"click",b=>{const C=gn(l);if(!(!C||C===b.target||b.composedPath().includes(C))){if(b.detail===0&&(u=!d(b)),!u){u=!0;return}e(b)}},{passive:!0,capture:s}),mn(i,"pointerdown",b=>{const C=gn(l);u=!d(b)&&!!(C&&!b.composedPath().includes(C))},{passive:!0}),a&&mn(i,"blur",b=>{setTimeout(()=>{var C;const _=gn(l);((C=i.document.activeElement)==null?void 0:C.tagName)==="IFRAME"&&!(_!=null&&_.contains(i.document.activeElement))&&e(b)},0)})].filter(Boolean);return()=>g.forEach(b=>b())}const dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},cr="__vueuse_ssr_handlers__",dw=cw();function cw(){return cr in dr||(dr[cr]=dr[cr]||{}),dr[cr]}function fw(l,e){return dw[l]||e}function pw(l){return l==null?"any":l instanceof Set?"set":l instanceof Map?"map":l instanceof Date?"date":typeof l=="boolean"?"boolean":typeof l=="string"?"string":typeof l=="object"?"object":Number.isNaN(l)?"any":"number"}const gw={boolean:{read:l=>l==="true",write:l=>String(l)},object:{read:l=>JSON.parse(l),write:l=>JSON.stringify(l)},number:{read:l=>Number.parseFloat(l),write:l=>String(l)},any:{read:l=>l,write:l=>String(l)},string:{read:l=>l,write:l=>String(l)},map:{read:l=>new Map(JSON.parse(l)),write:l=>JSON.stringify(Array.from(l.entries()))},set:{read:l=>new Set(JSON.parse(l)),write:l=>JSON.stringify(Array.from(l))},date:{read:l=>new Date(l),write:l=>l.toISOString()}},Sh="vueuse-storage";function mw(l,e,t,i={}){var n;const{flush:s="pre",deep:a=!0,listenToStorageChanges:u=!0,writeDefaults:d=!0,mergeDefaults:p=!1,shallow:g,window:w=ur,eventFilter:b,onError:C=Y=>{console.error(Y)},initOnMounted:_}=i,S=(g?c.shallowRef:c.ref)(typeof e=="function"?e():e);if(!t)try{t=fw("getDefaultStorage",()=>{var Y;return(Y=ur)==null?void 0:Y.localStorage})()}catch(Y){C(Y)}if(!t)return S;const F=po(e),L=pw(F),U=(n=i.serializer)!=null?n:gw[L],{pause:H,resume:N}=lw(S,()=>oe(S.value),{flush:s,deep:a,eventFilter:b});w&&u&&hw(()=>{mn(w,"storage",W),mn(w,Sh,pe),_&&W()}),_||W();function O(Y,he){w&&w.dispatchEvent(new CustomEvent(Sh,{detail:{key:l,oldValue:Y,newValue:he,storageArea:t}}))}function oe(Y){try{const he=t.getItem(l);if(Y==null)O(he,null),t.removeItem(l);else{const j=U.write(Y);he!==j&&(t.setItem(l,j),O(he,j))}}catch(he){C(he)}}function V(Y){const he=Y?Y.newValue:t.getItem(l);if(he==null)return d&&F!=null&&t.setItem(l,U.write(F)),F;if(!Y&&p){const j=U.read(he);return typeof p=="function"?p(j,F):L==="object"&&!Array.isArray(j)?{...F,...j}:j}else return typeof he!="string"?he:U.read(he)}function W(Y){if(!(Y&&Y.storageArea!==t)){if(Y&&Y.key==null){S.value=F;return}if(!(Y&&Y.key!==l)){H();try{(Y==null?void 0:Y.newValue)!==U.write(S.value)&&(S.value=V(Y))}catch(he){C(he)}finally{Y?c.nextTick(N):N()}}}}function pe(Y){W(Y.detail)}return S}const bw={class:"relative"},go={__name:"MMenu",setup(l){const e=c.ref(null);uw(e,s=>t.value=!1);const t=c.ref(!1),i={isOpen:t.value},n={click:()=>t.value=!t.value};return(s,a)=>(c.openBlock(),c.createElementBlock("div",bw,[c.renderSlot(s.$slots,"activator",c.normalizeProps(c.guardReactiveProps({on:n,props:i})),()=>[c.createElementVNode("button",c.mergeProps({class:"bg-blue-500 text-white px-4 py-2 rounded-md"},c.toHandlers(n,!0))," Open Menu "+c.toDisplayString(t.value),17)]),t.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"absolute top-[35px] left-0 mt-2 w-48 rounded-md shadow-lg z-[1]",ref_key:"target",ref:e},[c.renderSlot(s.$slots,"default",{},()=>[a[0]||(a[0]=c.createElementVNode("ul",{class:"py-2"},[c.createElementVNode("li",{class:"px-4 py-2 hover:bg-gray-100 cursor-pointer"},"Item 1"),c.createElementVNode("li",{class:"px-4 py-2 hover:bg-gray-100 cursor-pointer"},"Item 2"),c.createElementVNode("li",{class:"px-4 py-2 hover:bg-gray-100 cursor-pointer"},"Item 3")],-1))])],512)):c.createCommentVNode("",!0)]))}},KT="",vw={class:"border-muted-200 dark:border-muted-700 dark:bg-muted-800 relative mb-4 w-full rounded-lg border bg-white p-6 transition-all duration-300"},ww={class:"flex flex-col ml-1 border-[rgba(0,0,0,.1)] pb-4"},yw={class:"flex flex-row justify-between mb-4 items-center"},Cw={class:"font-heading text-base font-semibold leading-tight text-muted-800 dark:text-white"},Ew={class:"flex items-center"},xw={class:"z-[1]"},Rw={class:"fc-drop-down-content"},_w={key:0,class:"p-2 text-center"},Tw=["onClick"],kw={class:"text-muted-400 font-sans text-sm"},Sw={class:"flex w-full justify-between align-start"},Mw={class:"w-[12%] flex justify-center items-center"},Lw=["disabled"],Dw={class:"flex border-t dark:border-muted-600 flex-col p-2 mt-2"},Aw={class:"flex items-center"},Fw={class:"font-heading text-base font-semibold leading-tight text-muted-800 dark:text-white"},zw={class:"group-hover:text-red-500"},Pw={class:"my-2 flex overflow-x-auto slimscroll"},Ow={class:"flex"},Hw=["onClick"],Bw={class:"mt-[0px]"},Nw=["onClick"],Iw={key:0,class:"flex items-center mx-2 text-[0.75rem]"},Vw={class:"flex w-full gap-x-2 justify-between !items-end"},Ww={class:"pt-4 md:pt-6"},$w={class:"flex gap-x-2"},Gw=["placeholder"],Uw=Mt({__name:"MFilter",setup(l){const e=c.inject("store");let t=-1;const i=c.ref(!1),n=c.ref({field:""}),s=c.ref(!1),a=c.ref(""),u=b(),d=c.ref(null);function p(N){if(!N)return!1;const O={text:"TextFilter",date:"DateFilter",select:"SelectFilter",map:"NullFilter"},oe=$.get(O,N.type),V=$.get(Zv,oe);return typeof V=="function"?V(N):!1}const g={field:{placeholder:"field",type:"select",native:!1,items:e.headersWithoutActions,"label-prop":"title","value-prop":"field",object:!0,search:!0,trackBy:["title"],columns:2,onChange(N,O,oe){const V=p(N)||[];for(const W in n.value)W!=="field"&&delete n.value[W];w.value={...g,...V},c.nextTick(()=>{try{const W=oe.form$.el$("value");W&&"clear"in W&&W.clear(),W&&"updateItems"in W&&W.updateItems()}catch{}})}}},w=c.ref({...g});function b(){const N=window.location.pathname.replace(/^\/|\/$/g,"")+"-filters";return mw(N,{},localStorage,{mergeDefaults:!0})}function C(){e.filters.push($.cloneDeep(n.value)),n.value={}}function _(){t!==-1&&e.filters.splice(t,1,n.value),i.value=!1,n.value={}}function S(N,O){i.value=!0,t=O,n.value=N,c.nextTick(()=>{n.value.op=N.op,n.value.value=N.value})}function F(N){e.filters=e.filters.filter(O=>O!==N)}function L(){e.filters=[],e.loadItems()}function U(){if(!s.value)return s.value=!0,d.value.focus();a.value&&(u.value[a.value]={...e.filters},s.value=!1,a.value="",d.value.blur())}function H(){e.loadItems()}return(N,O)=>{const oe=c.resolveComponent("Vueform");return c.withDirectives((c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["accordion-content",{hide:c.unref(e).panel!=="filters"}])},[c.createElementVNode("div",vw,[c.createElementVNode("div",ww,[c.createElementVNode("div",yw,[c.createElementVNode("h3",Cw,c.toDisplayString(N.$fcTr("filter_data")),1),c.createElementVNode("div",Ew,[c.createVNode(go,null,{activator:c.withCtx(({props:V,on:W})=>[c.createElementVNode("button",c.mergeProps(c.toHandlers(W,!0),{class:[V.isOpen?"before:hidden":"before:block","fc-filter-choose is-button rounded is-button-default min-w-[130px]"]}),[c.createElementVNode("span",xw,c.toDisplayString(N.$fcTr("choose_filter")),1)],16)]),default:c.withCtx(()=>[c.createElementVNode("div",Rw,[Object.keys(c.unref(u)).length===0?(c.openBlock(),c.createElementBlock("p",_w,c.toDisplayString(N.$fcTr("not_filter_create_yes")),1)):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(u),(V,W)=>(c.openBlock(),c.createElementBlock("a",{class:"group rounded flex w-full items-center py-3 text-sm duration-300 text-muted-500 hover:bg-muted-100 dark:hover:bg-muted-700 justify-between rtl:pl-4 rtl:pr-5",key:W,onClick:c.withModifiers(pe=>c.unref(e).filters=Object.values(V),["stop"])},[c.createElementVNode("p",kw,c.toDisplayString(W),1),O[6]||(O[6]=c.createElementVNode("svg",{"data-v-74b3417a":"","aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 text-muted-500"},[c.createElementVNode("path",{"data-v-74b3417a":"",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6 6 18M6 6l12 12"})],-1))],8,Tw))),128))])]),_:1})])]),c.createElementVNode("div",Sw,[c.createVNode(oe,{modelValue:n.value,"onUpdate:modelValue":O[0]||(O[0]=V=>n.value=V),schema:w.value,sync:!0,class:"w-[100%] justify-between ml-4",columns:{label:12}},null,8,["modelValue","schema"]),c.createElementVNode("div",Mw,[i.value?(c.openBlock(),c.createElementBlock("button",{key:1,class:"!border-dashed is-button-default is-button w-full rounded-full font-bold py-1 px-2 !border-green-400 !text-green-400 hover:!bg-green-50",onClick:_},[c.createTextVNode(c.toDisplayString(N.$fcTr("edit_filter"))+" ",1),O[8]||(O[8]=c.createElementVNode("svg",{class:"icon h-4 w-4",viewBox:"0 0 24 24"},[c.createElementVNode("path",{stroke:"currentColor","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1))])):(c.openBlock(),c.createElementBlock("button",{key:0,disabled:!n.value.field,class:"disabled:cursor-not-allowed disabled:hover:bg-transparent !border-dashed !h-[86%] is-button-default is-button w-full rounded font-bold py-1 px-2 !border-green-400 !text-green-400 dark:active:hover:bg-muted-600 active:hover:!bg-green-50",onClick:C},[O[7]||(O[7]=c.createElementVNode("svg",{class:"icon h-4 ml-1 w-4",viewBox:"0 0 24 24"},[c.createElementVNode("path",{stroke:"currentColor","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),c.createTextVNode(" "+c.toDisplayString(N.$fcTr("add_filter")),1)],8,Lw))])])]),c.withDirectives(c.createElementVNode("div",Dw,[c.createElementVNode("div",Aw,[c.createElementVNode("h3",Fw,c.toDisplayString(N.$fcTr("active_filter")),1),c.createElementVNode("button",{onClick:L,class:"is-button group hover:text-red-500 hover:border-red-500 w-fit text-muted-600 dark:text-muted-400 !text-xs border !px-3 !py-0 !h-[1.5rem] mx-2 !rounded-full"},[c.createElementVNode("span",zw,c.toDisplayString(N.$fcTr("clear_all")),1),O[9]||(O[9]=c.createElementVNode("svg",{stroke:"currentColor",width:"1em",height:"1em",class:"ml-1 rtl:ml-1 rtl:mr-1 group-hover:fill-red-500 dark:fill-muted-400 fill-muted-600",viewBox:"0 0 512 512"},[c.createElementVNode("path",{d:"M340 148L488 0l24 24L364 172l52 52L257.2 483.9 240 512l-23.3-23.3L23.3 295.3 0 272l28.1-17.2L288 96l52 52zM51.4 278.1l47.9 47.9 33.4-33.4L144 281.4 166.6 304l-11.3 11.3-33.4 33.4L233.9 460.6l89.6-146.6L197.9 188.6 51.4 278.1zM340.6 286l34.9-57.2-92.4-92.4L226 171.4 340.6 286z"})],-1))])]),c.createElementVNode("div",Pw,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(e).filters,(V,W)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:W},[c.createElementVNode("div",Ow,[c.createElementVNode("span",{class:"flex px-3 font-sans transition-shadow duration-300 py-1 text-[0.75rem] cursor-pointer rounded-full bg-primary-100 text-primary-500 border-primary-100 dark:border-primary-500 dark:text-primary-500 border dark:bg-transparent",onClick:pe=>S(V,W)},[c.createElementVNode("span",Bw,c.toDisplayString(c.unref($.get)(V,"field.title")),1),c.createElementVNode("button",{class:"text-white font-bold rounded px-1 hover:bg-primary-500 hover:text-black-500",onClick:c.withModifiers(pe=>F(V),["stop"])},O[10]||(O[10]=[c.createElementVNode("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 text-primary-500"},[c.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6 6 18M6 6l12 12"})],-1)]),8,Nw)],8,Hw)]),c.unref(e).filters.length-1!==W?(c.openBlock(),c.createElementBlock("span",Iw,c.toDisplayString(N.$fcTr("&")),1)):c.createCommentVNode("",!0)],64))),128))])],512),[[c.vShow,c.unref(e).filters.length>0]]),c.createElementVNode("div",Vw,[c.createElementVNode("button",{onClick:O[1]||(O[1]=V=>c.unref(e).panel=""),class:"is-button text-muted-500 rounded hover:text-red-500 !underline focus-within:!outline-none"},c.toDisplayString(N.$fcTr("cancel")),1),c.createElementVNode("div",Ww,[c.createElementVNode("div",$w,[c.createElementVNode("button",{onClick:O[5]||(O[5]=c.withModifiers(V=>Object.keys(c.unref(e).filters).length!==0?U():"",["self"])),class:c.normalizeClass([{"!bg-muted-100 dark:!bg-muted-700 ltr:pr-1":s.value," focus:outline-none !cursor-not-allowed":Object.keys(c.unref(e).filters).length===0},"transitionX-inp is-button rounded is-button-default"])},[c.createElementVNode("span",{onClick:O[2]||(O[2]=c.withModifiers(V=>Object.keys(c.unref(e).filters).length!==0?U():"",["self"])),class:c.normalizeClass({" bg-green-500 px-2 py-1 rounded text-muted-50":s.value," focus:outline-none !cursor-not-allowed":Object.keys(c.unref(e).filters).length===0})},c.toDisplayString(N.$fcTr("save")),3),c.createElementVNode("span",{class:c.normalizeClass(["transitionX-inp overflow-hidden flex items-center justify-between",s.value?"w-[221px] opacity-1 ltr:pl-3 rtl:mr-3":"opacity-0 w-[0px]"])},[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":O[3]||(O[3]=V=>a.value=V),class:c.normalizeClass(["fc-focus py-1 rounded px-2 dark:bg-muted-800",s.value?" border border-1":"flex "]),placeholder:N.$fcTr("filter_save_placeholder"),ref_key:"filterNameInp",ref:d},null,10,Gw),[[c.vModelText,a.value]]),c.createElementVNode("span",{class:"px-2",onClick:O[4]||(O[4]=V=>s.value=!1)},O[11]||(O[11]=[c.createElementVNode("svg",{"data-v-74b3417a":"","aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 text-primary-500"},[c.createElementVNode("path",{"data-v-74b3417a":"",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6 6 18M6 6l12 12"})],-1)]))],2)],2),c.createElementVNode("button",{onClick:H,class:"is-button rounded bg-primary-500 dark:bg-primary-500 hover:enabled:bg-primary-400 dark:hover:enabled:bg-primary-400 text-white hover:enabled:shadow-lg hover:enabled:shadow-primary-500/50 dark:hover:enabled:shadow-primary-800/20 focus-visible:outline-primary-400/70 focus-within:outline-primary-400/70 focus-visible:bg-primary-500 active:enabled:bg-primary-500 dark:focus-visible:outline-primary-400 dark:focus-within:outline-primary-400 dark:focus-visible:bg-primary-500 dark:active:enabled:bg-primary-500"},c.toDisplayString(N.$fcTr("filter")),1)])])])])],2)),[[c.vShow,c.unref(e).panel==="filters"]])}}},[["__scopeId","data-v-c58a2751"]]),XT="",jw={id:"tooltip",class:"tooltip"},Kw=Mt({__name:"MTooltip",setup(l){return c.onMounted(()=>{const e=document.getElementById("tooltip");function t(n){const s=n.target.closest("[data-tooltip]");if(s){const a=s.getAttribute("data-tooltip");e.textContent=a,e.style.left=`${n.pageX+10}px`,e.style.top=`${n.pageY+10}px`,e.classList.add("visible")}}function i(){e.classList.remove("visible")}document.addEventListener("mouseover",t),document.addEventListener("mouseout",i)}),(e,t)=>(c.openBlock(),c.createElementBlock("div",jw))}},[["__scopeId","data-v-d7c03134"]]),JT="",qw={key:0,class:"w-full border bg-white rounded p-2 flex align-center mt-2"},Xw=["onClick"],Yw={__name:"MHeaderBox",setup(l){const e=c.inject("store");let t=null;c.watch(()=>e.panel,n=>{e.panel==="headerBox"&&e.headersWithoutActions.forEach(s=>{t=document.querySelector(`[tabulator-field="${s.field}"]`),t.innerHTML=t.innerHTML+'<span class="fc-remove"><button class="text-white font-bold rounded px-1" onclick=""><svg aria-hidden="true" viewBox="0 0 24 24" class="h-4 w-4 text-primary-500"><path data-v-74b3417a="" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6 6 18M6 6l12 12"></path></svg></button></span>'})});function i(n){n.isHeader=!n.isHeader}return(n,s)=>c.unref(e).panel==="headerBox"?(c.openBlock(),c.createElementBlock("div",qw,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(e).flatFields,a=>(c.openBlock(),c.createElementBlock("div",{key:a.field,class:c.normalizeClass(["px-1 mx-1 cursor-pointer divide-y rounded",{"bg-primary-600 text-white":a.isHeader}]),onClick:u=>i(a)},c.toDisplayString(a.title),11,Xw))),128))])):c.createCommentVNode("",!0)}},Jw=["disabled"],Zw={__name:"BatchActions",setup(l){const e=c.inject("store"),t=c.ref([]);se.listen("toggle.select",n=>{t.value.includes(n)?t.value=t.value.filter(s=>s!==n):t.value.push(n)});function i(){se.event("dialog.confirm",{description:" آیا از حذف این "+t.value.length+" آیتم ، مطمئن هستید؟ ",title:"حذف دسته جمعی",icon:"fluent:delete-dismiss-24-regular",confirmFunc:async()=>{const n=await e.remove(t.value);return t.value=[],se.event("batch.removed"),n}})}return(n,s)=>(c.openBlock(),c.createBlock(c.Transition,{name:"fade"},{default:c.withCtx(()=>[c.createElementVNode("button",{class:"fc-header-icon-btn !bg-red-100","data-tooltip":"حذف دسته جمعی",disabled:!t.value.length,onClick:i},s[0]||(s[0]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},[c.createElementVNode("rect",{width:"16",height:"16",fill:"none"}),c.createElementVNode("path",{fill:"#f00",d:"M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5M11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1zm1.958 1l-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47M8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5"})],-1)]),8,Jw)]),_:1}))}},Qw={class:"flex items-center gap-3 relative hover:bg-muted-200 dark:hover:bg-muted-700 rounded-lg px-5 pl-3 rtl:pl-8 rtl:pr-5 py-2 duration-300"},ey=["modelValue"],ty={class:"text-success-500 peer-disabled:opacity-75"},iy={class:"font-heading text-muted-800 text-xs font-semibold leading-tight dark:text-white"},ny={__name:"SelectColumnItem",props:{checked:{default:!1},columnName:{default:""}},setup(l){return(e,t)=>(c.openBlock(),c.createElementBlock("div",Qw,[c.createElementVNode("div",{class:c.normalizeClass(["nui-focus block focus-within:outline-current rounded-full",JSON.parse(l.checked)?"is-checked":"is-unchecked"])},[c.createElementVNode("input",{modelValue:l.checked,type:"checkbox",class:"peer cursor-pointer disabled:cursor-not-allowed","true-value":"true","false-value":"false",onClick:t[0]||(t[0]=i=>e.$emit("toggle"))},null,8,ey),c.createElementVNode("label",ty,[c.createElementVNode("div",{class:c.normalizeClass(["rtl:left-[auto] rtl:!right-0 ltr:right-[auto] ltr:left-0",JSON.parse(l.checked)?"is-opaque":""])},null,2),t[1]||(t[1]=c.createElementVNode("svg",{"aria-hidden":"true",viewBox:"0 0 52 52","data-v-3e8a7b5f":""},[c.createElementVNode("circle",{cx:"26",cy:"26",r:"25",fill:"none",stroke:"currentColor"}),c.createElementVNode("path",{fill:"none",stroke:"currentColor",d:"m14.1 27.2 7.1 7.2 16.7-16.8"})],-1))])],2),c.createElementVNode("div",null,[c.createElementVNode("h6",iy,c.toDisplayString(l.columnName),1)])]))}},ZT="",ry={class:"fc-header"},sy={class:"fc-header-left-sid"},oy={class:"z-[1]"},ay={class:"bg-muted-200 dark:bg-muted-800 cursor-pointer rounded-xl fm-light-shadow"},ly={class:"text-muted-400 font-sans text-xs"},hy={class:"bg-white dark:bg-muted-800 rounded-xl pt-1 rtl:text-right ltr:text-left fm-light-shadow"},uy={class:"m-3 mt-2 text-muted-600 dark:text-muted-200"},dy={class:"p-2"},cy={key:0,"data-tooltip":"فیلتر",class:"fm-header-rigth-sid flex w-full sm:w-auto rtl:flex-row-reverse rtl:justify-end"},fy={key:0},py={class:"group/nui-input relative rtl:"},gy=["placeholder"],my={class:"ltr:left-0 text-muted-400 group-focus-within/nui-input:text-primary-500 absolute end-0 rtl:start-0 top-0 flex items-center justify-center transition-colors duration-300 peer-disabled:cursor-not-allowed peer-disabled:opacity-75 h-10 w-10"},by={key:0,class:"icon h-[1.15rem] w-[1.15rem]",width:"1em",height:"1em",viewBox:"0 0 24 24"},vy={key:1,xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512",class:"icon animate-spin"},wy=Mt({__name:"MButtonBox",setup(l){const{can:e}=Os(),t=c.inject("store");function i(b){b===t.panel?t.panel="":t.panel=b}const n=c.ref(null);c.onMounted(()=>{n.value=document.body.getAttribute("dir")});const s=c.computed(()=>t.flatFields.find(b=>b.field==="_select_")),a=c.computed(()=>!!s.value.isHeader);function u(){s.value.isHeader=!s.value.isHeader,s.value.isHeader||t.selected.clear()}const d=c.ref(!1);function p(){d.value=!0,t.loadItems().finally(()=>d.value=!1)}const g=$.debounce(p,600);function w(){window.open(ye.defaults.baseURL+t.generateQuery())}return(b,C)=>(c.openBlock(),c.createElementBlock("div",ry,[c.createElementVNode("div",sy,[c.unref(e)("create")?(c.openBlock(),c.createElementBlock("button",{key:0,class:"fc-plus-btn","data-tooltip":"افزودن",onClick:C[0]||(C[0]=_=>c.unref(se).event("createBtn"))},C[5]||(C[5]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-plus"},[c.createElementVNode("path",{d:"M5 12h14"}),c.createElementVNode("path",{d:"M12 5v14"})],-1)]))):c.createCommentVNode("",!0),c.createVNode(go,null,{activator:c.withCtx(({on:_,props:S})=>[c.createElementVNode("button",c.mergeProps({class:S.isOpen?"before:block":"before:hidden"},S,c.toHandlers(_,!0),{class:"fc-header-icon-btn fc-drop-down-btn min-w-[130px]"}),[c.createElementVNode("span",oy,c.toDisplayString(b.$fcTr("export")),1)],16)]),default:c.withCtx(()=>[c.createElementVNode("div",ay,[c.createElementVNode("a",{class:"group flex w-full items-center py-3 text-sm duration-300 text-muted-500 hover:bg-muted-300 dark:hover:bg-muted-700 rounded-xl justify-end flex-row-reverse",onClick:w},[c.createElementVNode("p",ly,c.toDisplayString(b.$fcTr("export_as_excel")),1),C[6]||(C[6]=c.createElementVNode("svg",{class:"fill-muted-400 w-3.5 mx-2",viewBox:"0 0 512 512"},[c.createElementVNode("path",{d:"M48 448V64c0-8.8 7.2-16 16-16H224v80c0 17.7 14.3 32 32 32h80V448c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16zM64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V154.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0H64zm90.9 233.3c-8.1-10.5-23.2-12.3-33.7-4.2s-12.3 23.2-4.2 33.7L161.6 320l-44.5 57.3c-8.1 10.5-6.3 25.5 4.2 33.7s25.5 6.3 33.7-4.2L192 359.1l37.1 47.6c8.1 10.5 23.2 12.3 33.7 4.2s12.3-23.2 4.2-33.7L222.4 320l44.5-57.3c8.1-10.5 6.3-25.5-4.2-33.7s-25.5-6.3-33.7 4.2L192 280.9l-37.1-47.6z"})],-1))])])]),_:1}),c.createElementVNode("button",{class:"fc-header-icon-btn","data-tooltip":"رفرش",onClick:C[1]||(C[1]=(..._)=>c.unref(t).reloadData&&c.unref(t).reloadData(..._))},[(c.openBlock(),c.createElementBlock("svg",{class:c.normalizeClass({spin:c.unref(t).loadings.mainLoading}),viewBox:"0 0 512 512"},C[7]||(C[7]=[c.createElementVNode("path",{d:"M371.2 122.9C340.3 96.2 300 80 256 80C158.8 80 80 158.8 80 256s78.8 176 176 176c39.7 0 76.2-13.1 105.6-35.2c10.6-8 25.6-5.8 33.6 4.8s5.8 25.6-4.8 33.6C353 463.3 306.4 480 256 480C132.3 480 32 379.7 32 256S132.3 32 256 32c57.3 0 109.6 21.5 149.2 56.9l30.5-30.5c6.6-6.6 15.6-10.3 25-10.3C480.2 48 496 63.8 496 83.3V200c0 13.3-10.7 24-24 24H355.3c-19.5 0-35.3-15.8-35.3-35.3c0-9.4 3.7-18.3 10.3-25l40.8-40.8zm76.8-9L385.9 176H448V113.9z"},null,-1)]),2))]),c.createElementVNode("button",{class:c.normalizeClass(["fc-header-icon-btn",{"fm-active-btn":a.value}]),"data-tooltip":"انتخاب گروهی",onClick:u},C[8]||(C[8]=[c.createElementVNode("svg",{viewBox:"0 0 512 512"},[c.createElementVNode("path",{d:"M384 48c8.8 0 16 7.2 16 16V448c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16H384zM64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H64zM80 112v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V112c0-8.8-7.2-16-16-16H96c-8.8 0-16 7.2-16 16zM96 352c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V368c0-8.8-7.2-16-16-16H96zm80-224c0 13.3 10.7 24 24 24H344c13.3 0 24-10.7 24-24s-10.7-24-24-24H200c-13.3 0-24 10.7-24 24zm32 128c0 13.3 10.7 24 24 24H344c13.3 0 24-10.7 24-24s-10.7-24-24-24H232c-13.3 0-24 10.7-24 24zM176 384c0 13.3 10.7 24 24 24H344c13.3 0 24-10.7 24-24s-10.7-24-24-24H200c-13.3 0-24 10.7-24 24zm-4.7-140.7c6.2-6.2 6.2-16.4 0-22.6s-16.4-6.2-22.6 0L112 257.4 99.3 244.7c-6.2-6.2-16.4-6.2-22.6 0s-6.2 16.4 0 22.6l24 24c6.2 6.2 16.4 6.2 22.6 0l48-48z"})],-1)]),2),a.value?(c.openBlock(),c.createBlock(Zw,{key:1})):c.createCommentVNode("",!0),c.createVNode(go,{"close-on-content-click":!0},{activator:c.withCtx(({props:_,on:S})=>[c.createElementVNode("button",c.mergeProps(c.toHandlers(S,!0),{class:["fc-header-icon-btn",[_.isOpen?"light:!bg-white dark:bg-muted-800":"",_.isOpen?n.value==="rtl"?"expanded-rtl":"expanded2":""]],"data-tooltip":"انتخاب سرستون"}),C[9]||(C[9]=[c.createElementVNode("svg",{viewBox:"0 0 448 512",class:"z-[1]"},[c.createElementVNode("path",{d:"M64 448c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32H384c17.7 0 32 14.3 32 32V416c0 17.7-14.3 32-32 32H64zM0 416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64C28.7 32 0 60.7 0 96V416zM128 288c8.8 0 16-7.2 16-16V144c0-8.8-7.2-16-16-16s-16 7.2-16 16V272c0 8.8 7.2 16 16 16zm176 48c0 8.8 7.2 16 16 16s16-7.2 16-16V144c0-8.8-7.2-16-16-16s-16 7.2-16 16V336zm-80-80c8.8 0 16-7.2 16-16V144c0-8.8-7.2-16-16-16s-16 7.2-16 16v96c0 8.8 7.2 16 16 16z"})],-1)]),16)]),default:c.withCtx(()=>[c.createElementVNode("div",hy,[c.createElementVNode("div",uy,c.toDisplayString(b.$fcTr("custom_column")),1),c.createElementVNode("ul",dy,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(t).flatFieldsWithoutActions,_=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:_.field},[_.title?(c.openBlock(),c.createBlock(ny,{key:0,"column-name":_.title,checked:_.isHeader,onToggle:S=>_.isHeader=!_.isHeader},null,8,["column-name","checked","onToggle"])):c.createCommentVNode("",!0)],64))),128))])])]),_:1})]),c.unref(e)("filter")?(c.openBlock(),c.createElementBlock("div",cy,[c.createElementVNode("button",{class:c.normalizeClass(["test fc-header-icon-btn transform transition-all",c.unref(t).panel==="filters"?"!bg-white dark:!bg-muted-800 !rounded-b-none ":""]),onClick:C[2]||(C[2]=_=>i("filters"))},[c.createVNode(c.Transition,{name:"scale"},{default:c.withCtx(()=>[c.unref(t).panel==="filters"?(c.openBlock(),c.createElementBlock("div",fy,C[10]||(C[10]=[c.createElementVNode("span",null,null,-1)]))):c.createCommentVNode("",!0)]),_:1}),(c.openBlock(),c.createElementBlock("svg",{class:c.normalizeClass(c.unref(t).panel==="filters"?"light:!fill-primary-700":""),stroke:"currentColor",viewBox:"0 0 512 512"},C[11]||(C[11]=[c.createElementVNode("path",{d:"M0 73.7C0 50.7 18.7 32 41.7 32H470.3c23 0 41.7 18.7 41.7 41.7c0 9.6-3.3 18.9-9.4 26.3L336 304.5V447.7c0 17.8-14.5 32.3-32.3 32.3c-7.3 0-14.4-2.5-20.1-7l-92.5-73.4c-9.6-7.6-15.1-19.1-15.1-31.3V304.5L9.4 100C3.3 92.6 0 83.3 0 73.7zM55 80L218.6 280.8c3.5 4.3 5.4 9.6 5.4 15.2v68.4l64 50.8V296c0-5.5 1.9-10.9 5.4-15.2L457 80H55z"},null,-1)]),2))],2),c.createElementVNode("div",py,[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":C[3]||(C[3]=_=>c.unref(t).searchParam=_),type:"text",class:"nui-focus px-4! border-muted-300 text-muted-600 placeholder:text-muted-300 dark:border-muted-700 dark:bg-muted-900/75 dark:text-muted-200 dark:placeholder:text-muted-500 dark:focus:border-muted-700 peer w-full border bg-white font-sans transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-75 h-10 py-2 text-sm leading-5 pe-4 ps-9 rounded-full",placeholder:b.$fcTr("search"),onKeyup:C[4]||(C[4]=(..._)=>c.unref(g)&&c.unref(g)(..._))},null,40,gy),[[c.vModelText,c.unref(t).searchParam]]),c.createElementVNode("div",my,[d.value?(c.openBlock(),c.createElementBlock("svg",vy,C[13]||(C[13]=[c.createElementVNode("path",{d:"M457 372c11.5 6.6 26.3 2.7 31.8-9.3C503.7 330.2 512 294.1 512 256C512 122.7 410.1 13.2 280 1.1C266.8-.1 256 10.7 256 24v0c0 13.3 10.8 23.9 24 25.4C383.5 61.2 464 149.2 464 256c0 29.3-6.1 57.3-17 82.6c-5.3 12.2-1.5 26.8 10 33.5v0z"},null,-1)]))):(c.openBlock(),c.createElementBlock("svg",by,C[12]||(C[12]=[c.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[c.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),c.createElementVNode("path",{d:"m21 21l-4.35-4.35"})],-1)])))])])])):c.createCommentVNode("",!0)]))}},[["__scopeId","data-v-121187ed"]]),yy={};function Cy(l,e){return c.openBlock(),c.createElementBlock("div")}const Ey=Mt(yy,[["render",Cy]]),ek="",xy={class:"fixed z-50 inset-0 overflow-hidden pointer-events-none"},Ry={class:"absolute bg-white shadow-2xl border border-gray-200 pointer-events-auto transition-all duration-300 rounded-xl",style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"400px","max-width":"90vw"}},_y={class:"flex items-center justify-between px-4 py-3 border-gray-200 border-b rounded-t-xl bg-gradient-to-r from-red-50 to-orange-50"},Ty={class:"flex flex-col overflow-hidden"},ky={class:"px-4 py-4 overflow-y-auto"},Sy={class:"mb-5 flex flex-row flex-wrap"},My={class:"flex-shrink-0 bg-gray-50 px-4 py-3 border-t border-gray-200 rounded-b-xl"},Ly={class:"flex justify-end gap-2"},Dy=["disabled"],Ay={key:0},Fy={key:1},zy=Mt({__name:"MDeleteDialog",setup(l){const e=c.inject("store"),t=c.ref(!1);let i="";return se.listen("deleteBtn",n=>{t.value=!0,i=n.id}),se.listen("handleDeleteDialog",n=>{t.value=n}),(n,s)=>(c.openBlock(),c.createBlock(c.Transition,{name:"fade",appear:""},{default:c.withCtx(()=>[t.value?(c.openBlock(),c.createElementBlock("div",{key:0,onKeydown:s[4]||(s[4]=c.withKeys(a=>t.value=!1,["escape"])),class:"relative z-50",role:"dialog"},[c.createElementVNode("div",{class:"fixed inset-0 bg-black bg-opacity-30 transition-opacity backdrop-blur-sm",onClick:s[0]||(s[0]=a=>t.value=!1)}),c.createElementVNode("div",xy,[c.createElementVNode("div",Ry,[c.createElementVNode("div",_y,[s[6]||(s[6]=c.createElementVNode("h3",{class:"text-lg font-semibold text-gray-900 flex items-center gap-2"},[c.createElementVNode("div",{class:"w-2 h-2 rounded-full bg-red-500 animate-pulse"}),c.createTextVNode(" حذف ")],-1)),c.createElementVNode("button",{onClick:s[1]||(s[1]=a=>t.value=!1),class:"p-1.5 rounded-full hover:bg-red-100 transition-colors group",title:"Close"},s[5]||(s[5]=[c.createElementVNode("svg",{class:"w-4 h-4 text-gray-600 group-hover:text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[c.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),c.createElementVNode("div",Ty,[c.createElementVNode("div",ky,[c.createElementVNode("div",Sy,c.toDisplayString(n.$fcTr("alert_to_delete")),1)]),c.createElementVNode("div",My,[c.createElementVNode("div",Ly,[c.createElementVNode("button",{onClick:s[2]||(s[2]=a=>t.value=!1),class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-1 transition-colors"},c.toDisplayString(n.$fcTr("no")),1),c.createElementVNode("button",{disabled:c.unref(e).loadings.mainLoading,class:"px-4 py-2 text-sm font-medium text-white bg-red-600 border border-transparent rounded-lg hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-1 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:s[3]||(s[3]=a=>c.unref(e).remove(c.unref(i)))},[c.unref(e).loadings.mainLoading?(c.openBlock(),c.createElementBlock("span",Fy,"loading")):(c.openBlock(),c.createElementBlock("span",Ay,c.toDisplayString(n.$fcTr("yes")),1))],8,Dy)])])])])])],32)):c.createCommentVNode("",!0)]),_:1}))}},[["__scopeId","data-v-144e4312"]]),Py=({listen:l,store:e})=>{se.listen("reloadData",()=>{e.reloadData()})},Oy={__name:"MCrud",props:{options:{default:()=>({})},structure:{default:()=>({})},hiddenActions:{default:()=>[]},fields:{default:()=>[]},tableOptions:{default:()=>({})},tableComponent:{default:null},dir:{default:()=>Ti().dir},route:{default:"route"}},emits:["mounted"],setup(l,{emit:e}){const t=l,i=e,n=kg({fields:t.fields,hiddenActions:t.hiddenActions,options:t.options,structure:t.structure,route:t.route,query:c.inject("formue.query")||!1});return c.provide("store",n),c.provide("tableOptions",{dir:t.dir,...t.tableOptions}),c.provide("tableComponent",t.tableComponent),document.body.setAttribute("dir",t.dir),c.onMounted(()=>{i("mounted")}),Py({store:n}),c.onUnmounted(()=>{n.$dispose(),n.reset()}),(s,a)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.createVNode(wy),c.createVNode(Uw),c.createVNode(Yw),c.createVNode(Jv),c.createVNode(Ey),c.createVNode(zy),c.createVNode(Kw),c.renderSlot(s.$slots,"extra")],64))}};Te.ActionButton=gh,Te.MCrud=Oy,Te.emitter=se,Te.fields=Nl,Te.install=Sg,Te.registerFields=Wl,Te.setEmitter=Na,Object.defineProperty(Te,Symbol.toStringTag,{value:"Module"})});
|