apex.model={},function(e,t,n,i,r,s,a){"use strict";let l={},d=[],o=100,h=10;const c=i.hasOwnProperty,u=a.extend,g=Array.isArray,f=a.isPlainObject,_=e=>"function"==typeof e,p=a.Deferred,v=s.toNumber;function y(e){return"object"==typeof e&&c(e,"v")}function I(e){if("string"==typeof e)return[e,null];if(g(e)&&2===e.length&&"string"==typeof e[0]&&(null===e[1]||"string"==typeof e[1]))return e;throw new Error("Invalid model id")}function m(e){var t,n;if(g(e)){for(n=[],t=0;t<e.length;t++)n.push(m(e[t]));return n}return f(e)?u(!0,{},e):e}function R(e,t,n){var i,r=e._listeners;for(i=0;i<r.length;i++)r[i].onChange(t,n)}function w(e,t,n,i,r){e?t.call(e,n,i,r):t(n,i,r)}function x(e){return"string"==typeof e?e:g(e)?1===e.length?""+e[0]:JSON.stringify(e):e.toString()}function A(e,t){var n,r=[],s=[];function l(e){var t,n,i=e._listeners;for(t=0;t<i.length;t++)(n=i[t].progressView)&&n[0]&&n[0].offsetWidth&&n[0].offsetHeight&&(r.push(n),s.push(i[t].progressOptions||null))}if(l(e),t)for(n=0;n<t.length;n++)l(t[n]);return 0===r.length?null:e._options.makeLoadingIndicator?e._options.makeLoadingIndicator(r,s):function(){var e,t,n=a();for(e=0;e<r.length;e++)t=i.showSpinner(r[e],s[e]),n=n.add(t);return function(){n.remove()}}}function F(e,t,n,i){var r,s;return s=e,i&&(s+=" Server status: "+i),r=new Error(s),t.status>=0&&(r.status=t.status),r}function K(e,t){var n,i;for(n in delete e.error,delete e.warning,delete e.message,e.fields)c(e.fields,n)&&(i=e.fields[n],t||(delete i.changed,delete i.stale),delete i.error,delete i.warning,delete i.message)}function M(e,t,n,i,r){return-1===t&&(t=0),-1===n&&(n=t+e*i),t+(n-t)/(i+1)*r}const b=e=>new Error(`Model has invalid shape for the ${e} method`),D=e=>new Error(`Wrong data type for ${e} aggregate`),S=()=>new Error("Model must have identityField defined"),T=(e,t)=>new Error(`Field '${e}' depends on unknown field/item '${t}'`),C=(e,t)=>new Error(e+" field not found: "+t);function E(e,t){var n,i=e,r=t;if(null!==e&&y(e)&&(i=e.v,null!==t&&y(t)&&(r=t.v)),g(i)&&g(r)){if(i.length!==r.length)return!1;for(n=0;n<i.length;n++)if(i[n]!=r[n])return!1;return!0}return i==r}function k(e,t,n){var i,r,s,a;for(i in t)c(t,i)&&((r=t[i]).volatile||r.virtual||"string"==typeof(a=e[s=n?r.index:i])&&(e[s]=a.replace(/\r\n/g,"\n")))}function O(e,t,n,i,s){var a,l,d,o,h,c,u,g,f,_,p,y,I=e._options,m=t.record,w=e._getIdentity(m),x=[];for(function t(n,i,r){var s,a,l,d;for(s=0;s<n.length;s++)a=n[s],(l=I.fields[a])&&!i[a]&&(l.dependsOn&&t(l.dependsOn,i,r),i[a]||!l.calcValue&&!l.dependsOn||(r.push(a),i[a]=1,(d=e._dependentFields[a])&&t(d,i,r)))}(n,s||{},x),a=0;a<x.length;a++)if(d=x[a],(o=I.fields[d]).calcValue){for(_=[],l=0;l<o.dependsOn.length;l++)":"===(u=o.dependsOn[l]).substr(0,1)?p=r(u.substr(1)).getValue():(g=I.fields[u],p=e.getValue(m,u),"NUMBER"===o.dataType&&(p=v(p,g?g.formatMask:null))),_.push(p);if(y=o.calcValue(_,e,m),h=e.getFieldKey(d),t.fields&&t.fields[d]&&t.fields[d].ck)throw new Error("Set calculated value not allowed for field");E(c=m[h],y)||(m[h]=y,t.fields||(t.fields={}),(f=t.fields[d])||(f={},t.fields[d]=f),f.changed=!0,i&&R(e,"set",{oldValue:c,oldIdentity:null,recordId:w,record:m,field:d}),e._checkAggregates(d))}else(f=t.fields[d])||(f={},t.fields[d]=f),f.stale=!0,i&&e.metadataChanged(w,d)}function q(e,t){var n,i,r={},s=t.record,a=[];for(n=0;n<e._calculatedFields.length;n++)i=e._calculatedFields[n],null==s[e.getFieldKey(i)]?a.push(i):r[i]=1;a.length>0&&O(e,t,a,!1,r)}const P={SUM:{name:"SUM",init:function(e){if(e.dataType&&"NUMBER"!==e.dataType)throw D("SUM");e.total=0,e.grandTotal=0},add:function(e,t){t=v(t,e.formatMask),isNaN(t)||(e.total+=t,e.grandTotal+=t)},get:function(e,t){var n=t?e.total:e.grandTotal;return t&&(e.total=0),n}},AVG:{name:"AVG",init:function(e){if(e.dataType&&"NUMBER"!==e.dataType)throw D("AVG");e.total=0,e.grandTotal=0,e.count=0,e.totalCount=0},add:function(e,t){t=v(t,e.formatMask),isNaN(t)||(e.total+=t,e.grandTotal+=t,e.count+=1,e.totalCount+=1)},get:function(e,t){var n=t?e.total/e.count:e.grandTotal/e.totalCount;return t&&(e.total=0,e.count=0),n}},MAX:{name:"MAX",init:function(e){e.max=null,e.overallMax=null},add:function(e,t){"NUMBER"===e.dataType?t=v(t,e.formatMask):t.d&&(t=t.d),null===t||""===t.toString().trim()||isNaN(t)||((null===e.max||t>e.max)&&(e.max=t),(null===e.overallMax||t>e.overallMax)&&(e.overallMax=t))},get:function(e,t){var n=t?e.max:e.overallMax;return t&&(e.max=null),n}},MIN:{name:"MIN",init:function(e){e.min=null,e.overallMin=null},add:function(e,t){"NUMBER"===e.dataType?t=v(t,e.formatMask):t.d&&(t=t.d),null===t||""===t.toString().trim()||isNaN(t)||((null===e.min||t<e.min)&&(e.min=t),(null===e.overallMin||t<e.overallMin)&&(e.overallMin=t))},get:function(e,t){var n=t?e.min:e.overallMin;return t&&(e.min=null),n}},MEDIAN:{name:"MEDIAN",init:function(e){e.values=[],e.allValues=[]},add:function(e,t){t=v(t,e.formatMask),isNaN(t)||(e.values.push(t),e.allValues.push(t))},get:function(e,t){var n,i=t?e.values:e.allValues,r=i.length;return i.sort((function(e,t){return e-t})),n=r%2==0?(i[r/2]+i[r/2-1])/2:i[(r-1)/2],t&&(e.values=[]),n}},COUNT:{name:"COUNT",init:function(e){e.count=0,e.totalCount=0},add:function(e,t){t.v&&(t=t.v),null!==t&&""!==t.toString().trim()&&(e.count+=1,e.totalCount+=1)},get:function(e,t){var n=t?e.count:e.totalCount;return t&&(e.count=0),n}},COUNT_DISTINCT:{name:"COUNT_DISTINCT",init:function(e){e.count=0,e.totalCount=0,e.distinctValues={}},add:function(e,t){t.v&&(t=t.v),null!==t&&""!==t.toString().trim()&&(e.distinctValues[t]||(e.count+=1,e.totalCount+=1),e.distinctValues[t]=1)},get:function(e,t){var n=t?e.count:e.totalCount;return t&&(e.count=0),n}}};var V={modelId:function(){return null===this.instance?this.name:[this.name,this.instance]},fetch:function(e,t,n){var i,r,s,a,l,d,o,h,c,g=this,f=this._options,_=p();if("number"!=typeof e&&(n=t,t=e,e=0),"table"===f.shape){if(h=e,c=f.pageSize,o=Math.floor(h/c)*c,e=function(e){var t,n=g._data;for(t=e;t<n.length&&void 0!==n[t];t++);return t}(o),this._haveAllData&&e>=this._data.length||this._masterRecordIsInserted||this._masterRecordIsDeleted)return!1;d=this._getServerOffset(e),(l=o+f.pageSize-d)<f.pageSize&&void 0===this._data[o+f.pageSize]&&(l+=f.pageSize),a={version:f.version,firstRow:d+1,maxRows:l}}else a={version:f.version};return this._requestsInProgress.fetch?null:(r={regions:[u({},f.regionData,{id:f.regionId,ajaxIdentifier:f.ajaxIdentifier,fetchData:u({},f.fetchData,a)})]},f.pageItemsToSubmit&&(r.pageItems=f.pageItemsToSubmit),this._addParentItems(r.regions[0]),s=u({},f.requestOptions),n?delete s.loadingIndicator:s.loadingIndicator=A(this),this._requestsInProgress.fetch=!0,this._callServer(r,s).done((function(t){var n,i=null,r=null,s=null,a=null,l=null;delete g._requestsInProgress.fetch,g._requestsInProgress.abortFetch?(delete g._requestsInProgress.abortFetch,_.reject(F("Error: Aborted when model cleared",{status:0}))):(n=t.regions[0].fetchedData,"table"===f.shape?(i=n.values,r=n.totalRows,s=n.firstRow-1,a=n.moreData,l=n.dataOverflow):"tree"===f.shape?i=n.root:"record"===f.shape&&(i=n.value),g._addData(e,s,i,r,a,l),_.resolve())})).fail((function(e,t,n){delete g._requestsInProgress.fetch,_.reject(F("Error retrieving data.",e,0,n))})),i=_.promise(),t&&i.always(t),i.always((function(e){g._drainWaiters(e)})),i)},fetchAll:function(e){var t=this,n=0,i=this._options,r=i.pageSize;if("table"!==i.shape)throw b("fetchAll");for(;this._data[n];)n+=1;!function i(){var s=t.fetch(n,(function(s){s?e({error:s}):(e({offset:n,total:t.getTotalRecords(),done:!1}),n+=r,i())}),!0);null===s?setTimeout((function(){i()}),500):!1===s&&e({offset:n,total:t.getTotalRecords(),done:!0})}()},fetchRecords:function(e,t){var n,i,r,s,a,l,d=this,o=this._options,h=[],c=p();if("record"===o.shape)throw b("fetchRecords");if(void 0===this._identityKeys)throw S();for(n=0;n<e.length;n++)i=this._getIdentity(e[n]),(r=this.getRecordMetadata(i))&&!r.inserted&&h.push({recordId:i,pk:this._getPrimaryKey(e[n])});return 0===h.length?null:(a={regions:[u({},o.regionData,{id:o.regionId,ajaxIdentifier:o.ajaxIdentifier,fetchData:u({},o.fetchData,{version:o.version,primaryKeys:h})})]},o.pageItemsToSubmit&&(a.pageItems=o.pageItemsToSubmit),this._addParentItems(a.regions[0]),l=u({},o.requestOptions,{loadingIndicator:A(this)}),this._callServer(a,l).done((function(e){var t;t=e.regions[0].fetchedData.values,d._updateData(t),c.resolve()})).fail((function(e,t,n){c.reject(F("Error retrieving data.",e,0,n))})),s=c.promise(),t&&s.always(t),s)},save:function(e){var t,n,i,r,s,a=this._options,l=p();return s=u({},a.requestOptions,{loadingIndicator:A(this)}),r={},(n=this.addChangesToSaveRequest(r))?(n(t=this._callServer(r,s)),t.done((function(e){e.errors?l.reject(e.errors):l.resolve(null,e)})).fail((function(e,t,n){l.reject(F("Error saving data.",e,0,n))})),i=l.promise(),e&&i.always(e),i):null},saveInProgress:function(){return!!this._requestsInProgress.save},addChangesToSaveRequest:function(e){var t,n,i,r,s,a,l,d,o,h,f=this,_=this._options,p=this._metaKey,v=[],I=[],R={},w=[],x=0;function A(){delete f._requestsInProgress.save,f._changes=f._pendingChanges.concat(f._changes)}function F(e){var t,n,i,r,s,a,l,d=e.record;for(a=e.inserted&&!e.originalId,n=_.recordIsArray?[]:{},t=0;t<I.length;t++)null!==(i=d[r=I[t]])&&y(i)&&(i=i.v),l=R[r],e.fields&&e.fields[l]&&e.fields[l].disabled&&(i=""),!a||!f.isIdentityField(l)||e.original&&i!==e.original[r]||(i=""),"string"==typeof i&&(i=i.replace(/\n/g,"\r\n")),_.recordIsArray?n.push(m(i)):n[r]=m(i);s=null,e.deleted?s="d":e.inserted?s="i":e.updated&&(s="u"),n[p]||(n[p]={}),s&&(n[p].op=s),n[p].recordId=f._getIdentity(d),e.originalId&&(n[p].originalId=e.originalId),_.saveSelection&&(n[p].sel=e.sel?"Y":"N"),w.push(n)}if(_.pageItemsToSubmit&&((r=e.pageItems)||(r=[],e.pageItems=r),g(r)))for(s=_.pageItemsToSubmit,g(s)||(s=s.replace(/#/g,"").split(/\s*,\s*/)),t=0;t<s.length;t++)r.indexOf(s[t])<0&&r.push(s[t]);if(this._requestsInProgress.save||0===this._changes.length&&!_.saveSelection)return null;for(t in _.fields)c(_.fields,t)&&((n=_.fields[t]).virtual||(x+=1),n.volatile||n.virtual||(i=_.recordIsArray?n.index:t,I.push(i),R[i]=t,_.recordIsArray&&n.index===this._metaKey&&(p=I.length-1)));for(_.recordIsArray&&I.sort((function(e,t){return e-t})),p||(p=_.recordIsArray?I.length:"_meta"),t=0;t<this._changes.length;t++)(a=this._changes[t]).autoInserted&&!a.updated&&v.push(a.record);for(v.length&&this.deleteRecords(v),t=0;t<this._changes.length;t++)F(a=this._changes[t]);if(this._pendingChanges=this._changes,this._changes=[],_.saveSelection)for(const e of this._selection.values())e.inserted||e.deleted||e.updated||F(e);for((l=e.regions)||(e.regions=l=[]),t=0;t<l.length&&(d=l[t]).id!==_.regionId;t++)d=null;return d||(d=u({},_.regionData,{id:_.regionId,ajaxIdentifier:_.ajaxIdentifier,saveData:{models:[]}}),l.push(d)),o=d.saveData.models,h=u({},_.saveData,{instance:this.instance,version:_.version,values:w}),this._addParentItems(h),o.push(h),this._requestsInProgress.save=!0,function(e){e.done((function(e){var t,n,i,r,s,a,l;if(f._requestsInProgress.abortSave)delete f._requestsInProgress.abortSave,A();else if(e.errors){for(t=0;t<e.errors.length;t++)(a=e.errors[t]).regionStaticId===_.regionStaticId&&a.recordId&&a.instance==f.instance&&f.setValidity("error",a.recordId,a.columnName||null,a.message);A()}else if(e.regions){for(s=null,t=0;t<e.regions.length;t++){if((i=e.regions[t]).id===_.regionId){for(r=i.fetchedData.models,n=0;n<r.length;n++)if(r[n].instance==f.instance){s=r[n].values,f._metaKey||(l=_.recordIsArray?x:"_meta"),f._updateData(s,l);break}break}i=null}f._clearChanges("_pendingChanges")}delete f._requestsInProgress.save})).fail((function(){A()}))}},setData:function(e,t=0,n=null,i=!1){null===n&&e&&!i&&(n=e.length),this._addData(t,t,e,n,i,!1),0===t&&R(this,"refresh",{})},clearData:function(){this._clear(),R(this,"refresh",{})},getTotalRecords:function(e){let t=this._options;return"table"===t.shape?this._haveAllData||"none"===t.paginationType?this._data.length:this._totalRecords<0&&!0!==e?this._totalRecords:Math.max(this._data.length,this._totalRecords):"record"===t.shape?1:"tree"===t.shape?this._index.size:void 0},getServerTotalRecords:function(){var e=this._options;return"table"===e.shape?this._totalRecords<0?this._totalRecords:this._totalRecords+this._numInsertedRecords-this._numDeletedRecords:"record"===e.shape?1:"tree"===e.shape?-1:void 0},getDataOverflow:function(){return!!this.dataOverflow},forEach:function(e,t){var n,i,r,s=this,a=this._options,l=this._data;if("record"===a.shape)throw b("forEach");if("tree"===a.shape)n=0,l&&this.walkTree(l,{node:function(i){w(t,e,i,n,s._getIdentity(i)),n+=1}});else for(r=l.length,n=0;n<r;n++)(i=l[n])&&w(t,e,i,n,this._getIdentity(i,n))},transform:function(e,t){var n,i,r,s,a,l=/^\[\W*([^ \t/]+)\W*]$/,d=e.template,o=e.showNullAs,h=d.length,u=[],f={},p=this;function v(e,t){var n;return(n=e[t])||(n={values:{},paths:[]},e[t]=n),n}function y(e,t,n,i,r,s){var a,d,o,h,u,f,_,p;if(e){for(u=e.split("/"),f=i,_=null,p=null,o=null,a=0;a<u.length;a++){if(o=u[a],d=l.exec(o)){v(s,d[1]).paths[t]=u.slice(a+1).join("/");break}_=f,p=o,c(f,o)||(f[o]={}),f=f[o]}_?(g(_[p])?(h=_[p]).length=0:h=[],_[p]=h):h=i,r[t]=h}else{if(!g(i))throw new Error("Context must be an array when there is no path");r[t]=i}n&&v(s,n)}function I(e,n,i,r){var s,a,l,d,h=!1;return"string"==typeof e?(s=e.length,l=e.charAt(0),d=e.charAt(s-1),"'"===l&&"'"===d?e.substring(1,s-1):("("===l&&")"===d&&(e=e.substring(1,s-1),h=!0),null!==(a=p.getValue(n,e))&&"object"==typeof a&&c(a,"d")&&(a=h?a.v:a.d),h||!o||null!==a&&""!==a||(a=o),a)):_(e)?e.call(t,p,n,i,r):null===e?e:g(e)?function(e,t,n,i,r){var s,a;for(s=0;s<e.length;s++)void 0!==(a=I(e[s],n,i,r))&&(t[s]=a);return t}(e,[],n,i,r):"object"==typeof e?function(e,t,n,i,r){var s,a;for(s in e)c(e,s)&&void 0!==(a=I(e[s],n,i,r))&&(t[s]=a);return t}(e,{},n,i,r):void 0}function m(e,t,n,i){var r,s,a,d=[];if(e)for(e=e.split("/"),r=0;r<e.length;r++)s=e[r],(a=l.exec(s))&&d.push({key:a[1],value:I(a[1],t,n,i)});return d}function R(n,i,r){var l,o,c,g,_,R,w,x,A,F,K;if(!(i<s||a>0&&i>=s+a)&&(e.includeAggregates||!p._metaKey||!n[p._metaKey].agg)&&(!e.filter||e.filter.call(t,p,n,i,r)))for(l=0;l<h;l++)if(R=null,c=d[l],g=u[l],!c.filter||c.filter.call(t,p,n,i,r)){if(c.uniqueIndexField&&(R=f[c.uniqueIndexField],w=I(c.uniqueIndexField,n,i,r),void 0!==R.values[w]))continue;if(void 0!==(_=I(c.item,n,i,r))){if(R)R.values[w]={index:g.length,arrays:[],indexes:{}};else for(x=m(c.path,n,i,r),K=f,o=0;o<x.length;o++)void 0===(A=(R=v(K,x[o].key)).values[x[o].value])&&(A={index:g.length,arrays:[],indexes:{}},F=""===R.paths[l]?[]:{},g.push(F),R.values[x[o].value]=A),F=g[A.index],A.arrays[l]||y(R.paths[l],l,null,F,A.arrays,A.indexes),g=A.arrays[l],K=A.indexes;g.push(_)}}}for(null!==t&&"object"==typeof t||(t={}),function(){var e,n;for(e=0;e<d.length;e++)y((n=d[e]).path,e,n.uniqueIndexField,t,u,f)}(),s=0,e.offset>=0&&(s=e.offset),a=e.fetchData?this._options.pageSize:null,e.count>0&&(a=e.count),e.fetchData?this.forEachInPage(s,a,R):this.forEach(R),n=0;n<h;n++)i=d[n],r=u[n],i.sort&&r.array.sort(i.sort);return t},forEachInPage:function(e,t,i,r){var s,a,l,d,o=e,h=this,c=this._options,u=this._data;function g(s){var a=t-(s-e);n.trace("Model: "+h.modelId()+". forEachInPage fetching more data starting at: ",s),h._waitingPages.push({offset:s,callback:i,thisArg:r,next:function(){h.forEachInPage(s,a,i,r)}}),h._requestsInProgress.fetch||h.fetch(s,(function(e){e||setTimeout((function(){h._waitingPages.length>0&&h._waitingPages.shift().next()}),1)}))||(h._waitingPages.pop(),w(r,i,null,-1,null))}if("table"!==c.shape)throw b("forEachInPage");if(t>c.pageSize&&(c.pageSize=10*Math.floor((t+9)/10)),"one"===c.paginationType&&(o=e-this._offset),o<0||o>=u.length)this._haveAllData?(w(r,i,null,-1,null),this._drainWaiters()):g(e);else{for(a=o+t,d=e,s=o;s<a;s++){if(void 0===(l=u[s]))return void(this._haveAllData&&s>=u.length?(w(r,i,null,-1,null),this._drainWaiters()):g(s+this._offset));l&&(w(r,i,l,d,this._getIdentity(l,s)),d+=1)}this._drainWaiters()}},indexOf:function(e){let t,n=this._options.shape;if("record"===n)throw b("indexOf");if(e){if(t=this.getRecordMetadata(this._getIdentity(e)),"tree"===n)return t&&t.parent?t.parent[this._childrenKey].indexOf(e):-1;if(t)return t.index}return this._data.indexOf(e)},recordAt:function(e){if("table"!==this._options.shape)throw b("recordAt");return this._data[e]||null},getRecordId:function(e){return this._getIdentity(e)},getAggregateRecord:function(e,t){var n,i,r,s,a=null;if(t>=0){if(r=this._breakEndIds[t],(n=this.indexOf(this.getRecord(r)))>=0)for(s=!1;n<this._data.length;n++)if((i=(a=this._data[n])[this._metaKey])&&i.agg){if(s=!0,i.agg===e)break}else if(s){a=null;break}}else for(n=this._data.length-1;n>=0;n--){if(!((i=(a=this._data[n])[this._metaKey])&&i.agg&&i.grandTotal)){a=null;break}if(i.agg===e)break}return a},isIdentityField:function(e){return void 0!==this._identityKeys&&this._identityKeys.includes(this.getFieldKey(e))},getRecordMetadata:function(e){return this._index.get(x(e))||null},metadataChanged:function(e,t){let n=this._index.get(x(e));n&&R(this,"metaChange",{record:n.record,recordId:e,field:t||null})},getTypeMetadata:function(e){return this._options.types[e]||null},getFieldMetadata:function(e){return this._options.fields[e]||null},getFieldKey:function(e){var t=this._options;if(c(t.fields,e)&&!t.fields[e].virtual)return t.recordIsArray?t.fields[e].index:e},isChanged:function(){var e,t,n;if(0===this._changes.length)return!1;for(n=0,e=0;e<this._changes.length;e++)(t=this._changes[e]).autoInserted&&!t.updated||(n+=1);return n>0},getChanges:function(){return this._changes},clearChanges:function(){this._clearChanges("_changes")},hasErrors:function(){return this._errors.length>0},getErrors:function(){return this._errors},setSelectionState:function(e,t,n="set"){let i,r,s;const a=(e,t)=>{let n=!1;for(let a=e;a<t;a++)s=this._data[a],s?(i=this._getIdentity(s,a),r=this._index.get(i),r&&!r.agg&&(r.sel=!0,this._selection.set(i,r))):n=!0;return n};if("all"===n)a(0,this._data.length),this._selectAll=!0;else if(i=x(e),r=this._index.get(i),r){if(t=!!t,this._selectAll&&["set","range"].includes(n)&&this.clearSelection(),"range"===n){let e,t,n,i=r.index;r=this._index.get(this._selectAnchor),r&&(t=r.index,i>t&&(e=i,i=t,t=e),n=a(i,t+1),n&&(this._selectRange=[i,t]))}else r.sel!==t&&(r.sel=t,t?(this._selection.set(i,r),this._selectAllExcept.delete(i)):(this._selection.delete(i),this._selectAll&&this._selectAllExcept.add(i))),this._selectAnchor=i,"toggle"!==n&&(this._selectRange=null);if(!this._selectAll){let e=this._totalRecords>=0?this.getServerTotalRecords():this.getTotalRecords(!0)-this._numAggregateRecords;this.getSelectedCount()===e&&(this._selectAll=!0)}}},clearSelection:function(){for(const e of this._selection.values())e.sel=!1;this._selection.clear(),this._selectAll=!1,this._selectRange=null,this._selectAllExcept.clear()},getSelectedCount:function(){let e=this._selection.size;if(this._selectAll)e=this._totalRecords>=0?this.getServerTotalRecords():this.getTotalRecords(!0)-this._numAggregateRecords,e-=this._selectAllExcept.size;else if(this._selectRange){let t=0,n=this._selectRange[0],i=this._selectRange[1]+1;for(let e=n;e<i;e++)this._data[e]||(t+=1);e+=t}return e},getSelectedRecords:function(){return[...this._selection.values()].sort((e,t)=>e.index-t.index).map(e=>e.record)},getSelectionState:function(){return{selectAll:this._selectAll,records:this.getSelectedRecords(),except:[...this._selectAllExcept],count:this.getSelectedCount(),rangeAnchor:this._selectAnchor}},allowEdit:function(e){return this.check("canEdit",e)},allowDelete:function(e){var t=this._options;return"record"!==t.shape&&("tree"!==t.shape||e!==this._data)&&this.check("canDelete",e)},allowAdd:function(e,t,n){var i,r,s,a,l=this._options;if("record"===l.shape)return!1;if(!("tree"!==l.shape||e&&e[this._childrenKey]))return!1;if((s=this.check("canAdd",e,t,n))&&n&&"tree"===l.shape&&!0!==(r=void 0!==(a=this._getType(e)).validChildren?a.validChildren:void 0===l.types.default.validChildren||l.types.default.validChildren))for(i=0;i<n.length;i++)if(!r.includes(n[i][this._typeKey])){s=!1;break}return s},allowDrag:function(e){return"record"!==this._options.shape&&this.check("canDrag",e)},dragOperations:function(e){var t,n,i,r=this._options;if(e){if(e.length>0&&this._typeKey){for(i=e[0][this._typeKey]||"default",t=1;t<e.length;t++)if((e[t][this._typeKey]||"default")!==i){i="default";break}}else i="default";n=r.types[i].operations&&void 0!==r.types[i].operations.drag?r.types[i].operations.drag:r.types.default.operations.drag}else n=r.types.default.operations.externalDrag;return n},check:function(e,t,n,i){var r,s=!1,a=this._options,l=this._getType(t);if(!a.editable||this._masterRecordIsDeleted)return!1;if(t&&(r=this.getRecordMetadata(this._getIdentity(t)))){if(r.deleted||r.agg)return!1;if(r.inserted&&("canEdit"===e||"canDelete"===e))return!0}return r&&void 0!==r[e]?s=r[e]:l.operations&&void 0!==l.operations[e]?s=l.operations[e]:void 0!==a.types.default.operations[e]&&(s=a.types.default.operations[e]),_(s)&&(s=s.call(this,t,n,i)),_(a.check)&&(s=a.check(s,e,t,n,i)),s},getValue:function(e,t){return void 0===t&&(t=e,e=this._data),e[this.getFieldKey(t)]},setValue:function(e,t,n,i){var r,s,a,l,d,o,h,u,f,_,p,v,y,I=this._options,w=!1;if(void 0===n&&(n=t,t=e,e=this._data),a=this.getFieldKey(t),!this.allowEdit(e))throw new Error("Set value not allowed for record");if(h=this._getIdentity(e),!(l=this.getRecordMetadata(h)))return null;if(y=I.fields[t],void 0===a||y.readonly&&!y.parentField||l.fields&&l.fields[t]&&l.fields[t].ck)throw new Error("Set value not allowed for field");if(!E(s=e[a],n)){if(!i&&(t===I.sequenceField||t===I.parentIdentityField))if(u=f=_=null,t===I.sequenceField){if("tree"===I.shape?(f=this.parent())&&(u=f[this._childrenKey]):u=this._data,u)for(r=0;r<u.length&&!(parseFloat(u[r][this._sequenceKey])>parseFloat(n));r++)_=u[r]}else t===I.parentIdentityField&&(f=this.getRecord(n));if(l.original||(l.original=function(e){let t,n;if(g(e))for(n=[],t=0;t<e.length;t++)n[t]=m(e[t]);else for(t in n={},e)c(e,t)&&(n[t]=m(e[t]));return n}(e),w=!0),e[a]=n,(o=this._getIdentity(e))!==h){if(this._index.has(o))return e[a]=s,w&&delete l.original,"DUP";l.originalId||(l.originalId=h),this._index.delete(h),this._index.set(o,l),l.sel&&(this._selection.delete(h),this._selection.set(o,l))}return l.updated||l.deleted||l.inserted||this._addChange(l),l.updated=!0,l.fields||(l.fields={}),(d=l.fields[t])||(d={},l.fields[t]=d),d.changed=!0,(l.error||l.warning)&&this.setValidity("valid",o),R(this,"set",{oldValue:s,oldIdentity:o!==h?h:null,recordId:o,record:e,field:t}),this._checkAggregates(t),(p=this._dependentFields[t])&&(y.calcValue&&((v={})[t]=1),O(this,l,p,!0,v)),(f||_)&&this.moveRecords([e],f,_),"SET"}return"NC"},getRecordValue:function(e,t){return this.getValue(this.getRecord(e),t)},setRecordValue:function(e,t,n){this.setValue(this.getRecord(e),t,n)},setValidity:function(e,t,n,i){var r,s,a,l,d,o,h,u=this._index.get(x(t));if(u&&(n?(u.fields||(u.fields={}),(a=u.fields[n])||(a={},u.fields[n]=a)):a=u,o="valid",h=a.message||i,a.warning&&(o="warning"),a.error&&(o="error"),e!==o||h!==i)){switch(e){case"error":s="error",delete a.warning;break;case"warning":s="warning",delete a.error;break;case"valid":delete a.error,delete a.warning,delete a.message;break;default:throw new Error("Invalid value for pValidity parameter: "+e)}if(s&&(a[s]=!0,a.message=i),!(l=u.error)&&u.fields)for(r in u.fields)if(c(u.fields,r)&&u.fields[r].error){l=!0;break}l?((d=this._errors.indexOf(u))>=0&&this._errors.splice(d,1),this._errors.push(u)):this._removeError(u),this.metadataChanged(t,n)}},deleteRecords:function(e){var t,i,r,s,a=[],l=[],d=this._options;if("record"===d.shape)throw b("deleteRecords");for(t=0;t<e.length;t++)s=e[t],r=this._getIdentity(s),(i=this.getRecordMetadata(r))?this.allowDelete(s)?("table"===d.shape&&(this._numDeletedRecords+=1),d.onlyMarkForDelete&&!i.inserted||("table"===d.shape&&i.inserted&&(this._numDeletedRecords-=1,this._numInsertedRecords-=1),this._removeRecord(r,i)),i.inserted?(delete i.inserted,delete i.autoInserted,delete i.updated,this._removeError(i),this._removeChange(i)):(K(i,!0),this._removeError(i),i.deleted=!0,this._addChange(i)),a.push(s),l.push(r)):n.warn("Delete not allowed for record: "+r):n.warn("Record to delete not found: "+r);return a.length>0&&(R(this,"delete",{records:a,recordIds:l}),this._checkAggregates()),a.length},canRevertRecord:function(e){var t;return!(!(t=this.getRecordMetadata(this._getIdentity(e)))||!t.original&&!t.deleted)},revertRecords:function(e){var t,i,r,s,a,l,d={},o=[],h=[],c=this._options;for(t=0;t<e.length;t++)r=e[t],s=this._getIdentity(r),(i=this.getRecordMetadata(s))?i.original||i.deleted?("table"===c.shape?a=this._data:"tree"===c.shape&&(a=this.parent(i.record)[this._childrenKey]),l=a.indexOf(i.record),i.deleted?("table"===c.shape&&(this._numDeletedRecords-=1),delete i.deleted):(i.originalId&&(this._index.set(i.originalId,i),this._index.delete(s),i.sel&&(this._selection.set(i.originalId,i),this._selection.delete(s)),d[s]=i.originalId,delete i.originalId),i.original&&(i.record=i.original,delete i.original),delete i.updated,K(i),this._removeError(i)),this._removeChange(i),r=i.record,a[l]!==r&&(a[l]=r),o.push(r),h.push(s)):n.warn("Nothing to revert for record "+s):n.warn("Record to revert not found: "+s);return o.length>0&&(R(this,"revert",{records:o,recordIds:h,newIds:d}),this._checkAggregates()),o.length},insertNewRecord:function(e,t,n){var i,r,s,a,l,d,o,h=this._options,c=null;if("record"===h.shape)throw b("insertNewRecord");if(a=this._initRecord(n,null,e),!this.allowAdd(e,"new",[a]))throw new Error("Insert not allowed for new record");return l="tree"===h.shape?e?e[this._childrenKey]:this._data[this._childrenKey]:this._data,r=0,t&&(c=this._getIdentity(t),(i=this.getRecordMetadata(c))&&(r=l.indexOf(i.record)+1)),this._sequenceKey&&(d=o=-1,r-1>=0&&(d=parseFloat(l[r-1][this._sequenceKey])),r<l.length&&(o=parseFloat(l[r][this._sequenceKey])),a[this._sequenceKey]=""+M(h.sequenceStep,d,o,1,1)),l.splice(r,0,a),"tree"!==h.shape&&this._reindex(r+1),s=this._getIdentity(a),i={record:a,inserted:!0,index:r},this._index.set(s,i),this._addChange(i),"tree"===h.shape?i.parent=e:this._numInsertedRecords+=1,q(this,i),R(this,"insert",{record:a,recordId:s,insertAfterId:c}),s},moveRecords:function(e,t,i){let r,s,a,l,d,o,h,c,u,g,f,_=this._options,p=[],v=[],y=null;if("record"===_.shape)throw b("moveRecords");"tree"===_.shape?(t||(t=this._data),a=t[this._childrenKey]):a=this._data,s=0,i&&(y=this._getIdentity(i),r=this.getRecordMetadata(y),r&&(s=a.indexOf(r.record)+1),(!r||s<0)&&(n.warn("AfterRecord not found, move to beginning."),s=0)),this._sequenceKey&&(c=u=-1,s-1>=0&&(c=parseFloat(a[s-1][this._sequenceKey])),s<a.length&&(u=parseFloat(a[s][this._sequenceKey]))),f=0,g=this._data.length;for(let i=0;i<e.length;i++)if(o=e[i],h=this._getIdentity(o),r=this.getRecordMetadata(h),r){if("tree"===_.shape){if(l=this.parent(o),!l){n.warn("Move not allowed for root");continue}l=l[this._childrenKey]}else l=a;d=l.indexOf(o),"tree"!==_.shape&&(d>f&&(f=d),d<g&&(g=d)),l.splice(d,1),a===l&&d<s&&(s-=1),v.push(o),p.push(h),a.splice(s,0,o),"tree"!==_.shape&&(s>f&&(f=s),s<g&&(g=s)),s+=1,this._sequenceKey&&this.setValue(o,_.sequenceField,""+M(_.sequenceStep,c,u,e.length,i+1),!0),"tree"===_.shape&&(r.parent=t,this._parentIdKey&&this.setValue(o,_.parentIdentityField,this._getIdentity(t),!0))}else n.warn("Record to move not found: "+h);return"tree"!==_.shape&&this._reindex(g,f+1),R(this,"move",{records:v,recordIds:p,insertAfterId:y}),p},copyRecords:function(e,t,i){let r,s,a,l,d,o,h,c,u,g,f=this,_=this._options,p=[],v=[],y=null;if("record"===_.shape)throw b("copyRecords");"tree"===_.shape?(c={node:function(e,t){var n,i;t&&(n=f._getIdentity(e),i={record:e,inserted:!0,parent:t},f._index.set(n,i),f._addChange(i))}},t||(t=this._data),o=t[this._childrenKey]):o=this._data,s=0,i&&(y=this._getIdentity(i),r=this.getRecordMetadata(y),r&&(s=o.indexOf(r.record)+1),(!r||s<0)&&(n.warn("AfterRecord not found, copy to beginning."),s=0)),this._sequenceKey&&(u=g=-1,s-1>=0&&(u=parseFloat(o[s-1][this._sequenceKey])),s<o.length&&(g=parseFloat(o[s][this._sequenceKey])));for(let i=0;i<e.length;i++)a=e[i],d=this._getIdentity(a),r=this.getRecordMetadata(d),r?(l=this._initRecord(null,e[i],t),o.splice(s,0,l),this._sequenceKey&&(l[this._sequenceKey]=""+M(_.sequenceStep,u,g,e.length,i+1)),h=this._getIdentity(l),v.push(l),p.push(h),r={record:l,inserted:!0,index:s},this._index.set(h,r),this._addChange(r),"tree"===_.shape?(r.parent=t,this.walkTree(l,c,null)):this._numInsertedRecords+=1,s+=1):n.warn("Record to copy not found: "+d);return this._reindex(s),R(this,"copy",{records:v,recordIds:p,insertAfterId:y}),this._checkAggregates(),p},root:function(){if("tree"!==this._options.shape)throw b("root");return this._data},child:function(e,t){var n=e[this._childrenKey];if(n)return n[t]},parent:function(e){var t,n;if(this._identityKeys&&(t=this._getIdentity(e),(n=this.getRecordMetadata(t))&&c(n,"parent")))return n.parent?n.parent:null},childCount:function(e){var t=e[this._childrenKey];return null===t?null:t?t.length:0},hasChildren:function(e){var t=e[this._childrenKey];return null===t?null:!!t&&t.length>0},fetchChildNodes:function(e,t){var n,i,r,s=this,a=this._options,l=p();return i={regions:[u({},a.regionData,{id:a.regionId,ajaxIdentifier:a.ajaxIdentifier,fetchData:u({},a.fetchData,{version:a.version,parentId:this._getPrimaryKey(e)})})]},a.pageItemsToSubmit&&(i.pageItems=a.pageItemsToSubmit),this._addParentItems(i.regions[0]),r=u({},a.requestOptions,{loadingIndicator:A(this)}),this._callServer(i,r).done((function(t){var n=t[s._childrenKey];s._addData(e,null,n),l.resolve(n.length)})).fail((function(e,t,n){l.reject(F("Error retrieving data.",e,0,n))})),n=l.promise(),t&&n.always(t),n},clearChildNodes:function(e){e[this._childrenKey]=null},walkTree:function(e,t,n){var i,r,s,a;if(void 0===n&&(n=null,(r=this._getIdentity(e))&&(s=this.getRecordMetadata(r))&&(n=s)),!t.node(e,n)&&(a=e[this._childrenKey])&&a.length>0){for(t.beginChildren&&t.beginChildren(e),i=0;i<a.length;i++)this.walkTree(a[i],t,e);t.endChildren&&t.endChildren(e)}},subscribe:function(e){var t=e.viewId;return t||(t="v::"+o,o+=1,e.viewId=t),this._listeners.push(e),t},unSubscribe:function(e){var t;for(t=0;t<this._listeners.length;t++)this._listeners[t].viewId===e&&this._listeners.splice(t,1)},getOption:function(e){var t=this._options[e];if(void 0===t)throw new Error("No such option: "+e);return t},setOption:function(e,t){if({genIdPrefix:1,pageItemsToSubmit:1,fetchData:1,saveData:1,regionData:1,requestOptions:1,parentRecordId:1,editable:1,pageSize:1}[e]){if("editable"===e&&!this._options.identityField)throw S();this._options[e]=t}else n.warn("Option cannot be set: "+e)},_callServer:function(e,n){return(this._options.callServer||t.plugin)(e,n)},_drainWaiters:function(e){var t,n;for(t=0;t<this._waitingPages.length;t++)if(n=this._waitingPages[t],(this._haveAllData||this._data[n.offset]||e)&&(this._waitingPages.splice(t,1),t-=1,e&&0!==e.status?w(n.thisArg,n.callback,null,-1,null):n.next(),this._requestsInProgress.fetch))return},_getServerOffset:function(e){var t,n,i,r=e-1;for(i=this._data[r];i;){if(t=this._getIdentity(i,r),(n=this.getRecordMetadata(t))&&n.serverOffset>=0)return n.serverOffset+1;r-=1,i=this._data[r]}return e},_clear:function(){var e=this._options;this._requestsInProgress.fetch&&(this._requestsInProgress.abortFetch=!0),this._requestsInProgress.save&&(this._requestsInProgress.abortSave=!0),"table"===e.shape?(this._data=[],e.hasTotalRecords?this._totalRecords=0:this._totalRecords=-1,this._haveAllData=!1,this._offset=0,this._numInsertedRecords=0,this._numDeletedRecords=0,this._numAggregateRecords=0,this._masterRecordIsInserted&&(this._haveAllData=!0),this.dataOverflow=!1):this._data=null,this._changes=[],this._errors=[],this._index.clear(),this._breakEndIds=[],this._selection.clear(),this._selectAll=!1,this._selectRange=null,this._selectAnchor=null,this._selectAllExcept.clear()},_saveDataState:function(){this._saveState={_data:this._data,_totalRecords:this._totalRecords,_haveAllData:this._haveAllData,_offset:this._offset,_numInsertedRecords:this._numInsertedRecords,_numDeletedRecords:this._numDeletedRecords,_numAggregateRecords:this._numAggregateRecords,dataOverflow:this.dataOverflow,_changes:this._changes,_errors:this._errors,_index:this._index,_breakEndIds:this._breakEndIds,_selection:this._selection,_selectAll:this._selectAll,_selectRange:this._selectRange,_selectAllExcept:this._selectAllExcept},this._index=new Map,this._selection=new Map,this._selectAllExcept=new Set},_restoreDataState:function(){var e=this._saveState;this._data=e._data,this._totalRecords=e._totalRecords,this._haveAllData=e._haveAllData,this._offset=e._offset,this._numInsertedRecords=e._numInsertedRecords,this._numDeletedRecords=e._numDeletedRecords,this._numAggregateRecords=e._numAggregateRecords,this.dataOverflow=e.dataOverflow,this._changes=e._changes,this._errors=e._errors,this._index=e._index,this._breakEndIds=e._breakEndIds,this._selection=e._selection,this._selectAll=e._selectAll,this._selectRange=e._selectRange,this._selectAllExcept=e._selectAllExcept},_clearChanges:function(e){var t,n,i,r=[],s=[],a=this._options,l=this[e];for(t=0;t<l.length;t++)n=l[t],i=this._getIdentity(n.record),n.deleted&&a.onlyMarkForDelete&&this._removeRecord(i,n),n.deleted?r.push(i):(n.inserted||n.updated)&&s.push(i),delete n.deleted,delete n.recordId,delete n.inserted,delete n.autoInserted,delete n.updated,delete n.original;this[e]=[],R(this,"clearChanges",{deletedIds:r,changedIds:s})},_reindex:function(e,t){let n,i=this._data.length;for(null!=t&&t<i&&(i=t),n=e;n<i;n++){let e=this._getIdentity(this._data[n]);this.getRecordMetadata(e).index=n}},_addData:function(e,t,i,r,s,a){var l,d,o,h,c,g,f,_,p,v,y,I,m,w,x=this._options,A=this,F=this._calculatedFields.length>0;function K(e,t,n,i){var r={record:i};A._metaKey&&(u(r,i[A._metaKey]),r.sel="Y"===r.sel,r.agg&&(!e||A._identityKeys&&!i[A._identityKeys[0]])&&(A._assignTempIdentity(i),e=A._getIdentity(i)),r.allowedOperations&&(r.canEdit=!!r.allowedOperations.update,r.canDelete=!!r.allowedOperations.delete)),null!=t&&(r.serverOffset=t),null!=n&&(r.index=n),r.agg&&(A._numAggregateRecords+=1),A._index.set(e,r),(r.sel||A._selectAll||A._selectRange&&n>A._selectRange[0]&&n<=A._selectRange[1])&&(r.sel=!0,A._selection.set(e,r)),k(i,x.fields,x.recordIsArray),F&&!r.agg&&q(A,r)}function M(e,t,n){var i,r,s,a,l,d,o;for(s=0,i=0;i<A._aggregateRecs.length;i++)t[r=A._aggregateRecs[i]]||(l=A._initRecord(!1),o=A._getIdentity(l),d={agg:r},n&&(d.grandTotal=n),l[A._metaKey]=d,a=e+s,A._data[a]?A._data.splice(a,0,l):A._data[a]=l,K(o,null,a,l),s+=1);return s}function b(){if(A._data.length>0&&A._haveAllData&&A._aggregateRecs.length>0){if(m){if(g&&g.grandTotal){for(l=A._data.length-1;l>=0&&(o=A._data[l],(g=A._metaKey&&o[A._metaKey])&&g.agg&&g.grandTotal);l--);l+=1}l+=M(l,w),A._reindex(l)}(l=M(A._data.length,w,!0))>0&&A._checkAggregates()}}if("table"===x.shape?((0===e&&!this.isChanged()||"none"===x.paginationType)&&this._clear(),"one"===x.paginationType&&(this._offset=e),this._totalRecords=-1,null!=r?this._totalRecords=r:x.hasTotalRecords&&n.warn("Model missing total records"),this._haveAllData||s||(this._haveAllData=!0),a&&(this.dataOverflow=!0)):"record"===x.shape&&this._clear(),"tree"===x.shape&&e)(_=e)[this._childrenKey]=i,x.identityField&&A.walkTree(_,{node:function(e,t){var n;t&&(K(n=A._getIdentity(e),null,null,e),A.getRecordMetadata(n).parent=t)}},null),R(this,"addData",{parentNode:_,offset:0,count:i.length});else if(null===this._data||0===this._data.length||"table"!==x.shape||"one"===x.paginationType){if(n.trace("Model: "+this.modelId()+". add data set: ",e,r,s),this._data=i,this._numInsertedRecords=0,this._numDeletedRecords=0,this._numAggregateRecords=0,"record"!==x.shape)if(y={offset:0,count:i.length},p=t,"tree"===x.shape&&this.root()&&x.identityField)this.walkTree(this.root(),{node:function(e,t){h=A._getIdentity(e),A._metaKey&&o[A._metaKey].agg?v=null:(v=p,p+=1),K(h,v,null,e),A.getRecordMetadata(h).parent=t}},null),y.parentNode=null,y.count=1;else{for(m=!1,w={},l=0;l<this._data.length;l++)o=this._data[l],h=this._getIdentity(o,l),(g=this._metaKey&&o[this._metaKey])&&g.agg?(v=null,w[g.agg]=1):(v=p,p+=1,m&&(l+=M(l,w)),m=!1),g&&g.endControlBreak&&(this._breakEndIds.push(h),this._aggregateRecs.length>0&&(m=!0,w={})),K(h,v,l,o);b()}else x.identityField&&this._data?(y={offset:0,count:1},K(this._getIdentity(this._data),null,null,this._data)):y={offset:0,count:this._data?1:0};R(this,"addData",y)}else{for(n.trace("Model: "+this.modelId()+". add data merge: ",e,r,s),d=e,p=t,I=[],m=!1,w={},l=0;l<i.length;l++){if(o=i[l],h=this._getIdentity(o,d),(g=this._metaKey&&o[this._metaKey])&&g.agg?(v=null,w[g.agg]=1):(v=p,p+=1),f=this.getRecordMetadata(h)){if(f.updated||f.inserted||f.deleted)continue;c=this._data.indexOf(f.record),this._data[c]=o,k(o,x.fields,x.recordIsArray),f.record=o,f.serverOffset=v,g&&u(f,g),I.push(h),F&&!f.agg&&q(this,f)}else this._data[d]?this._data.splice(d,0,o):this._data[d]=o,K(h,v,d,o),d+=1;g&&(g.agg||(m&&(d+=M(d,w)),m=!1),g.endControlBreak&&(this._breakEndIds.push(h),this._aggregateRecs.length>0&&(m=!0,w={})))}b(),y={offset:e,count:d-e},I.length&&(y.replacedIds=I),R(this,"addData",y)}},_updateData:function(e,t){var n,i,r,s,a,l,d=this._options,o=!1,h=[],c=[],g=[],f=[],_={},p=t||this._metaKey;for(n=0;n<e.length;n++)s=(l=(i=e[n])[p])?l.recordId:null,l&&s&&l.notFound?(a=this.getRecordMetadata(s),this._removeRecord(s,a),g.push(a.record),f.push(s)):(s===(r=this._getIdentity(i))&&(s=null),(a=this.getRecordMetadata(s||r))&&(s&&(_[s]=r,this._index.set(r,a),this._index.delete(s),this._selection.delete(s)),h.push(i),c.push(s||r),this._data[this._data.indexOf(a.record)]=i,k(i,d.fields,d.recordIsArray),a.record=i,p&&l?(u(!0,a,l),a.highlight&&void 0===l.highlight&&delete a.highlight,a.allowedOperations&&(a.canEdit=!!a.allowedOperations.update,a.canDelete=!!a.allowedOperations.delete),delete a.recordId):t&&(d.recordIsArray?i.splice(t,1):delete i[t]),q(this,a),delete a.deleted,delete a.inserted,delete a.autoInserted,delete a.updated,delete a.original,K(a),this._removeError(a),this._removeChange(a)));h.length>0&&(R(this,"refreshRecords",{records:h,recordIds:c,newIds:_}),o=!0),g.length>0&&(R(this,"delete",{records:g,recordIds:f}),o=!0),o&&this._checkAggregates()},_initRecord:function(t,n,i){var r,s,a,l,d,o,h,u,g,f,_=!0,p=this._options;if(t)o=t;else for(r in!1===t&&(_=!1),o=p.recordIsArray?[]:{},p.fields)if(c(p.fields,r)&&(s=p.fields[r],a=p.recordIsArray?s.index:r,!s.virtual))if(!n||s.noCopy){if(s.parentField&&p.parentModel&&(h||(h=e.get(p.parentModel))&&!u&&p.parentRecordId&&(u=h.getRecord(p.parentRecordId)),u)){o[a]=h.getValue(u,s.parentField);continue}g="",_&&void 0!==(f=s.defaultValue)&&(g="function"==typeof f?f(this,n):f),o[a]=g}else o[a]=n[a];if(h&&e.release(p.parentModel),this._identityKeys&&this._assignTempIdentity(o),this._metaKey&&(o[this._metaKey]={}),"tree"===p.shape&&(this._parentIdKey&&(o[this._parentIdKey]=this._getIdentity(i)),d=[],o[this._childrenKey]=d,n&&(l=n[this._childrenKey])))for(r=0;r<l.length;r++)d.push(this._initRecord(null,l[r],o));return o},_assignTempIdentity:function(e){var t;for(t=0;t<this._identityKeys.length;t++)e[this._identityKeys[t]]=this._options.genIdPrefix+this._nextInsertId,this._nextInsertId+=1},_getIdentity:function(e,t){var n,i=null;if(void 0!==this._identityKeys)if(1===this._identityKeys.length)i=e[this._identityKeys[0]]+"";else for(i=[],n=0;n<this._identityKeys.length;n++)i.push(e[this._identityKeys[n]]+"");else null!=t&&(i=t+"");return null!==i?x(i):i},_getPrimaryKey:function(e){var t,n;if(void 0!==this._identityKeys)for(n=[],t=0;t<this._identityKeys.length;t++)n.push(e[this._identityKeys[t]]+"");return n},_getType:function(e){var t="default",n=this._options;return e&&void 0!==this._typeKey&&(null!==(t=e[this._typeKey])&&y(t)&&(t=t.v),t||(t="default")),n.types[t]||n.types.default},_getRecordById:function(e){var t=this._index.get(x(e));return t?t.record:null},_removeRecord:function(e,t){var n,i,r,s=this._options;"table"===s.shape?n=this._data:"tree"===s.shape&&(n=t.parent[this._childrenKey],delete t.parent),r=n.indexOf(t.record),n.splice(r,1),this._reindex(r),i=x(e),this._index.delete(i),t.sel&&this._selection.delete(i)},_addChange:function(e){var t=this._changes.indexOf(e);t>=0&&this._changes.splice(t,1),this._changes.push(e)},_removeChange:function(e){var t=this._changes.indexOf(e);t>=0&&!e.deleted&&!e.updated&&!e.inserted&&this._changes.splice(t,1)},_removeError:function(e){var t=this._errors.indexOf(e);t>=0&&this._errors.splice(t,1)},_addParentItems:function(t){var n,i,r,s,a,l,d={values:[]},o=this._options;if(o.parentModel&&o.parentRecordId){for(n in o.fields)c(o.fields,n)&&(i=o.fields[n]).parentField&&(r||(r=e.get(o.parentModel))&&!s&&(s=r.getRecord(o.parentRecordId),l=r.getRecordMetadata(o.parentRecordId)),s&&(a={n:i.parentField,v:r.getValue(s,i.parentField)},d.values.push(a)));l&&(l.salt&&(d.salt=l.salt),l.protected&&(d.protected=l.protected)),r&&e.release(o.parentModel),t.parentRecordId=o.parentRecordId,d.values.length>0&&(t.parentItems=d)}},_updateAggregates:function(){var e,t,n,i,r,a,l=this._options.fields,d=[];if(!(this._staleAggFields.length<=0)){for(e=0;e<this._staleAggFields.length;e++)for(n=l[i=this._staleAggFields[e]],t=0;t<n.aggregates.length;t++)"string"==typeof(r=n.aggregates[t])&&(r=P[r]),(a={name:r.name,fieldName:i,key:this.getFieldKey(this._staleAggFields[e]),state:{dataType:n.dataType,formatMask:n.formatMask},agg:r}).agg.init(a.state),d.push(a);this.forEach((function(e,t,n){var i,r,l,o=this.getRecordMetadata(n);for(i=0;i<d.length;i++)if(a=d[i],o.agg){if(o.agg===a.name){let t=a.state.dataType,i=a.state.formatMask;l=e[a.key],r=a.agg.get(a.state,!o.grandTotal)+"",r="NUMBER"===t&&i?s.formatNumber(r,i):""+r,e[a.key]=r,R(this,"set",{oldValue:l,oldIdentity:null,recordId:n,record:e,field:a.fieldName})}}else o.deleted||(r=e[a.key],a.agg.add(a.state,r))}),this),this._staleAggFields=[]}},_checkAggregates:function(e){var t;if(e)this._aggregatedFields[e]&&this._staleAggFields.indexOf(e)<0&&(this._staleAggFields.push(e),this._debouncedUpdateAggregates());else for(t in this._aggregatedFields)c(this._aggregatedFields,t)&&this._checkAggregates(t)},_recalculate:function(e){this.forEach((function(t,n,i){var r=this.getRecordMetadata(i);r.agg||O(this,r,e,!0)}),this)}};const N={shape:"table",recordIsArray:!1,hasTotalRecords:!1,genIdPrefix:"t",regionId:null,ajaxIdentifier:null,pageItemsToSubmit:null,regionData:{},fetchData:{},saveData:{},version:1,parentModel:null,parentRecordId:null,editable:!1,onlyMarkForDelete:!0,identityField:null,typeField:null,childrenField:null,parentIdentityField:null,sequenceField:null,metaField:null,sequenceStep:10,saveSelection:!1,types:{default:{validChildren:!0,operations:{canAdd:!0,canEdit:!0,canDelete:!0,canDrag:!0,drag:{normal:"move",ctrl:"copy"},externalDrag:{normal:"add"}}}},check:null,sortCompare:null,paginationType:"none",pageSize:100,preFetch:!1},j=new Set(["table","tree","record"]),U=new Set(["none","one","progressive"]);function z(e){var t,n=I(e);return(t=l[n[0]])&&(t=n[1]?t.instances[n[1]]:t.model),t}function B(e,t,n,i){var r,s,a=i?I(i):null,d=[];function o(i){var r=!(!n&&!i._options.regionId);return r&&("change"===e?r=i.isChanged():"error"===e&&(r=i.hasErrors()),r&&t&&(r=function(e){for(var t,n=e,i=I(n.modelId());i;){if(i[0]===a[0]&&(i[1]===a[1]||null===a[1]))return!0;i=null,(t=n.getOption("parentModel"))&&(n=z(t))&&(i=I(t))}return!1}(i))),r}function h(e,t){d.push({id:e,model:t})}function u(e,t){var n;for(n in e.model&&o(e.model)&&h(t,e.model),e.instances)c(e.instances,n)&&o(e.instances[n])&&h([t,n],e.instances[n])}if(a||(t=!1),!t&&a&&a[0])s=a[0],(r=l[s])&&(a[1]?r.instances[a[1]]&&o(r.instances[a[1]])&&h([s,a[1]],r.instances[a[1]]):u(r,s));else for(s in l)c(l,s)&&u(r=l[s],s);return d}function $(e){var t;(t=d.indexOf(e))>=0&&d.splice(t,1)}e.create=function(t,s,o,f,_,p){var v,y,m,w,x,A,F,K,M,b,D,E,k=I(t),O=Object.create(V);function q(e,t){var i=y.fields[e];(i.calcValue||i.dependsOn||i.aggregates&&i.aggregates.length>0)&&(n.warn("Model "+t+" field does not support calculations"),delete i.calcValue,delete i.dependsOn)}if(O.name=k[0],O.instance=k[1],O._requestsInProgress={},O._listeners=[],O._waitingPages=[],m=s.fields,O._options=u(!0,{},N,s),O._options.fields=m,!(y=O._options).fields)throw new Error("The fields option is required");if(!j.has(y.shape))throw new Error("Invalid shape option: "+y.shape);if(!U.has(y.paginationType))throw new Error("Invalid paginationType option: "+y.paginationType);if(y.editable&&!y.identityField)throw S();if("tree"===y.shape&&!y.childrenField)throw new Error("A tree shaped model requires a childrenField");if("table"===y.shape&&"none"===y.paginationType&&void 0===s.hasTotalRecords&&(y.hasTotalRecords=!0),O._dependentFields={},O._calculatedFields=[],O._aggregatedFields={},O._aggregateRecs=[],function(e,t,n,s,l){var d,o,h,u,g,f,_,p,v,y,I=[],m={},R=function(e){var t=e.target.id;O._recalculate(O._dependentFields[":"+t])};for(h in e)if(c(e,h)){if((u=e[h]).calcValue&&n.push(h),g=u.dependsOn)for(d=0;d<g.length;d++){if(":"===(_=g[d]).substr(0,1)){if(p=_.substr(1),!r(p).node)throw T(h,p);I.push(p)}else if(!e[_])throw T(h,_);v=h,t[y=_]||(t[y]=[]),t[y].push(v)}if(u.aggregates){for(d=0;d<u.aggregates.length;d++){if("string"==typeof(o=u.aggregates[d])&&!P[o]||"object"==typeof o&&!(o.name&&o.init&&o.add&&o.get))throw new Error(`Field '${h}' has invalid aggregate`);m[f=o.name||o]||l.push(f),m[f]=1}s[h]=1}}I.length>0&&(O._externalItems$=a(I.map((function(e){return"#"+i.escapeCSS(e)})).join(",")),O._externalItems$.on("change",R),O._externalItemsHandler=R)}(y.fields,O._dependentFields,O._calculatedFields,O._aggregatedFields,O._aggregateRecs),O._staleAggFields=[],O._debouncedUpdateAggregates=i.debounce((function(){O._updateAggregates()}),250),O._nextInsertId=1e3,y.identityField)if(g(y.identityField))for(O._identityKeys=[],v=0;v<y.identityField.length;v++)O._identityKeys.push(O.getFieldKey(y.identityField[v])),q(y.identityField[v],"identity");else O._identityKeys=[O.getFieldKey(y.identityField)],q(y.identityField,"identity");if(y.typeField){if(O._typeKey=O.getFieldKey(y.typeField),void 0===O._typeKey)throw C("Type",y.typeField);q(y.typeField,"type")}if(y.childrenField){if(O._childrenKey=O.getFieldKey(y.childrenField),void 0===O._childrenKey)throw C("Children",y.childrenField);q(y.childrenField,"children")}if(y.parentIdentityField){if(O._parentIdKey=O.getFieldKey(y.parentIdentityField),void 0===O._parentIdKey)throw C("Parent identity",y.parentIdentityField);q(y.parentIdentityField,"parentIdentity")}if(y.sequenceField){if(O._sequenceKey=O.getFieldKey(y.sequenceField),void 0===O._sequenceKey)throw C("Sequence",y.sequenceField);q(y.sequenceField,"sequence")}if(y.metaField){if(O._metaKey=O.getFieldKey(y.metaField),void 0===O._metaKey)throw C("Meta",y.metaField);q(y.metaField,"meta")}if("record"!==y.shape?y.identityField?O.getRecord=O._getRecordById:O.getRecord=O.recordAt:O.getRecord=function(){return O._data},O._index=new Map,O._selection=new Map,O._selectAllExcept=new Set,O._clear(),o?(M="none"!==y.paginationType&&(null!=_?_:null==f||o.length<f),O._addData(0,0,o,f,M,p)):null!=f&&(O._totalRecords=f),y.parentModel&&y.parentRecordId&&!o&&(E=e.get(y.parentModel))){for(v in(D=E.getRecordMetadata(y.parentRecordId)).inserted&&(O._masterRecordIsInserted=!0,O._clear()),D.deleted&&(O._saveDataState(),O._masterRecordIsDeleted=!0,O._clear(),O._addData(0,0,[],0,!1,!1)),A=O._parentFieldsMap={},y.fields)c(y.fields,v)&&(x=y.fields[v]).parentField&&(A[x.parentField]||(A[x.parentField]=[]),A[x.parentField].push(v));O.parentModelViewId=E.subscribe({onChange:function(t,n){var i,r;if("delete"===t||"revert"===t||"refreshRecords"===t||"clearChanges"===t){for(r=n.recordIds||n.deletedIds,i=0;i<r.length;i++)if(r[i]===y.parentRecordId){"delete"===t?(O._saveDataState(),O._masterRecordIsDeleted=!0,O._clear(),O._addData(0,0,[],0,!1,!1),R(O,"refresh",{})):"revert"!==t&&"refreshRecords"!==t||!O._masterRecordIsDeleted?"refreshRecords"===t&&n.newIds&&n.newIds[O.instance]||"clearChanges"===t&&O._masterRecordIsDeleted&&delete O._saveState:(delete O._masterRecordIsDeleted,O._restoreDataState(),R(O,"refresh",{}));break}"clearChanges"===t&&O._masterRecordIsInserted&&delete O._masterRecordIsInserted}else"set"===t&&(n.oldIdentity||n.recordId)===y.parentRecordId?((F=n.field)in A&&(w=A[F],K=E.getValue(n.record,F),O.forEach((function(e){var t,i;if(!O._metaKey||!e[O._metaKey].agg)for(t=0;t<w.length;t++)i=w[t],n.oldValue===O.getValue(e,i)&&O.setValue(e,i,K)}))),n.oldIdentity&&(y.parentRecordId=n.recordId,e.renameInstance(O.modelId(),n.recordId))):"refresh"===t&&O._masterRecordIsDeleted&&(delete O._masterRecordIsDeleted,O._restoreDataState(),R(O,"refresh",{}))}}),e.release(y.parentModel)}return d.length>=h&&(b=function(){var e,t;for(e=0;e<d.length;e++)if(!(t=d[e]).isChanged())return t;return null}())&&(n.info("Model: cache overflow; remove model from cache: "+b.modelId()),e.destroy(I(b.modelId()))),(b=l[k[0]])||(b={instances:{},instancesRef:{}},l[k[0]]=b),k[1]?(b.instancesRef[k[1]]=1,b.instances[k[1]]=O):(b.modelRef=1,b.model=O),n.info("Model: created model: "+t+" refCount: 1"),O},e.list=function(e,t,n){return B(null,n,e,t).map((function(e){return e.id}))},e.getStats=function(){var e,t,n,i,r,s=[];for(e in l)if(c(l,e))for(r in(i=(t=l[e]).model)&&(n={name:i.name,instance:null,refCount:t.modelRef,cachePos:d.indexOf(i),subscribers:i._listeners.length,progressViews:i._listeners.map((function(e){return e.progressView||null}))},s.push(n)),t.instances)c(t.instances,r)&&(n={name:(i=t.instances[r]).name,instance:i.instance,refCount:t.instancesRef[r],cachePos:d.indexOf(i),subscribers:i._listeners.length,progressViews:i._listeners.map((function(e){return e.progressView||null}))},s.push(n));return s},e.anyChanges=function(e,t,n){return B("change",n,e,t).length>0},e.anyErrors=function(e,t,n){return B("error",n,e,t).length>0},e.addChangesToSaveRequest=function(e,t,n){var i,r,s=[],a=B("change",n,!1,t);if(a.length<=0)return null;for(i=0;i<a.length;i++)(r=a[i].model.addChangesToSaveRequest(e))&&s.push(r);return function(e){var t;for(t=0;t<s.length;t++)s[t](e)}},e.save=function(e,n,i,r,s){var a,l,d,o,h;if(e=e||{},n=n||{},o=B("change",r,!1,i),l=apex.model.addChangesToSaveRequest(e,i,r)){if(i&&void 0===n.loadingIndicator&&void 0===n.loadingIndicatorPosition){for(h=[],a=1;a<o.length;a++)h.push(o[a].model);n.loadingIndicator=A(o[0].model,h)}return l(d=(s||t.plugin)(e,n)),d}return null},e.get=function(e){var t,i,r,s=I(e);return(t=l[s[0]])&&(s[1]?(i=t.instances[s[1]])&&(r=t.instancesRef[s[1]]+=1):(i=t.model)&&(r=t.modelRef+=1),i&&($(i),n.info("Model: get model: "+e+" refCount: "+r))),i},e.renameInstance=function(e,t){var i,r,s=I(e);(i=l[s[0]])&&s[1]&&((r=i.instances[s[1]]).instance=t,delete i.instances[s[1]],i.instances[t]=r,n.info("Model: rename model "+s[0]+" instance: "+s[1]+" to "+t),R(r,"instanceRename",{oldInstance:s[1],newInstance:t}))},e.release=function(t){var i,r,s=I(t);(i=l[s[0]])&&(s[1]?(r=i.instancesRef[s[1]]-=1,i=i.instances[s[1]]):(r=i.modelRef-=1,i=i.model),n.info("Model: release model: "+t+" refCount: "+r),r<=0&&(i._options.parentModel&&z(i._options.parentModel)?(n.info("Model: save in cache model: "+t),function(e){var t;(t=d.indexOf(e))>=0&&d.splice(t,1),d.push(e)}(i)):i.isChanged()||e.destroy(t)))},e.destroy=function(t){var i,r,s=I(t);function a(i){var r,s;i&&($(i),i.parentModelViewId&&(s=i._options.parentModel,(r=e.get(s))&&(r.unSubscribe(i.parentModelViewId),e.release(s))),i._externalItems$&&i._externalItems$.off("change",i._externalItemsHandler),i._data=null,i._index=null,i._selection=null,n.info("Model: destroy model: "+t))}if(i=l[s[0]]){if(s[1])a(i.instances[s[1]]),delete i.instancesRef[s[1]],delete i.instances[s[1]];else if(a(i.model),delete i.model,delete i.modelRef,"string"==typeof t&&!s[1])for(r in i.instances)c(i.instances,r)&&(a(i.instances[r]),delete i.instancesRef[r],delete i.instances[r]);0!==Object.keys(i.instances).length||i.model||delete l[s[0]]}},e.getMaxCachedModels=function(){return h},e.setMaxCachedModels=function(e){h=parseInt(e,10)||10}}(apex.model,apex.server,apex.debug,apex.util,apex.item,apex.locale,apex.jQuery);
!function(t,a,e,o){"use strict";var i="a-Toolbar",n=t.ui.keyCode,r=1;t.widget("apex.toolbar",{version:"5.1",widgetEventPrefix:"toolbar",options:{label:"",toolbarFor:null,idPrefix:null,actionsContext:null,small:!1,simple:!1,toolbarClass:"",cursorKeyNavigation:!1,data:[]},_create:function(){var e,n=this.element,r=this,s=this.options;e=a.debounce((function(a,e){"update"!==e&&"updateChoices"!==e||(r.enterActions[a.name]&&n.find('[data-enter-action="'+a.name+'"]').prop("disabled",!!a.disabled),n.is(":visible")&&n.find(".a-Toolbar-group").each((function(){var a,e=t(this);a=e.children().filter((function(){return!this.style||"none"!==this.style.display})).length>0,e.toggle(a)})))}),10),this.menus={},this.enterActions={},n.addClass(i).attr("role","toolbar").attr("aria-label",s.label?s.label:o.formatMessage("APEX.TB.TOOLBAR")),s.toolbarFor&&n.attr("aria-controls",s.toolbarFor),s.small&&n.addClass("a-Toolbar--small"),s.simple&&n.addClass("a-Toolbar--simple"),s.toolbarClass&&n.addClass(s.toolbarClass),apex.actions&&(this.actionsContext=s.actionsContext||apex.actions,this.actionsContext.observe(e),this.actionObserver=e),this.refresh(),s.cursorKeyNavigation&&(this.toolbarHasChanged(),this._on(this._keyNavHandlers))},_keyNavHandlers:{keydown:function(a){var e=this,o=a.which,i=t(a.target);function r(t){var o,i;t.attr("tabindex","-1"),o=(i=parseFloat(e.focusableElements.index(t[0])+1))>=e.focusableElements.length?e.focusableElements.first():e.focusableElements.filter(":eq("+i+")"),t.is(":input[type=radio]")&&t.attr("name")===o.attr("name")?r(o):o.attr("tabindex","0").focus(),a.preventDefault()}function s(t){var o,i;t.attr("tabindex","-1"),o=(i=parseFloat(e.focusableElements.index(t[0])-1))<0?e.focusableElements.last():e.focusableElements.filter(":eq("+i+")"),t.is(":input[type=radio]")&&t.attr("name")===o.attr("name")?s(o):o.attr("tabindex","0").focus(),a.preventDefault()}i.is(":input[type=text],:input[type=radio],select")?a.shiftKey&&o===n.TAB?s(i):o===n.TAB&&r(i):o===n.LEFT?s(i):o===n.RIGHT&&r(i)}},_destroy:function(){var a,e=this.element,o=this.options;for(a in e.removeClass(i+" a-Toolbar--small a-Toolbar--simple "+o.toolbarClass).removeAttr("role").empty(),this.actionsContext&&this.actionsContext.unobserve(this.actionObserver),this.menus)this.menus.hasOwnProperty(a)&&t("#"+a).remove()},_setOption:function(t,a){var e=this.element;"small"===t&&e.toggleClass("a-Toolbar--small",a),"simple"===t&&e.toggleClass("a-Toolbar--simple",a),"toolbarClass"===t&&e.removeClass(this.options.toolbarClass).addClass(a),this._super(t,a),"data"===t&&this.refresh()},_getControlProperty:function(t,a){var e,o;return void 0===(o=t[a])&&t.action&&(e=this.actionsContext.lookup(t.action))&&e[a]&&(o=e[a]),o},_getLocalizedControlProperty:function(t,a){var e,i=null;return t[a+"Key"]?i=o.getMessage(t[a+"Key"]):void 0!==t[a]&&(i=t[a]),!i&&t.action&&(e=this.actionsContext.lookup(t.action))&&void 0!==e[a]&&(i=e[a]),i},_getNoUpdate:function(t){return t.label||t.labelKey||t.icon||t.title||t.titleKey?"true":null},_getId:function(t){var a=this.options.idPrefix||this.element[0].id||"tb";return t.id?a+"_"+t.id:null},_forceId:function(t){t.id||(t.id="m"+r,r+=1)},_buildText:function(a,e){var o=t.extend({id:"",label:"",size:"30",maxChars:"4000",placeholder:"",action:""},e);o.enterAction&&(this.enterActions[o.enterAction]=!0),a.markup("<input").optionalAttr("id",this._getId(o)).attr("class","a-Toolbar-input a-Toolbar-inputText a-Toolbar-item").attr("title",this._getLocalizedControlProperty(o,"label")).attr("type","text").attr("size",o.size).attr("maxlength",o.maxChars).attr("value","").optionalAttr("placeholder",this._getLocalizedControlProperty(o,"placeholder")).optionalAttr("data-enter-action",o.enterAction).markup(" />")},_buildStatic:function(t,a){t.markup("<span").optionalAttr("id",this._getId(a)).attr("class","a-Toolbar-static a-Toolbar-item").markup(">"),a.content?t.markup(a.content):t.content(this._getLocalizedControlProperty(a,"label")),t.markup("</span>")},_buildSelect:function(t,a){var e,o=this.actionsContext.lookup(a.action);(e=this._getLocalizedControlProperty(a,"title"))||(e=this._getLocalizedControlProperty(a,"label")),t.markup("<select").optionalAttr("id",this._getId(a)).attr("class","a-Toolbar-selectList js-actionSelect a-Toolbar-item").attr("size","1").optionalAttr("title",e).optionalAttr("aria-label",e).optionalBoolAttr("disabled",o&&!!o.disabled).attr("data-action",a.action).markup("></select>")},_buildButton:function(t,a){var e,o,i,n,r,s="a-Button a-Toolbar-item",l=a.menu||a.menuId;function u(){t.markup("<span").attr("class","a-Icon "+i).markup("></span>")}l?(a.menu?(this._forceId(a),e=this._getId(a)+"_menu"):e=a.menuId,s+=" js-menuButton"):s+=" js-actionButton",(i=this._getControlProperty(a,"icon"))&&(s+=" a-Button--withIcon"),a.iconOnly&&(s+=" a-Button--noLabel"),a.hot&&(s+=" a-Button--hot"),(r=this.actionsContext.lookup(a.action))&&r.get&&!r.onLabel&&r.get(a.action)&&(s+=" is-active"),t.markup("<button type='button'").attr("class",s).optionalAttr("id",this._getId(a)).optionalBoolAttr("disabled",r&&!!r.disabled),o=this._getLocalizedControlProperty(a,"label"),n=this._getLocalizedControlProperty(a,"title"),!o&&r&&r.get&&(o=r.get()?r.onLabel:r.offLabel),a.iconOnly?(n||(n=o),t.attr("title",n).attr("aria-label",o)):n&&t.attr("title",n),l?t.attr("data-menu",e).attr("aria-haspopup",!0).attr("aria-expanded",!1):t.attr("data-action",a.action).optionalAttr("data-no-update",this._getNoUpdate(a)),t.markup(">"),i&&a.iconBeforeLabel&&u(),a.iconOnly||t.markup("<span class='a-Button-label'>").content(o).markup("</span>"),i&&!a.iconBeforeLabel&&u(),l&&t.markup("<span").attr("class","a-Icon icon-menu-drop-down").markup("></span>"),t.markup("</button>"),a.menu&&(this.menus[e]=a.menu)},_buildRadioButtonGroup:function(t,a){t.markup("<div role='group'").attr("aria-label",this._getLocalizedControlProperty(a,"label")).attr("class","a-Toolbar-radioGroup js-actionRadioGroup a-Toolbar-item").attr("data-action",a.action).attr("data-item","a-Button").attr("data-item-wrap","a-Toolbar-button-item").markup("></div>")},_buildToggle:function(t,a){var e,o,i=this.actionsContext.lookup(a.action);this._forceId(a),o="a-Toolbar-input a-Toolbar-inputCheckbox",(e=i&&i.get(a.action))&&(o+=" is-active"),t.markup("<div").attr("class","a-Toolbar-toggleButton js-actionCheckbox a-Toolbar-item").attr("data-action",a.action).optionalAttr("data-no-update",this._getNoUpdate(a)).markup(">"),t.markup("<input type='checkbox'").attr("class",o).attr("name",a.action).attr("id",this._getId(a)).optionalBoolAttr("checked",e).optionalBoolAttr("disabled",i&&!!i.disabled).markup(" />"),t.markup("<label").attr("for",this._getId(a)).attr("class","a-Button").markup(">").content(this._getLocalizedControlProperty(a,"label")).markup("</label>"),t.markup("</div>")},_buildToolbar:function(t,a){var e,o=[],i=[],n=[];for(e=0;e<a.length;e++)a[e].align&&"start"!==a[e].align?"center"===a[e].align?i.push(a[e]):"end"===a[e].align&&n.push(a[e]):o.push(a[e]);o.length&&this._buildGroupContainer(t,"start",o),i.length&&this._buildGroupContainer(t,"center",i),n.length&&this._buildGroupContainer(t,"end",n)},_buildGroupContainer:function(t,a,o){var i,n,r,s,l,u="a-Toolbar-groupContainer";switch(a){case"start":u+=" a-Toolbar-groupContainer--start";break;case"center":u+=" a-Toolbar-groupContainer--center";break;case"end":u+=" a-Toolbar-groupContainer--end"}for(t.markup("<div").attr("class",u).markup(">"),i=0;i<o.length;i++){for(l="a-Toolbar-group",(r=o[i]).customCSS&&(l+=" "+r.customCSS),r.groupTogether&&(l+=" a-Toolbar-group--together"),t.markup("<div").attr("class",l).markup(">"),n=0;n<r.controls.length;n++)switch((s=r.controls[n]).type){case"STATIC":this._buildStatic(t,s);break;case"TEXT":this._buildText(t,s);break;case"SELECT":this._buildSelect(t,s);break;case"MENU":case"BUTTON":this._buildButton(t,s);break;case"RADIO_GROUP":this._buildRadioButtonGroup(t,s);break;case"TOGGLE":this._buildToggle(t,s);break;default:e.error("Unknown toolbar control type: "+s.type)}t.markup("</div>")}t.markup("</div>")},refresh:function(){var e,o,i,n,r,s,l,u=this,c=this.element,d=this.options,p=d.data,h=a.htmlBuilder();for(r in this.menus)this.menus.hasOwnProperty(r)&&t("#"+r).remove();for(this._buildToolbar(h,d.data),c.html(h.toString()),e=0;e<p.length;e++)if(i=p[e].controls)for(o=0;o<i.length;o++)n=i[o],(l=this.actionsContext.lookup(n.action))&&(l.hide&&this.actionsContext.update(n.action),l.choices&&this.actionsContext.updateChoices(n.action));for(r in c.find(".a-Toolbar-input").on("keydown",(function(a){var e=t(a.target).attr("data-enter-action");e&&13===a.which&&(u.actionsContext.invoke(e),a.preventDefault())})),this.menus)this.menus.hasOwnProperty(r)&&(t("<div/>",{id:r,class:"a-Toolbar-menu",style:"display:none;"}).appendTo("body"),(s=this.menus[r]).actionsContext=this.actionsContext,s.idPrefix=this.options.idPrefix||this.element[0].id||"tb",t("#"+r).menu(s))},toolbarHasChanged:function(){var t,a;this.focusableElements=this.element.find(":focusable"),a=(t=this.focusableElements.filter("[tabindex=0]")).length?this.focusableElements.index(t[0]):0,this.focusableElements.filter(":eq("+a+")").attr("tabindex","0").end().not(":eq("+a+")").attr("tabindex","-1")},hideControl:function(t){var a=this.find(t);a&&(a.action?this.actionsContext.hide(a.action):(this.findElement(t).hide(),this.actionObserver&&this.actionObserver({},"update")))},showControl:function(t){var a=this.find(t);a&&(a.action?this.actionsContext.show(a.action):(this.findElement(t).show(),this.actionObserver&&this.actionObserver({},"update")))},disableControl:function(t){var a=this.find(t);a&&(a.action?this.actionsContext.disable(a.action):this.findElement(t).prop("disabled",!0))},enableControl:function(t){var a=this.find(t);a&&(a.action?this.actionsContext.enable(a.action):this.findElement(t).prop("disabled",!1))},findGroup:function(t){var a,e,o=this.options.data;for(a=0;a<o.length;a++)if((e=o[a]).id===t)return e;return null},find:function(a){var e,o,i,n,r,s=this.options.data;for(e=0;e<s.length;e++)if(i=s[e].controls)for(o=0;o<i.length;o++)if((n=i[o]).id===a)return n;for(r in this.menus)if(this.menus.hasOwnProperty(r)&&(n=t("#"+r).menu("find",a)))return n;return null},findElement:function(a){var e=this._getId({id:a});return t("#"+e)}})}(apex.jQuery,apex.util,apex.debug,apex.lang);
!function(t,e,i,s,n){"use strict";var o="is-selected",a="aria-multiselectable",r=n.ui.keyCode,l=0;function c(t){return t.parent().children().index(t)}function h(t){var e=t.find("a");return e.length?e[0]:t[0]}function d(t){return n(t).closest(".a-IconList-item")}var u=function(t,e){t._trigger("selectionChange",e)},f=s.debounce(u,1),m=s.debounce(u,350),g={begin:function(){this.text="<ul>\r\n"},item:function(t,e,i){this.text+="<li>"+s.escapeHTML(i)+"</li>\r\n"},end:function(){this.text+="</ul>\r\n"},toString:function(){return this.text}};n.widget("apex.iconList",n.extend(!0,{version:"19.1",widgetEventPrefix:"iconlist",options:{multiple:!1,itemSelector:!1,addItemSelector:!0,label:!0,navigation:!1,tabbableContent:null,noNavKeyContent:null,allowCopy:!0,dataTransferFormats:[{format:"text/plain",writer:Object.create({begin:function(){this.text=""},item:function(t,e,i){e>0&&(this.text+="\r\n"),this.text+=i},end:function(){},toString:function(){return this.text}})},{format:"text/html",writer:Object.create(g)}],selectionChange:null,activate:null},_create:function(){var t,i=this,s=this.options,c=this.element;this.columns=0,this.rows=0,this.searchString="",this.searchTimerId=null,s.navigation&&(s.multiple=!1),c.addClass("a-IconList").attr("role","listbox"),s.multiple&&c.attr(a,"true"),this.forwardKey=r.RIGHT,this.backwardKey=r.LEFT,"rtl"===c.css("direction")&&(c.addClass("u-RTL"),this.forwardKey=r.LEFT,this.backwardKey=r.RIGHT),c.attr("aria-labelledby")?(t=n("#"+c.attr("aria-labelledby").split(" ").join(",#")).last(),this.infoId=t.attr("id")+"_info",t.append("<span id='"+this.infoId+"' class='u-VisuallyHidden'></span>")):(l+=1,this.infoId=(c.attr("id")||"il"+l)+"_info",c.before("<span id='"+this.infoId+"' class='u-VisuallyHidden'></span>"),c.attr("aria-labelledby",this.infoId),this.addedLabel=!0),this._initContextMenu("a-IconList-item",(function(){return!1}),(function(t){var e=d("keydown"===t.type&&i.lastFocused?i.lastFocused:t.target);return!!e.length&&(!!e.hasClass(o)||e)})),this._on(this._eventHandlers),s.allowCopy&&e.addHandler(c[0],(function(t){return i._copy(t),!0})),this.refresh(),s.disabled&&this._setOption("disabled",s.disabled)},_eventHandlers:{resize:function(t){t.target===this.element[0]&&(this._dim(),t.stopPropagation())},click:function(t){var e,i=this.options,s=i.navigation,o=n(t.target);s&&o.closest("a").length>0&&(t.shiftKey||t.ctrlKey)||(e=o.closest(".a-IconList-item")).length&&(i.itemSelector&&o.closest(".u-selector").length&&(t.ctrlKey=!0,t.shiftKey=!1),this._select(e,t,!0,!1),s&&this._activate(t),!s&&i.tabbableContent&&o.closest(i.tabbableContent).length?i.tabbableContent&&o.closest(i.tabbableContent).length&&o.focus():t.preventDefault())},dblclick:function(t){this.options.navigation||d(t.target).length&&this._activate(t)},mousedown:function(t){t.preventDefault()},keydown:function(t){var e,i,s,o=this.element,a=this.options,l=n(t.target),h=null,u=t.which;!a.navigation&&a.noNavKeyContent&&l.closest(a.noNavKeyContent).length||(u===r.HOME?h=o.children().first():u===r.END?h=o.children().last():u===r.DOWN?this.lastFocused&&(e=this._index2RowCol(c(d(this.lastFocused))),i=o.children(),e.row<Math.floor((i.length-1)/this.columns)&&((s=this._rowCol2Index(e.row+1,e.column))>=i.length&&(s=i.length-1),h=i.eq(s))):u===r.UP?this.lastFocused&&(e=this._index2RowCol(c(d(this.lastFocused))),i=o.children(),(s=this._rowCol2Index(e.row-1,e.column))>=0&&(h=i.eq(s)),h&&t.stopPropagation()):u===this.backwardKey?this.lastFocused&&(h=d(this.lastFocused).prev()):u===this.forwardKey?this.lastFocused&&(h=d(this.lastFocused).next()):u===r.SPACE?this.lastFocused&&!this.searchTimerId&&(h=d(this.lastFocused)):u===r.ENTER&&"A"!==t.target.nodeName&&this._activate(t),h&&h[0]&&(this._select(h,t,!0,!0),t.preventDefault()))},keypress:function(t){var e,i,s=this.options,o=this;if(0!==t.which&&s.label&&!t.altKey&&!t.ctrlKey&&(s.navigation||!s.noNavKeyContent||!n(t.target).closest(s.noNavKeyContent).length)){if(e=String.fromCharCode(t.which).toLowerCase(),this.searchTimerId)e!==this.searchString&&(this.searchString+=e),clearTimeout(this.searchTimerId),this.searchTimerId=null;else{if(" "===e)return;this.searchString=e}this.searchTimerId=setTimeout((function(){o.searchTimerId=null}),500),(i=this._findItem(this.searchString))&&this._select(i,t,!0,!0)}},focusin:function(t){var e=d(t.target);0!==e.length&&(e.addClass("is-focused"),this._setFocusable(t.target))},focusout:function(t){d(t.target).removeClass("is-focused")}},_destroy:function(){var t=this.element,i=this.options;t.removeClass("a-IconList is-disabled u-RTL").removeAttr("role").removeAttr(a).children().removeClass("a-IconList-item").removeAttr("role").removeAttr("aria-selected").removeAttr("tabindex"),t.find("a").removeAttr("tabindex").removeAttr("role"),i.itemSelector&&i.addItemSelector&&t.find(".u-selector").remove(),e.removeHandler(t[0]),this._destroyContextMenu(),n("#"+this.infoId).remove(),this.addedLabel&&t.removeAttr("aria-labelledby")},_setOption:function(t,e){var i,s,n=this.options,o=this.element;if(this._checkContextMenuOptions(t,e),"multiple"===t)n.navigation&&(e=!1);else if("allowCopy"===t||"addItemSelector"===t||"navigation"===t)throw new Error("IconList "+t+" option cannot be set");this._super(t,e),"disabled"===t?(o.toggleClass("is-disabled ui-state-disabled",e).attr("aria-disabled",e),this.lastFocused&&(e?this.lastFocused&&((i=!n.navigation&&n.tabbableContent)?(s=d(this.lastFocused)).add(s.find(i).not(":disabled")).prop("tabIndex",-1):this.lastFocused.tabIndex=-1):this._setFocusable(this.lastFocused)),e&&this._dim()):"multiple"===t?e?o.attr(a,"true"):o.removeAttr(a):"itemSelector"===t&&this.refresh()},refresh:function(){var t,e,i,s=this.options,o=this.element;s.multiple&&!s.itemSelector&&apex.userHasTouched()&&(s.itemSelector=!0,s.addItemSelector=!0),o.find("a").attr("tabindex",-1).attr("role","option"),o.find(s.tabbableContent).attr("tabindex",-1),(i=o.children()).addClass("a-IconList-item").filter((function(){return 0===n(this).find("a").length})).attr("role","option").attr("tabindex",-1),s.addItemSelector&&(s.itemSelector?(e=n("<span class='"+(s.multiple?"u-selector":"u-selector u-selector--single")+"'></span>"),i.filter((function(){return n(this).find(".u-selector").length<=0})).prepend(e)):o.find(".u-selector").remove()),this._dim(),(t=o.find(".is-selected.a-IconList-item")).length>0?this.setSelection(t,!1):(this.lastFocused&&n(this.lastFocused).is(":visible")||(this.lastFocused=h(o.children().first())),this.selectAnchor=this.lastFocused,this.lastFocused&&!s.disabled&&this._setFocusable(this.lastFocused))},resize:function(){this._dim()},focus:function(){this.lastFocused&&this.lastFocused.focus()},getColumns:function(){return this.columns},getRows:function(){return this.rows},getSelection:function(){return this.element.find(".is-selected.a-IconList-item")},getSelectionValues:function(){var t=[];return this.getSelection().each((function(){t.push(n(this).attr("data-value"))})),t},setSelection:function(t,e,i){e=!!e,this._select(t,null,e,!1,i)},_copy:function(t){var e,i,s=this.getSelection(),n=this.options.dataTransferFormats;if(s.length){for(n.forEach((function(t){t.writer.begin(s)})),e=0;e<s.length;e++)i=s.eq(e),n.forEach((function(t){t.writer.item(i,e,i.text())}));n.forEach((function(e){e.writer.end(),t.setData(e.format,e.writer.toString())}))}},_rowCol2Index:function(t,e){return t*this.columns+e},_index2RowCol:function(t){var e=Math.floor(t/this.columns);return{row:Math.floor(t/this.columns),column:t-e*this.columns}},_dim:function(){var t,e,s,o=this,a=this.element,r=a.width(),l=a.children(),c=l.length;c&&(t=l.first().position().top,s=l.first().outerWidth()),this.columns=c,l.each((function(e){var i=n(this).position().top;if(i>t)return t=i,o.columns=e,!1})),this.rows=c>0?Math.floor((c+this.columns-1)/this.columns):0,1===this.rows&&(this.columns=Math.floor(r/s)),e=1===this.columns?i.formatMessage("APEX.ICON_LIST.LIST_DIM",this.rows):i.formatMessage("APEX.ICON_LIST.GRID_DIM",this.columns,this.rows),n("#"+this.infoId).text(e)},_findItem:function(t){var e,i,s=this.element,n=t.length,o=this.options.label;for(e=i=d(this.lastFocused),1===n&&(e=e.next()),0===e.length&&(e=s.children().first());e.length>0;){if((!0===o?e.text().trim():e.find(o).text()).substring(0,n).toLowerCase()===t)return e;if(0===(e=e.next()).length&&(e=s.children().first()),e[0]===i[0])break}return null},_setFocusable:function(t){var e,i=this.options,s=!i.navigation&&i.tabbableContent;this.lastFocused&&this.lastFocused!==t&&(s?(e=d(this.lastFocused)).add(e.find(s).not(":disabled")).prop("tabIndex",-1):this.lastFocused.tabIndex=-1),s?(e=d(t)).find(s).not("disabled").prop("tabIndex",0).length||e.prop("tabIndex",0):t.tabIndex=0,this.lastFocused=t},_activate:function(t){var e,i;this._trigger("activate",t,{values:this.getSelectionValues()}),this.options.navigation&&!t.isDefaultPrevented()&&(i=(e=this.getSelection()).attr("href")||e.find("a").attr("href"))&&(t.preventDefault(),apex.navigation.redirect(i))},_select:function(t,e,i,a,r){var l,d,u,g,p,b,v,C,x,I="set",y=this.element,_=this.options,w=y.find(".is-selected.a-IconList-item");t=t.filter(":visible"),e&&_.multiple&&("click"===e.type?e.ctrlKey||e.metaKey?I="toggle":e.shiftKey&&(I="range"):"keydown"===e.type&&(e.keyCode===n.ui.keyCode.SPACE?I=e.ctrlKey?"toggle":e.shiftKey?"range":"add":e.ctrlKey?I="none":e.shiftKey&&(I="range"))),"range"!==I||this.selectAnchor||(I="set"),"set"!==I&&"range"!==I||w.removeClass(o).removeAttr("aria-selected").find(".u-selector").removeClass(o),l=t.hasClass(o),"set"===I||"add"===I||"toggle"===I&&!l?(t.addClass(o).attr("aria-selected",!0).find(".u-selector").addClass(o),this.selectAnchor=t[0]):"range"===I?(y.children().removeClass(o).removeAttr("aria-selected").find(".u-selector").removeClass(o),b=c(n(this.selectAnchor)),v=c(t.last()),b>v&&(C=v,v=b,b=C),y.children().filter((function(t){return t>=b&&t<=v})).addClass(o).attr("aria-selected",!0).find(".u-selector").addClass(o)):"toggle"===I&&l&&(t.removeClass(o).removeAttr("aria-selected").find(".u-selector").removeClass(o),this.selectAnchor=t[0]),t.length>0&&(x=h(t.first()),i?(x.tabIndex=0,x.focus()):this._setFocusable(x),(g=(u=y.scrollParent())[0]===document?{left:0,top:0}:u.offset())&&(p=y.offset(),((d=t.first().offset()).top<g.top||d.top>g.top+u[0].offsetHeight)&&(u[0].scrollTop=d.top-p.top),(d.left+t[0].offsetWidth<g.left||d.left>g.left+u[0].offsetWidth)&&(u[0].scrollLeft=d.left-p.left))),r||_.navigation&&e&&"click"===e.type||("toggle"===I||"range"===I&&!l||"add"===I&&!l||"set"===I&&!s.arrayEqual(w,t))&&(a?m(this,e):f(this,e))}},apex.widget.contextMenuMixin))}(apex.debug,apex.clipboard,apex.lang,apex.util,apex.jQuery);
!function(e,t,a,s,o,i){"use strict";e.widget("apex.combobox",{version:"5.1",widgetEventPrefix:"combobox",options:{source:[],multipleValues:!1,multipleValueDelimiter:",",label:""},_create:function(){var i=t.htmlBuilder(),n=this,l=this.options,r=e(".a-Combobox").length;this.baseId=this.element[0].id||"combobox"+(r+1),this.actions=a.createContext("combobox",this.element[0]),l.label&&o.warn("Label not provided, which is an accessibility issue (unless the 'label' option is later set)."),i.markup("<span").attr("class","a-Combobox-wrapper").markup("></span>"),this.element.wrap(i.toString()).addClass("a-Combobox"),this.wrapper$=this.element.closest(".a-Combobox-wrapper"),this._createShowAllButton(),this._on(this.element,{keydown:function(t){(t.altKey||t.metaKey)&&t.which===e.ui.keyCode.DOWN&&(n.menu$.menu("open",n.element,!1),n.menu$.find(":focusable").first().focus())}}),this.actions.add({name:this.baseId+"-values",label:s.getMessage("APEX.COMBOBOX.LIST_OF_VALUES"),set:function(e){var t=n.element.val();l.multipleValues?n.element.val((t?t+l.multipleValueDelimiter:t)+e):n.element.val(e),t!==n.element.val()&&n.element.change()},get:function(){return n.element.val()},choices:l.source})},_setOption:function(t,a){switch(this._super(t,a),t){case"multipleValues":break;case"source":this.actions.lookup(this.baseId+"-values").choices=a,this.actions.updateChoices(this.baseId+"-values");break;case"label":e("#"+this.baseId+"-showAll",this.wrapper$).attr("title",s.formatMessage("APEX.COMBOBOX.SHOW_ALL_VALUES",a)).attr("aria-label",s.formatMessage("APEX.COMBOBOX.SHOW_ALL_VALUES",a))}},_createShowAllButton:function(){var a=t.htmlBuilder();a.markup("<button type='button'").attr("id",this.baseId+"-showAll").attr("tabindex","-1").attr("title",s.formatMessage("APEX.COMBOBOX.SHOW_ALL_VALUES",this.options.label)).attr("aria-label",s.formatMessage("APEX.COMBOBOX.SHOW_ALL_VALUES",this.options.label)).attr("class","a-Button a-Button--withIcon a-Button--noLabel js-menuButton").attr("data-menu",this.baseId+"-menu").attr("aria-haspopup",!0).attr("aria-expanded",!1).markup(">"),a.markup("<span").attr("aria-hidden",!0).attr("class","a-Icon icon-menu-drop-down").markup(">").markup("</span>"),a.markup("</button>"),this.wrapper$.append(a.toString()),this.menu$=e("<div/>",{id:this.baseId+"-menu",class:"",style:"display:none;"}).appendTo("body"),this.menu$.menu({actionsContext:this.actions,items:[{type:"radioGroup",action:this.baseId+"-values"}]})},_destroy:function(){this.element.insertBefore(this.wrapper$),this.wrapper$.remove(),this.menu$.remove(),this.element.removeClass("a-Combobox"),a.removeContext("combobox",this.element[0])}})}(apex.jQuery,apex.util,apex.actions,apex.lang,apex.debug);
!function(t,i,e){"use strict";var s=".a-Splitter-barH,.a-Splitter-barV",o="a-Splitter-thumb",r="."+o,a="is-disabled",n="title";t.widget("apex.splitter",{version:"5.0",widgetEventPrefix:"splitter",options:{orientation:"horizontal",positionedFrom:"begin",minSize:60,position:100,noCollapse:!1,dragCollapse:!0,collapsed:!1,snap:!1,inc:10,realTime:!1,iframeFix:!1,restoreText:null,collapseText:null,title:null,change:null},lastPos:null,bar$:null,before$:null,after$:null,horiz:!0,fromEnd:!1,barSize:1,_create:function(){var s,o,a,n,l,h,p=this,d=this.options,c=this.element,f=i.htmlBuilder(),b=t.ui.keyCode,u=!!d.snap&&[1*d.snap,1*d.snap],m=d.noCollapse?0:1,z=null;if(2!==c.children().length)throw new Error("Splitter must have exactly two children.");if("horizontal"!==d.orientation&&"vertical"!==d.orientation)throw new Error("Orientation bad value");if("begin"!==d.positionedFrom&&"end"!==d.positionedFrom)throw new Error("PositionedFrom bad value");if(d.minSize<m&&(d.minSize=m,e.warn("Option minSize adjusted")),this.horiz="horizontal"===d.orientation,this.fromEnd="end"===d.positionedFrom,h=this.horiz?"left":"top",this.before$=c.children().eq(0),this.after$=c.children().eq(1),c.addClass("a-Splitter resize"),"rtl"===c.css("direction")&&(c.addClass("u-RTL"),this.horiz&&(this.before$=c.children().eq(1),this.after$=c.children().eq(0),this.fromEnd=!this.fromEnd)),c.parent(".a-Splitter").length>0||this.before$.is(".a-Splitter")||this.after$.is(".a-Splitter"))throw new Error("Child of splitter cannot be a splitter");this.before$[0].id||(this.before$[0].id=(c[0].id||"splitter")+"_first"),this.after$[0].id||(this.after$[0].id=(c[0].id||"splitter")+"_second"),d.position<d.minSize&&(d.position=d.minSize),this.lastPos=d.position,d.snap&&(d.inc=d.snap),this._renderBar(f),this.bar$=t(f.toString()).insertAfter(c.children().eq(0)),this.horiz?this.barSize=this.bar$.width():this.barSize=this.bar$.height(),c.css({position:"relative"}).children().css({position:"absolute"}),this.horiz?(s=this.bar$.position()[h],o=0,a="e-resize",this.fromEnd?(n=b.LEFT,l=b.RIGHT):(n=b.RIGHT,l=b.LEFT)):(s=0,o=this.bar$.position()[h],a="s-resize",this.fromEnd?(n=b.UP,l=b.DOWN):(n=b.DOWN,l=b.UP)),this.bar$.css({left:s,top:o}).draggable({axis:p.horiz?"x":"y",containment:"parent",cancel:"button",cursor:a,iframeFix:d.iframeFix,grid:u,scroll:!1,drag:function(t,i){var e;d.realTime&&(e=i.position[h],p.fromEnd&&(e=(p.horiz?c.width():c.height())-e-p.barSize),p._setPos(e,!1))},start:function(){p.bar$.addClass("is-active")},stop:function(t,i){var e=i.position[h];p.bar$.removeClass("is-active"),p.fromEnd&&(e=(p.horiz?c.width():c.height())-e-p.barSize),p._setPos(e,!1)}}).click((function(){t(this).find(r).focus()})).find("button").click((function(){p._setPos(p._getPos(),!p._isCollapsed())})),apex.widget.util.TouchProxy.addTouchListeners(this.bar$[0]),this.bar$.find(r).focus((function(){t(this).parent().addClass("is-focused is-active")})).blur((function(){t(this).parent().removeClass("is-focused is-active")})).keydown((function(t){var i,e,s=t.keyCode,o=null,r=!1;if(s!==l||d.collapsed?s===n&&((o=p._getPos())<0?(d.noCollapse||(r=!0),o=0):o+=d.inc,i=p._getMaxPos(),o>i&&(o=i)):(o=p._getPos(),(o-=d.inc)<d.minSize&&d.noCollapse&&(o=d.minSize),o<0&&(o=0)),null!==o)return e=o,p.fromEnd&&(e=(p.horiz?c.width():c.height())-e-p.barSize),p.bar$.css(h,e),z&&(clearTimeout(z),z=null),z=setTimeout((function(){z=null,p._setPos(o,r)}),100),!1})),this._on(!0,this._eventHandlers),d.disabled&&this._setOption("disabled",d.disabled),this.refresh()},_eventHandlers:{resize:function(e){var s,o,r,a,n=this.options,l=this.element;if(e.target===l[0]){if(s=l.height(),o=l.width(),0===s||0===o)throw new Error("Splitter needs to be in a component with size");a=l.offset(),this.horiz?(l.children().each((function(){i.setOuterHeight(t(this),s)})),this.fromEnd?(r=[a.left+n.minSize,a.top,a.left+o-this.barSize,a.top+s],n.dragCollapse&&!n.noCollapse||(r[2]-=n.minSize)):(r=[a.left,a.top,a.left+o-this.barSize-n.minSize,a.top+s],n.dragCollapse&&!n.noCollapse||(r[0]+=n.minSize+1))):(l.children().each((function(){i.setOuterWidth(t(this),o)})),this.fromEnd?(r=[a.left,a.top+n.minSize,a.left+o,a.top+s-this.barSize],n.dragCollapse&&!n.noCollapse||(r[3]-=n.minSize)):(r=[a.left,a.top,a.left+o,a.top+s-this.barSize-n.minSize],n.dragCollapse&&!n.noCollapse||(r[1]+=n.minSize+1))),this._setPos(n.position,n.collapsed),this.bar$.draggable("option","containment",r),l.children(".resize").filter(":visible").trigger("resize"),e.stopPropagation()}}},_destroy:function(){this.element.removeClass("a-Splitter "+a+" u-RTL resize").children(s).remove(),this.element.children().css("position","")},refresh:function(){this.element.is(":visible")&&this.element.trigger("resize")},_setOption:function(i,s){var o,l,h;if(!this.options.noCollapse||"collapsed"!==i&&"restoreText"!==i&&"collapseText"!==i){if("orientation"===i||"positionedFrom"===i||"noCollapse"===i)throw new Error("Readonly option: "+i);"position"===i?this._setPos(1*s,this._isCollapsed()):"collapsed"===i?this._setPos(this._getPos(),!!s):"snap"===i?(s=!!s&&1*s,this.options.snap=s,o=!!s&&[s,s],this.bar$.draggable("option","grid",o),s&&(this.options.inc=s)):"inc"===i?(s*=1,this.options.snap&&(s=this.options.snap),this.options.inc=s):"disabled"===i?(this.options.disabled=s,h=this.bar$.find(r),this.options.noCollapse?s?h.removeAttr("tabindex"):h.attr("tabindex","0"):(h[0].disabled=s,s?h.attr(n,this.options.title):h.attr(n,this.options.collapsed?this.options.restoreText:this.options.collapseText)),this.bar$.draggable("option","disabled",s),s?(this.element.addClass(a),this.bar$.addClass(a),h.attr("aria-disabled",!0)):(h.removeAttr("aria-disabled"),this.bar$.removeClass(a),this.element.removeClass(a))):"minSize"===i?(s<(l=this.options.noCollapse?0:1)&&(s=l,e.warn("Option minSize adjusted")),this.options.minSize=s):t.Widget.prototype._setOption.apply(this,arguments),"title"===i?(this.bar$.attr(n,s),(this.options.noCollapse||this.options.disabled)&&this.bar$.find(r).attr(n,s)):"restoreText"===i&&this.options.collapsed&&!this.options.disabled?this.bar$.find("button").attr(n,s):"collapseText"!==i||this.options.collapsed||this.options.disabled?"iframeFix"===i?this.bar$.draggable("option","iframeFix",s):"dragCollapse"===i&&this.refresh():this.bar$.find("button").attr(n,s)}else e.warn("Setting "+i+" option on noCollapse splitter has no effect.")},_renderBar:function(t){var i=this.options,e=this.horiz?"a-Splitter-barH":"a-Splitter-barV";this.fromEnd&&(e+=" a-Splitter--end"),i.noCollapse&&(i.collapsed=!1),i.collapsed&&(e+=" is-collapsed"),t.markup("<div").attr("class",e).optionalAttr(n,i.title).markup("><div></div>"),i.noCollapse?t.markup("<span role='separator' class='"+o+"' tabindex='0' aria-expanded='true'").optionalAttr(n,i.title).markup("></span>"):t.markup("<button role='separator' class='"+o+"' type='button'").attr("aria-expanded",!i.collapsed).optionalAttr(n,i.collapsed?i.restoreText:i.collapseText).markup("></button>"),t.markup("</div>")},_getPos:function(){var t=this.element,i=this.horiz?"left":"top",e=this.bar$.position()[i];return this.fromEnd&&(e=(this.horiz?t.width():t.height())-e-this.barSize),e},_isCollapsed:function(){return this.bar$.hasClass("is-collapsed")},_getMaxPos:function(){var t=this.options,i=this.element;return this.horiz?i.width()-this.barSize-t.minSize:i.height()-this.barSize-t.minSize},_setPos:function(t,e){var s,o,a,l,h,p,d=this.options,c=this.element,f=this.horiz?"left":"top",b=this._isCollapsed(),u=this.lastPos;d.noCollapse&&(e=!1),b&&!e&&(t=this.lastPos)<d.minSize&&(t=d.minSize),t<d.minSize?d.noCollapse?t=d.minSize:e=!0:t>(s=this._getMaxPos())&&(t=s),d.noCollapse&&t<=0&&(t=0),t>0&&(this.lastPos=t),e&&(t=0,d.position=0),o=this.horiz?c.width():c.height(),h=t,this.fromEnd&&(h=o-t-this.barSize),this.bar$.css(f,h),p=this.bar$.find(r),this.fromEnd?(a=this.after$,l=o-h-this.barSize):(a=this.before$,l=h),e?(this.bar$.addClass("is-collapsed"),d.disabled||p.attr("aria-expanded",!1).attr(n,d.restoreText),a.hide()):(d.noCollapse?a.toggle(0!==t):(this.bar$.removeClass("is-collapsed"),d.noCollapse||d.disabled||p.attr("aria-expanded",!0).attr(n,d.collapseText),a.show()),this.horiz?i.setOuterWidth(a,l):i.setOuterHeight(a,l)),this.fromEnd?(a=this.before$,l=h):(a=this.after$,l=o-h-this.barSize),this.horiz?i.setOuterWidth(a,l):i.setOuterHeight(a,l),d.noCollapse&&a.toggle(0!==l),this.after$.css(f,h+this.barSize+"px"),this.before$.css(f,0),(!e&&t!==u||b!==e)&&(d.collapsed=e,d.position=t,c.children(".resize").filter(":visible").trigger("resize"),this._trigger("change",{},{position:d.position,collapsed:d.collapsed,lastPosition:this.lastPos}))}});var l=0,h=0;t.apex.splitter.nextSplitter=function(i){var e,o,a,n=i?-1:1,p=t(document.activeElement);if(!(l>0||h>0))return(a=(o=t(".a-Splitter >.a-Splitter-barH,.a-Splitter >.a-Splitter-barV").filter(":visible").not(".ui-state-disabled").add(p)).index(p))>=0&&(a+=n,i&&p.parent().is(s)&&(a+=n),a>=0&&a<o.length&&(e=o.eq(a))),(e&&0===e.length&&!p.parent().is(s)||p.is("html,body"))&&(e=t(".a-Splitter >.a-Splitter-barH,.a-Splitter >.a-Splitter-barV").filter(":visible").not(".ui-state-disabled")[i?"last":"first"]()),e&&e.length>0?(e.children(r).focus(),!0):void 0},t((function(){t(document.body).on("menubeforeopen",(function(){h+=1})).on("menuafterclose",(function(){h-=1})).on("dialogopen",(function(){l+=1})).on("dialogclose",(function(){l-=1}))})),apex.message&&apex.message.addVisibilityCheck((function(i){var e=t("#"+i);e.parents(".a-Splitter").each((function(){e.is(":visible")||t(this).splitter("option","collapsed",!1)}))}))}(apex.jQuery,apex.util,apex.debug);
!function(e,t,i,s,a,o){"use strict";const r="data-start",l="data-end",n=".js-pg-prev,.js-pg-next,.js-pg-first,.js-pg-last",h=e.hasOwnProperty,d=e.applyTemplate,c=Array.isArray,g=e=>parseInt(e,10);let f={};function u(e){return s.getMessage("APEX.GV."+e)}function p(e){var t=Array.prototype.slice.call(arguments);return t[0]="APEX.GV."+e,s.formatMessage.apply(s,t)}function m(e,t){return Math.floor(e/t)*t}function _(e,t,i,s,a){let o=Math.ceil((i+1-t)/s)*a;e.css("height",o)}function R(e,t,i){e.find(".a-GV-scrollFiller").each((function(){var e=o(this),s=g(e.attr(r)),a=g(e.attr(l));_(e,s,a,t,i)}))}function v(e){return"collapse"!==e.css("visibility")}function P(e,t){e.css("visibility",t?"":"collapse").toggleClass("is-hidden",!t)}function C(e){return e.getOption("hasTotalRecords")}o.widget("apex.tableModelViewBase",{version:"21.1",widgetEventPrefix:"tableModelViewBase",options:{modelName:null,progressOptions:null,noDataMessage:"",noDataIcon:"icon-irr-no-results",moreDataMessage:"",editable:!1,autoAddRecord:!1,hideDeletedRows:!1,hasSize:!1,footer:!0,fixedRowHeight:!0,showNullAs:"-",applyTemplateOptions:{},stickyTop:!1,stickyFooter:!1,hideEmptyFooter:!1,pagination:{scroll:!1,virtual:!1,loadMore:!1,showPageLinks:!1,maxLinks:5,showPageSelector:!1,showRange:!0,firstAndLastButtons:!1,hideSinglePage:!1},persistSelection:!1,highlights:{},highlighter:null,highlighterContext:null,rowsPerPage:null,selectionStatusMessageKey:"APEX.GV.SELECTION_COUNT",scrollParentOverride:null},firstPage:function(){return!this.renderInProgress&&(this.options.pagination.scroll?this.scrollParent$.scrollTop(this.scrollDelta):this.pageOffset>0&&(this.pageOffset=0,this.refresh(!1)),!0)},previousPage:function(){var e,t;return!this.renderInProgress&&(this.options.pagination.scroll?((t=(e=this.scrollParent$).scrollTop()-this.scrollDelta-this.viewportHeight)<0&&(t=0),e.scrollTop(t+this.scrollDelta)):this.pageOffset>0&&(this.pageOffset-=this.pageSize,this.pageOffset<0&&(this.pageOffset=0),this.refresh(!1)),!0)},nextPage:function(){var e,t,i,s;return!this.renderInProgress&&(this.options.pagination.scroll?(e=this.scrollParent$,t=this._getDataContainer().first().height()-this.viewportHeight,(i=e.scrollTop()-this.scrollDelta+this.viewportHeight)>t&&(i=t),e.scrollTop(i+this.scrollDelta)):((s=this.model.getTotalRecords())<0||this.pageOffset+this.pageCount<s)&&(this.pageOffset+=this.pageSize,this.refresh(!1)),!0)},lastPage:function(){var e,t,i,s;return!this.renderInProgress&&(this.options.pagination.scroll?(t=this.scrollParent$,i=this._getDataContainer().first().height()-this.viewportHeight,t.scrollTop(i+this.scrollDelta)):(s=this.model.getTotalRecords())>0&&this.pageOffset+this.pageCount<s&&(e=Math.ceil(s/this.pageSize),this.pageOffset=(e-1)*this.pageSize,this.refresh(!1)),!0)},loadMore:function(){return this.options.pagination.scroll&&!this._scrollHandler?this._addNextPage():this.nextPage()},getPageInfo:function(){let t=null,i=C(this.model),s=this.options.pagination,a=this.model.getTotalRecords(),r=this.model.getServerTotalRecords();if(!this.noData)if(t={rowHeight:this.avgRowHeight,recordsPerRow:this._getRecordsPerRow(),firstOffset:this.pageFirstOffset||null,lastOffset:this.pageLastOffset||null,pageSize:this.pageSize,pageOffset:this.pageOffset},i&&(t.total=r),s.scroll){let i,s=this.scrollParent$[0]===window,a="TBODY"===this._getDataContainer()[0].nodeName,r=this._getDataContainer().children().not(".is-aggregate");i=e.binarySearch(r,t.scrollOffset,(e,i)=>{let r=o(i),l=s?r.offset().top:r.position().top;return s||a||r.offsetParent().closest(this.scrollParent$).length>0||(l+=t.scrollOffset),e-l}),t.viewOffset=g(r.eq(i).attr("data-rownum"))-1||null,t.scrollOffset=this.scrollParent$.scrollTop()}else t.currentPage=Math.floor(this.pageOffset/this.pageSize),a>=0&&(t.totalPages=Math.ceil(a/this.pageSize));return t},gotoPage:function(e){var t,i=this.model.getTotalRecords();return!this.renderInProgress&&(i>0&&(t=Math.ceil(i/this.pageSize),e>=0&&e<t&&(this.pageOffset=e*this.pageSize,this.refresh(!1))),!0)},getActiveRecordId:function(){return this.activeRecordId},getActiveRecord:function(){return this.activeRecord},getModel:function(){return this.model},setActiveRecordValue:function(e){var t=this.columnItems[e];this.activeRecord&&t&&(this.ignoreItemChange=!0,this._setModelValue(null,t.item,this.activeRecord,e,!0),this.ignoreItemChange=!1)},lockActive:function(){this.activeRecord&&(this.activeLockCount+=1)},unlockActive:function(){this.activeRecord&&(this.activeLockCount-=1,this.activeLockCount<0&&(this.activeLockCount=0),0===this.activeLockCount&&(this.activeUnlockCallback&&(this.activeUnlockCallback(),this.activeUnlockCallback=null),this.finishEditingCallback&&(this.finishEditingCallback(),this.finishEditingCallback=null)))},finishEditing:function(){var e=this,t=o.Deferred();function i(){e._finishEditing?e._finishEditing(t):t.resolve()}return this.activeLockCount>0?this.finishEditingCallback=i:i(),t.promise()},addStateIcon:function(t,i,s){var a=e.htmlBuilder();this.stateIconMessages[t]=s,0===this._findStateIcon(t).length&&(a.markup("<span tabindex='0'").attr("class",i).attr("data-state",t).markup("></span>"),this.stateIcons$.append(a.toString()))},removeStateIcon:function(e){this._findStateIcon(e).remove(),delete this.stateIconMessages[e]},_create:function(){var e=this.options;e.hideDeletedRows&&this.element.addClass("a-GV--hideDeleted"),this.noData=!0,this.pendingRefresh=null,this.renderInProgress=!1,this.pageOffset=0,this.highWaterMark=0,this.pageCount=0,this.totalRenderedRecords=0,this.pageSize=10,this.onLastPage=!1,this.lastScrollLeft=null,this.lastScrollTop=null,this.scrollPageTimer=null,this.hasScrollFillers=!1,this._scrollHandler=null,this.stateIconMessages={},this.ignoreFieldChange=null,this.reinitCallbacks=null,this.activeRecord=null,this.activeRecordId=null,this.activeLockCount=0,this.activeUnlockCallback=null,this.columnItems=null,this.columnItemsContainer$=null,e.progressOptions||(e.progressOptions={fixed:!e.hasSize}),e.pagination.scroll&&!e.pagination.loadMore&&(e.rowsPerPage=null),e.rowsPerPage&&(this.pageSize=e.rowsPerPage),this._setOption("applyTemplateOptions",e.applyTemplateOptions)},_tableModelViewDestroy:function(){this.footer$.remove(),this.footer$=null,this.pageRange$=null,this.pageSelector$=null,this.status$=null,this.stateIcons$=null,this.element.removeClass("a-GV--hideDeleted"),this._removeScrollHandler()},_refreshCheckIfVisible:function(){return null===this.element[0].offsetParent?(this.pendingRefresh=!0,!1):(this.pendingRefresh=!1,!0)},_initModel:function(i,s){var a,o=this.options,r=this;let l=!0;if(this.model&&(this.model.unSubscribe(this.modelViewId),l=c(this.modelName)&&c(i)?!e.arrayEqual(this.modelName,i):this.modelName!==i,l&&(t.release(this.modelName),this.model=null,this.modelName=null)),this.modelChanged=l,i){if(l&&(this.modelName=i,this.model=t.get(i),!this.model))throw new Error("Model not found: "+i);this.modelViewId=this.model.subscribe({onChange:s||function(e,t){var i,s,l,n,h,d,c,g,f,u,p;if(!r.pendingRefresh){if("refresh"===e)r.pageOffset=0,r.highWaterMark=0,r.pageCount=0,r.refresh();else if("refreshRecords"===e||"revert"===e)for(s=r._elementsFromRecordIds(t.recordIds),i=0;i<s.length;i++)(l=s[i])&&(n=t.records[i],d=t.recordIds[i],h=t.newIds[d]||d,c=r.model.getRecordMetadata(h),r._replaceRecord(l,n,d,h,c));else if("move"===e)for(u=t.records,t.insertAfterId&&(l=(s=r._elementsFromRecordIds([t.insertAfterId])).length>0?s[0]:null),i=u.length-1;i>=0;i--)n=u[i],h=r.model.getRecordId(n),c=r.model.getRecordMetadata(h),(s=r._elementsFromRecordIds([h])).length>0&&s[0]&&r._removeRecord(s[0]),g=r._insertRecord(l,n,h,c,l?"after":"before");else if("insert"===e||"copy"===e)if("insert"===e?(p=!1,u=[t.record]):(p=!0,u=t.records),t.insertAfterId&&(l=(s=r._elementsFromRecordIds([t.insertAfterId])).length>0?s[0]:null),r.noData)setTimeout((function(){r.refresh(),(s=r._elementsFromRecordIds([r.model.getRecordId(u[0])])).length>0&&s[0]&&r._afterInsert(s,p)}),1);else{for(f=[],i=u.length-1;i>=0;i--)n=u[i],h=r.model.getRecordId(n),c=r.model.getRecordMetadata(h),g=r._insertRecord(l,n,h,c,l?"after":"before"),f.push(g);r._afterInsert(f,p)}else if("clearChanges"===e){if(a)for(s=r._elementsFromRecordIds(t.deletedIds),i=0;i<s.length;i++)s[i]&&r._removeRecord(s[i]);for(s=r._elementsFromRecordIds(t.changedIds),i=0;i<s.length;i++)(l=s[i])&&(h=t.changedIds[i],c=r.model.getRecordMetadata(h),n=r.model.getRecord(h),r._updateRecordState(l,h,n,c))}else if(t.recordIds){for(s=r._elementsFromRecordIds(t.recordIds),i=0;i<s.length;i++)(l=s[i])&&(h=t.recordIds[i],c=r.model.getRecordMetadata(h),n=t.records[i],"delete"===e?(!o.hideDeletedRows&&a&&null!==c||r._removeFocus(l),a&&null!==c?r._updateRecordState(l,h,n,c):r._removeRecord(l)):r._updateRecordState(l,h,n,c));"delete"===e&&(0===r.model.getTotalRecords()?r.refresh():o.hideDeletedRows&&(r.element.find(".is-deleted").removeClass("is-selected").removeAttr("aria-selected"),r._updateStatus()))}else"set"===e||"metaChange"===e?null!==r.ignoreFieldChange&&r.ignoreFieldChange===t.field||(n=t.record,h=r.model.getRecordId(n),t.oldIdentity&&r._identityChanged(t.oldIdentity,h),c=r.model.getRecordMetadata(h),(s=r._elementsFromRecordIds([h])).length>0&&s[0]&&("set"===e&&r._updateRecordField(s[0],n,t.field,c),r._updateRecordState(s[0],h,n,c))):"instanceRename"===e&&r.modelName[1]===t.oldInstance&&(r.modelName[1]=t.newInstance);r._updateTotalRecords()}},progressView:this.element,progressOptions:o.progressOptions}),a=this.model.getOption("onlyMarkForDelete"),this.options.pagination.scroll&&this.scrollParent$&&this.scrollParent$.scrollTop()>this.scrollDelta&&this.scrollParent$.scrollTop(this.scrollDelta),this.pageOffset=0,this.highWaterMark=0,this.pageCount=0}},_renderButton:function(e,t,i,s,a){e.markup(`<button class='${t}' type='button'`).attr("aria-label",s).attr("title",s).optionalAttr("aria-expanded",null==a?null:a?"true":"false").markup("><span aria-hidden='true' class='a-Icon ").attr(i).markup("'></span></button>")},_renderAltDataMessages:function(e,t){var i=this.options;function s(i,s,a,o){e.markup(`<div class='${i} a-GV-altMessage' style='display:none;'><div class='a-GV-altMessage-icon'><span aria-hidden='true' class='a-Icon ${a}'></span></div><span class='a-GV-altMessage-text'`).optionalAttr("id",t?t+s+"_msg":null).markup(`>${o}</span></div>`)}s("a-GV-noDataMsg","_no",i.noDataIcon,i.noDataMessage),s("a-GV-moreDataMsg","_more","icon-warning",i.moreDataMessage)},_renderLoadMore:function(e){var t=this.options.pagination;t.scroll&&t.loadMore&&e.markup("<div class='a-GV-loadMore'><button type='button' class='js-load a-GV-loadMoreButton'>").content(u("LOAD_MORE")).markup("</button></div>")},_renderFooter:function(e,t){var i,s,a="a-GV-pageButton a-GV-pageButton--nav ",o=this.options;function r(){var i=u("PAGE_RANGE");e.markup("<span class='js-rangeDisplay'").optionalAttr("id",t?t+"_pageRange":null).attr("title",i).markup("><span class='u-vh'>").content(i).markup("</span> <span class='a-GV-pageRange'></span></span>")}o.footer&&(e.markup("<div class='a-GV-footer'><div class='a-GV-stateIcons'></div><div").optionalAttr("id",t?t+"_status":null).markup(" class='a-GV-status'></div><div class='a-GV-pagination'>"),o.pagination&&(i=!1,s=C(this.model),o.pagination.scroll||(s&&o.pagination.firstAndLastButtons&&this._renderButton(e,a+"js-pg-first","icon-first",u("FIRST_PAGE")),this._renderButton(e,a+"js-pg-prev","icon-prev",u("PREV_PAGE"))),s&&(o.pagination.showPageLinks||o.pagination.showPageSelector)?e.markup("<span class='a-GV-pageSelector'></span>"):o.pagination.showRange&&(r(),i=!0),o.pagination.scroll||(this._renderButton(e,a+"js-pg-next","icon-next",u("NEXT_PAGE")),s&&o.pagination.firstAndLastButtons&&this._renderButton(e,a+"js-pg-last","icon-last",u("LAST_PAGE"))),!i&&o.pagination.showRange&&r()),e.markup("</div></div>"))},_refreshPagination:function(e){let t=this.options,i=t.pagination;this.hasScrollFillers=i.scroll&&i.virtual&&!i.loadMore,this.lastScrollTop=null,this.lastScrollLeft=null,e.length&&(t.hasSize||(e=t.scrollParentOverride?o(t.scrollParentOverride):o(window)),this.lastScrollLeft=e.scrollLeft(),this.lastScrollTop=e.scrollTop())},_paginationHasFocus:function(){var e,t=o(document.activeElement);if(t.closest(".a-GV-footer").length>0){if(t.parent().hasClass("a-GV-pageSelector-item"))return t.parent().attr("data-page");if(e=/js-pg-\S+/.exec(t.attr("class")))return"."+e[0]}return!1},_restorePaginationFocus:function(e){var t,i;e&&((t=e)>=0&&(t=`[data-page='${e}'] button`),(i=this.footer$.find(t))[0]&&i[0].disabled&&(i=this.footer$.find(":focusable").eq(0)),i.focus())},_initPagination:function(e,t){let i,s=this.options,a=this.element,r=a.hasClass("u-RTL")?"right":"left";if(this.pageKey=null,i=this.footer$=a.find(".a-GV-footer"),this.status$=i.find(".a-GV-status"),this.stateIcons$=i.find(".a-GV-stateIcons"),this.pageRange$=i.find(".a-GV-pageRange"),this.pageSelector$=i.find(".a-GV-pageSelector"),this.noData$=a.find(".a-GV-noDataMsg"),this.moreData$=a.find(".a-GV-moreDataMsg"),o.ui.tooltip){let e=this.stateIconMessages;this.stateIcons$.tooltip({content:function(){let t=o(this).attr("data-state");return e[t]},items:"[data-state]",show:apex.tooltipManager.defaultShowOption(),tooltipClass:"a-GV-tooltip",position:{my:r+" bottom",at:r+" top-10",collision:"flipfit"}})}if(this._updateScrollHandler(t),s.pagination.scroll&&(this.pageOffset=0,this.highWaterMark=0,this.pageCount=0,this.totalRenderedRecords=0),!s.hasSize&&o.apex.stickyWidget){if(s.stickyTop){let t={stickToEnd:!0,toggleWidth:!0,bottom:()=>a.offset().top+a.outerHeight()-this._footerHeight()};"function"==typeof s.stickyTop&&(t.top=s.stickyTop),e.css("overflow","hidden").stickyWidget(t)}s.footer&&s.stickyFooter&&i.stickyWidget({isFooter:!0,toggleWidth:!0,stickToEnd:!0,top:()=>a.offset().top+this._getHeaderHeight()})}s.pagination.showPageLinks?this.pageSelector$.click(e=>{let t=o(e.target).parent();t.length&&this.gotoPage(g(t.attr("data-page"))),e.preventDefault()}):s.pagination.showPageSelector&&this.pageSelector$.change(e=>{this.gotoPage(g(o(e.target).val()))}),i.find(".js-pg-first").click(()=>{this.firstPage()}),i.find(".js-pg-prev").click(()=>{this.previousPage()}),i.find(".js-pg-next").click(()=>{this.nextPage()}),i.find(".js-pg-last").click(()=>{this.lastPage()}),a.find(".js-load").click(()=>{this.loadMore()})},_footerHeight:function(){return this.footer$.outerHeight()||0},_addNextPage:function(){if(this.renderInProgress)return!1;let e=this.model.getTotalRecords();return(e<0||this.pageOffset+this.pageCount<e)&&(this.pageOffset+=this.pageCount,this._addPageOfRecords()),!0},_addPageOfRecords:function(e){var t,i,s,a,n,h,d=this._hasControlBreaks(),c=C(this.model),f=this,u=this.options,p=this._getDataRenderContext();function S(e,t,i,s,a){return e>=t||(i.attr(r,e),i.attr(l,t),_(i,e,t,s,a),!1)}function I(e,t,i,s){let a=s||0,r=i-t;return d&&(a=t+a,r=i,t=0,i+=e.filter(".a-GV-controlBreak").length),e.slice(t,i).filter((e,t)=>{let i=o(t);return i.hasClass("a-GV-controlBreak")&&(e<a&&(a+=1),r+=1),i.hasClass("a-GV-scrollFiller")&&(r=e),e>=a&&e<r})}function b(e,t,i){let s=t,o=a.find(`[data-rownum="${t+1}"]`);return(e&&!v(e)||!o.is(":visible"))&&(s=g(o[i?"nextAll":"prevAll"](".a-GV-row[data-rownum]:visible").first().attr("data-rownum"))||0),s}if(!this.renderInProgress){if(n=f.noData$.parent().children().not(".a-GV-altMessage"),(this.noData||this.moreData$.is(":visible"))&&(this.noData$.hide(),this.moreData$.hide(),n.show(),this.resize()),a=f._getDataContainer(),0!==this.pageOffset&&u.pagination.scroll||(this.pageFirstOffset="",this.pageLastOffset=""),u.pagination.scroll||(this.totalRenderedRecords=0),this.controlBreakCollapsed=!!d&&null,d)if(0!==this.pageOffset&&u.pagination.scroll){let e=this.model.getOption("metaField");if(e){let t=this.pageOffset-1;for(;t>0;){let i,s=this.model.recordAt(t);if(s&&(i=this.model.getValue(s,e),!i.agg)){h=!0===i.endControlBreak;break}t-=1}}}else h=!0;if(t=0,i=this.pageSize,u.pagination.scroll){if(f.hasScrollFillers){a.find(".a-GV-scrollFiller").each((function(){let e=o(this),t=g(e.attr(r)),s=g(e.attr(l));if(f.pageOffset>=t&&f.pageOffset<s)return i=Math.min(i,s+1-f.pageOffset),!1}))}}else this.pageOffset=m(this.pageOffset,i);s=this.pageOffset,this.renderInProgress=!0,this.model.forEachInPage(this.pageOffset,i,(function(_,C,T){var $,w,k;_&&(w=($=T?this.model.getRecordMetadata(T):{}).serverOffset,d&&!$.agg&&(!0,h&&(h=!1,k=this._controlBreakLabel(_),this._renderBreakRecord(p,!0,k,w)),$.endControlBreak&&(h=!0)),this._renderRecord(p,_,C,T,$),void 0!==w&&(w+=1,""===this.pageFirstOffset&&(this.pageFirstOffset=w),w>this.pageLastOffset&&(this.pageLastOffset=w)),t+=1),t!==i&&_||function(){let i,h,d,_,C,T,$,w=f.avgRowHeight;if(f.pageCount=t,f.totalRenderedRecords+=t,f.pageOffset+t>f.highWaterMark&&(f.highWaterMark=f.pageOffset+t),0===f.pageOffset&&0===t)f.noData=!0,n.hide(),f.moreData$.hide(),f.noData$.show(),u.autoAddRecord&&f.model.allowAdd()&&f._autoAddRecord();else{if(0===t)return f.renderInProgress=!1,void(u.pagination.scroll||(f.pageOffset-=f.pageSize,f.pageOffset<0&&(f.pageOffset=0),f._addPageOfRecords()));if(f.noData=!1,f.noData$.hide(),f.model.getDataOverflow()&&u.moreDataMessage?(f.moreData$.show(),n.hide()):(f.moreData$.hide(),n.show()),f.hasScrollFillers){i=a.find(".a-GV-scrollFiller"),d=f.model.getTotalRecords(!0)-1,C=d,0===i.length&&c?(h=f._getDataRenderContext(),f._renderFillerRecord(h,"a-GV-scrollFiller"),i=f._insertFiller(h,null),i.attr(r,0),i.attr(l,d),i=i.last()):0===i.last().next().length&&(C=g(i.last().attr(l))),d!==C&&i.last().attr(l,d),_=f._getRecordsPerRow();let e=-1,n=!1;if(i.each((function(i){let a,d=!1,c=o(this),u=g(c.last().attr(r)),m=g(c.last().attr(l));if(s===u?(d=S(s+t,m,c,_,w),f._insertData(p,s,t,c,"before"),e=i,n=!0):s+t<m?(S(s+t,m,c,_,w),h=f._getDataRenderContext(),f._renderFillerRecord(h,"a-GV-scrollFiller"),a=f._insertFiller(h,c),S(u,s-1,a,_,w),f._insertData(p,s,t,c,"before"),e=i+1,n=!0):s<=m&&s+t>m&&(d=S(u,s-1,c,_,w),f._insertData(p,s,t,c,"after"),e=i+1,n=!0),n)return d&&(e===i&&(e=i+1),c.remove()),!1})),n||(f._insertData(p,s,t),e=i.length),f.totalRenderedRecords>8*f.pageSize){let t,s,o,n,c,p,R,C=0,k=null,O=0,M=0,V=!1;if(u.fixedRowHeight||(T=a.find(`[data-rownum="${f.pageOffset+1}"]`),T[0]&&($=T.offset().top)),i=a.find(".a-GV-scrollFiller"),R=i.length-1,M>=e)M=-1,c=2*f.pageSize;else{for(k=i.eq(M);k.next().is(".a-GV-scrollFiller");)k=k.next();c=g(k.attr(l))}if(c>0&&(C=Math.abs(f.pageOffset-b(k,c+1,!0))),C>=3*f.pageSize)M>=0?(n=I(k.nextAll(),0,f.pageSize),O=n.not(".a-GV-controlBreak").length,o=n.first().is(":visible")&&n.last().is(":visible"),p=n.last().next().filter(".a-GV-scrollFiller"),p.length&&o===v(p)?(t=g(k.attr(r)),s=g(p.attr(l)),S(t,s,p,_,w),k.remove()):o===v(k)?(t=g(k.attr(r)),s=g(k.attr(l))+O,S(t,s,k,_,w)):(t=g(k.attr(l))+1,V=!0)):(t=c,s=t+f.pageSize,n=I(a.children(),t,s),O=n.not(".a-GV-controlBreak").length,o=n.first().is(":visible")&&n.last().is(":visible"),V=!0),V&&(h=f._getDataRenderContext(),f._renderFillerRecord(h,"a-GV-scrollFiller"),k=f._insertFiller(h,n.eq(0)),S(t,t+O-1,k,_,w),P(k,o));else{let u;if(C=0,R<e)R=-1,c=-1,u=a.children().not(".is-aggregate").last(),u.attr("data-id")&&(c=f.model.indexOf(f.model.getRecord(u.attr("data-id"))),c=m(c,f.pageSize)-f.pageSize);else{for(k=i.eq(R);k.prev().is(".a-GV-scrollFiller");)k=k.prev();c=g(k.attr(r))}c>0&&(C=Math.abs(f.pageOffset+f.pageSize-b(k,c-1,!1))),C>=3*f.pageSize&&(R>=0?(n=I(k.prevAll(),0,f.pageSize),O=n.not(".a-GV-controlBreak").length,o=n.first().is(":visible")&&n.last().is(":visible"),p=n.prev(".a-GV-scrollFiller"),p.length&&o===v(p)?(t=g(p.attr(r)),s=g(k.attr(l)),S(t,s,p,_,w),k.remove()):o===v(k)?(t=g(k.attr(r))-O,s=g(k.attr(l)),S(t,s,k,_,w)):(t=g(k.attr(r))-O,s=t+O-1,V=!0)):(t=d-c,s=t+f.pageSize,n=I(u.prevAll(),0,s,t),O=n.not(".a-GV-controlBreak").length,O>0&&(o=n.first().is(":visible")&&n.last().is(":visible"),V=!0,s=c-1,t=c-O)),V&&(h=f._getDataRenderContext(),f._renderFillerRecord(h,"a-GV-scrollFiller"),k=f._insertFiller(h,n.eq(0)),S(t,s,k,_,w),P(k,o)))}O>0&&(n.remove(),f.totalRenderedRecords-=O)}if(!u.fixedRowHeight){let e=0;f._updateAvgRowHeight(),R(f._getDataContainer(),_,f.avgRowHeight),T&&T[0]&&(e=T.offset().top-$),0!==e&&f.scrollParent$.scrollTop(f.scrollParent$.scrollTop()+e)}}else f._insertData(p,s,t)}if(f._updateTotalRecords(),f.renderInProgress=!1,!f.noData&&u.pagination.scroll&&(f.controlBreakCollapsed||!c&&a.height()<f.scrollParent$.height())){let t=f.model.getTotalRecords(),s=f.hasScrollFillers?f.pageOffset+f.pageCount:f.highWaterMark;if(t<0||s<t){let t=!0;if(f.pageOffset=s,f.hasScrollFillers&&(t=!1,i=a.find(".a-GV-scrollFiller"),i.each((function(){if(f.pageOffset===g(o(this).attr(r)))return t=!0,!1}))),t)return void f._addPageOfRecords(e)}}e&&e()}()}),this)}},_initPageSize:function(){let t,i,s,a,r=this.options,l=this._getRecordsPerRow();o.apex.stickyWidget&&this.element.find(".js-stickyWidget-toggle").stickyWidget("refresh"),this.hasScrollFillers&&(this.recPerRow!==l&&R(this._getDataContainer(),l,this.avgRowHeight),this._scrollPage()),this.recPerRow=l,this._updateAvgRowHeight(),t=this.avgRowHeight,r.hasSize?i=this.scrollParent$[0].offsetHeight:(i=this.scrollParent$.height(),this.footer$.hasClass("js-stickyWidget-toggle")&&(i-=this._footerHeight()),a=this._getStickyTop(),a>0&&(i-=a+this._getHeaderHeight())),i-=e.getScrollbarSize().height,s=Math.floor(i/t),s<1&&(s=1),this.viewportHeight=s*t,r.rowsPerPage||(r.fixedRowHeight||r.pagination.scroll?(s*=l,r.pagination.scroll?(this.pageSize=Math.max(40,2*s),this.pageSize=Math.ceil(this.pageSize/l)*l):this.pageSize=s):this.pageSize=20)},_updateStatus:function(){var e,t=this._selectedCount(),i="";this.options.hideDeletedRows&&(e=this._deletedCount()),t>0&&(i+=s.format(this._selectedStatusMessage(),t)),e>0&&(i&&(i+=", "),i+=p("DELETED_COUNT",e)+" "),this.status$.text(i)},_setModelValue:function(e,t,i,s,a){var o,r,l,n,d;e&&e.removeClass("is-active"),o=t.getValue(),a||(this.ignoreFieldChange=s),d=this.model.getRecordId(i),null!==(r=this.model.getValue(i,s))&&"object"==typeof r&&h(r,"v")&&(o={v:o,d:t.displayValueFor(o)}),"DUP"===this.model.setValue(i,s,o)?(this._setColumnItemValue(t,i,s),apex.message.alert(u("DUP_REC_ID"))):(l=t.getValidity(),n=this.model.getRecordId(i),l.valid?this.model.setValidity("valid",n,s):this.model.setValidity("error",n,s,t.getValidationMessage()),n!==d&&this._identityChanged(d,n)),a||(this.ignoreFieldChange=null)},_initColumnItems:function(e){var t,s,r,l,n,h=!0;for(this.columnItems={},this.columnItemsContainer$=null,this.asyncColumnItems=[],t=0;t<e.length;t++)n=null,(l=(s=e[t]).elementId)&&(f[l]?r=(n=this.columnItems[s.property]=f[l]).item:(r=a(l)).node&&(h=!1,f[l]=n=this.columnItems[s.property]={element$:o("#"+l).closest(".a-GV-columnItem"),item:r},r.whenReady&&this.asyncColumnItems.push(r.whenReady())),n&&!this.columnItemsContainer$&&(this.columnItemsContainer$=n.element$.parent()));this.columnItemsContainer$?h||this.columnItemsContainer$.find(":tabbable").addClass("js-tabbable").attr("tabindex",-1):this.editable&&i.error(`An editable ${this.widgetName} must have at least one column with a column item.`)},_waitForColumnItems:function(){return o.when(...this.asyncColumnItems)},_activateColumnItem:function(e,t){var i=e.element$;i.find(".js-tabbable").attr("tabindex",0).removeClass("js-tabbable"),t&&i.find(":tabbable").first().attr("aria-labelledby",t)},_deactivateColumnItem:function(e){var t=e.element$,i=t.find(":tabbable");i.first().removeAttr("aria-labelledby"),this.columnItemsContainer$.append(t),i.addClass("js-tabbable").attr("tabindex",-1)},_renderFieldDataValue:function(t,i,s,a,o){var r,l,n,c=null,g=this.options;(o&&o.url||i.linkTargetColumn)&&!a.agg&&(c=i.linkTargetColumn?this.model.getValue(s,i.linkTargetColumn)||null:o.url),r=this.model.getValue(s,i.property),(a.agg||a.inserted&&i.readonly)&&this.model.isIdentityField(i.property)&&(r=""),(i.linkText||i.linkAttributes||i.cellTemplate)&&((l=this.atOptions).model=this.model,l.record=s),c&&(t.markup("<a").attr("href",c),i.linkAttributes&&t.markup(d(i.linkAttributes,l)),t.markup(" tabindex='-1'>")),c&&i.linkText?t.markup(d(i.linkText,l)):i.cellTemplate?a.agg?(r=null==r?"":r,t.content(""+r)):(r=d(i.cellTemplate,l),g.highlighter&&(r=g.highlighter(g.highlighterContext,r,i)),t.markup(r)):null!==r&&""!==r||!(g.showNullAs||a.agg||c)?(null===r&&(r=""),"object"==typeof r&&h(r,"d")?r=r.d:(n=this.columnItems[i.property])&&(r=n.item.displayValueFor(r,{readonly:o&&!!o.ck||i.readonly||a.deleted||!1,disabled:o&&o.disabled||!1})),!1!==i.escape&&(r=e.escapeHTML(""+r)),g.highlighter&&(r=g.highlighter(g.highlighterContext,r,i)),t.markup(r)):(r=a.agg||a.inserted||o&&(o.changed||o.error||o.warning)?"":c||g.showNullAs,t.content(r)),c&&t.markup("</a>")},_beginSetColumnItems:function(){this.reinitCallbacks=[]},_setColumnItemValue:function(e,t,i,s){var a,o=null,r=this.model.getValue(t,i);null!==r&&"object"==typeof r&&h(r,"d")&&(o=r.d,r=r.v),this.reinitCallbacks?(a=e.reinit(r,o))&&this.reinitCallbacks.push(a):e.setValue(r,o),s&&(s.fields&&s.fields[i]&&s.fields[i].disabled?e.disable():e.enable())},_endSetColumnItems:function(){var e,t=this.reinitCallbacks;if(t)for(e=0;e<t.length;e++)t[e]();this.reinitCallbacks=null},_autoAddRecord:function(e){var t=this.model.insertNewRecord(null,e);this.model.getRecordMetadata(t).autoInserted=!0},_triggerBeginEditing:function(e,t){this.element.trigger("apexbeginrecordedit",[{model:this.model,record:e,recordId:t}])},_triggerEndEditing:function(e,t){this.element.trigger("apexendrecordedit",[{model:this.model,record:e,recordId:t}])},_updateHighlights:function(){let t=this.options,i=[],s="";for(const[s,a]of e.objectEntries(t.highlights))a.id=s,i.push(a);i.sort((e,t)=>t.seq-e.seq);for(let e=0;e<i.length;e++){let t=i[e];t.cssClass||(t.cssClass=(t.row?"hlr_":"hlc_")+t.id),(t.color||t.background)&&(t.row?s+="."+t.cssClass+" td":s+="td."+t.cssClass,s+=" { ",t.color&&(s+="color: "+t.color+" !important; "),t.background&&(s+="background-color: "+t.background+" !important; "),s+="}\n")}!this.gridStyles$&&s&&(this.gridStyles$=o("<style type='text/css'></style>"),o("head").append(this.gridStyles$)),this.gridStyles$&&(this.gridStyles$=this.gridStyles$.text(s))},_findStateIcon:function(e){return this.stateIcons$.find(`[data-state='${e}']`)},_setOption:function(e,t){var s=this.options;this._super(e,t),"noDataMessage"===e?this.element.find(".a-GV-altMessage > .a-GV-altMessage-text").text(t):"noDataIcon"===e?this.element.find(".a-GV-altMessage > .a-GV-altMessage-icon span").attr("class","a-Icon "+t):"rowsPerPage"===e?(s.pagination.scroll&&!s.pagination.loadMore&&(i.warn("Ignoring rowsPerPage when scroll pagination."),s.rowsPerPage=null),s.rowsPerPage&&(this.pageSize=s.rowsPerPage)):"hideDeletedRows"===e?(this.element.toggleClass("a-GV--hideDeleted",t),!0===t&&this.element.find(".is-deleted").removeClass("is-selected").removeAttr("aria-selected"),this._updateStatus()):"scrollParentOverride"===e?s.hasSize?i.warn("Ignoring scrollParentOverride when hasSize is true."):this._updateScrollHandler():"applyTemplateOptions"===e&&(this.atOptions=o.extend(!0,{},s.applyTemplateOptions||{},{extraSubstitutions:{}}))},_updateScrollHandler:function(e){let t=this.options,i=this.scrollParent$,s=t.scrollParentOverride;t.hasSize?(this.scrollParent$=e,this.scrollDelta=0):(this.scrollParent$=o(s||window),this.scrollDelta=this.element.offset().top-this._getStickyTop()),this.totalRenderedRecords=0,t.pagination.scroll&&!t.pagination.loadMore&&(i&&this._scrollHandler?i.off("scroll",this._scrollHandler):this._scrollHandler=()=>{this.element[0].clientWidth>0&&this._scrollPage()},this.scrollParent$.on("scroll",this._scrollHandler))},_removeScrollHandler:function(){this._scrollHandler&&(this.scrollParent$.off("scroll",this._scrollHandler),this._scrollHandler=null)},_scrollPage:function(){var e=this,t=this.scrollParent$.scrollTop();t!==this.lastScrollTop&&(this.lastScrollTop=t,this.scrollPageTimer||(this.scrollPageTimer=setTimeout((function(){let t,i,s,a,n,h,d,c,f=null,u=!1,p=C(e.model),_=e.scrollParent$[0]===window,R=e.avgRowHeight;if(e.scrollPageTimer=null,e.renderInProgress)return e.lastScrollTop=null,void e._scrollPage();if(a=e.scrollParent$.height(),n=0-a/2,a*=2,h=n+a,t=e._getDataContainer(),i=e.scrollParent$.scrollTop(),e.hasScrollFillers&&(f=t.find(".a-GV-scrollFiller"),!f.length&&p&&e._removeScrollHandler(),s=e.pageOffset,c="TBODY"===t[0].nodeName,f.each((function(){var t,d,f=o(this),p=g(this.style.height),C=g(f.attr(r)),S=g(f.attr(l));if(C!==S)return d=_?f.offset().top:f.position().top,(_||c||f.offsetParent().closest(e.scrollParent$).length>0)&&(d-=i),t=d+p,d<=h&&t>=n?(e.pageOffset=p<2*a||d>n?C:m(t<h?S:C+Math.ceil((n+a/2-d)*e._getRecordsPerRow()/R),e.pageSize),e.pageOffset!==s&&e._addPageOfRecords(),u=!0,v(f)||P(f,!0),!1):void 0}))),!(u||p&&e.hasScrollFillers)){let s=t.height();(_||t.offsetParent().closest(e.scrollParent$).length>0)&&(s+=_?t.offset().top:t.position().top),s-=i,s>0&&s<=1.5*a&&(d=e.model.getTotalRecords(),d<0||e.highWaterMark<d?(e.pageOffset=e.highWaterMark,e._addPageOfRecords()):(f&&0===f.length||!f&&d===e.totalRenderedRecords)&&e._removeScrollHandler())}}),300)))},_updateTotalRecords:function(){var e,t,i,s,a,r,l,h,d=null,c=null,g=this.options,f=this.footer$,m=this.pageSelector$,_=g.pagination,R=this.model.getTotalRecords(),v=this.model.getServerTotalRecords();if(R>=0&&(d=Math.ceil(R/this.pageSize),c=Math.floor(this.pageOffset/this.pageSize)),null!==this.lastScrollLeft&&(this.scrollParent$.scrollLeft(this.lastScrollLeft),this.scrollParent$.scrollTop(this.lastScrollTop),this.lastScrollLeft=null,this.lastScrollTop=null),this.onLastPage=!1,0===this.pageCount&&0===this.pageOffset?(s="",this.onLastPage=!0,f.find(n).attr("disabled",!0)):(f.find(n).attr("disabled",!1),this.element.find(".js-load").attr("disabled",!1),0===this.pageOffset&&f.find(".js-pg-prev,.js-pg-first").attr("disabled",!0),R>0&&c===d-1&&(this.onLastPage=!0,f.find(".js-pg-next,.js-pg-last").attr("disabled",!0),this.element.find(".js-load").attr("disabled",!0)),l=C(this.model),s=_.scroll&&_.virtual&&!_.loadMore&&l?p("TOTAL_PAGES",v):l?_.hideSinglePage&&1===d?p("TOTAL_PAGES",v):p("PAGE_RANGE_XYZ",this.pageFirstOffset,this.pageLastOffset,v):p("PAGE_RANGE_XY",this.pageFirstOffset,this.pageLastOffset)),document.activeElement&&document.activeElement.disabled&&o(document.activeElement).hasClass("js-load")&&this.focus(),this.pageRange$.text(s),d>0){if(_.showPageLinks){if(r=`${R}_${this.pageSize}_${c}`,this.pageKey!==r){for(h="<li class='a-GV-pageSelector-item'>…</li>",this.pageKey=r,a="<ul class='a-GV-pageSelector-list'>",(t=c-Math.floor(_.maxLinks/2))<0&&(t=0),(i=t+_.maxLinks)>=d&&(t=(i=d)-_.maxLinks)<0&&(t=0),t>0&&(a+=h),e=t;e<i;e++)a+=`<li class='a-GV-pageSelector-item' data-page='${e}'><button class='a-GV-pageButton' type='button'>${e+1}</button></li>`;i<d&&(a+=h),a+="</ul>",m.html(a)}m.find(".is-selected").removeClass("is-selected"),m.find(`[data-page='${c}']`).addClass("is-selected")}else if(_.showPageSelector){if(r=`${R}_${this.pageSize}`,this.pageKey!==r){for(this.pageKey=r,a=`<select class='a-GV-pageSelectlist' size='1' aria-label='${u("PAGE_SELECTION")}'>`,e=0;e<d;e++)a+=`<option value='${e}'>${p("SELECT_PAGE_N",e+1)}</option>`;a+="</select>",m.html(a)}m.children("select").val(c)}}else m.empty(),this.pageKey=null;_.hideSinglePage&&!_.scroll&&(f.find(n).add(m)[1===d?"hide":"show"](),f.find(".js-rangeDisplay")[l?"show":"hide"]()),f[this.noData&&g.hideEmptyFooter?"hide":"show"]()},_updateAvgRowHeight:function(){let e;if(this.options.fixedRowHeight)e=this._getFixedRecordHeight();else{let t,i=this._getRecordsPerRow(),s=Math.ceil(this.totalRenderedRecords/i);s<=0?e=this.avgRowHeight||this._getFixedRecordHeight():(t=this._getDataContainer().height(),this._getDataContainer().find(".a-GV-scrollFiller").each((function(){t-=o(this).height()})),e=t/s)}e<=0&&(e=43),this.avgRowHeight=e},_getStickyTop:function(){let e=this.options.stickyTop;return"function"==typeof e?e():0},_getHeaderHeight:function(){return 0},_getRecordsPerRow:function(){return 1},_getDataRenderContext:function(){return e.htmlBuilder()},_selectedCount:function(){return 0},_selectedStatusMessage:function(){return s.getMessage(this.options.selectionStatusMessageKey)},_deletedCount:function(){return 0},_hasControlBreaks:function(){return!1},_elementsFromRecordIds:function(){return[]},_renderFillerRecord:function(){},_insertFiller:function(){return o()},_insertData:function(){},_controlBreakLabel:function(){return{}},_renderBreakRecord:function(e,t,i){e.markup("<h3>").content(i.label).markup("</h3>")},_renderRecord:function(){},_removeRecord:function(){},_insertRecord:function(){return o()},_afterInsert:function(){},_identityChanged:function(){},_replaceRecord:function(){},_updateRecordField:function(){},_removeFocus:function(){},_updateRecordState:function(){}});const S=o.ui.keyCode,I=/^\s*<[\w]+[^>]*>/,b=/<([^ <>]*)/;function T(e){e.APEX$ROW_STATE_CLASSES=e.APEX$AGG=e.APEX$AGG_TOTAL=e.APEX$ROW_URL=e.APEX$ROW_ID=e.APEX$ROW_INDEX=e.APEX$VALIDATION_MESSAGE=null}o.widget("apex.tableModelView",o.apex.tableModelViewBase,{version:"21.1",widgetEventPrefix:"tableModelView",options:{headerTemplate:"",beforeTemplate:"<ul>",recordTemplate:"",controlBreakTemplate:"",aggregateTemplate:"",afterTemplate:"</ul>",syncHeaderHScroll:!1,collectionClasses:null,iconClassColumn:null,imageURLColumn:null,imageAttributes:null,labelColumn:null,linkTarget:!1,linkTargetColumn:null,linkAttributes:null,useIconList:!1,iconListOptions:{},constrainNavigation:!0,selectionChange:null,pageChange:null},_create:function(){var e=this.options,t=this.element;i.info(`TableModelView '${t[0].id}' created. Model: ${e.modelName}`),t.addClass("a-TMV"),e.fixedRowHeight||t.addClass("a-TMV--variableHeight"),this.recordHeight=null,this.recPerRow=null,this._super(),this._initModel(e.modelName),this._on(this._eventHandlers),this._initRecordTemplate(),this.refresh(),e.disabled&&this._setOption("disabled",e.disabled)},_eventHandlers:{keydown:function(e){var t,i=this.options,s=e.which;i.useIconList&&!e.isDefaultPrevented()&&(!(t=this.getIconList().options).navigation&&t.noNavKeyContent&&o(e.target).closest(t.noNavKeyContent).length||(s!==S.DOWN&&s!==this.getIconList().forwardKey||!i.pagination.loadMore?(s===S.UP||s===this.getIconList().backwardKey)&&i.pagination.loadMore&&o(e.target).hasClass("js-load")&&(this.getIconList().focus(),e.preventDefault()):this.element.find(".js-load").not(":disabled").focus()[0]&&e.preventDefault(),!i.constrainNavigation||s!==S.DOWN&&s!==S.UP&&s!==S.LEFT&&s!==S.RIGHT&&s!==S.PAGE_UP&&s!==S.PAGE_DOWN||e.preventDefault()))},resize:function(e){e.target===this.element[0]&&(this.resize(),e.stopPropagation())}},_destroy:function(){this._tableModelViewDestroy(),this.element.removeClass("a-TMV is-disabled").empty(),this.data$=null,this._initModel(null)},_setOption:function(e,t){if(i.info(`TabelModelView '${this.element[0].id}' set option '${e}' to: ${t}`),"iconListOptions"===e)throw new Error(`TabelModelView '${e}' cannot be set. Set options directly on the iconList widget`);if(this._super(e,t),"disabled"===e){if(this.element.toggleClass("is-disabled",t),this.options.useIconList)return this.getIconList().option(e,t);t&&this.resize()}else"modelName"===e?(this._initModel(t),this.refresh(!1)):"highlights"===e?this._updateHighlights():"hideEmptyFooter"===e?this._updateTotalRecords():"fixedRowHeight"===e?(this.element.toggleClass("a-TMV--variableHeight",!t),this.refresh()):["beforeTemplate","recordTemplate","afterTemplate","collectionClasses","iconClassColumn","imageURLColumn","imageAttributes","labelColumn","linkTarget","linkTargetColumn","linkAttributes"].includes(e)?(this._initRecordTemplate(),this.refresh()):["footer","useIconList","pagination","rowsPerPage"].includes(e)&&this.refresh()},refresh:function(e){var t,i=!1,s=this.options,a=this,r=this.element;if(!0!==e&&(i=this._paginationHasFocus()),void 0===e&&(e=o(document.activeElement).closest(r).length>0),!this._refreshCheckIfVisible())return;let l=this.modelChanged;this.modelChanged=!1,this.data$&&(t=this.getSelectedRecords()),!s.hasSize&&this.data$&&r.css("min-height",r.height()+"px"),this._refreshPagination(r.find(".a-TMV-w-scroll")),this._initView(),this._updateStatus(),this.resize(),this._addPageOfRecords((function(){i&&(a._restorePaginationFocus(i),e=!1),s.hasSize||r.css("min-height",""),t&&t.length>0?a.setSelectedRecords(t,e):(l&&a._trigger("selectionChange",{}),e&&a.focus())}))},resize:function(){var e,t,i=this.element,s=this.options,a=i.height(),o=i.children().first(),r=i.find(".a-TMV-w-scroll");null!==i[0].offsetParent&&(o.length&&!this.pendingRefresh?(e=i.width(),r.width(e),this.recordHeight=null,this.recPerRow=null,s.hasSize&&(t=a-this._footerHeight(),o.height(t),r.height(t-(i.find(".a-TMV-hdr").height()||0))),s.useIconList&&this.data$.iconList("resize"),this._initPageSize()):this.refresh())},focus:function(){var e=this.getIconList();if(e)return e.focus();this.data$.find(":focusable").first().focus()},getSelection:function(){var e=this.getIconList();return e?e.getSelection():null},setSelection:function(e,t,i){var s=this.getIconList();if(s)return s.setSelection(e,t,i)},getRecords:function(e){var t,i,s=this,a=[];return e.each((function(){(t=o(this).attr("data-id"))&&(i=s.model.getRecord(t))&&a.push(i)})),a},getSelectedRecords:function(){return this.options.useIconList&&this.data$?this.getRecords(this.getSelection()):null},setSelectedRecords:function(e,t,i){var s,a=[],r={};if(this.options.useIconList&&this.data$){for(s=0;s<e.length;s++)r[this.model.getRecordId(e[s])]=1;this.data$.children().each((function(){var e=o(this).attr("data-id");r[e]&&a.push(this)})),this.setSelection(o(a),t,i)}},getIconList:function(){return this.options.useIconList&&this.data$?this.data$.data("apex-iconList"):null},_initRecordTemplate:function(){var e,t,i=this.options;if(!i.recordTemplate){if(i.collectionClasses||(i.collectionClasses="a-TMV-defaultIconView"),!i.labelColumn)throw new Error("Option recordTemplate or labelColumn is required");i.beforeTemplate="<ul>",i.afterTemplate="</ul>",e="<li data-id='&APEX$ROW_ID.' data-rownum='&APEX$ROW_INDEX.' class='&APEX$ROW_STATE_CLASSES.'>",i.linkTarget||i.linkTargetColumn?(e+=`<a href='&${i.linkTargetColumn?i.linkTargetColumn:"APEX$ROW_URL"}.' class='a-IconList-content' ${i.linkAttributes?i.linkAttributes:""}>`,t="</a>"):(e+="<span class='a-IconList-content'>",t="</span>"),(i.iconClassColumn||i.imageURLColumn)&&(e+="<span class='a-IconList-icon'>",i.iconClassColumn?e+=`<span class='&${i.iconClassColumn}.'></span>`:e+=`<img src='&${i.imageURLColumn}.' ${i.imageAttributes?i.imageAttributes:""}/>`,e+="</span>"),e+=`<span class='a-IconList-label'>&${i.labelColumn}.</span>${t}</li>`,i.recordTemplate=e}let s=this.atOptions;s.model=this.model,s.record=null,T(s.extraSubstitutions),I.exec(d(i.recordTemplate,s))||(d(i.beforeTemplate,s).toLowerCase().match(/<ul|<ol/)?i.recordTemplate=`<li>${i.recordTemplate}</li>`:i.recordTemplate=`<div>${i.recordTemplate}</div>`)},_initView:function(){var t,i,s,a,o=this,r=this.element,l=this.options,n=0,h=0,c=null,g=this._getDataRenderContext(),f=this.atOptions,u=f.extraSubstitutions;function p(){n!==h&&(s[0].scrollLeft=n=h,a[0].scrollLeft=n,i.css("left",n)),c=null}f.model=this.model,f.record=null,T(u),this.recordElement="div",(t=b.exec(d(l.recordTemplate,f)))&&t.length>1&&(this.recordElement=t[1].toLowerCase()),g.markup("<div").attr("class","a-TMV-body").markup(">"),this._renderAltDataMessages(g);let m=[];for(const[,t]of e.objectEntries(this.model.getOption("fields")))m.push(t);m.sort((e,t)=>e.seq-t.seq),u.APEX$COLUMNS=m,l.headerTemplate&&g.markup(`<div class='a-TMV-hdr'>${d(l.headerTemplate,f)}</div>`),g.markup("<div").attr("class","a-TMV-w-scroll").markup(">").markup(d(l.beforeTemplate,f)).markup(`<${this.recordElement} class='js-data-placeholder' style='display:none;'></${this.recordElement}>`).markup(d(l.afterTemplate,f)),this._renderLoadMore(g),g.markup("</div></div>"),this._renderFooter(g),r.html(g.toString()),this.data$=r.find(".js-data-placeholder").parent(),this.data$.empty().addClass(l.collectionClasses||""),l.useIconList&&(this.data$.iconList(l.iconListOptions),this.data$.on("iconlistselectionchange",(function(e){o._updateStatus(),o._trigger("selectionChange",e)}))),a=r.find(".a-TMV-w-scroll"),s=r.find(".a-TMV-hdr"),this._initPagination(s,r.find(".a-TMV-w-scroll")),l.headerTemplate&&l.syncHeaderHScroll&&(i=this.data$.find(".a-GV-loadMoreButton"),a.on("scroll.tmvss",(function(){h=this.scrollLeft,c||(c=e.invokeAfterPaint(p))})),s.on("scroll.tmvss",(function(){h=this.scrollLeft,c||(c=e.invokeAfterPaint(p))})))},_initRecordMetrics:function(){let e,t=0,i=!1,s=this.options;if(T(this.atOptions.extraSubstitutions),this.atOptions.record=null,this.recPerRow=1,e=this.data$.children().filter(":visible").first(),!e.length){let t,a="";for(t=0;t<20;t++)a+=d(s.recordTemplate,this.atOptions);e=o(a),e=this.data$.append(e).children().filter(":visible").first(),s.useIconList&&this.getIconList().refresh(),i=!0}if(s.useIconList)this.recPerRow=this.getIconList().getColumns();else{let i=e,s=i.length>0?Math.trunc(i.offset().top):0,a=s,o=0;for(;a===s&&i[0];)o+=1,i=i.next(),i[0]&&(a=Math.trunc(i.offset().top));this.recPerRow=o,t=a-s}this.recPerRow<1&&(this.recPerRow=1),0===t&&(t=e.outerHeight(!0),"grid"===this.data$.css("display")&&(t+=g(this.data$.css("grid-row-gap")))),this.recordHeight=t||43,i&&this.data$.empty()},_getHeaderHeight:function(){return this.element.find(".a-TMV-hdr").outerHeight()},_getFixedRecordHeight:function(){return this.recordHeight||this._initRecordMetrics(),this.recordHeight},_getRecordsPerRow:function(){return this.recPerRow||this._initRecordMetrics(),this.recPerRow},_getDataContainer:function(){return this.data$},_selectedCount:function(){return this.options.useIconList?this.getIconList().getSelection().length:0},_hasControlBreaks:function(){return null!=this.options.controlBreakTemplate},_elementsFromRecordIds:function(e){var t,i,s=[];for(t=0;t<e.length;t++)(i=this.data$.children(`[data-id='${e[t]}']`))[0]&&s.push(i);return s},_renderFillerRecord:function(e,t){e.markup(`<${this.recordElement} class='${t}'></${this.recordElement}>`)},_insertFiller:function(e,t){var i=o(e.toString());return t?t.before(i):this.data$.html(i),i},_insertData:function(e,t,i,s,a){var o,r;s?s[a](e.toString()):this.data$.append(e.toString()),this.options.useIconList&&(r=(o=this.element.find(".a-TMV-w-scroll")).scrollTop(),this.getIconList().refresh(),o.scrollTop(r)),this.atOptions.clearItemCache=!0,this._trigger("pageChange",null,{offset:t,count:i})},_controlBreakLabel:function(e){return{record:e}},_renderBreakRecord:function(e,t,i,s){var a,o=this.options,r=this.atOptions,l=r.extraSubstitutions;T(l),r.model=this.model,r.record=i.record,l.APEX$ROW_INDEX=null!=s?""+(s+1):"",a=d(this.options.controlBreakTemplate,r),o.highlighter&&(a=o.highlighter(o.highlighterContext,a)),e.markup(a),this.atOptions.clearItemCache=!1},_renderRecord:function(e,t,i,s,a){var o,r,l=this.options,n=l.recordTemplate,h="",c=this.atOptions,g=c.extraSubstitutions;if(T(g),a.agg){if(!l.aggregateTemplate)return;n=l.aggregateTemplate,g.APEX$AGG=a.agg,g.APEX$AGG_TOTAL=a.grandTotal?"Y":""}else a.url&&(g.APEX$ROW_URL=a.url),a.deleted?h+=" is-deleted":(a.inserted?h+=" is-inserted":a.updated&&(h+=" is-updated"),a.error?h+=" is-error":a.warning&&(h+=" is-warning"),a.highlight&&((o=l.highlights[a.highlight])&&o.cssClass?h+=" "+o.cssClass:h+=" "+a.highlight),a.message&&(g.APEX$VALIDATION_MESSAGE=a.message)),h&&(g.APEX$ROW_STATE_CLASSES=h);g.APEX$ROW_ID=""+s,g.APEX$ROW_INDEX=""+(i+1),c.model=this.model,c.record=t,r=d(n,c),l.highlighter&&!a.agg&&(r=l.highlighter(l.highlighterContext,r)),e.markup(r),this.atOptions.clearItemCache=!1},_removeRecord:function(e){e.remove()},_insertRecord:function(t,i,s,a,r){var l,n=e.htmlBuilder();return this._renderRecord(n,i,null,s,a),this.atOptions.clearItemCache=!0,l=o(n.toString()),"after"===r&&t?t.after(l):this.data$.prepend(l),this.options.useIconList&&this.getIconList().refresh(),l},_afterInsert:function(){},_identityChanged:function(e,t){var i,s,a=this._elementsFromRecordIds([e])[0];a&&(i=this.model.getRecord(t),s=this.model.getRecordMetadata(t),this._replaceRecord(a,i,e,t,s))},_replaceRecord:function(t,i,s,a,o){var r=e.htmlBuilder();this._renderRecord(r,i,void 0,a,o),this.atOptions.clearItemCache=!0,t.replaceWith(r.toString()),this.options.useIconList&&this.getIconList().refresh()},_removeFocus:function(){},_updateRecordState:function(e,t,i,s){this._replaceRecord(e,i,t,t,s)}})}(apex.util,apex.model,apex.debug,apex.lang,apex.item,apex.jQuery);
!function(e,t,l,s,a,i,o,n){"use strict";const r=".a-GV-header,.a-GV-headerGroup,.a-GV-cell,.a-GV-controlBreakHeader",d="a-GV-controlBreak",h="a-GV-controlBreakHeader",c="is-selected",u="."+c,f="is-focused",p="is-active",m="."+p+".a-GV-cell",g="aria-multiselectable",C="aria-readonly",v="u-RTL",_="a-GV-frozen",b="a-GV-frozen--start",w="a-GV-frozen--startLast",G="a-GV-frozen--endLast",x="none",H="label",I="true",V=e.hasOwnProperty,y=e.objectEntries,S=n.extend,R=Array.isArray,k=n.ui.keyCode,$=navigator.appVersion.includes("Mac"),M=e.invokeAfterPaint,D=e=>parseInt(e,10);let F=0;const E={begin:function(e,t,l){1===l.length&&t.records&&1===t.records.length?this.text="":(this.table=!0,this.text="<table><tbody>")},beginRow:function(){this.table&&(this.text+="<tr>")},cell:function(t,l,s,a){this.table?this.text+=`<td>${e.escapeHTML(a)}</td>`:this.text+=e.escapeHTML(a)},endRow:function(){this.table&&(this.text+="</tr>")},end:function(){this.table&&(this.text+="</tbody></table>")},toString:function(){return this.text}};function T(e,t){var l="";return"start"===e?l=" u-tS":"end"===e?l=" u-tE":"left"===e?l=" u-tL":"right"===e?l=" u-tR":"center"!==e||t||(l=" u-tC"),l}function A(e,t,l){var s;return e.highlight&&((s=t.highlights[e.highlight])&&s.cssClass?l+=" "+s.cssClass:l+=" "+e.highlight),l}function W(e,t,l,s,a){var i="a-GV-row";return e.agg?(i+=" is-aggregate",i+=" a-GV-aggregate--"+e.agg,e.grandTotal&&(i+=" is-grandTotal")):((e.sel||l)&&(i+=" "+c),e.deleted?i+=" is-deleted":(e.inserted?i+=" is-inserted":e.updated&&(i+=" is-updated"),e.error?i+=" is-error":e.warning&&(i+=" is-warning"),i=A(e,t,i),s.allowEdit(a)||(i+=" is-readonly"))),i}function P(e,t,l,s,a,i,o){let n,r=!1,d="a-GV-cell";return d+=T(e.alignment),e.columnCssClasses&&(d+=" "+e.columnCssClasses),e.cellCssClassesColumn&&(d+=" "+i.getValue(o,e.cellCssClassesColumn)),a&&([c,f,p,_,w,G].forEach(e=>{a.hasClass(e)&&(d+=" "+e)}),n=/(^|\s)a-GV-frozen--(start|end)\d+(\s|$)/.exec(a.attr("class")),n&&(d+=" "+n[0].trim())),l&&(t.deleted||(l.error?d+=" is-error":l.warning?d+=" is-warning":l.changed?d+=" is-changed":l.stale&&(d+=" is-stale")),d=A(l,s,d),l.disabled&&(d+=" is-disabled"),r=l.ck),(r||e.readonly)&&(d+=" is-readonly"),e.usedAsRowHeader&&!t.agg&&(d+=" a-GV-rowHeader"),d}function L(e){return s.getMessage("APEX.GV."+e)}function N(e){var t=Array.prototype.slice.call(arguments);return t[0]="APEX.GV."+e,s.formatMessage.apply(s,t)}const z=e.binarySearch;function B(e,t){return e.offset-t.offset}function K(e){return e.parent().children().index(e)}function O(e){var t=n(e.toString());return t.find("a,button,input,select,textarea").prop("tabIndex",-1),t}function q(e){return n(e).closest(r)}function j(e){return n(e).closest(".a-GV-cell,.a-GV-controlBreakHeader")}function U(e){return n(e).closest(".a-GV-cell")}function X(e,t){var l,s,a=e.children();return a.last().hasClass("a-GV-headerGroup")?(s=0,a.each((function(){if((s+=D(n(this).attr("colspan"))||1)>t)return l=n(this),!1}))):l=a.eq(t),l}function Q(e){var t;return e.hasClass("a-GV-headerGroup")?(t=0,e.parent().children().each((function(){if(this===e[0])return!1;t+=D(n(this).attr("colspan"))||1}))):t=K(e),t}function Y(e){n("body").on("keydown.gridGlobalEscape",(function(t){t.which===k.ESCAPE&&(n("body").off("keydown.gridGlobalEscape"),e())}))}function J(){n("body").off("keydown.gridGlobalEscape")}function Z(e){var t=e.groupName||null;return t&&e.useGroupFor&&e.useGroupFor.indexOf("heading")<0&&(t=null),t}function ee(e){return e.closest("tr")}const te=function(e,t,l){e.element.hasClass("a-GV")&&(e._updateStatus(),t&&e._trigger("selectionChange",l))},le=e.debounce(te,1),se=e.debounce(te,350);n.widget("apex.grid",n.apex.tableModelViewBase,S(!0,{version:"21.1",widgetEventPrefix:"grid",options:{columns:null,columnGroups:null,columnSort:!0,columnSortMultiple:!0,resizeColumns:!0,reorderColumns:!0,collapsibleControlBreaks:!0,aggregateLabels:{},aggregateTooltips:{},tabbableCellContent:"a,button,input",allowEditMode:!0,allowDelete:!0,allowInsert:!0,allowCopy:!0,skipReadonlyCells:!1,rowHeader:x,rowHeaderCheckbox:!1,rowHeaderLabelColumn:null,rowHeaderWidth:null,selectCells:!1,multiple:!1,multipleCells:!0,selectAll:!0,allowSelectHidden:!1,tooltip:{tooltipClass:"a-GV-tooltip"},dataTransferFormats:[{format:"text/plain",writer:Object.create({begin:function(){this.text=""},beginRow:function(e){e>0&&(this.text+="\r\n")},cell:function(e,t,l,s){e>0&&(this.text+="\t"),this.text+=s},endRow:function(){},end:function(){},toString:function(){return this.text}})},{format:"text/html",writer:Object.create(E)}],constrainNavigation:!0,selectionChange:null,activateColumnHeader:null,activateCell:null,expansionChange:null,cancelColumnHeader:null,sortChange:null,columnReorder:null,columnResize:null,modeChange:null,pageChange:null},_create:function(){var e=this,t=this.options,s=this.element;l.info(`Grid '${s[0].id}' created. Model: ${t.modelName}`),s.addClass("a-GV").attr("role","grid"),t.multiple&&s.attr(g,I),t.editable||s.attr(C,I),t.fixedRowHeight||s.addClass("a-GV--variableHeight"),this.forwardKey=k.RIGHT,this.backwardKey=k.LEFT,"rtl"===s.css("direction")&&(s.addClass(v),this.forwardKey=k.LEFT,this.backwardKey=k.RIGHT),this._enforceOptionConstraints(),this._super(),this.origLabelBy=s.attr("aria-labelledby"),F+=1,this.idPrefix=s[0].id||"agv_"+F,this.accContextId=this.idPrefix+"_ctx",this.curRowHeaders="",this.tableHeader$=null,this.tableData$=null,this.lastEditModeCell=null,this.controlBreaks=[],this.editMode=!1,this.columns=null,this.columnsStale=!0,this.columnGroups=null,this.lastFrozenColIndex=-1,this.endFrozenColIndex=-1,this.lastFocused=null,this.lastRow$=null,this.focusInHeader=!1,this.lastHoverCell=null,this.lastHoverRow=null,this.lastColIndex=null,this.columnControls$=null,this.scrollTimerId=null,this.deactivateDelayTimer=null,this.lastFloatingPos={},this.allSelected=!1,this.hasSelection=!1,this.activateContext=null,this.gotoCellPending=null,this._initContextMenu("tr",(function(t){return n(t.target).closest("a").length>0||e.editMode}),(function(t){var l;if((l=U("keydown"===t.type?this.lastFocused:t.target)).length){if(e.options.selectCells){if(!l.hasClass(c))return l}else if(!l.parent().hasClass(c))return l;return!0}return!1}),(function(t){e.options.selectCells?t.selectedRange=e.getSelectedRange():t.selectedRecords=e.getRecords(t.selection)})),this._initModel(t.modelName),this._on(this._eventHandlers),t.allowCopy&&i.addHandler(s[0],(function(t){return!e.editMode&&(e._copy(t),!0)})),this._updateHighlights(),this.refresh(),this._setSelectionMode(),t.disabled&&this._setOption("disabled",t.disabled)},_eventHandlers:{resize:function(e){e.target===this.element[0]&&(this.resize(),e.stopPropagation())},click:function(e){var t,l=this.options,s=n(e.target);if(s.closest("a,button,.a-GV-footer").length)(t=s.closest(".a-GV-header,.a-GV-headerGroup")).length?(this.focusInHeader=!0,this.lastColIndex=null,this._select(t,e,!0,!1)):(t=s.closest(".a-GV-cell,.a-GV-controlBreakHeader")).length&&!this.editMode&&(this.focusInHeader=!1,this.lastColIndex=null,this._select(t,"none",!1,!1),s.focus());else if(!(s.closest(".a-GV-floatingItem").length>0)){if((t=s.closest(".a-GV-selHeader.a-GV-header")).length)return this.focusInHeader=!0,this.lastColIndex=null,void(l.rowHeaderCheckbox&&l.multiple&&l.selectAll&&!l.selectCells?(t.find(".u-selector").attr("aria-checked")===I?this.setSelection(n()):!l.pagination.scroll&&l.persistSelection&&e.shiftKey?(this.focusInHeader=!1,this._select(this._getAllRows().map((function(){return n(this).children()[0]})),"add",!1,!1),this.focusInHeader=!0):this.selectAll(),this._select(t,e,!0,!1),this._setFocusable(t[0])):this._select(t,e,!0,!1));if((t=s.closest(".a-GV-headerGroup")).length)return this.focusInHeader=!0,this.lastColIndex=null,this._select(t,e,!0,!1),void e.preventDefault();if((t=s.closest(".a-GV-header")).length&&0===s.closest("button").length)return this.focusInHeader=!0,this.lastColIndex=null,this._select(t,e,!0,!1),this._activateColumnHeader(e,t),void e.preventDefault();if((t=s.closest(".a-GV-selHeader")).length)return l.rowHeaderCheckbox&&!l.selectCells&&(e.ctrlKey=!0,e.shiftKey=!1),this.focusInHeader=!1,this.lastColIndex=null,this._select(t,e,!0,!1),void e.preventDefault();(t=s.closest(".a-GV-cell")).length&&(this.focusInHeader=!1,this.lastColIndex=null,t.hasClass(p)||(this._checkInteractWithCellItem(e,s,t),this._select(t,e,!0,!1),e.preventDefault())),(t=s.closest(".a-GV-controlBreakHeader")).length&&(this.focusInHeader=!1,this.lastColIndex=null,this._select(t,e,!0,!1),e.preventDefault())}},dblclick:function(e){var t=this.options,l=n(e.target).closest(".a-GV-cell").not(".a-GV-selHeader");l.length&&(t.editable&&t.allowEditMode?this.editMode||this.setEditMode(!0,!0):this._fireActivate(e,l))},mousedown:function(e){var t,l=n(e.target);0!==e.originalEvent.button||l.closest("a,button,.a-GV-footer").length?this.focusInHeader=l.closest(".a-GV-header,.a-GV-headerGroup").length>0:!l.closest(".a-GV-expandCollapse").length&&this.editMode?(t=l.closest(".a-GV-cell"),this.editMode&&t.length&&!t.hasClass(p)&&(this.activateContext=e.clientX-e.target.getClientRects()[0].x,this._checkInteractWithCellItem(null,l,t))):e.preventDefault()},keydown:function(e){var t,l,s,a,i,o,r,d,c,u=this,f=this.options,p=null,m=e.which,g=n(e.target);function C(){s.hasClass("a-GV-selHeader")?s.find(".u-selector").click():(u._activateColumnHeader(e,s),e.preventDefault())}function v(e,t){var l,s=null;for(l=e+=t;l>=0&&l<u.columns.length;l+=t)if(!u.columns[l].hidden){s=l;break}return s}function _(){e.ctrlKey=!1,f.pagination.scroll&&u.firstPage(),p=u.tableData$.children().first().children().first(),u.focusInHeader=!1}function b(){e.ctrlKey=!1,f.pagination.scroll&&u.lastPage(),(p=u.tableData$.children(":visible").last()).hasClass("a-GV-scrollFiller")?(p=null,u.element.one("gridpagechange",()=>{u._select(u.tableData$.children().last().children().last(),{type:"keydown",shiftKey:e.shiftKey},!0,!1)})):p=p.children().last(),u.focusInHeader=!1}function w(e,t){u.element.one("gridpagechange",()=>{setTimeout(()=>{u._select(u.tableData$.children()[e]().children().eq(t),null,!0,!0)},0)})}if(!(g.closest(".a-GV-footer").length>0)){if(m!==k.PAGE_UP&&m!==k.PAGE_DOWN||(o=this.viewportHeight/this.avgRowHeight),m===k.HOME)!this.editMode&&this.lastFocused&&(this.lastColIndex=null,e.ctrlKey&&!$?_():p=this.lastRow$.first(),e.preventDefault());else if(m===k.END)!this.editMode&&this.lastFocused&&(this.lastColIndex=null,e.ctrlKey&&!$?b():p=this.lastRow$.last(),e.preventDefault());else if(m===k.PAGE_DOWN){if((!this.editMode||q(this.lastFocused).hasClass("a-GV-selHeader"))&&!e.altKey){if(this.focusInHeader){let e=(s=q(this.lastFocused)).closest("thead").children(),t=e.length-e.index(s.parent());s=this._getNextCellDown(q(this.lastFocused),t)}else s=j(this.lastFocused);if(!(p=this._getNextCellDown(s,o)))if(f.pagination.loadMore)this.element.find(".js-load").focus();else if(!f.pagination.scroll){let e=this.model.getTotalRecords();(e<0||this.pageOffset+this.pageCount<e)&&(w("first",Q(s)),this.nextPage())}e.preventDefault()}}else if(m===k.PAGE_UP)this.focusInHeader||this.editMode&&!q(this.lastFocused).hasClass("a-GV-selHeader")||e.altKey||(s=j(this.lastFocused),(p=this._getPrevCellUp(s,o,!0))||!f.pagination.scroll&&this.pageOffset>0&&(w("last",Q(s)),this.previousPage()),e.preventDefault());else if(m===k.DOWN){if(s=q(this.lastFocused),f.columnSort&&e.altKey&&s.hasClass("a-GV-header"))return void u._sortChange(e,s,"desc");(!this.editMode||this.focusInHeader||s.hasClass("a-GV-selHeader")||s.hasClass(h))&&this.lastFocused&&(e.altKey?$&&e.altKey&&b():(!(p=this._getNextCellDown(s,1))&&f.pagination.loadMore&&this.element.find(".js-load").focus()[0]&&e.preventDefault(),(p||f.constrainNavigation)&&e.preventDefault())),g.closest(".js-menuButton").length&&e.stopPropagation()}else if(m===k.UP){if(s=q(this.lastFocused),f.columnSort&&e.altKey&&s.hasClass("a-GV-header"))return void u._sortChange(e,s,"asc");(!this.editMode||this.focusInHeader||s.hasClass("a-GV-selHeader")||s.hasClass(h))&&this.lastFocused&&(e.altKey?$&&e.altKey&&_():(g.hasClass("js-load")?(this.focus(),e.preventDefault()):p=this._getPrevCellUp(s,1),(p||f.constrainNavigation)&&e.preventDefault()),e.stopPropagation())}else if(m===this.backwardKey){if(e.altKey||e.metaKey)return;if(s=q(this.lastFocused),(e.ctrlKey||e.shiftKey)&&(s.hasClass("a-GV-header")||s.hasClass("a-GV-headerGroup"))&&(!s.hasClass("a-GV-selHeader")||"sequence"===f.rowHeader||f.rowHeader===H)&&(i=D(s.attr("data-idx")),!isNaN(i)||e.ctrlKey||"sequence"===f.rowHeader||f.rowHeader===H))if(i>=0&&(a=this.columns[i]),e.shiftKey&&f.reorderColumns){if(e.preventDefault(),s.hasClass("a-GV-headerGroup"))r=K(s.parent()),i>0&&(this.moveColumnGroup(r,i,i-1),s=n(this.lastFocused).closest(".a-GV-headerGroup"));else if(null!==(i=v(i,-1)))return void this.moveColumn(a,i)}else if(e.ctrlKey&&f.resizeColumns&&!s.hasClass("a-GV-headerGroup"))return void(a?s.outerWidth()>40&&((c=s.outerWidth()-10)<40&&(c=40),this.setColumnWidth(a,c)):u.rowHeaderWidth>40&&((c=u.rowHeaderWidth-10)<40&&(c=40),u.rowHeaderWidth=c,this._calculateColumnWidths(s,!0)));(!this.editMode||this.focusInHeader||s.hasClass(h))&&this.lastFocused&&(this.lastColIndex=null,(l=this.lastRow$.index(s))>0&&(l-=1,p=this.lastRow$.eq(l)),e.preventDefault())}else if(m===this.forwardKey){if(e.altKey)return;if(s=q(this.lastFocused),(e.ctrlKey||e.shiftKey)&&(s.hasClass("a-GV-header")||s.hasClass("a-GV-headerGroup"))&&(!s.hasClass("a-GV-selHeader")||"sequence"===f.rowHeader||f.rowHeader===H)&&(i=D(s.attr("data-idx")),!isNaN(i)||e.ctrlKey||"sequence"===f.rowHeader||f.rowHeader===H))if(i>=0&&(a=this.columns[i]),e.shiftKey&&f.reorderColumns){if(e.preventDefault(),s.hasClass("a-GV-headerGroup"))r=K(s.parent()),i<this.columnGroups[r].length-1&&(this.moveColumnGroup(r,i,i+1),s=n(this.lastFocused).closest(".a-GV-headerGroup"));else if(null!==(i=v(i,1)))return void this.moveColumn(a,i)}else if(e.ctrlKey&&f.resizeColumns&&!s.hasClass("a-GV-headerGroup"))return void(a?this.setColumnWidth(a,s.outerWidth()+10):(u.rowHeaderWidth+=10,this._calculateColumnWidths(s,!0)));(!this.editMode||this.focusInHeader||s.hasClass(h))&&this.lastFocused&&(this.lastColIndex=null,(l=this.lastRow$.index(s))<this.lastRow$.length-1&&(l+=1,p=this.lastRow$.eq(l)),e.preventDefault())}else if(65===m&&e.ctrlKey&&!this.editMode&&f.multiple&&f.selectAll&&!f.selectCells)!f.pagination.scroll&&f.persistSelection&&e.shiftKey?this._select(this._getAllRows().map((function(){return n(this).children()[0]})),"add",!1,!1):this.selectAll(null),e.preventDefault();else if(m===k.SPACE){if("BUTTON"===e.target.nodeName)return;if((s=g.filter(".a-GV-selHeader").find(".u-selector")).length)return s.click(),void e.preventDefault();if((s=q(this.lastFocused)).hasClass("a-GV-header"))C();else if(s.hasClass("a-GV-cell")&&(!this.editMode||s.hasClass("a-GV-selHeader"))){let t=this._checkInteractWithCellItem(e,g,s);this._select(s,e,!0,!0),t||e.preventDefault()}}else if(m===k.ENTER){if(!g.hasClass("a-GV-expandCollapse")&&g.closest("a,button,.js-uses-enter").length>0)return;if((s=g.filter(".a-GV-selHeader").find(".u-selector")).length)return void s.click();s=q(this.lastFocused),this.editMode&&(s.hasClass("a-GV-cell")||s.hasClass(h))?(e.shiftKey?(p=this._getPrevCellUp(s,1,!0),e.shiftKey=!1):p=this._getNextCellDown(s,1),this.activateContext=-1):(e.preventDefault(),f.editable&&f.allowEditMode&&s.hasClass("a-GV-cell")&&!s.hasClass("a-GV-selHeader")?this.setEditMode(!0,!0):s.hasClass("a-GV-header")?C():f.editable&&f.allowEditMode||!s.hasClass("a-GV-cell")||this._fireActivate(e,s))}else if(113===m)(s=U(this.lastFocused)).length&&f.editable&&f.allowEditMode&&!this.editMode&&this.setEditMode(!0,!0);else if(m===k.ESCAPE)f.editable&&f.allowEditMode&&this.editMode&&this._doEscapeKey(e);else if(m===k.DELETE){if(f.editable&&f.allowDelete&&!this.editMode&&!this.focusInHeader){for(d=this.getSelectedRecords(),t=0;t<d.length;t++)this.model.allowDelete(d[t])||(d.splice(t,1),t-=1);d.length>0&&this.model.deleteRecords(d)}}else 45===m?f.editable&&f.allowInsert&&!this.editMode&&!f.selectCells&&this.model.allowAdd()&&((d=this.getSelectedRecords()).length>0?this.model.insertNewRecord(null,d[d.length-1]):this.model.insertNewRecord()):112===m&&e.altKey?this._doHelpKey():m===k.TAB&&this.editMode&&(this.activateContext=-1,this.lastKeyTab=!0);p&&(this._select(p,e,!0,!0),e.preventDefault())}},focusin:function(e){var t,l,s=null,a=this,i=n(e.target);if(i.closest(".a-GV-floatingItem").length)this._clearDeactivate();else if(0!==(t=i.closest(r)).length)if(t.addClass(f),this.lastEditModeCell!==t[0]){if(this.editMode){let o=this.activateContext;this.focusInHeader=!1,l=n(this.lastEditModeCell),this._clearDeactivate(),l.length&&this._deactivateCell(l),t.hasClass("a-GV-cell")||t.hasClass(h)?!t.hasClass("a-GV-selHeader")&&!t.hasClass(h)||this.lastKeyTab?(i.closest("a,button").length&&(s=e.target),setTimeout((function(){a.editMode&&!t.hasClass(p)&&a._activateCell(t,s,o)}),0)):(this._clearTabTraps(),this.lastEditModeCell=null,this._setFocusable(e.target),this._setTabTraps(t)):(this.focusInHeader=!0,this.lastEditModeCell=null,this._setFocusable(e.target))}else this._setFocusable(e.target);this.lastKeyTab=!1,this.activateContext=null}else this._clearDeactivate();else i.hasClass("js-tabTrap")||(this.lastEditModeCell=null)},focusout:function(e){var t=n(e.target).closest(r),l=this._getColumnMetadata(t),s=l&&this.columnItems[l.property];t.removeClass(f),this.editMode&&t.hasClass("a-GV-cell")&&(null===this.lastEditModeCell&&this._clearTabTraps(),s&&s.item.isDisabled()||this._beginDeactivate(t))},mousemove:function(e){var t,l,s,a,i,o=n(e.target),h=this.options,c=o.closest(r);e=e.originalEvent||e,c.length?c[0]!==this.lastHoverCell&&((t=c.parent())[0]!==this.lastHoverRow&&(this._clearHoverStates(),this.lastHoverRow=t[0],!t.hasClass("a-GV-row")&&!t.hasClass(d)||this.columnReordering||this.columnWidthDragging||this._setRowHoverState(t)),this.lastHoverCell=c[0],this.columnControls$.hide(),this.columnHandle$.hide(),"TH"!==c[0].nodeName||c.hasClass("a-GV-cell")||t.hasClass(d)||(a=this.columns[c.attr("data-idx")],!h.columnSort||this.columnReordering||this.columnWidthDragging||c.hasClass("a-GV-selHeader")||c.hasClass("a-GV-headerGroup")||!a.canSort||(c.append(this.columnControls$.show()),this._updateColumnControls(a)),!h.reorderColumns||0!==e.buttons||this.columnReordering||this.columnWidthDragging||c.hasClass("a-GV-selHeader")||(this.columnReorderCell$=c,c.append(this.columnHandle$.show().css("left",""))),!h.resizeColumns||this.columnReordering||this.columnWidthDragging||c.hasClass("a-GV-selHeader")&&"sequence"!==h.rowHeader&&h.rowHeader!==H||(l=c.closest("div")[0],s=c[0].offsetLeft+l.offsetLeft-l.scrollLeft,this.element.hasClass(v)||(s+=c.outerWidth()),this.columnWidthHandle$.show().css("left",s-this.columnWidthHandle$.width()/2),i=c.attr("data-idx"),this.columnWidthCell$=i?this._columnFromIndex(i):this.element.find(".a-GV-header.a-GV-selHeader")))):null!==this.lastHoverCell&&(this.lastHoverCell=null,this.lastHoverRow=null,this._clearHoverStates())},mouseleave:function(){null!==this.lastHoverCell&&(this.lastHoverCell=null,this.lastHoverRow=null,this._clearHoverStates())}},_doEscapeKey:function(e){var t=U(this.lastFocused);t.length&&this._setFocusable(t[0]),t.focus(),this.setEditMode(!1),t.length&&this._setFocus(this._getCellFocusable(t)),e.stopPropagation()},_doHelpKey:function(){var e,t=q(this.lastFocused);t.hasClass("a-GV-selHeader")||t.hasClass("a-GV-headerGroup")||t.hasClass(h)||(e=this._getColumnMetadata(t))&&e.helpid&&(this.editMode&&t.focus(),apex.theme.popupFieldHelp(e.helpid,apex.env.APP_SESSION))},_initTooltips:function(t){var s,a=this;n.ui.tooltip?(this.tooltipOptions&&(this.element.find(".a-GV-bdy").filter(":data('ui-tooltip')").tooltip("destroy"),this.tooltipOptions=null),t&&((s=this.tooltipOptions=S(!0,{show:apex.tooltipManager.defaultShowOption(),tooltipClass:"a-GV-tooltip"},t)).items="td,th",s._originalContent=s.content,s.content=function(t){let l,i,o,r=n(this),d=r.parent(),h=null,c=null,u=a._getColumnMetadata(r);return l=d.attr("data-id"),l&&(h=a.model.getRecordMetadata(l)),u&&h&&h.fields&&(c=h.fields[u.property]),h&&!h.deleted&&(c&&(c.error||c.warning)?(i=c.error?"is-error":"is-warning",o=c.message):(h.error||h.warning)&&r.hasClass("a-GV-selHeader")?(i=h.error?"is-error":"is-warning",o=h.message):h.agg&&u&&(i="",o=a.options.aggregateTooltips[h.agg+"|"+u.property]),o)?`<span class='${i}'>${e.escapeHTML(o)}</span>`:s._originalContent?s._originalContent.call(this,t,a.model,h,c,u):null},s.open=function(e,t){t.tooltip.find(".is-error").length&&t.tooltip.addClass("is-error"),t.tooltip.find(".is-warning").length&&t.tooltip.addClass("is-warning")},this.element.find(".a-GV-bdy,.a-GV-hdr").tooltip(s))):l.warn("tooltip option ignored because missing tooltip widget dependency")},_destroy:function(){var e=this.element;this._tableModelViewDestroy(),e.removeClass("a-GV is-disabled "+v).removeAttr("role").removeAttr(g).removeAttr(C).attr("aria-labelledby",this.origLabelBy).empty(),i.removeHandler(e[0]),l.info(`Grid '${e[0].id}' destroyed. Model: ${this.options.modelName}`),this.tableData$=null,this._initModel(null),this.gridStyles$&&this.gridStyles$.remove(),this._destroyContextMenu()},_setOption:function(e,t){var s=this.element,a=this.options;if(l.info(`Grid '${s[0].id}' set option '${e}' to:`,t),this._checkContextMenuOptions(e,t),"allowCopy"===e)throw new Error(`Grid ${e} cannot be set`);"editable"===e&&!t&&this.editMode?this.setEditMode(!1):"multiple"===e&&this.setSelection(n()),this._super(e,t),this._enforceOptionConstraints(),"disabled"===e?(s.toggleClass("is-disabled",t),this.lastFocused&&(t?this.lastFocused.tabIndex=-1:this._setFocusable(this.lastFocused)),t&&this.resize()):"selectCells"===e?this._setSelectionMode():"multiple"===e?(t?s.attr(g,I):s.removeAttr(g),a.rowHeader!==x&&a.rowHeaderCheckbox&&this.refreshColumns(),this.refresh()):"modelName"===e?(this.editMode&&this.setEditMode(!1),this._initModel(t),this.refresh(!1)):"highlights"===e?this._updateHighlights():"tooltip"===e?this._initTooltips(t):"hideEmptyFooter"===e?this._updateTotalRecords():"fixedRowHeight"===e?(s.toggleClass("a-GV--variableHeight",!t),this._refreshGrid()):["rowHeader","rowHeaderCheckbox","rowHeaderLabelColumn","columnSort","resizeColumns","reorderColumns","editable","selectAll","autoAddRecord","footer","pagination","rowsPerPage"].includes(e)&&("editable"===e&&(t?s.removeAttr(C):s.attr(C,I)),this._refreshGrid())},_enforceOptionConstraints:function(){var e=this.options;e.rowHeaderCheckbox&&e.rowHeader===x&&(l.warn("Option rowHeaderCheckbox cannot be true when rowHeader is 'none'."),e.rowHeaderCheckbox=!1),!e.multiple||e.rowHeader!==x&&e.rowHeaderCheckbox||!apex.userHasTouched()||(e.rowHeader===x&&(e.rowHeader="plain"),e.rowHeaderCheckbox=!0),e.editable&&e.allowEditMode||(e.autoAddRecord=!1),e.rowHeader!==x&&(e.rowHeaderWidth?this.rowHeaderWidth=e.rowHeaderWidth:(e.rowHeaderCheckbox?this.rowHeaderWidth=34:this.rowHeaderWidth=16,"sequence"!==e.rowHeader&&e.rowHeader!==H||(this.rowHeaderWidth+=38)))},refresh:function(e){let t,s,a,i,o,r,d,h,c,u,f=!1,p=null,g=null,C=null,v=this,_=this.options,b=this.element;if(l.info("Grid '"+b[0].id+"' refreshed. Model: "+_.modelName),!0!==e&&(f=this._paginationHasFocus()),void 0===e&&(e=n(document.activeElement).closest(b[0]).length>0),!this._refreshCheckIfVisible())return;p=b.find(m),p.length&&this._deactivateCell(p),p=n(this.lastFocused).closest("td,th"),i=K(p),o=p.parent().attr("data-id"),this.focusInHeader?this.columnsStale&&this.columns&&(C=K(n(this.lastFocused).closest("tr")),t=n(this.lastFocused).closest("th").attr("data-idx"),t&&(t=this.columns[t].property),this.lastFocused=null):this.lastFocused=null;let w=this.modelChanged;if(this.modelChanged=!1,!this.tableData$||_.persistSelection&&!_.selectCells)_.persistSelection&&(u=this.hasSelection,this.hasSelection=!1);else if(_.selectCells)s=this.getSelection(),s.length>0&&(p=s[0].first(),a=K(p),g={rowIndex:K(p.parent()),colIndex:a});else{s=this.getSelection(),g=[];for(let e=0;e<s.length;e++)d=s[e].first().attr("data-id"),void 0!==d&&g.push(d);0===g.length&&(g=null)}!_.hasSize&&this.tableData$&&b.css("min-height",b.height()+"px"),this._refreshPagination(b.find(".a-GV-w-scroll")),this.columnsStale||!this.columns?this._initGrid():(this.tableData$.empty(),this._clearChildrenRowCache(),this._updateScrollHandler(b.find(".a-GV-w-scroll"))),this.controlBreaks=[],this._updateStatus(),this.noData||this.resize(),h=b.find(".a-GV-hdr"),null!==C&&t&&(c=_.columns[0][t],c&&(t=c.seq-1,h.find("thead").each((function(){if(p=n(this).children().eq(C).find("th[data-idx='"+t+"']"),p.length)return!1}))),p&&p.length||(p=h.find("thead").first().find("tr").eq(C).children().first()),p&&p.length&&(v._select(p,null,e,!1,!0),e=!1)),this.allSelected=!1,this._addPageOfRecords((function(){let t,l,d,c=!1;if(f&&(v._restorePaginationFocus(f),e=!1),b.find(".a-GV-header .u-selector").attr("aria-disabled",v.noData?I:"false").toggleClass("is-disabled",v.noData),v._updateAccLabel(),_.hasSize?v._calculateColumnWidths(null,!0,!0):b.css("min-height",""),v.lastHoverCell=null,v.lastHoverRow=null,!v.lastFocused||!n(v.lastFocused).is(":visible")){let e=b.find("[data-id='"+o+"']");e[0]||(e=b.children(".a-GV-bdy").find("tbody .a-GV-row").first()),v.lastRow$=null,v.lastFocused=v._getCellFocusable(e.children().eq(i>=0?i:0)),v.lastFocused?(v.selectAnchor=n(v.lastFocused).closest(".a-GV-cell")[0],!_.selectCells&&v.selectAnchor&&(v.selectAnchor=v.selectAnchor.parentNode),v.focusInHeader=!1):(v.lastFocused=v._getCellFocusable(h.find("thead").first().find("tr").last().children().first()),v.focusInHeader=!0),v.lastFocused&&!_.disabled&&(d=v.lastFocused,v._setFocusable(v.lastFocused),v._setCurrentRow(v.lastFocused))}if(g){if(_.selectCells)v.tableData$.find(".a-GV-row").length>g.rowIndex&&(a=g.colIndex,r=v.tableData$,t=r.find(".a-GV-row").eq(g.rowIndex).children(),a>=t.length&&(a=t.length-1),v.setSelection([t.eq(a)]),c=!0);else{s=[];for(let e=0;e<g.length;e++)l=v.model.getRecord(g[e]),l&&s.push(l);s.length>0&&(c=0!==v.setSelectedRecords(s,!1,!0))}c&&!w||le(v,!0,null)}else _.persistSelection&&(u||w)&&le(v,!0,null);d&&c&&(v._setFocusable(d),v._setCurrentRow(d)),e&&v.focus()}))},focus:function(){this.lastFocused&&this.lastFocused.focus()},gotoCell:function(e,t){var s,a,i,o,n=this.options,r=!1,d=null,h=null,c=this.element.find("[data-id='"+e+"']");if(this.gotoCellPending=null,this.tableData$){if(t&&((d=n.columns[0][t])?d.hidden&&d.canHide&&(d.hidden=!1,r=!0,this.refreshColumns(),this.gotoCellPending={record:e,column:t}):l.warn("Warning column not found "+t)),!c.length){if(!(s=this.model.getRecord(e)))return void l.warn("Warning record not found "+e);a=this.model.indexOf(s),this.gotoCellPending={record:e,column:t},n.pagination.scroll?(i=this.scrollParent$,o=Math.floor(a/this.viewportHeight/this.avgRowHeight)*this.viewportHeight,i.scrollTop(o)):(this.pageOffset=Math.floor(a/this.pageSize)*this.pageSize,r=!0)}r&&this.refresh(!1),this.gotoCellPending||(t&&d&&(h=this._cellFromColumn(c,t)),h||(h=c.children().first()),this._select(h,null,!0,!1))}},getActiveCellFromColumnItem:function(e){var t,l=this,s=null;return this.activeRecordId&&(t=this.element.find("[data-id='"+this.activeRecordId+"']"),n.each(this.columnItems,(function(a,i){e===i.item.node&&(s=l._cellFromColumn(t,a))}))),s},inEditMode:function(){return this.editMode},setEditMode:function(e,t=!1){let s,a,i=!1,o=this;const n=()=>{this.columnItemsContainer$.off("change.gridedit"),this.activeRecord=null,this.activeRecordId=null},r=()=>{e=!!e,this.lastFloatingPos={},s=e!==this.editMode,this.editMode=e,this.element.toggleClass("a-GV--editMode",e),a=U(this.lastFocused),a.length&&(e?this._activateCell(a,null,t?-1:null):(this.lastEditModeCell=null,this._clearDeactivate(),this._deactivateCell(a),this.activeRecord&&(this._deactivateRow(n),i=!0))),s&&(e?this.columnItemsContainer$.on("change.gridedit",(function(e){let t,l,s;if(o.activeRecord)for(t=0;t<o.columns.length;t++)if(l=o.columns[t],l.elementId===e.target.id){s=l.property,o.setActiveRecordValue(s);break}})):i||n(),this._trigger("modeChange",null,{editMode:e}))};this.tableData$&&(this.options.editable?r():e&&l.warn("Grid is not editable."))},getSelection:function(){let e=[];return this.tableData$&&(this.options.selectCells?this.tableData$.find(u).parent("tr").each((t,l)=>{e.push(n(l).find(u).filter("td,th"))}):this.tableData$.find(u).filter("tr").each((t,l)=>{e.push(n(l))})),e},setSelection:function(e,t,l){let s,a=null,i=this.options.multiple,o=[];if(this.tableData$){if(this.options.selectCells)R(e)||(e=[e]),s=e[0].first()[0],o.push(e[e.length-1].last()[0]),s!==o[0]&&(this._select(n(s),null,null,!1,!1),a={type:"click",shiftKey:!0});else if(R(e)){let t=e.length;!i&&t>1&&(t=1);for(let l=0;l<t;l++)s=e[l].children("td,th")[0],s&&o.push(s)}else e.each((function(){if(s="TR"===this.nodeName?n(this).children("td,th")[0]:n(this).closest("td,th")[0],s&&(o.push(s),!i))return!1}));this._setSelection(o,a,t,l)}},_setSelection:function(e,t,l,s){let a=this.lastFocused,i=this.focusInHeader;this.focusInHeader=!1,this._select(n(e),t,l,!1,s),l||(this.focusInHeader=i,i&&(this._setFocusable(a),this._setCurrentRow(a)))},selectAll:function(e,t){var l=[],s=this.options,a=this.tableData$;a&&s.multiple&&s.selectAll&&!s.selectCells&&(a.children(".a-GV-row").each((function(){l.push(n(this).children()[0])})),this._setSelection(l,"all",e,t))},getRecords:function(e){var t,l,s,a=[];for(t=0;t<e.length;t++)void 0!==(l=e[t].attr("data-id"))&&(s=this.model.getRecord(l))&&a.push(s);return a},getSelectedRange:function(){var e,t,l,s,a,i,o,n=null;if(this.options.selectCells)for(n={columns:[],recordIds:[],values:[]},e=this.getSelection(),t=0;t<e.length;t++){if(a=e[t],0===t)for(l=0;l<a.length;l++)o=this._getColumnMetadata(a.eq(l)),n.columns.push(o?o.property:null);for(i=a.first().parent().attr("data-id"),n.recordIds.push(void 0!==i?i:null),s=[],l=0;l<a.length;l++)s.push(a.eq(l).text());n.values.push(s)}return n},getSelectedRecords:function(){var e=this.options;return e.selectCells?[]:e.persistSelection?this.model.getSelectedRecords():this.getRecords(this.getSelection())},setSelectedRecords:function(e,t,l){let s=0,a=e.length,i=[],o=new Set,r=this.tableData$;if(!r||this.options.selectCells||this.renderInProgress)return-1;!this.options.multiple&&a>1&&(a=1);for(let t=0;t<a;t++)o.add(this.model.getRecordId(e[t]));if(r.children(".a-GV-row").each((function(){var e=n(this),t=e.attr("data-id");o.has(t)&&(o.delete(t),i.push(e.children()[0]),s+=1)})),this._setSelection(i,null,t,l),this.options.persistSelection){for(let e of o){this.model.getRecord(e)&&(this.model.setSelectionState(e,!0),s+=1)}0!==i.length||l||le(this,!0,null)}return s},activateRow:function(e,t){var l=!1,s=n(this.lastEditModeCell),a=e.parent().attr("data-id");this.editMode&&a===this.activeRecordId||(this.element.one("apexbeginrecordedit",(function(){t()})),l=!0),this.editMode?(s.length&&(s.removeClass(f),this._deactivateCell(s)),e.addClass(f),this._activateCell(e)):(this.lastFocused=e[0],this.setEditMode(!0)),l||t()},activateCell:function(e){var t=n(this.lastEditModeCell);return!!this.editMode&&(t.length&&(t.removeClass(f),this._deactivateCell(t)),e.addClass(f),this._activateCell(e))},copyDownSelection:function(e,t){return this._setSelectionValues(1,e,t)},fillSelection:function(e,t,l){return this._setSelectionValues(0,t,l,e)},_setSelectionValues:function(e,t,l,s){var a,i,o,r=this,d=this.editMode,h=this.lastFocused,c=0,u=this.options;function p(){for(var e,t,s;;){if(c>=a.length||!i.length){(s=n(r.lastEditModeCell)).removeClass(f),d?s.length&&r._deactivateCell(s):r.setEditMode(!1),r.setSelection(a),n(h).focus(),l&&l();break}if(c>0&&(o=u.selectCells?a[c]:a[c].children()),c+=1,e=o.first().parent().attr("data-id"),r.model.allowEdit(r.model.getRecord(e))){t=o.first(),!u.selectCells&&u.rowHeader!==x&&o.length>=2&&(t=o.eq(1)),r.activateRow(t,(function(){setTimeout(m,0)}));break}}}function m(){var e;function t(){var e,t,l,s=[];for(e=0;e<i.length;e++)t=i[e],r.activateCell(o.eq(t.index))&&(l=t.item.reinit(t.value,t.displayValue))&&s.push(l);if(s.length>0)for(let e=0;e<s.length;e++)s[e]();setTimeout(p,0)}r.activeLockCount>0?(e=r.activeUnlockCallback,r.activeUnlockCallback=function(){e&&e(),t()}):t()}return!((a=this.getSelection()).length<=e)&&(t||(t=[],u.selectCells?this.getSelectedRange().columns.forEach((function(e){e&&t.push(e)})):this.columns.forEach((function(e){var l=e.property;!l||e.hidden||e.virtual||e.noCopy||r.model.isIdentityField(l)||!e.elementId||e.readonly||t.push(l)}))),o=u.selectCells?a[c]:a[c].children(),this.activateRow(o.first(),(function(){i=[],o.each((function(l){var a,o,d,h=n(this),c=r._getColumnMetadata(h);c&&t.indexOf(c.property)>=0&&c.elementId&&(o={index:l,item:a=r.columnItems[c.property].item},1===e?(o.value=a.getValue(),d=a.displayValueFor(o.value),o.value!==d&&(o.displayValue=d)):s.v&&s.d?(o.value=s.v,o.displayValue=s.d):o.value=s,i.push(o))})),p()})),!0)},resize:function(){var e,t,l,s=this.element,a=this.options,i=s.height(),o=s.width(),n=s.children(".a-GV-hdr"),r=s.children(".a-GV-bdy");null!==s[0].offsetParent&&(r.length&&!this.pendingRefresh?(l=this.tableData$.prev().height(),s.find(".a-GV-bdy .a-GV-table").css("margin-top",-(l+D(this.tableHeader$.find("th").first().css("border-bottom-width")))),e=o,s.find(".a-GV-w-scroll,.a-GV-w-hdr").width(e),a.hasSize&&(t=i-n.height()-this._footerHeight(),r.children(".a-GV-w-scroll").addBack().height(t)),this._calculateColumnWidths(null,!0,a.hasSize||this.tableData$.parent().width()>e),this._initPageSize()):this.refresh())},expandControlBreak:function(e){this._expandCollapseControlBreak(e,!0)},collapseControlBreak:function(e){this._expandCollapseControlBreak(e,!1)},getColumns:function(){return this.columns},refreshColumns:function(){this.columnsStale=!0},setColumnWidth:function(e,t){var l=this._updateColumnWidth(e,t,!0);this._trigger("columnResize",null,{header$:l[1],column:l[0],width:t})},hideColumn:function(e){var t=this._columnName(e);this.options.columns[0][t].hidden=!0,this._refreshGrid()},showColumn:function(e){var t=this._columnName(e);this.options.columns[0][t].hidden=!1,this._refreshGrid()},freezeColumn:function(e){var t,l,s=this.columns,a=this._columnName(e);for(t=0;t<s.length&&(l=s[t],t<s.length-1&&(l.frozen=!0),l.property!==a);t++);this._refreshGrid()},unfreezeColumn:function(e){var t,l,s=this._columnName(e);for(t=this.columns.length-1;t>=0&&((l=this.columns[t]).frozen=!1,l.property!==s);t--);this._refreshGrid()},moveColumn:function(e,t){var l=this._moveColumn(e,t);this._refreshGrid(),l.header$=this._columnFromIndex(t),this._trigger("columnReorder",null,l)},moveColumnGroup:function(e,t,l){var s,a,i,o,n,r,d,h=[];if(!(i=this.columnGroups[e]))throw new Error("Invalid column group level: "+e);for(o=-1,s=0;s<i.length;s++)a=i[s],s===t&&(o=a.start,n=a.end),s===l&&(r=-1===o?a.start:a.end);if(l>t)for(s=o;s<=n;s++)(d=this._moveColumn(this.columns[o],r)).newPosition=r-(n-s),d.oldPosition=s,h.push(d),this._updateColumns();else for(s=n;s>=o;s--)(d=this._moveColumn(this.columns[n],r)).newPosition=r+(s-o),d.oldPosition=s,h.push(d),this._updateColumns();for(this._refreshGrid(),s=0;s<h.length;s++)(d=h[s]).header$=this._columnFromIndex(d.newPosition),this._trigger("columnReorder",null,d)},_refreshGrid:function(){var e;(e=this.element.find(m)).length&&this._deactivateCell(e),this.refreshColumns(),this.refresh()},_cellFromColumn:function(e,t){var s,a,i=this.columns,o=this.options,n=null,r=0;if(!o.columns[0][t])return l.warn("Warning column not found "+t),null;for(o.rowHeader!==x&&(r=1),s=0;s<i.length;s++)if(!(a=i[s]).hidden){if(a.property===t){n=e.children().eq(r);break}r+=1}return s>=i.length&&l.warn("Warning column is hidden "+t),n},_columnFromIndex:function(e){return this.element.find(".a-GV-header[data-idx='"+e+"']")},_columnName:function(e){var t;if(t="object"==typeof e?e.property:e,!this.options.columns[0][t])throw new Error("Unknown column: "+t);return t},_moveColumn:function(e,t){var l,s,a,i,o=this.columns,n=this._columnName(e);for(a=-1,l=0;l<o.length;l++)if((s=o[l]).property===n){a=l;break}if(i=o[t].seq,a!==t){if(a<t)for(l=t;l>a;l--)o[l].seq=o[l-1].seq;else for(l=t;l<a;l++)o[l].seq=o[l+1].seq;return o[a].frozen=t<=this.lastFrozenColIndex,o[a].seq=i,{column:s,newPosition:t,oldPosition:a}}},_updateColumns:function(){let e,t,l,s,a,i,o,n,r,d,h,c,u,f={},p=this.options,m=p.columns[0];this.columns=[],this.columnsStale=!1,this.columnGroups=[],this.breakColumns=[],this.fieldToColumnIndex={};for(const[e,t]of y(m))t.property=e,t.domId=t.elementId?t.elementId+"_HDR":this.idPrefix+"_h_"+t.property,t.seq=t.seq||"0",this.columns.push(t);for(this.columns.sort((function(e,t){return e.seq-t.seq})),this.lastFrozenColIndex=-1,u=p.rowHeader!==x?1:0,e=0;e<this.columns.length;e++)if(l=this.columns[e],!l.hidden){if(!l.frozen)break;u<20&&(u+=1,this.lastFrozenColIndex=e)}for(this.endFrozenColIndex=-1,e=this.columns.length-1;e>0;e--)if(l=this.columns[e],!l.hidden){l.frozen&&(this.endFrozenColIndex=e);break}for(d=p.rowHeader!==x?1:0,e=0;e<this.columns.length;e++)l=this.columns[e],l.controlBreakIndex>0&&this.breakColumns.push(l),l.hidden||(this.fieldToColumnIndex[l.property]=d,d+=1);for(this.breakColumns.sort((function(e,t){return e.controlBreakIndex-t.controlBreakIndex})),a=null,o=null,n=null,h=!0,d=0,i=0,t=0,c=[],e=0;e<this.columns.length;e++)if(l=this.columns[e],!l.hidden){if(null===a&&(a=[],this.columnGroups.push(a)),r=Z(l),r!==o||e===this.lastFrozenColIndex+1){if(o=r,n&&(n.span=d-i,n.end=t,n.children=c,c=[]),i=d,r){if(n=S({},p.columnGroups[r]),!n)throw new Error("Unknown column group name: "+r);n.heading&&(h=!1,f[r]||(n.domId=this.idPrefix+"_g_"+r)),n.property=r,a.push(n)}else n={},a.push(n);n.start=e,e<=this.lastFrozenColIndex&&(n.frozen=!0,f[r]=1)}c.push(l),d+=1,t=e,null===n&&(n={start:e},this.lastFrozenColIndex>=0&&(n.frozen=!0),a.push(n))}for(n&&(n.span=d-i,n.end=t,n.children=c),h&&(this.columnGroups=[],a=null);a;){for(s=a,a=null,o=null,n=null,h=!0,d=0,c=[],e=0;e<s.length;e++){if(l=s[e],r=l.parentGroupName||null,r!==o||l.frozen!==(!!n&&n.frozen)){if(o=r,null===a&&(a=[],this.columnGroups.unshift(a),d>0&&(n={},l.frozen&&(n.frozen=!0),a.push(n))),n&&(n.span=d-i,n.children=c,c=[]),i=d,r){if(n=S({},p.columnGroups[r]),!n)throw new Error("Unknown column group name: "+r);n.heading&&(h=!1,f[r]||(n.domId=this.idPrefix+"_g_"+r)),n.property=r,a.push(n)}else n={},a.push(n);n.start=l.start,l.frozen&&(n.frozen=!0,f[r]=1)}c.push(l),n.end=l.end,d+=l.span}n&&(n.span=d-i,n.end=l.end,n.children=c),h&&(this.columnGroups.shift(),a=null)}},_initGrid:function(){var t,s,a,i,r,h,c,u,f,p,g,C=0,v=0,_=null,b=this,w=this.options,G=this.element;function H(){C!==v&&(t[0].scrollLeft=C=v,s[0].scrollLeft=C,p.css("left",C)),_=null}function I(){var e=b.element.find(m);b.floatingItem$.hasClass("is-expanded")?b._collapseFloatingItem(e):b._expandFloatingItem(e)}l.info("Grid render and initialize."),this._updateColumns(),this.columnItems||this._initColumnItems(this.columns),this._renderGrid(),G.find(".a-GV-hdr :tabbable").prop("tabIndex",-1),w.tooltip&&this._initTooltips(w.tooltip),w.rowHeader!==x&&w.rowHeaderCheckbox&&(this.tableHeader$.parent().addClass("a-GV-table--checkbox"),this.tableData$.parent().addClass("a-GV-table--checkbox")),t=G.find(".a-GV-w-hdr"),s=G.find(".a-GV-w-scroll"),u=(a=G.children(".a-GV-bdy")).find("col"),f=a.find("thead").find(".a-GV-header"),g=this.tableData$.parent().width()-e.getScrollbarSize().width,t.add(s).width(g),u.each((function(e){var t=n(this),l=b.columns[t.attr("data-idx")];l&&(l.width?l.curWidth=l.width:l.curWidth=l.defWidth=f.eq(e).width(),l.curWidth<40&&(l.curWidth=40))})),p=this.tableData$.parent().parent().find(".a-GV-loadMoreButton"),s.on("scroll.gvss",(function(){v=this.scrollLeft,_||(_=M(H))})),t.on("scroll.gvss",(function(){v=this.scrollLeft,_||(_=M(H))})),r=this.element.find(".js-tabTrap"),this.tabTraps$=r,2===r.length?h=0:(3===r.length&&(h=1,c=0),r.eq(c).on("focus",(function(){n(this).hasClass("js-autoAdd")&&b._autoAddRecord(b.activeRecord)}))),r.eq(h).on("focus",(function(){var e,t,l=n(b.lastEditModeCell).closest("tbody").find(":tabbable").add(b.lastEditModeCell),s=l.index(b.lastEditModeCell);s>0?(b.activateContext=-1,l.first().focus()):(e=n(":tabbable"),t=b.element.find(":tabbable").first(),s=e.index(t),e.eq(s-1).focus())})),r.eq(h+1).on("focus",(function(){var e,t,l=n(b.lastEditModeCell).closest("tbody").find(":tabbable").add(b.lastEditModeCell),s=l.index(b.lastEditModeCell);n(this).hasClass("js-autoAdd")?b._autoAddRecord(b.activeRecord):s<l.length-1?(b.activateContext=-1,l.last().focus()):(e=n(":tabbable"),t=b.tableData$.find(":tabbable").last(),s=e.index(t),e.eq(s+1).focus())})),r.prop("tabIndex",-1),w.reorderColumns&&this._initColumnReorder(),this.columnWidthHandle$=n(),w.resizeColumns&&this._initColumnResize(),this.columnControls$.on("click","button",(function(e){var t=n(e.target);b._sortChange(e,t.closest(".a-GV-header"),t.closest("button").hasClass("js-asc")?"asc":"desc")})),this.floatingItem$.draggable({handle:".a-GV-cellMoveHandle",containment:"body",stop:function(e,t){var l=b._getColumnMetadata(b.element.find(m)).property;b.lastFloatingPos[l]={left:t.position.left,top:t.position.top}}}).on("keydown",(function(e){var t=e.which;if(e.ctrlKey&&117===t)return I(),!1;112===t&&e.altKey?b._doHelpKey():t===k.ESCAPE&&b._doEscapeKey(e)})).on("mousedown",(function(e){n(e.target).hasClass("a-GV-cellMoveHandle")&&b._clearDeactivate()})).on("focusin",(function(){b._clearDeactivate()})).on("focusout",(function(){b.lastEditModeCell&&b._beginDeactivate(n(b.lastEditModeCell))})).children(".a-GV-expandCollapse").click(I),o.TouchProxy.addTouchListeners(this.floatingItem$[0]),this._initPagination(G.find(".a-GV-hdr"),s),this.breakColumns.length>0&&w.collapsibleControlBreaks&&G.find(".a-GV-bdy").on("click",".js-toggleBreak",(function(){i=n(this).closest("."+d),b._expandCollapseControlBreak([i],!i.hasClass("is-expanded"))}))},_initColumnReorder:function(){var e,t,l,s,a,i,r,d,h,c,u,f,p,m,g=this.element.hasClass(v),C=this.element.find(".a-GV-hdr"),_=this;C.append(this.columnMoveMarker$),m=D(_.columnHandle$.css("margin-left")),g&&(m=-m),_.columnHandle$.draggable({appendTo:this.element,containment:C,cursor:"move",cursorAt:g?{right:-2*m}:{left:0},axis:"x",helper:function(){var e=n("<div class='a-GV-header-dragHelper'></div>"),t=_.columnReorderCell$;return e.append(t.find(".a-GV-headerLabel,.a-GV-columnHandle").clone()).width(t.outerWidth()).height(t.outerHeight()),"fixed"===C.css("position")&&e.css("position","fixed"),e},start:function(o,m){let v=_.columnReorderCell$.outerHeight();_.columnControls$.hide(),_._trigger("cancelColumnHeader",o,{}),e=_.columnReorderCell$.parent().offset().top-_.element.offset().top,t=e+_.element[0].offsetTop,i=C.css("position"),d="absolute",r=102,h=-C.offset().left,"relative"!==i&&("fixed"===i&&(h=0,e=t=_.columnReorderCell$.parent()[0].offsetTop+C[0].offsetTop,d="fixed"),r=D(C.css("z-index"))+1),c=-_.columnMoveMarker$.width()/2,m.helper.css({top:t+"px",position:d,transform:"translateY("+v+"px)","z-index":r}),f=m.helper.outerWidth(),_.columnMoveMarker$.show().css({top:e+"px",left:_.columnReorderCell$.offset().left+h+(g?_.columnReorderCell$.width():0)+"px",position:d,height:v+"px","z-index":r}),_.columnReorderCell$.find(".a-GV-headerLabel,.a-GV-header-sort").hide(),_.columnHandle$.hide(),_.columnWidthHandle$.hide(),Y((function(){_.columnReorderCancel=!0})),u=D(_.columnReorderCell$.attr("data-idx")),_.hdrScrollParent=_.element.find(".a-GV-w-hdr")[0],p=_.hdrScrollParent.scrollLeft,l=[],a=null,(s=ee(_.columnReorderCell$)).children().each((function(){var e=n(this),t=!0,s=e.offset().left+h;e.parent().parent().parent().parent()[0]===_.hdrScrollParent&&(s+=p,t=!1),l.push({colIdx:D(e.attr("data-idx")),start:s,end:s+e.outerWidth(),frozen:t})})),_.columnReordering=!0,_.columnReorderCancel=!1},drag:function(e){var t=_.hdrScrollParent.scrollLeft,s=D(_.columnMoveMarker$.css("left"));function i(){var i,o,n,r=!1,d=e.pageX-m+h+_.hdrScrollParent.scrollLeft;for(i=0;i<l.length;i++)if(d>=(o=l[i]).start&&d<o.end){i!==a&&(a=i,n=g?(o.colIdx<u?o.end:o.start)+c:(o.colIdx<u?o.start:o.end)+c,o.frozen||(n-=_.hdrScrollParent.scrollLeft),s=n,t=_.hdrScrollParent.scrollLeft,_.columnMoveMarker$.css("left",n+"px"),r=!0);break}r||t===_.hdrScrollParent.scrollLeft||(n=s-(_.hdrScrollParent.scrollLeft-t),_.columnMoveMarker$.css("left",n+"px"))}_.columnReorderCancel?e.preventDefault():(i(),_._headerScrollCheck(e.pageX-m,f)?_.scrollTimerId||_._headerScrollStart(e.pageX-m,f,i):_.scrollTimerId&&_._headerScrollStop())},stop:function(){var e=null;null!==a&&(e=l[a].colIdx),isNaN(e)&&a+1<l.length&&(e=l[a+1].colIdx),isNaN(e)||(_.columnReordering=!1,_.columnReorderCell$.find(".a-GV-headerLabel,.a-GV-header-sort").show(),e===u&&(_.columnHandle$.show(),_.columnWidthHandle$.show(),_.columnControls$.show()),_.columnMoveMarker$.hide(),_.lastHoverCell=null,J(),_.scrollTimerId&&_._headerScrollStop(),_.columnReorderCancel||null===e||e===u||(_.columnReorderCell$.hasClass("a-GV-headerGroup")?_.moveColumnGroup(K(s),u,e):_.moveColumn(_.columns[u],e),_.focus()))}}),o.TouchProxy.addTouchListeners(_.columnHandle$[0])},_initColumnResize:function(){var e,t,l,s=this,a=this.element.hasClass(v)?-1:1,i=this.element.find(".a-GV-hdr"),r=i.find("tr").last();this.columnWidthHandle$=n("<div class='a-GV-columnWidthHandle'></div>").appendTo(i).css("top",r[0].offsetTop).height(r.height()),this.columnWidthHandle$.draggable({axis:"x",containment:i,start:function(a,i){s.columnWidthDragging=!0,s.columnWidthCancel=!1,s.columnWidthStartPos=i.position.left,s.columnWidthStartWidth=s.columnWidthCell$.first().outerWidth(),e=i.helper.outerWidth(),s.hdrScrollParent=s.element.find(".a-GV-w-hdr")[0],l=s.columnWidthCell$.parent().parent().parent().parent()[0]!==s.hdrScrollParent,t=s.hdrScrollParent.scrollLeft,Y((function(){s.columnWidthCancel=!0}))},drag:function(i,o){function n(e){var i,n,r=s.columnWidthStartWidth+a*(o.position.left-s.columnWidthStartPos);i=s.hdrScrollParent.scrollWidth,l||(r+=s.hdrScrollParent.scrollLeft-t),r>40&&(s.columnWidthCell$.hasClass("a-GV-selHeader")?(s.rowHeaderWidth=r,s._calculateColumnWidths()):s._updateColumnWidth(s._getColumnMetadata(s.columnWidthCell$.first()),r)),(n=s.hdrScrollParent.scrollWidth-i)<0&&!e&&s.hdrScrollParent.scrollLeft!==t&&(s.hdrScrollParent.scrollLeft+=n,t+=n)}s.columnWidthCancel?i.preventDefault():(n(),s._headerScrollCheck(o.offset.left,e)?s.scrollTimerId||s._headerScrollStart(o.offset.left,e,(function(){n(!0)})):s.scrollTimerId&&s._headerScrollStop())},stop:function(e,i){var o=s.columnWidthStartWidth+a*(i.position.left-s.columnWidthStartPos);l||(o+=s.hdrScrollParent.scrollLeft-t),s.columnWidthDragging=!1,J(),s.scrollTimerId&&s._headerScrollStop(),s.columnWidthCancel&&(o=s.columnWidthStartWidth),o<40&&(o=40),s.columnWidthCell$.hasClass("a-GV-selHeader")?(s.rowHeaderWidth=o,s._calculateColumnWidths(null,!0)):s.setColumnWidth(s._getColumnMetadata(s.columnWidthCell$.first()),o)}}),o.TouchProxy.addTouchListeners(this.columnWidthHandle$[0])},_updateColumnWidth:function(e,t,l){var s,a,i,o=this._columnName(e);return(s=this.options.columns[0][o]).width=t,s.curWidth=t,i=this.columns.indexOf(s),a=this._columnFromIndex(i),this._calculateColumnWidths(a,l),[s,a]},_calculateColumnWidths:function(t,l,s){var a,i,o,r,d,h,c,u,f,p=this.options.hasSize,m=this.element,g=this;function C(e){var t,l;for(t=e+1;t<g.columns.length;t++)if(!(l=g.columns[t]).hidden&&!l.noStretch&&t!==f)return!1;return!0}function v(e,t){var l=0,s=0,a=t.parent().find("col");return e.parent().find("col").each((function(e){var t,i,o=n(this),r=o.attr("data-idx");t=r?(i=g.columns[r]).curWidth:g.rowHeaderWidth,(0===e&&!i||i.frozen)&&e<20&&(m.css("--a-gv-frozen-offset-"+(e+1),s+"px"),s+=t),o[0].width=t,a[e].width=t,l+=t})),m.css("--a-gv-scroll-pad-start",s+"px"),t.parent().width(l),e.parent().width(l),l}if(s)for(a=0;a<this.columns.length;a++)(i=this.columns[a]).curWidth=i.width||i.defWidth,i.curWidth<40&&(i.curWidth=40);if(t&&(d=t.parent().parent()[0],f=D(t.attr("data-idx"))),o=d&&d!==this.tableHeader$[0]?this.tableData$.parent().width():v(this.tableData$,this.tableHeader$),l&&(r=m.find(".a-GV-w-scroll")[0].clientWidth,p&&0===this.tableData$.children().length&&(r-=e.getScrollbarSize().width),o<r)){if((r=r-o-1)>10)for(u=r,a=0;a<this.columns.length;a++)(i=this.columns[a]).hidden||i.frozen||i.noStretch||a===f||(C(a)?i.curWidth+=u:(c=Math.floor(r*(i.curWidth/o)),i.curWidth+=c,u-=c));else for(a=this.columns.length-1;a>0;a--)if(!((i=this.columns[a]).hidden||i.frozen||i.noStretch||a===f)){i.curWidth=i.curWidth+r;break}v(this.tableData$,this.tableHeader$)}p&&(h=m.children(".a-GV-bdy"),this._adjustSizeForScrollBars(h.height(),h.find(".a-GV-w-scroll").width()))},_addFrozenClasses:function(e,t,l,s){if(l.frozen){let a=l.span||1;void 0===s&&(s=l.end),s===this.endFrozenColIndex?e+=" "+_+" a-GV-frozen--end1"+G:s<=this.lastFrozenColIndex&&(e+=" "+_+" "+b+t,s===this.lastFrozenColIndex&&(e+=" "+w),t+=a)}return[e,t]},_renderGrid:function(){let t,l,s=this,a=this.element,i=this.options,o=i.hasSize||i.stickyTop;const r=e.htmlBuilder(),d="<table role='presentation' class='a-GV-table'>",h="<span class='js-tabTrap u-vh is-focusable' aria-hidden='true' tabindex='-1'></span>";function c(e){var t,l;for(i.rowHeader!==x&&e.markup("<col").optionalAttr("width",s.rowHeaderWidth).markup("/>"),t=0;t<s.columns.length;t++)(l=s.columns[t]).hidden||e.markup("<col").optionalAttr("width",l.width).attr("data-idx",t).markup("/>")}function u(e,t){var a,o,n,r,d,h,c,u,f,p,m=s.columns;for(o=0;o<s.columnGroups.length;o++){for(h=s.columnGroups[o],p=1,e.markup("<tr class='a-GV-row' role='row'>"),i.rowHeader!==x&&(r="a-GV-headerGroup a-GV-selHeader "+_+" "+b+"1",s.lastFrozenColIndex<0&&(r+=" "+w),p+=1,e.markup(`<th role='columnheader' class='${r}'`),t&&e.markup(" style='visibility: hidden;'"),e.markup(">")),a=0;a<h.length;a++)r="a-GV-headerGroup",r+=T((n=h[a]).headingAlignment||"center",!0),[r,p]=s._addFrozenClasses(r,p,n),f=t?null:n.domId,e.markup("<th role='columnheader' ").attr("class",r).attr("colspan",n.span).attr("data-idx",a),t&&e.markup(" style='visibility: hidden;'"),e.markup(" tabindex='-1'><span class='a-GV-headerLabel'").optionalAttr("id",f).markup(">"+(n.heading||"")).markup("</span></th>");e.markup("</tr>")}for(e.markup("<tr class='a-GV-row' role='row'>"),p=1,i.rowHeader!==x&&(u=null,t&&(u="visibility: hidden;"),r="a-GV-header a-GV-selHeader "+_+" "+b+"1",s.lastFrozenColIndex<0&&(r+=" "+w),p+=1,e.markup(`<th role='columnheader' class='${r}'`).optionalAttr("style",u).markup("><span class='u-vh a-GV-headerLabel'").optionalAttr("id",t?null:s.idPrefix+"_shh").markup(">").content(L("ROW_HEADER")).markup("</span>"),i.rowHeaderCheckbox&&i.multiple&&i.selectAll&&e.markup("<span class='u-selector' role='checkbox' aria-checked='false'").attr("title",L("SELECT_ALL")).markup("></span>"),"sequence"===i.rowHeader?e.markup("<span class='a-GV-rownum' aria-hidden='true'></span>"):i.rowHeader===H&&e.markup("<span class='a-GV-rowLabel'></span>"),e.markup("</th>")),a=0;a<m.length;a++)(n=m[a]).hidden||(r="a-GV-header",r+=T(n.headingAlignment||"center",!0),n.isRequired&&(r+=" is-required"),n.elementId&&!n.readonly||(r+=" is-readonly"),n.headingCssClasses&&(r+=" "+n.headingCssClasses),[r,p]=s._addFrozenClasses(r,p,n,a),c=null,1===n.sortIndex&&("asc"===n.sortDirection?c="ascending":"desc"===n.sortDirection&&(c="descending")),u=null,t?(u="visibility: hidden;",f=null):f=n.domId,e.markup("<th role='columnheader' ").attr("class",r).attr("data-idx",a).optionalAttr("style",u).optionalAttr("aria-sort",c).optionalAttr("aria-haspopup",i.activateColumnHeader?I:null).markup(" tabindex='-1'><span class='a-GV-headerLabel'").optionalAttr("id",f).markup(`>${n.heading}</span>`),n.sortDirection&&(d=N("asc"===n.sortDirection?"SORTED_ASCENDING":"SORTED_DESCENDING",l>1?n.sortIndex:""),e.markup("<span class='a-GV-header-sort'><span aria-hidden='true'").attr("class","a-Icon "+("asc"===n.sortDirection?"icon-irr-sort-asc":"icon-irr-sort-desc")).attr("title",d).markup("></span><span class='u-vh'>").content(" "+d).markup("</span>"),l>1&&e.markup("<span aria-hidden='true'>").content(n.sortIndex).markup("</span>"),e.markup("</span>")),e.markup("</th>"));e.markup("</tr>")}for(l=0,t=0;t<this.columns.length;t++)this.columns[t].sortDirection&&(l+=1);r.markup(`<div class='a-GV-hdr${o?" a-GV-hdr--fixed":""}'><div class='a-GV-w-hdr'>${d}`),c(r),r.markup("<thead role='rowgroup'>"),u(r,!1),r.markup("</thead></table></div></div><div class='a-GV-bdy'>"),this._renderAltDataMessages(r,this.idPrefix),r.markup("<div class='u-vh'").attr("id",this.accContextId).markup("></div>"),r.markup("<div class='a-GV-w-scroll' tabindex='-1'>"+d),c(r),r.markup("<thead role='rowgroup'>"),u(r,!0),r.markup("</thead><tbody></tbody></table>"),this._renderLoadMore(r),r.markup("</div>"),i.autoAddRecord&&this.model.allowAdd()&&r.markup(h),r.markup("</div>"),i.editable&&r.markup(`<div class='a-GV-floatingItem' tabindex='-1' style='display: none;'><div class='a-GV-cellMoveHandle'></div><button type='button' class='a-GV-expandCollapse' tabindex='-1'><span aria-hidden='true' class='a-Icon'></span></button>${h}<div class='a-GV-floatingItemContent'></div>${h}</div>`),this._renderFooter(r,this.idPrefix),i.columnSort&&(r.markup("<div class='a-GV-columnControls' style='display:none'>"),this._renderButton(r,"a-Button js-asc","icon-up-chevron",L("SORT_ASCENDING")),this._renderButton(r,"a-Button js-desc","icon-down-chevron",L("SORT_DESCENDING")),r.markup("</div>")),i.reorderColumns&&r.markup("<div class='a-GV-columnHandle' style='display:none'></div><div class='a-GV-colMoveMarker' style='display:none'><span class='a-GV-colMoveMarker-x'></span></div>"),this.floatingItem$&&this.floatingItem$.remove(),a.html(r.toString()),this._updateAccLabel(),this.pageKey=null,this.tableHeader$=a.find(".a-GV-hdr .a-GV-table>thead"),this.tableData$=a.find(".a-GV-table>tbody"),this._clearChildrenRowCache(),this.accContext$=n("#"+this.accContextId),this.columnControls$=a.find(".a-GV-columnControls"),this.columnControls$.find("button").attr("tabindex",-1),this.columnHandle$=a.find(".a-GV-columnHandle"),this.columnMoveMarker$=a.find(".a-GV-colMoveMarker"),this.floatingItem$=a.find(".a-GV-floatingItem")},_updateAccLabel:function(){var e=this.origLabelBy;this.noData?e+=" "+this.idPrefix+"_msg":this.options.footer&&(e+=" "+this.idPrefix+"_pageRange "+this.idPrefix+"_status"),this.element.attr("aria-labelledby",e)},_calcSpanAllColumns:function(e){let t,l,s=this.lastFrozenColIndex>=0||this.options.rowHeader!==x,a=0;null!=e&&s?e?(t=0,l=this.lastFrozenColIndex+1,this.options.rowHeader!==x&&(a+=1)):(t=this.lastFrozenColIndex+1,l=this.columns.length):(t=0,l=this.columns.length);for(let e=t;e<l;e++)this.columns[e].hidden||(a+=1);return a},_getHeaderHeight:function(){return this.element.find(".a-GV-hdr").outerHeight()},_selectedCount:function(){var e=this.options;if(this.tableData$)return e.selectCells?this.tableData$.find(u).filter("td,th").length:e.persistSelection?this.model.getSelectedCount():this.tableData$.find("tr.is-selected").length},_selectedStatusMessage:function(){var e=this.options;return s.getMessage(e.selectCells?"APEX.GV.SELECTION_CELL_COUNT":e.selectionStatusMessageKey)},_deletedCount:function(){return this.tableData$.find("tr.is-deleted").length},_hasControlBreaks:function(){return this.breakColumns.length>0},_getFixedRecordHeight:function(){var e,t;return(e=this.tableData$.find("tr").filter(":visible").first()).length?t=e.outerHeight():(e=n("<tr class='a-GV-row'><td class='a-GV-cell'></td></tr>"),t=(e=this.tableData$.append(e)).outerHeight(),this.tableData$.empty()),t},_getDataContainer:function(){return this.tableData$},_insertFiller:function(e,t){let l=n(e.toString());return t?t.last().before(l):this.tableData$.html(l),this._clearChildrenRowCache(),l},_insertData:function(e,t,l,s,a){var i,o,r,d,h=this.options,c=this;o=O(e),s?s.last()[a](o):this.tableData$.append(o),this._clearChildrenRowCache(),this.allSelected&&(h.pagination.scroll&&!h.persistSelection?(r=o.map((function(e,t){return n(t).children()[0]})),d=this.focusInHeader,this.focusInHeader=!1,this._select(r,"add",null,!1),this.focusInHeader=d):this._updateStatus()),!h.pagination.scroll&&h.persistSelection&&this._updateSelectAll(),h.hasSize&&(i=this.element.children(".a-GV-bdy"),this._adjustSizeForScrollBars(i.height(),i.find(".a-GV-w-scroll").width())),this.gotoCellPending&&setTimeout((function(){c.gotoCell(c.gotoCellPending.record,c.gotoCellPending.column)}),0),this._trigger("pageChange",null,{offset:t,count:l})},_controlBreakLabel:function(t){var l,s,a,i,o=this.options,n="",r=[];for(l=0;l<this.breakColumns.length;l++)s=this.breakColumns[l],l>0&&(n+=", "),a=this.model.getValue(t,s.property),r[l]=a,null===a&&(a=""),"object"==typeof a&&V(a,"d")?a=a.d:(i=this.columnItems[s.property])&&(a=i.item.displayValueFor(a)),""===a&&o.showNullAs&&(a=o.showNullAs),!1!==s.escape&&(a=e.escapeHTML(a)),(s.label||s.heading)&&(n+=`<span class='a-GV-breakLabel'>${s.label?e.escapeHTML(s.label):s.heading}:</span> `),n+=`<span class='a-GV-breakValue'> ${a}</span>`;return{label:n,values:r}},_renderBreakRecord:function(e,t,l,s){let a=l.label,i=this._getControlBreak(s+1,!0);i?t=i.expanded:(this.controlBreaks.push({offset:s+1,label:a,expanded:t,values:l.values}),this.controlBreaks.sort(B)),this._renderBreakRow(e,t,a,s),this.controlBreakCollapsed=!t},_renderFillerRecord:function(e,t){e.markup(`<tr class='${t}'><td `).attr("colspan",this._calcSpanAllColumns()).markup("></td></tr>")},_renderRecord:function(e,t,l,s,a){this._renderRow(e,t,l,s,a)},_insertRecord:function(t,l,s,a,i){var o,r=e.htmlBuilder(),h=[];return!t&&this._hasControlBreaks()&&((t=n(this.lastFocused).closest("."+d)).length||(t=this.tableData$.find("."+d).first()),t&&this._expandCollapseControlBreak([t],!0),i="after"),this._renderRow(r,l,null,s,a),o=O(r),h.push(o[0]),"after"===i&&t?t.after(o):this.tableData$.prepend(o),this._clearChildrenRowCache(),n(h)},_afterInsert:function(e,t){var l,s,a=!!this.element.find("."+f).length||n(document.activeElement).hasClass("js-autoAdd"),i=e[0].find(".a-GV-cell").first();for(l=0;l<this.columns.length;l++)if(!(s=this.columns[l]).hidden&&!s.readonly&&this.columnItems[s.property]){i=X(e[0],this.fieldToColumnIndex[s.property]);break}if(this._hasControlBreaks()&&!t&&e[0]){let t,a,i,o=e[0].prev().attr("data-rownum");if(null!=o)for(t=this._getControlBreak(D(o)),a=this.model.getRecord(e[0].attr("data-id")),i=t.values,l=0;l<this.breakColumns.length;l++)(s=this.breakColumns[l]).readonly||this.model.setValue(a,s.property,i[l])}setTimeout(()=>{this.focusInHeader=!1,this._select(i,null,a,!1,!1),a&&this.options.editable&&!this.editMode&&this.setEditMode(!0)},0)},_updateRecordField:function(t,l,s,a){var i,o,n,r,d=this.fieldToColumnIndex[s],h=e.htmlBuilder();void 0!==d&&(i=X(t,d),!this.editMode||l!==this.activeRecord||this.ignoreItemChange||a.agg||(o=this.columnItems[s])&&this._setColumnItemValue(o.item,l,s),i.hasClass(p)||(n=this.options.columns[0][s],r=null,a.fields&&(r=a.fields[n.property]),h=e.htmlBuilder(),this._renderFieldDataValue(h,n,l,a,r),i.html(h.toString())))},_updateRecordState:function(e,t,l,s){var a,i,o,n=this.options,r=!this.tooltipOptions;if(i=W(s,n,e.hasClass(c),this.model,l),e.attr("class",i),r&&(s.message?e.first().find(".a-GV-selHeader").attr("title",s.message):e.first().find(".a-GV-selHeader").removeAttr("title")),s.fields)for(const[t,d]of y(s.fields))void 0!==(o=this.fieldToColumnIndex[t])&&(a=X(e,o),i=P(n.columns[0][t],s,d,n,a,this.model,l),a.attr("class",i),r&&(d.message&&!s.deleted?a.attr("title",d.message):a.removeAttr("title")))},_removeRecord:function(e){e.remove()},_identityChanged:function(e,t){this._elementsFromRecordIds([e])[0].attr("data-id",t),this.activeRecordId===e&&(this.activeRecordId=t)},_replaceRecord:function(t,l,s,a,i){var o,r,d,h,u,p,m,g,C=null,v=null,_=[],b=t.children().first().find(".a-GV-rownum").text()||null,w=e.htmlBuilder();b&&(b=D(b)-1),this.activeRecordId===s&&(this.activeRecord=this.activeRecordId=null),r=t.hasClass(c),(d=t.find(this.lastFocused).length)&&(u=q(g=this.lastFocused).hasClass(f)),(h=t.find(this.lastEditModeCell).length&&n(this.lastEditModeCell).hasClass(f))&&(g=this.lastEditModeCell),g&&(C=0,v=K(j(g))),this._renderRow(w,l,b,a,i),o=O(w),_.push(o[0]),t.last().replaceWith(o),this._clearChildrenRowCache(),o=n(_),r&&o.add(o.find(".a-GV-selHeader .u-selector")).addClass(c).attr("aria-selected",!0),h?this._activateCell(X(o.eq(C),v)):d&&(m=X(o.eq(C),v),p=this._getCellFocusable(m),this._setFocusable(p),this._setCurrentRow(m[0]),u&&this._setFocus(p))},_removeFocus:function(e){var t,l,s;((t=n(this.lastFocused).closest("tr"))[0]===e[0]||e.length>1&&t[0]===e[1])&&(l=U(this.lastFocused),(s=this._getNextCellDown(l,1))||(s=this._getPrevCellUp(l,1)),s&&this._select(s,null,!0,!1))},_elementsFromRecordIds:function(e){var t,l=[],s={};for(t=0;t<e.length;t++)s[e[t]]=t,l[t]=null;return this.tableData$.children().each((e,t)=>{var a=n(t),i=a.attr("data-id");void 0!==s[i]&&(l[s[i]]=a)}),l},_renderBreakRow:function(e,t,l,s){let a=this.lastFrozenColIndex>=0||this.options.rowHeader!==x,i=h;if(a&&(i+=" "+_+" "+b+"1"),e.markup(`<tr role='row' class='${d}${t?" is-expanded":""}'`).optionalAttr("data-rownum",null!=s?s+1:null).markup(`><th role='rowheader' class='${i}'`).attr("colspan",this._calcSpanAllColumns(!0)).markup(">"),this.options.collapsibleControlBreaks){let l,s;t?(l="icon-down-arrow",s=L("BREAK_COLLAPSE")):(l="icon-right-arrow",s=L("BREAK_EXPAND")),this._renderButton(e,"a-Button js-toggleBreak",l,s,t)}e.markup("<span class='a-GV-controlBreakLabel'>").markup(l).markup("</span></th>"),a&&e.markup(`<th role='rowheader' class=${h} colspan=${this._calcSpanAllColumns(!1)}></th>`),e.markup("</tr>")},_getControlBreak:function(e,t){let l,s=null;return this.breakColumns.length>0&&(l=z(this.controlBreaks,{offset:e},B),s=this.controlBreaks[l],t||s&&s.offset===e||(s=this.controlBreaks[l-1])),s},_renderRow:function(e,t,l,s,a){var i,o,n,r,d,h,u,f,p=1,m=null,g=null,C=null,v=this.options,G=this.columns,V=!this.tooltipOptions;for(n=W(a,v,null,this.model,t),a.agg?m=a.grandTotal?v.aggregateLabels[a.agg].overallLabel:v.aggregateLabels[a.agg].label:!a.deleted&&a.message&&V&&(g=a.message),h=void 0!==a.serverOffset?a.serverOffset+1:"",null===this.controlBreakCollapsed&&this._hasControlBreaks()&&(this.controlBreakCollapsed=!1,(f=this._getControlBreak(h))&&(f.expanded||this._controlBreakLabel(t).label!==f.label||(this.controlBreakCollapsed=!0))),e.markup("<tr role='row'").attr("data-id",s).optionalAttr("data-rownum",h).attr("class",n).optionalAttr("title",m).optionalAttr("aria-selected",a.sel?I:null).optionalAttr("style",this.controlBreakCollapsed&&!a.agg?"display:none;":null).markup(">"),v.rowHeader!==x&&(u=a.agg||v.rowHeader===H,n="a-GV-cell a-GV-selHeader "+_+" "+b+"1",u&&(n+=" a-GV-rowHeader"),this.lastFrozenColIndex<0&&(n+=" "+w),p+=1,e.markup("<th role='rowheader'").attr("class",n).optionalAttr("title",g).markup(">"),a.agg||(v.rowHeaderCheckbox&&(r=v.multiple?"u-selector":"u-selector u-selector--single",a.sel&&(r+=" "+c),e.markup(`<span class='${r}'`).attr("title",L("SELECT_ROW")).markup("></span>")),"sequence"===v.rowHeader&&e.markup("<span class='a-GV-rownum' aria-hidden='true'>").content(h).markup("</span>")),u&&(e.markup("<span class='a-GV-rowLabel'>"),a.agg?e.content(v.aggregateLabels[a.agg][a.grandTotal?"overallLabel":"label"]):v.rowHeaderLabelColumn&&e.markup(this.model.getValue(t,v.rowHeaderLabelColumn)),e.markup("</span>")),e.markup("</th>")),i=0;i<G.length;i++)o=G[i],d=null,a.fields&&(d=a.fields[o.property]),o.hidden||(n=P(o,a,d,v,null,this.model,t),C=null,V&&(d&&d.message?C=d.message:a.agg&&(C=v.aggregateTooltips[a.agg+"|"+o.property])),[n,p]=this._addFrozenClasses(n,p,o,i),e.markup("<td role='gridcell' tabindex='-1'").attr("class",n).optionalAttr("title",C).markup(">"),this._renderFieldDataValue(e,o,t,a,d),e.markup("</td>"));e.markup("</tr>")},_getColumnMetadata:function(e){var t,l;if(e.hasClass("a-GV-cell"))t=K(e),l=this.tableHeader$.children().last().children().eq(t);else{if(!e.hasClass("a-GV-header"))return null;l=e}return t=D(l.attr("data-idx")),isNaN(t)?null:this.columns[t]},_activateColumnHeader:function(e,t){var l=this._getColumnMetadata(t);l.noHeaderActivate||this._trigger("activateColumnHeader",e,{header$:t,column:l})},_activateRow:function(e){var t,l,s,a,i,o,n,r=e.parent(),d=r.attr("data-id"),h=this;for(a=this.model.getRecord(d),i=this.model.getRecordId(a),n=this.model.allowEdit(a),o=this.model.getRecordMetadata(i),r.addClass(p),this._beginSetColumnItems(),t=0;t<this.columns.length;t++)s=this.columns[t].property,(l=this.columnItems[s])&&this._setColumnItemValue(l.item,a,s,n?o:null);this.activeRecord=a,this.activeRecordId=i,this._endSetColumnItems(),setTimeout((function(){h._triggerBeginEditing(h.activeRecord,h.activeRecordId)}),0)},_deactivateRow:function(t){var l,s,a,i,o,n,r=this.element.find(".a-GV-row.is-active");if(this.activeLockCount>0)this.activeUnlockCallback=t;else{if(r.removeClass(p),(i=this.model.getRecordMetadata(this.activeRecordId))&&!i.deleted&&this.model.allowEdit(this.activeRecord))for(l=0;l<this.columns.length;l++){let t=this.columns[l];a=t.property,(s=this.columnItems[a])&&((n=s.item.isDisabled())?this.model.setValidity("valid",this.activeRecordId,a):s.item.getValidity().valid||this.model.setValidity("error",this.activeRecordId,a,s.item.getValidationMessage(e.escapeHTML(t.label||t.heading))),((o=i.fields?i.fields[a]:null)&&o.disabled||n)&&(o||(i.fields||(i.fields={}),o={},i.fields[a]=o),o.disabled=n))}this._triggerEndEditing(this.activeRecord,this.activeRecordId),this.activeRecord=null,this.activeRecordId=null,t()}},_beginDeactivate:function(e,t){var l=this;this.deactivateDelayTimer||(this.deactivateDelayTimer=setTimeout((function(){l.lastEditModeCell=null,l._deactivateCell(e),t&&(l.dontFocusEditableItem=!0,e.focus()),l.deactivateDelayTimer=null}),10))},_clearDeactivate:function(){this.deactivateDelayTimer&&(clearTimeout(this.deactivateDelayTimer),this.deactivateDelayTimer=null)},_setTabTraps:function(e){var t,l,s,a=this.options.autoAddRecord&&this.model.allowAdd(),i=this.tabTraps$;e.attr("tabindex",-1),t=this._nextCellWithWrap(e).attr("tabindex",0),this._prevCellWithWrap(e).attr("tabindex",0),s=null,a?(s=0,l=2):l=1,null!==s&&(a&&this.onLastPage&&0===t.length?i.eq(s).prop("tabIndex",0).addClass("js-autoAdd"):i.eq(s).prop("tabIndex",t.length?0:-1).removeClass("js-autoAdd")),a&&this.onLastPage&&0===t.length?i.eq(l).prop("tabIndex",0).toggleClass("js-last",!t.length).addClass("js-autoAdd"):i.eq(l).prop("tabIndex",0).toggleClass("js-last",!t.length).removeClass("js-autoAdd")},_clearTabTraps:function(){this.element.find(".a-GV-cell[tabindex='0'],.a-GV-controlBreakHeader[tabindex='0']").attr("tabindex",-1),this.tabTraps$.prop("tabIndex",-1)},_activateCell:function(t,l,s){var a,i,o=this,r=!1,d=null,u=null,f=t.hasClass(h);function m(e){(l=l||o._getCellFocusable(e))!==e[0]&&l.focus()}function g(){let l=t.outerHeight();if((a=o._getColumnMetadata(t))&&(d=o.columnItems[a.property]),d&&o.model.allowEdit(o.activeRecord)&&!a.readonly&&!t.hasClass("is-readonly")){if(t.addClass(p),(i=d.item.getPopupSelector())&&n(document.body).on("focusin.gridpopup",(function(e){n(e.target).closest(i).length&&o._clearDeactivate()})).on("focusout.gridpopup",(function(e){var t;n(e.target).closest(i).length&&(t=n(o.lastEditModeCell),o._beginDeactivate(t,!0))})),u=d.element$.height(),d.element$=d.element$.detach(),t.css("height",l+"px").empty(),u>l?(o.floatingItem$.children(".a-GV-floatingItemContent").append(d.element$),o._expandFloatingItem(t)):t.append(d.element$),o._activateColumnItem(d,a.domId),!o.dontFocusEditableItem&&!d.item.isDisabled()){d.item.setFocus();let l=document.activeElement;if("INPUT"===l.nodeName&&["text","search","password","tel","email","url"].includes(l.type.toLowerCase())){let a=n(l),i=l.value,r=o.element.hasClass(v),d=t.css("text-align"),h=0;if("left"===d?d="start":"right"===d&&(d="end"),s<0||0===i.length)l.setSelectionRange(0,i.length,r?"forward":"backward");else{if(null!=s){let l,r,c=n(`<span class="a-GV-cell" style="position:absolute;top:0;white-space:nowrap;">${e.escapeHTML(i)}</span>`);o.element.append(c),l=c.width(),r=l/i.length,(s-="end"===d?Math.max(0,t.outerWidth()-D(a.css("paddingRight"))-l):"center"===d?Math.max(0,(t.outerWidth()-D(a.css("paddingRight"))-l)/2):D(a.css("paddingLeft")))<0&&(s=0),h=Math.round(s/r),c.remove()}l.setSelectionRange(h,h)}}}o.dontFocusEditableItem=!1,r=!0,o._savedActivationtarget&&(o._interactWithCellItem(n.Event("activate",{target:o._savedActivationtarget}),t,a,d.item),o._savedActivationtarget=null)}else m(t)}if(this.lastEditModeCell=t[0],t.parent().hasClass(c)?this.lastRow$&&this.lastRow$.index(t)>=0||this._setCurrentRow(t[0]):this._select(t,null,!1,!1),this._setFocusable(t[0]),this._setTabTraps(t),!this.activeRecord||this.activeRecordId!==t.parent().attr("data-id")){if(this.activeRecord)return void this._deactivateRow((function(){f?m(t):(o._activateRow(t),g())}));f?m(t):this._activateRow(t)}return f?m(t):g(),r},_checkInteractWithCellItem:function(e,t,l){var s,a=!1,i=this._getColumnMetadata(l),o=i&&this.columnItems[i.property];return o&&(o=o.item)&&o.getInteractionSelector&&(s=o.getInteractionSelector(),t.closest(s).length&&(e?(this._interactWithCellItem(e,l,i,o),a=!0):this._savedActivationtarget=t[0])),a},_interactWithCellItem:function(e,t,l,s){var a=t.parent().attr("data-id"),i=this.model.getRecord(a);"activate"===e.type?s.onInteraction(e):!this.model.allowEdit(i)||l.readonly||t.hasClass("is-readonly")||s.onInteraction(e,this.model,i,l.property)},_expandFloatingItem:function(e){var t,l,s,a=this.element.hasClass(v)?"right top":"left top",i=e.outerWidth(),o=this._getColumnMetadata(e).property;this.floatingItem$.css("position","").css("min-width",i+"px").appendTo("body").show().addClass("is-expanded").draggable("enable").attr("data-owning-region",this.element[0].id).find(".a-GV-expandCollapse span").removeClass("icon-ig-expand").addClass("icon-ig-restore"),this.floatingItem$.children(".a-GV-floatingItemContent").show().css({width:"",height:""}),(s=this.lastFloatingPos[o])?this.floatingItem$.css({left:s.left,top:s.top}):this.floatingItem$.position({my:a,at:a,of:e,collision:"fit fit"}),this.floatingItem$.find(".js-tabTrap").not(".js-last").attr("tabindex",0),(t=this._getColumnMetadata(e))&&((l=this.columnItems[t.property]).item.isDisabled()||l.item.setFocus())},_collapseFloatingItem:function(e){var t=e.innerWidth(),l=e.innerHeight();this.floatingItem$.css({position:"relative",left:"",top:""}).appendTo(e).draggable("disable").removeClass("is-expanded ui-state-disabled").removeAttr("data-owning-region").find(".a-GV-expandCollapse span").removeClass("icon-ig-restore").addClass("icon-ig-expand"),this.floatingItem$.children(".a-GV-floatingItemContent").hide().width(t).height(l),this.floatingItem$.find(".a-GV-expandCollapse").focus(),this.floatingItem$.find(".js-tabTrap").not(".js-last").attr("tabindex",-1)},_deactivateCell:function(t){var l,s,a,i,o=null;t.length<=0||(this._clearTabTraps(),this._setFocusable(t[0]),(l=this._getColumnMetadata(t))&&(o=this.columnItems[l.property]),o&&t.hasClass(p)&&(n(document.body).off(".gridpopup"),this._setModelValue(t,o.item,this.activeRecord,l.property),i=null,(a=this.model.getRecordMetadata(this.activeRecordId)).fields&&(i=a.fields[l.property]),this.debugDontDeactivateCell?t.addClass(f+" "+p):(this.floatingItem$.appendTo("body"),this.floatingItem$.hide(),this._deactivateColumnItem(o),s=e.htmlBuilder(),this._renderFieldDataValue(s,l,this.activeRecord,a,i),t.html(s.toString()).css("height","")),this._updateRecordState(this.lastRow$.parent(),this.activeRecordId,this.activeRecord,a)))},_finishEditing:function(e){var t,l=n(this.lastEditModeCell);l.length&&(t=l.hasClass(f),this._clearDeactivate(),this._deactivateCell(l),t&&this._activateCell(l)),e.resolve()},_setFocus:function(e){e.tabIndex=0,e.focus()},_setFocusable:function(t){var l,s,a,i,o,r,c,u,f,p,m,g,C,v=this,_=this.options.tabbableCellContent,b=q(t);function w(e){var t,l,s,a;for(t=0;t<v.columnGroups.length;t++)for(s=v.columnGroups[t],l=0;l<s.length;l++)if((a=s[l]).property===e)return a;return null}if(this.lastFocused&&(n(this.lastFocused).removeAttr("aria-labelledby").closest("td,th").removeAttr("id"),s=q(this.lastFocused),b[0]!==s[0]&&s.add(s.find(_).not(":disabled,.js-asc,.js-desc")).prop("tabIndex",-1)),u=(g=b.closest("tr")).attr("data-rownum"),f=null,(b.hasClass(h)||b.hasClass("a-GV-headerGroup"))&&(f=this.lastColIndex),null===f&&(f=Q(b)),f+=1,g.hasClass(d)?(u+="b",p=L("BREAK_CONTEXT")):g.hasClass("is-aggregate")?p=L("AGG_CONTEXT"):b.hasClass("a-GV-header")?p=L("HEADER_CONTEXT"):b.hasClass("a-GV-headerGroup")?p=L("GROUP_CONTEXT"):(u!==this.curRowNum&&f!==this.curColNum?p=N("ROW_COLUMN_CONTEXT",u,f):u!==this.curRowNum?p=N("ROW_CONTEXT",u):f!==this.curColNum&&(p=N("COLUMN_CONTEXT",f)),(C=this._getControlBreak(D(u)))&&C.offset!==this.curControlBreak&&(p=L("BREAK_CONTEXT")+" "+e.stripHTML(C.label)+"."+p)),p&&this.accContext$.text(p+" "),a=0,b.children(".a-GV-columnItem")[0]||(a=b.find(_).not(":disabled,.js-asc,.js-desc").prop("tabIndex",0).length),a||b.prop("tabIndex",0),this.lastFocused=t,i="",u!==this.curRowNum&&(this.curRowHeaders&&n(this.curRowHeaders).removeAttr("id"),this.curRowHeaders="",(g=ee(b)).find(".a-GV-rowHeader").not(b).each((function(e){var t=v.idPrefix+"_rh_"+e;n(this).attr("id",t),i+=t+" ",v.curRowHeaders&&(v.curRowHeaders+=","),v.curRowHeaders+="#"+t}))),f!==this.curColNum&&!this.focusInHeader)if((l=this._getColumnMetadata(b))&&l.domId){for(o="",r=Z(l);r;)(c=w(r))&&c.domId&&(o=c.domId+" "+o),r=c.parentGroupName;o+=l.domId,i+=o+" "}else b.hasClass("a-GV-selHeader")&&(i+=this.idPrefix+"_shh ");m=this.idPrefix+"_cur",i+=m,i=this.accContextId+" "+i,n(t).attr("aria-labelledby",i).closest("td,th").attr("id",m),this.curRowNum=u,this.curColNum=f,this.curControlBreak=C?C.offset:null},_getCellFocusable:function(e){var t=e.find(this.options.tabbableCellContent).not(":disabled,.js-asc,.js-desc");return t.length?t[0]:e[0]},_getPrevCellUp:function(e,t,l){var s,a=null,i=null;return(e.hasClass(h)||e.hasClass("a-GV-headerGroup"))&&(i=this.lastColIndex),null===i&&(i=Q(e),this.lastColIndex=i),e.closest("tr").prevAll(":visible").each((function(e){let a=n(this);return a.hasClass("a-GV-scrollFiller")?(l=!0,!1):(s=a,e<t-1)})),this.focusInHeader||l||s||(this.focusInHeader=!0,s=this.tableHeader$.children().last()),s&&(a=s.hasClass(d)?e.hasClass(_)?s.children().first():s.children().last():X(s,i)),a},_getNextCellDown:function(e,t){var l,s,a=null,i=null;return(e.hasClass(h)||e.hasClass("a-GV-headerGroup"))&&(i=this.lastColIndex),null===i&&(i=Q(e),this.lastColIndex=i),s=0,e.closest("tr").nextAll(":visible").each((function(e){let a=n(this);return s+=1,!a.hasClass("a-GV-scrollFiller")&&(l=a,e<t-1)})),this.focusInHeader&&(!l||s<t)&&(this.focusInHeader=!1,l=this.tableData$.children().first()),l&&(a=l.hasClass(d)?e.hasClass(_)?l.children().first():l.children().last():X(l,i)),a},_copy:function(e){var t,l,s,a,i,o,n,r,d,h,c=this.model,u=this.options,f=u.dataTransferFormats;if(u.selectCells){if(r=[],!(s=this.getSelectedRange())||!s.values.length)return;for(r=s.columns.map((function(e){return e?u.columns[0][e]:null})),f.forEach((function(e){e.writer.begin(c,s,r)})),t=0;t<s.values.length;t++){for(d=s.recordIds[t],n=null!==d?c.getRecord(d):null,f.forEach((function(e){e.writer.beginRow(t,n,d)})),o=s.values[t],l=0;l<o.length;l++)h=n&&r[l]?c.getValue(n,r[l].property):"",f.forEach((function(e){e.writer.cell(l,r[l],h,o[l])}));f.forEach((function(e){e.writer.endRow()}))}}else{if(!(s=this.getSelection()).length)return;for(r=[],"NONE"!==u.rowHeader&&r.push(null),this.getColumns().forEach((function(e){e.hidden||r.push(e)})),f.forEach((function(e){e.writer.begin(c,s,r)})),t=0;t<s.length;t++){for(a=s[t],d=a.first().attr("data-id"),n=null!==d?c.getRecord(d):null,f.forEach((function(e){e.writer.beginRow(t,n,d)})),i=a.children(),l=0;l<i.length;l++)h=n&&r[l]?c.getValue(n,r[l].property):"",f.forEach((function(e){e.writer.cell(l,r[l],h,i.eq(l).text())}));f.forEach((function(e){e.writer.endRow()}))}f.forEach((function(e){e.writer.end()}))}f.forEach((function(t){t.writer.end(),e.setData(t.format,t.writer.toString())}))},_setSelectionMode:function(){var e=this.options,t=this.element.children(".a-GV-bdy").find(u);this.element.toggleClass("a-GV--selectCells",e.selectCells),t.removeClass(c).removeAttr("aria-selected"),e.persistSelection&&this.model.clearSelection(),this.allSelected=!1,this.lastFocused&&t[0]&&this._select(n(this.lastFocused),null,!1)},_select:function(t,l,s,a,i){let o,r,h,u,f,p,m,g,C,v,_,b,w,G,x=!1,H=null,I=this.options,V="set";const y=(e,t)=>{const l=e=>{e.each((e,l)=>{let s=n(l).attr("data-id");s&&this.model.setSelectionState(s,t,V)})};I.persistSelection&&!x&&(l(e),"toggle"!==V&&e.length>1&&l(C.first()))};if("unset"===l||I.allowSelectHidden||(t=t.filter(":visible")),g=t.parent("tr"),_=this.lastRow$&&this.lastRow$.index(t.first())>=0,l&&(I.selectCells&&I.multipleCells||!I.selectCells&&I.multiple)&&("string"==typeof l?V=l:"click"===l.type?l.ctrlKey||l.metaKey?V="toggle":l.shiftKey&&(V="range"):"keydown"===l.type&&(l.which===k.SPACE?V=l.ctrlKey?"toggle":l.shiftKey?"range":"add":l.ctrlKey?V="none":l.shiftKey&&(V="range")),I.selectCells&&"range"!==V&&(V="set"),l.target||(l=null)),I.persistSelection&&(G=this.model.getSelectionState().rangeAnchor),"all"===V?(x=!0,V="set"):"range"!==V||(this.selectAnchor||G)&&!this.focusInHeader||(V="set"),!this.focusInHeader)if("set"!==V&&"range"!==V||(b=this.element.children(".a-GV-bdy").find(I.selectCells?"td.is-selected,th.is-selected":"tr.is-selected"),I.rowHeaderCheckbox&&b.find(".u-selector").removeClass(c),b.removeClass(c).removeAttr("aria-selected"),I.persistSelection&&this.model.clearSelection()),I.selectCells)if("range"===V){let e,l,s=n(this.selectAnchor);r=K(s.parent()),h=K(t.last().parent()),r>h&&(p=h,h=r,r=p),u=K(s),f=K(t.last()),u>f&&(p=f,f=u,u=p),e=u,l=f+1,this.tableData$.children().each((t,s)=>{var a=n(s);if(t>h)return!1;t>=r&&a.hasClass("a-GV-row")&&!a.hasClass("is-aggregate")&&(I.allowSelectHidden||a.is(":visible"))&&a.children().slice(e,l).addClass(c).attr("aria-selected",!0)})}else t.addClass(c).attr("aria-selected",!0),this.selectAnchor=t[0];else{if(I.persistSelection&&x&&this.model.setSelectionState(null,!0,"all"),o=g.hasClass(c),C=g.filter(".a-GV-row").not(".is-aggregate"),"set"===V||"add"===V||"toggle"===V&&!o)C.addClass(c).attr("aria-selected",!0),y(C,!0),this.selectAnchor=C[0],H=!0;else if("range"===V){let e,t=n(this.selectAnchor),l=g.last();if(r=this._rowIndex(t),I.persistSelection){let l=this.model.getRecordMetadata(G);l&&l.serverOffset&&(e=l.serverOffset+1,e!==D(t.attr("data-rownum"))&&(r=-1))}if(h=this._rowIndex(l),r<0){let s=e||D(t.attr("data-rownum")),a=D(l.attr("data-rownum"));if(I.pagination.virtual){let e=this.tableData$.find(".a-GV-scrollFiller").toArray();if(a>s)for(let l=0;l<e.length&&(t=n(e[l]).next(),!(D(t.attr("data-rownum"))>s));l++);else for(let l=e.length-1;l>=0&&(t=n(e[l]).prev(),!(D(t.attr("data-rownum"))<s));l--);r=this._rowIndex(t)}else!I.pagination.scroll&&I.persistSelection&&(t=this.tableDataChildren$[a>s?"first":"last"](),r=this._rowIndex(t))}I.persistSelection&&(l.hasClass(d)&&(l=l[r>h?"next":"prev"]()),y(l,!0)),r>h&&(p=h,h=r,r=p),h+=1,v=[],this.tableDataChildren$.slice(r,h).each((function(e,t){let l=n(t);l.hasClass("a-GV-row")&&!l.hasClass("is-aggregate")&&(I.allowSelectHidden||l.is(":visible"))&&v.push(t)})),C=n(v),C.addClass(c).attr("aria-selected",!0),H=!0}else("toggle"===V&&o||"unset"===V)&&(C.removeClass(c).removeAttr("aria-selected"),y(C,!1),this.selectAnchor=C[0],H=!1);null!==H&&I.rowHeaderCheckbox&&C.find(".u-selector").toggleClass(c,H),I.multiple&&I.selectAll&&this._updateSelectAll()}t.length>0&&null!==s&&(m=this._getCellFocusable(t.first()),s?this._setFocus(m):this._setFocusable(m),_||this._setCurrentRow(t[0])),I.persistSelection&&(this.hasSelection=this.model.getSelectedCount()>0),this.focusInHeader||"toggle"!==V&&"unset"!==V&&("range"!==V||!I.selectCells&&o)&&"add"!==V&&("set"!==V||!I.selectCells&&e.arrayEqual(b,C))||(w=!(i||I.navigation&&l&&"click"===l.type),a?se(this,w,l):le(this,w,l))},_getAllRows:function(){let e=this.tableData$.children(".a-GV-row").not(".is-aggregate");return this.options.allowSelectHidden||(e=e.filter(":visible")),e},_updateSelectAll:function(){let e,t=this.options;if(t.persistSelection){let t=this.model.getSelectionState();e=t.selectAll&&0===t.except.length}else{let t=this._getAllRows();e=t.length>0&&t.length===t.filter(u).length}this.allSelected=e,t.rowHeaderCheckbox&&this.tableHeader$.find(".u-selector").first().toggleClass(c,e).attr("aria-checked",e?I:"false").closest(".a-GV-selHeader").toggleClass(c,e)},_clearChildrenRowCache:function(){this.tableDataChildren$=null},_rowIndex:function(e){return e.parents(".a-GV-bdy").length?(this.tableDataChildren$||(this.tableDataChildren$=this.tableData$.children()),this.tableDataChildren$.index(e)):K(e)},_setCurrentRow:function(e){this.lastRow$=ee(n(e)).children()},_fireActivate:function(e,t){var l=ee(t);this._trigger("activateCell",e,{cell$:t,row$:l})},_nextCellWithWrap:function(e){let t,l=this.options.skipReadonlyCells;function s(e){let t,s=e.next();return s.length||(t=e.closest("tr"),t=t.next(),s=function(e){for(;l&&e.hasClass("is-aggregate")||e.not(":visible").length;)e=e.next();return e.children().first()}(t)),s}if(t=s(e),l)for(;t.hasClass("is-readonly");)t=s(t);return t},_prevCellWithWrap:function(e){let t,l=this.options.skipReadonlyCells;function s(e){let t,s=e.prev();return s.length||(t=e.closest("tr"),t=t.prev(),s=function(e){for(;l&&e.hasClass("is-aggregate")||e.not(":visible").length;)e=e.prev();return e.children().last()}(t)),s}if(t=s(e),l)for(;t.hasClass("is-readonly");)t=s(t);return t},_clearHoverStates:function(){this.element.find(".is-hover").removeClass("is-hover"),this.columnControls$.hide(),this.columnHandle$.hide()},_setRowHoverState:function(e){this.element.find(".is-hover").removeClass("is-hover"),(e=ee(e.children().eq(0))).addClass("is-hover")},_sortChange:function(e,t,l){var s,a="set",i=this._getColumnMetadata(t);i.canSort&&(s=l===i.sortDirection,this.options.columnSortMultiple&&e.shiftKey?(a="add",a=s?"remove":i.sortDirection?"change":"add"):s&&(a="clear"),this._trigger("sortChange",e,{header$:t,column:i,direction:l,action:a}))},_updateColumnControls:function(e){var t,l,s=!1,a=!1;"asc"===e.sortDirection?(t=L("SORT_OFF"),l=L("SORT_DESCENDING"),s=!0):"desc"===e.sortDirection?(t=L("SORT_ASCENDING"),l=L("SORT_OFF"),a=!0):(t=L("SORT_ASCENDING"),l=L("SORT_DESCENDING")),this.columnControls$.find(".js-asc").attr("title",t).attr("aria-label",t).toggleClass(p,s),this.columnControls$.find(".js-desc").attr("title",l).attr("aria-label",l).toggleClass(p,a)},_adjustSizeForScrollBars:function(t,l,s){var a=this.element.children().filter(".a-GV-hdr").children(".a-GV-w-hdr"),i=function(e,t){var l=e.parent()[0],s={h:!1,v:!1};return e.outerHeight()+(t||D(e.css("margin-top")))>l.clientHeight&&(s.v=!0),e.outerWidth()>l.clientWidth&&(s.h=!0),s}(this.tableData$.parent(),s);i.h&&e.getScrollbarSize().height,i.v&&(l-=e.getScrollbarSize().width),a.width(l)},_headerScrollCheck:function(e,t,l){var s,a,i,o=0,r=this.hdrScrollParent;return r&&(i=n(this.hdrScrollParent).offset().left,this.element.hasClass(v)?(e-t-i<10?o=-10:i+r.offsetWidth-e<10&&i+r.offsetWidth-e>0&&(o=10),l&&o&&((s=r.scrollLeft+o)>0?(r.scrollLeft=0,o=0):s>r.scrollWidth-r.clientWidth?(r.scrollLeft=r.scrollWidth-r.clientWidth,o=0):r.scrollLeft=s)):(i+r.offsetWidth-(e+t)<10?o=10:e-i<10&&e-i>0&&(o=-10),l&&o&&((s=r.scrollLeft+o)<0?(r.scrollLeft=0,o=0):s>r.scrollWidth-r.clientWidth?(r.scrollLeft=r.scrollWidth-r.clientWidth,o=0):r.scrollLeft=s)),a=!!o),a},_headerScrollStart:function(e,t,l){var s=this,a=0,i=[151,134,119,106,95,86,79,74,71];this.scrollTimerId&&this._headerScrollStop(),function o(){s.scrollTimerId=setTimeout((function(){s._headerScrollCheck(e,t,!0)?(l(),o()):s._headerScrollStop()}),i[a]),a<i.length-1&&(a+=1)}()},_headerScrollStop:function(){clearTimeout(this.scrollTimerId),this.scrollTimerId=null},_expandCollapseControlBreak:function(e,t){let l,s,a,i=[],o=[],r=this.options,h=!r.allowSelectHidden;function u(e,l){var o=n(l);if(o.hasClass("a-GV-row")&&!o.hasClass("is-aggregate"))!t&&h&&o.hasClass(c)&&i.push(o.children("td,th")[0]),o[t?"show":"hide"]();else{if(o.hasClass(d))return s=!0,!1;if(o.hasClass("a-GV-scrollFiller")){if(a=D(o.attr("data-start")),!t||"collapse"!==o.css("visibility"))return!1;o.css("visibility","").removeClass("is-hidden")}}}R(e)||(e=[e]);for(let l=0;l<e.length;l++){let i,n,h=e[l];h.hasClass(d)&&(o.push(h),s=!1,h.nextAll().each(u),n=this._getControlBreak(D(h.attr("data-rownum")),!0),n&&(n.expanded=t),t?(i=L("BREAK_COLLAPSE"),h.addClass("is-expanded").find(".js-toggleBreak").attr("aria-expanded",I).attr("title",i).attr("aria-label",i).children(".a-Icon").removeClass("icon-right-arrow").addClass("icon-down-arrow")):(i=L("BREAK_EXPAND"),h.removeClass("is-expanded").find(".js-toggleBreak").attr("aria-expanded","false").attr("title",i).attr("aria-label",i).children(".a-Icon").removeClass("icon-down-arrow").addClass("icon-right-arrow"),l===e.length-1&&r.pagination.scroll&&!r.pagination.loadMore&&(s?r.pagination.virtual?(this.lastScrollTop=null,this._scrollPage()):this.tableData$.height()<this.scrollParent$.height()&&this._addNextPage():r.pagination.virtual?a>=0&&(this.pageOffset=a,this._addPageOfRecords()):this._addNextPage())))}i.length&&(l=this.focusInHeader,this.focusInHeader=!1,this._select(n(i),"unset",n(document.activeElement).closest(this.element[0]).length>0,null),this.focusInHeader=l),this._trigger("expansionChange",null,{type:"break",expand:t,rows$:o})},debugCellEdit:function(e){this.debugDontDeactivateCell=!!e}},apex.widget.contextMenuMixin)),n.ui.dialog&&n.widget("ui.dialog",n.ui.dialog,{_allowInteraction:function(e){return n(e.target).closest(".a-GV-floatingItem").length>0||this._super(e)}})}(apex.util,apex.model,apex.debug,apex.lang,apex.item,apex.clipboard,apex.widget.util,apex.jQuery);
!function(e,t,i,o,r,l,s){"use strict";const d=".u-Form-fieldContainer",n="show",a="hide",c="delete-record",u="next-record",h="previous-record",f="insert-record",p=e.objectEntries,m=s.extend,g=s.ui.keyCode;const v=[{align:"start",controls:[{type:"MENU",labelKey:"APEX.RV.SETTINGS_MENU",iconOnly:!0,icon:"icon-gear",menu:{items:[{type:"toggle",action:"exclude-null-values"},{type:"toggle",action:"exclude-hidden"}]}}]},{align:"end",controls:[{type:"STATIC",id:"status",label:""},{type:"BUTTON",iconOnly:!0,action:h},{type:"STATIC",id:"recordNumber",label:""},{type:"BUTTON",iconOnly:!0,action:u}]}];function R(e){var t=e.groupName||null;return t&&e.useGroupFor&&e.useGroupFor.indexOf("srv")<0&&(t=null),t}s.widget("apex.recordView",s.apex.tableModelViewBase,{version:"21.1",widgetEventPrefix:"recordview",options:{idPrefix:null,actionsContext:null,recordOffset:0,recordParent:null,showNullAs:"-",fields:null,fieldGroups:null,alwaysEdit:!1,skipDeletedRecords:!1,toolbar:v,showExcludeNullValues:!0,showExcludeHiddenFields:!0,formCssClasses:null,labelAlignment:"end",tabbableFieldContent:"a,button,input",modeChange:null,recordChange:null},_create:function(){var e=this,t=this.options,i=this.element;i.addClass("a-RV"),this._super(),delete this.firstPage,delete this.previousPage,delete this.nextPage,delete this.lastPage,delete this.loadMore,delete this.gotoPage,this.editMode=!1,this.fields=null,this.excludeNullValues=!1,this.excludeHiddenFields=!1,this.lastFocused=null,this.lastField=null,this.toolbar$=null,this.currentRecord=null,this.currentRecordId=null,t.actionsContext?this.actions=t.actionsContext:this.actions=l.createContext("recordView",i[0]),this.actions.remove(["exclude-null-values","exclude-hidden",u,h,f,"refresh-record","revert-record",c,"duplicate-record"]),this.actions.add([{name:"exclude-null-values",labelKey:"APEX.RV.EXCLUDE_NULL",get:function(){return e.excludeNullValues},set:function(o){t.showExcludeNullValues&&(e.excludeNullValues=o,i.toggleClass("a-RV--excludeNull",o))}},{name:"exclude-hidden",labelKey:"APEX.RV.EXCLUDE_HIDDEN",get:function(){return e.excludeHiddenFields},set:function(o){t.showExcludeHiddenFields&&(e.excludeHiddenFields=o,i.toggleClass("a-RV--excludeHidden",o))}},{name:u,labelKey:"APEX.RV.NEXT_RECORD",shortcut:"Alt+Page Down",icon:"icon-next",action:function(){var i,o;if("tree"===e.modelShape){if(!(o=e._nextTreeRecord()))return;t.recordParent=o.parent,t.recordOffset=o.offset}else{if(!((i=e.model.getTotalRecords())<0||t.recordOffset+1<i))return;t.recordOffset+=1}e.direction=1,e.refresh(!1)}},{name:h,labelKey:"APEX.RV.PREV_RECORD",shortcut:"Alt+Page Up",icon:"icon-prev",action:function(){var i;if("tree"===e.modelShape){if(!(i=e._previousTreeRecord()))return;t.recordParent=i.parent,t.recordOffset=i.offset}else{if(!(t.recordOffset>0))return;t.recordOffset-=1}e.direction=-1,e.refresh(!1)}},{name:f,labelKey:"APEX.RV.INSERT",action:function(){if(t.editable)return e.model.insertNewRecord("tree"===e.modelShape?t.recordParent:null,e.getRecord()),e.actions.invoke(u),e.editMode||e.setEditMode(!0),e.focus(),!0}},{name:"refresh-record",labelKey:"APEX.RV.REFRESH",action:function(){e.model.fetchRecords([e.getRecord()])}},{name:"revert-record",labelKey:"APEX.RV.REVERT",action:function(){t.editable&&e.model.revertRecords([e.getRecord()])}},{name:c,labelKey:"APEX.RV.DELETE",action:function(){t.editable&&e.model.deleteRecords([e.getRecord()])}},{name:"duplicate-record",labelKey:"APEX.RV.DUPLICATE",action:function(){if(t.editable){var i=e.getRecord();return e.model.copyRecords([i],null,i),e.actions.invoke(u),e.editMode||e.setEditMode(!0),e.focus(),!0}}}]),this._updateMenuActions(),this._initModel(t.modelName),this._on(this._eventHandlers),this.direction=1,this.refresh(),t.disabled&&this._setOption("disabled",t.disabled)},_eventHandlers:{resize:function(e){e.target===this.element[0]&&(this.resize(),e.stopPropagation())},dblclick:function(e){var t=this.options;s(e.target).closest(d).length&&!t.alwaysEdit&&t.editable&&!this.editMode&&(e.preventDefault(),this.setEditMode(!0))},click:function(e){var t=s(e.target).closest(".u-Form-label");t.length&&t.closest(d).find(":tabbable").first().focus()},keydown:function(e){var t,i,o=this.options,r=e.which;if(r===g.ENTER){if(s(e.target).closest("a,button").length>0)return;s(e.target).closest(d).length&&!o.alwaysEdit&&o.editable&&!this.editMode&&(e.preventDefault(),this.setEditMode(!0))}else if(113===r)s(e.target).closest(d).length&&!o.alwaysEdit&&o.editable&&!this.editMode&&(e.preventDefault(),this.setEditMode(!0));else if(r===g.ESCAPE)!o.alwaysEdit&&o.editable&&this.editMode&&(this.setEditMode(!1),e.stopPropagation());else if(112===r&&e.altKey&&(t=s(e.target).closest(d).find(".js-itemHelp")).length&&(i=t.attr("data-itemhelp")))return apex.theme.popupFieldHelp(i,apex.env.APP_SESSION),!1},focusin:function(e){var t,i,o=this;function r(){o.deactivateDelayTimer&&(clearTimeout(o.deactivateDelayTimer),o.deactivateDelayTimer=null)}0!==(i=s(e.target).closest(d)).length?(i.addClass("is-focused"),this.lastFocused=i[0],i[0]!==this.lastField?(this.lastField=i[0],this.editMode&&(r(),(t=this.element.find(".is-active")).length&&this._deactivateField(t),this._activateField(i))):r()):this.lastField=null},focusout:function(e){var t=this,i=s(e.target).closest(d);0!==i.length&&(i.removeClass("is-focused"),this.editMode&&(this.deactivateDelayTimer=setTimeout((function(){t.lastField=null,t._deactivateField(i),t.deactivateDelayTimer=null}),10)))}},_destroy:function(){this.element.removeClass("a-RV is-disabled u-RTL a-RV--excludeHidden a-RV--excludeNull").empty(),this._initModel(null)},_setOption:function(e,t){"editable"===e&&!t&&this.editMode&&this.setEditMode(!1),this._super(e,t),"disabled"===e?(this.element.toggleClass("is-disabled",t),t&&this.resize()):"showExcludeNullValues"===e||"showExcludeHiddenFields"===e?this._updateMenuActions():"recordOffset"===e||"recordParent"===e?this.refresh():"modelName"===e?(this.editMode&&this.setEditMode(!1),this._initModel(t),this.refresh()):"editable"!==e&&"alwaysEdit"!==e&&"toolbar"!==e&&"formCssClasses"!==e&&"labelAlignment"!==e||this._refreshView()},getActions:function(){return this.actions},getToolbar:function(){return this.toolbar$},refresh:function(e){var t,i=this,o=this.options,r=this.element;this._refreshCheckIfVisible()&&((t=r.find(".u-Form-fieldContainer.is-active")).length&&this._deactivateField(t),this.fields||this._initView(),!this.editMode&&o.alwaysEdit&&this.setEditMode(!0),this._updateRecord(null,null,(function(){e&&i.focus()})))},focus:function(){this.lastField=null,this.body$.find(":tabbable").first().focus()},gotoField:function(e,t){var o,r,l,s,d,n=this.options,a=null;if(r=this.model.getRecord(e)){if(e!==this.currentRecordId&&(n.recordOffset=this.model.indexOf(r),this.refresh()),t)if(s=n.fields[0][t]){for(s.hidden&&s.canHide&&this.excludeHiddenFields&&this.actions.set("exclude-hidden",!1),null!==(d=this.model.getValue(r,t))&&""!==d||!this.excludeNullValues||this.actions.set("exclude-null-values",!1),o=0;o<this.fields.length;o++)if(!((l=this.fields[o]).virtual||!l.canHide&&l.hidden)&&l.property===t){a=this.element.find("[data-idx='"+o+"']");break}o>=this.fields.length&&i.warn("Warning field is hidden "+t)}else i.warn("Warning field not found "+t);a?(this.lastField=null,a.find(":tabbable").first().focus()):this.focus()}else i.warn("Warning record not found "+e)},getFields:function(){return this.fields},refreshFields:function(){this.fields=null},fieldElement:function(e){return this.mapFieldToLabelId&&this.mapFieldToLabelId[e]?s("#"+this.mapFieldToLabelId[e]).closest(d):s()},inEditMode:function(){return this.editMode},setEditMode:function(e){var t,o,r=this.element,l=this;this.scrollWrap$&&(this.options.editable?(e=!!e,o=this.editMode,e!==o&&((t=s(this.lastFocused)).length&&!e&&l._deactivateField(t),this._updateRecord(e,o,(function(){l.editMode=e,r.toggleClass("a-RV--editMode",e),e&&!t.length&&(l.focus(),t=s(l.lastFocused)),t.length&&(t.find(":tabbable").first().focus(),l.deactivateDelayTimer&&(clearTimeout(l.deactivateDelayTimer),l.deactivateDelayTimer=null),e&&l._activateField(t)),e?l.body$.on("change.rvedit",(function(e){var t,i,o;if(l.activeRecord&&!s(e.target).closest(".u-Form-fieldContainer.is-active").length)for(t=0;t<l.fields.length;t++)if((i=l.fields[t]).elementId===e.target.id){o=i.property,l.setActiveRecordValue(o);break}})):(l._forEachField(!0,(function(e,t){void 0!==l.columnItems[t.property]&&l._deactivateColumnItem(l.columnItems[t.property])})),l.body$.off("change.rvedit"),l.activeRecord=null,l.activeRecordId=null),l._trigger("modeChange",null,{editMode:e})})))):e&&i.warn("View is not editable."))},getRecord:function(){return this.currentRecord},resize:function(){var e,t=this.element,i=t.height();null!==t[0].offsetParent&&(this.scrollWrap$&&!this.pendingRefresh||(this.refresh(),this.fields))&&this.options.hasSize&&(e=i-(this.toolbar$?this.toolbar$.outerHeight():0),this.scrollWrap$.height(e))},expandGroup:function(){},collapseGroup:function(){},_initModel:function(t){var i,o=this.options,r=this;this._super(t,(function(t,l){var s,d,n,a,c,f,p,m;function g(e,s){var d,n;for(d=0;d<e.length;d++)(n=e[d])===r.currentRecordId&&("delete"===t?i&&o.skipDeletedRecords?(r.currentRecord=null,r.currentRecordId=null,r.activeRecord=null,r.activeRecordId=null,r.actions.invoke(u),null===r.currentRecord&&r.actions.invoke(h)):r._updateRecord():"clearChanges"===t&&s?r.actions.invoke(u):"refreshRecords"===t?(n=l.newIds[n]||n,r._updateRecord()):"revert"===t?r._updateRecord():r._updateRecordState())}r.pendingRefresh||("refresh"===t?("tree"===r.modelShape?(r.recordOffset=-1,r.recordParent=null):"table"===r.modelShape&&r.currentRecordId?(p=r.model.getRecord(r.currentRecordId),m=r.model.indexOf(p),o.recordOffset=m>-1?m:0):o.recordOffset=0,r.refresh(!0)):"insert"===t||"copy"===t?r.noData&&r.refresh():"refreshRecords"===t?g(l.recordIds):"clearChanges"===t?(g(l.deletedIds,!0),g(l.changedIds)):l.recordIds?g(l.recordIds):"set"===t?null!==r.ignoreFieldChange&&r.ignoreFieldChange===l.field||(l.oldIdentity&&r._identityChanged(l.oldIdentity,r.model.getRecordId(l.record)),r.model.getRecordId(l.record)===r.currentRecordId&&(s=r.columnItems[l.field],r.editMode&&s?r.ignoreItemChange||r._setColumnItemValue(s.item,l.record,l.field):(a=r.fieldElement(l.field)).length&&(n=r._getFieldMetadata(a),f=null,(c=r.model.getRecordMetadata(r.currentRecordId)).fields&&(f=c.fields[n.property]),d=e.htmlBuilder(),r._renderFieldDataValue(d,n,l.record,c,f),a.find(".a-RV-fieldValue").html(d.toString())),r._updateRecordState())):"metaChange"===t&&(null!==r.ignoreFieldChange&&r.ignoreFieldChange===l.field||l.recordId!==r.currentRecordId||r._updateRecordState()))})),t&&(i=this.model.getOption("onlyMarkForDelete"),this.modelShape=this.model.getOption("shape"),"record"===this.modelShape&&(this.actions.hide(u),this.actions.hide(h),this.actions.hide(f),this.actions.hide("duplicate-record"),this.actions.hide(c)))},_updateMenuActions:function(){var e=this.options;this.actions[e.showExcludeNullValues?n:a]("exclude-null-values"),this.actions[e.showExcludeHiddenFields?n:a]("exclude-hidden")},_updateFields:function(){let e={},t=this.options.fields[0];this.fields=[];for(const[i,o]of p(t)){o.property=i,this.fields.push(o);let t=R(o);t&&(!e[t]||o.seq<e[t])&&(e[t]=o.seq)}this.fields.sort((function(t,i){return R(t)===R(i)?t.seq-i.seq:R(t)?R(i)?(e[R(t)]||0)-(e[R(i)]||0):-1:1}))},_initView:function(){var e=this.options,t=this.editMode;this._updateFields(),this.columnItems||this._initColumnItems(this.fields),this.toolbar$=null,t&&this.setEditMode(!1),this._renderView(),(t||e.alwaysEdit)&&this.setEditMode(!0),e.toolbar&&(this.toolbar$=this.element.children(".a-RV-toolbar").toolbar({idPrefix:this._getIdPrefix()+"tb",actionsContext:this.actions,data:e.toolbar,small:!0}),"record"===this.modelShape&&this.toolbar$.toolbar("hideControl","recordNumber")),this.resize()},_refreshView:function(){this.refreshFields(),this.refresh()},_forEachField:function(e,t){var i,o,r,l,s,d=this.fields;for(e&&(l=this.element.find(".a-RV-fieldValue")),r=0,i=0;i<d.length;i++)(o=d[i]).virtual||!o.canHide&&o.hidden||(s=null,e&&(s=l.eq(r)),t.call(this,i,o,s),r+=1)},_getIdPrefix:function(){return(this.options.idPrefix||this.element[0].id||"rv")+"_"},_renderView:function(){var t,i,r,l=this.options,d=this.element,n=e.htmlBuilder();function a(){n.markup("<div").attr("class","u-Form"+(l.formCssClasses?" "+l.formCssClasses:"")).markup(">"),i=!0}l.toolbar&&n.markup("<div class='a-RV-toolbar'></div>"),this._renderAltDataMessages(n),n.markup("<div class='a-RV-w-scroll'>").markup("<div class='a-RV-body'>"),this.mapFieldToLabelId={},t=null,i=!1,this._forEachField(!1,(function(e,s){var d,c,u,h,f,p,m,g=this._getIdPrefix()+e,v=this.columnItems[s.property];if(this.mapFieldToLabelId[s.property]=g,r=R(s),t!==r){if(r){if(!(c=l.fieldGroups[r]))throw new Error("Unknown field group name: "+r);u=c.label||c.heading}else u=o.getMessage("APEX.RV.NOT_GROUPED_LABEL");i&&n.markup("</div>"),n.markup("<h3 class='u-Form-groupHeading'><button type='button'>").content(u).markup("</button></h3>"),a(),t=r}i||a(),d="u-Form-fieldContainer",s.hidden&&(d+=" a-RV-field--hidden"),s.fieldCssClasses&&(d+=" "+s.fieldCssClasses),s.isRequired&&(d+=" is-required"),h=s.label||s.heading,f=null,s.fieldColSpan&&((f=parseInt(s.fieldColSpan,10))>0&&f<13?n.markup("<div class='apex-col apex-col-"+f+"'>"):f=null),n.markup("<div").optionalAttr("id",s.elementId?s.elementId+"_CONTAINER":null).attr("data-idx",e).attr("class",d).markup("><div").attr("id",g).attr("class","u-Form-labelContainer "+function(e,t){var i="";return"start"===e?i=" u-tS":"end"===e?i=" u-tE":"left"===e?i=" u-tL":"right"===e?i=" u-tR":"center"!==e||t||(i=" u-tC"),i}(l.labelAlignment)).markup(">"),m=null,v&&v.item.setLabel||(m=s.elementId?s.elementId+"_LABEL":null,n.markup("<span").optionalAttr("id",m).attr("class","u-Form-label").markup(">").content(h).markup("</span>")),n.markup("</div><div class='u-Form-inputContainer'><div class='a-RV-fieldValue'></div>"),s.helpid&&(p=o.formatMessage("APEX.ITEM.HELP_TEXT",h),n.markup("<button class='a-Button a-Button--noUI a-Button--helpButton js-itemHelp' tabindex='-1' type='button'").attr("data-itemhelp",s.helpid).attr("aria-label",p).attr("title",p).markup("><span class='a-Icon icon-help' aria-hidden='true'></span></button>")),n.markup("</div></div>"),f&&n.markup("</div>")})),i&&n.markup("</div>"),n.markup("</div></div>"),d.html(n.toString()).find(".u-Form-groupHeading").each((function(){var e=s(this);e.collapsible({heading:".u-Form-groupHeading",controllingElement:"button",universalTheme:!0,collapsed:!1,content:e.next()})})),this.scrollWrap$=d.find(".a-RV-w-scroll"),this.body$=d.find(".a-RV-body"),this.noData$=d.find(".a-GV-noDataMsg")},_updateRecord:function(e,t,i){var o,r=this,l=this.currentRecordId,s=this.options;function d(){var e,t,i,o,l,s;for(o=r.model.getRecordMetadata(r.currentRecordId),e=0;e<r.fields.length;e++)t=r.fields[e].property,(i=r.columnItems[t])&&(s=i.item.isDisabled(),i.element$.is(":visible")&&!s?i.item.getValidity().valid||r.model.setValidity("error",r.currentRecordId,t,i.item.getValidationMessage()):r.model.setValidity("valid",r.currentRecordId,t),o&&((l=o.fields?o.fields[t]:null)&&l.disabled||s)&&(l||(o.fields||(o.fields={}),l={},o.fields[t]=l),l.disabled=s));r._triggerEndEditing(r.currentRecord,r.currentRecordId),r.activeRecord=null,r.activeRecordId=null}function n(o,n,a){var c,u,h,f=r.body$;if(o){if(c=r.model.getRecordMetadata(a)||{},r.scrollWrap$.show(),r.noData$.hide(),c.agg||c.deleted&&s.skipDeletedRecords)return"tree"===r.modelShape?(u=r[r.direction>0?"_nextTreeRecord":"_previousTreeRecord"]())&&(s.recordParent=u.parent,s.recordOffset=u.offset):(s.recordOffset+=r.direction,h=r.model.getTotalRecords(),s.recordOffset<0?(s.recordOffset=0,r.direction=-r.direction):h>=0&&s.recordOffset>=h&&(s.recordOffset=h-1,r.direction=-r.direction)),r._updateRecord(e,t,i),void r._updateRecord();s.editable&&r.currentRecord&&(e&&!1!==t||!0===t)&&d(),s.recordOffset=n,r.currentRecordId=a,r.currentRecord=null,r.activeRecord=null,r._renderRecordFields(e,o,n,a,c),r.currentRecord=o,e&&(r.activeRecord=o,r.activeRecordId=a),f.children(".a-Alert").remove(),f.find(".a-Form-error").remove(),r._updateRecordState(),r._updateRecordNumber(),s.editable&&e&&r._triggerBeginEditing(r.currentRecord,r.currentRecordId),null!==l&&l===r.currentRecordId||setTimeout((function(){r._trigger("recordChange",null,{recordOffset:s.recordOffset,recordId:r.currentRecordId})}),1)}else s.editable&&r.currentRecord&&(e&&!1!==t||!0===t)&&d(),r.currentRecordId=null,r.currentRecord=null,r._renderRecordFields(e,null,-1,null,{}),r.scrollWrap$.hide(),r.noData$.show(),r._updateActions(),r._updateRecordNumber()}if(null==e&&(e=this.editMode),this.activeLockCount>0)this.activeUnlockCallback=function(){r._updateRecord(e,t,i)};else{switch(this.modelShape){case"record":n(o=this.model.getRecord(),0,o?this.model.getRecordId(o):null);break;case"table":this.model.forEachInPage(s.recordOffset,1,(function(e,t,i){n(e,t,i)}),this);break;case"tree":null===s.recordParent?(o=this.model.root(),s.recordOffset=-1,n(o,s.recordOffset,o?this.model.getRecordId(o):null)):n(o=this.model.child(s.recordParent,s.recordOffset),s.recordOffset,o?this.model.getRecordId(o):null)}i&&i()}},_renderRecordFields:function(t,i,o,r,l){var s=null,d=this.options.tabbableFieldContent,n=!1,a=e.htmlBuilder(),c=this.columnItemsContainer$?this.columnItemsContainer$[0]:null;t&&i&&(n=this.model.allowEdit(i)),this._forEachField(!0,(function(e,t,o){var r,u,h,f,p=null,g=!1;r="u-Form-fieldContainer",i&&(null!==(u=this.model.getValue(i,t.property))&&""!==u||(r+=" a-RV-field--null"),t.hidden&&(r+=" a-RV-field--hidden"),t.fieldCssClasses&&(r+=" "+t.fieldCssClasses),t.isRequired&&(r+=" is-required"),l.fields&&(s=l.fields[t.property]),s&&(s.disabled&&(r+=" is-disabled"),g=s.ck),(g||t.readonly)&&(r+=" is-readonly",g=!0)),(h=this.columnItems[t.property])&&h.item.setLabel||(p=t.elementId+"_LABEL"),n&&h&&!g&&!t.volatile?h.element$.parent()[0]===c&&(o.empty().append(h.element$),this._activateColumnItem(h,p),p||h.item.setLabel(t.label||t.heading)):(h&&h.element$.closest(this.element).length&&(this._deactivateColumnItem(h),p||h.item.setLabel(null)),i?(a.clear(),p||((s=m(!0,{},s)).ck="X"),this._renderFieldDataValue(a,t,i,l,s),p||a.markup("<span class='u-Form-label'>").content(t.label||t.heading).markup("</span>"),o.html(a.toString()),(f=o.find(d)).length&&(o.attr("aria-labelledby",p).attr("role","group"),f.filter("[tabindex]").attr("tabindex",0))):o.empty()),o.parent().parent().attr("class",r)})),n&&i&&(this._beginSetColumnItems(),this._forEachField(!0,(function(e,t,o){var r=this.columnItems[t.property];!r||o.hasClass("is-readonly")||t.volatile||this._setColumnItemValue(r.item,i,t.property,n?l:null)})),this._endSetColumnItems())},_updateRecordState:function(){let e,t,i="",r=this.body$;if(e=this.model.getRecordMetadata(this.currentRecordId)||{},r.removeClass("is-deleted is-inserted is-updated is-error is-warning is-readonly"),e.deleted?(r.addClass("is-deleted"),i=o.getMessage("APEX.GV.ROW_DELETED")):e.inserted?(r.addClass("is-inserted"),i=o.getMessage("APEX.GV.ROW_ADDED")):e.updated&&(r.addClass("is-updated"),i=o.getMessage("APEX.GV.ROW_CHANGED")),this.model.allowEdit(this.currentRecord)||r.addClass("is-readonly"),e.error||e.warning?(t=r.children(".a-Alert"),t.length||(t=s("<div class='a-Alert'></div>"),r.prepend(t)),t.text(e.message),r.addClass(e.error?"is-error":"is-warning")):r.children(".a-Alert").remove(),e.fields)for(const[i,o]of p(e.fields)){let e=this.fieldElement(i);e.removeClass("is-changed is-stale is-error is-warning is-readonly"),o.error||o.warning?(t=e.find(".a-Form-error"),t.length||(t=s("<span class='a-Form-error'></span>"),e.find(".u-Form-inputContainer").append(t)),t.text(o.message),e.addClass(o.error?"is-error":"is-warning")):(e.find(".a-Form-error").remove(),o.changed?e.addClass("is-changed"):o.stale&&e.addClass("is-stale")),o.ck&&e.addClass("is-readonly")}this._updateActions(),this.toolbar$&&this.toolbar$.toolbar("findElement","status").text(i)},_hasPrevious:function(){var e=this.options;switch(this.modelShape){case"record":return!1;case"table":return e.recordOffset>0;case"tree":return null!==this._previousTreeRecord()}},_hasNext:function(){var e,t=this.options;switch(this.modelShape){case"record":return!1;case"table":return(e=this.model.getTotalRecords())<0||t.recordOffset+1<e;case"tree":return null!==this._nextTreeRecord()}},_nextTreeRecord:function(){var e,t,i=this.options,o=i.recordOffset,r=i.recordParent;if(t=null===r?this.model.root():this.model.child(r,o),this.model.childCount(t)>0)return{parent:t,offset:0};for(;r;){if((e=this.model.childCount(r))>0&&o+1<e)return{parent:r,offset:o+1};o=this.model.indexOf(r),r=this.model.parent(r)}return null},_previousTreeRecord:function(){var e=this,t=this.options,i=t.recordOffset,o=t.recordParent;return null===o?null:o&&i>0?function t(i){var o=e.model.childCount(i);return o>0?t(e.model.child(i,o-1)):{parent:e.model.parent(i),offset:e.model.indexOf(i)}}(this.model.child(o,i-1)):{parent:this.model.parent(o),offset:this.model.indexOf(o)}},_updateActions:function(){var e=this.options,t=this.actions,i=this.currentRecord,o=e.editable,r=this.model,l="tree"===this.modelShape?e.recordParent:null,s=o&&r.allowAdd(l,"new"),d=o&&i&&r.allowAdd(l,"copy"),n=o&&i;function a(e,i){t[e?"enable":"disable"](i)}a(n&&r.canRevertRecord(i),"revert-record"),a(n&&r.allowDelete(i),c),a(s,f),a(d,"duplicate-record"),a(i&&this._hasNext(),u),a(i&&this._hasPrevious,h)},_getFieldMetadata:function(e){var t=parseInt(e.attr("data-idx"),10);return isNaN(t)?null:this.fields[t]},_activateField:function(e){var t,i;e.length<=0||null===this.currentRecord||((t=this._getFieldMetadata(e))&&(i=this.columnItems[t.property]),i&&this.model.allowEdit(this.currentRecord)&&!e.hasClass("is-readonly")&&e.addClass("is-active"))},_deactivateField:function(e){var t,i=null;e.length<=0||null===this.currentRecord||((t=this._getFieldMetadata(e))&&(i=this.columnItems[t.property]),i&&!e.hasClass("is-readonly")&&e.hasClass("is-active")&&(this._setModelValue(e,i.item,this.currentRecord,t.property),this._updateRecordState()))},_updateRecordNumber:function(){var e,t,i="",r=this.options;this.toolbar$&&(this.currentRecord&&("tree"===this.modelShape?(t=this.model.parent(this.currentRecord))&&(e=this.model.childCount(t)):e=this.model.getTotalRecords(),i=e>0?o.formatMessage("APEX.RV.REC_XY",r.recordOffset+1,e):o.formatMessage("APEX.RV.REC_X",r.recordOffset+1)),this.toolbar$.toolbar("findElement","recordNumber").text(i))},_identityChanged:function(e,t){e===this.currentRecordId&&(this.currentRecordId=t,this.activeRecordId&&(this.activeRecordId=t))}}),s.apex.recordView.copyDefaultToolbar=function(){var e,t=[];for(e=0;e<v.length;e++)t.push(m(!0,{},v[e]));return t},s.apex.recordView.createModelEditDialog=function(i,r){var d,u,h,v,R,b,E,C,y,x,_,I,V,w,O,M,T,F=s,P=[],A=F("#"+i),S=r.modelOptions.shape||"table",D=r.okLabelKey?o.getMessage(r.okLabelKey):null,N=e.htmlBuilder(),k=r.classPrefix||"a-IG-dialog";function L(e){w&&(b&&w.expand(w.getSelection().first()),T&&clearTimeout(T),T=setTimeout((function(){w[b?"setSelectedNodes":"setSelectedRecords"]([e]),T=null}),1))}r.appendToTop&&(F=e.getTopApex().jQuery),I=F("body").context,A.length||(A=F("<div id='"+i+"'></div>"),F(r.appendTo||"body").append(A)),"tree"===S?u=s.apex.treeView.makeModelNodeAdapter(r.modelName,r.modelOptions,null):("record"===S&&(P=null),u=t.create(r.modelName,r.modelOptions,P,0,!1)),y=u.getOption("shape"),x=u.getOption("fields"),_=u.getOption("editable"),V=_&&u.getOption("sequenceField"),N.markup("<form novalidate><section class='"+k+"-region "+k+"-body'>"),"record"!==y&&N.markup("<aside class='"+k+"-side resize'><div class='nav resize'></div><div class='tb'></div></aside>"),N.markup("<main class='"+k+"-main resize'><div class='rv resize'></div></main></section></form>"),(d=m({closeText:o.getMessage("APEX.DIALOG.CLOSE"),noDataMessage:null},r,{autoOpen:!1,modal:!0,create:function(){var e,t,o,d,p=l.createContext("ModelEditDialog",A[0]);if(F(this).closest(".ui-dialog").css("position","fixed"),(R=s("#"+i,I).find(".rv")).recordView({modelName:r.modelName,noDataMessage:r.noDataMessage,idPrefix:r.idPrefix||r.modelName,fields:[x],actionsContext:p,toolbar:null,editable:!0,alwaysEdit:!0,hasSize:!0,skipDeletedRecords:!0,formCssClasses:r.formCssClasses,labelAlignment:r.labelAlignment,recordChange:function(){var t;"nav"!==e&&(t=R.recordView("getRecord"))&&(e="rv",L(t),e=null)}}),"record"!==y&&(E=s("#"+i,I).find(".tb"),p.add([{name:"move-up",labelKey:"APEX.RV.MOVE_UP",hide:!0,action:function(){var e,t=null,i=h.grid("getSelection"),o=h.grid("getSelectedRecords");i[0].prev().length&&((e=i[0].prev().prev()).length&&(t=h.grid("getRecords",[e])[0]),u.moveRecords(o,null,t),h.grid("setSelectedRecords",o))}},{name:"move-down",labelKey:"APEX.RV.MOVE_DOWN",hide:!0,action:function(){var e,t=null,i=h.grid("getSelection"),o=h.grid("getSelectedRecords");(e=i[i.length-1].next()).length&&(t=h.grid("getRecords",[e])[0],u.moveRecords(o,null,t),h.grid("setSelectedRecords",o))}}]),t=[{type:"BUTTON",iconOnly:!0,icon:"icon-plus",action:f},{type:"BUTTON",iconOnly:!0,icon:"icon-copy",action:"duplicate-record"},{type:"BUTTON",iconOnly:!0,icon:"icon-minus",action:c},{type:"BUTTON",iconOnly:!0,icon:"icon-up-chevron",action:"move-up"},{type:"BUTTON",iconOnly:!0,icon:"icon-down-chevron",action:"move-down"}],p[_?n:a](c),p[_?n:a](f),p[_&&r.includeCopy?n:a]("duplicate-record"),p[V?n:a]("move-up"),p[V?n:a]("move-down"),E.toolbar({actionsContext:p,data:[{align:"start",controls:t}]})),"table"===y)if(r.useList){if(v=s("#"+i,I).find(".nav"),!(d=r.recordTemplate)){if(!r.labelColumn)throw new Error("Option recordTemplate or labelColumn is required");d="<li data-id='&APEX$ROW_ID.' class='&APEX$ROW_STATE_CLASSES.'>",r.iconClassColumn&&(d+="<span class='a-IconList-icon'><span class='&"+r.iconClassColumn+".'></span></span>"),r.enabledCheckbox&&(d+="<span class='ro-checkbox &\"enabledClass\".'></span><span class='u-vh'>&\"enabledText\".</span>"),d+="<span class='a-IconList-label'>&"+r.labelColumn+".</span></li>"}v.tableModelView({modelName:r.modelName,columns:[x],hasSize:!0,footer:!1,pagination:{scroll:!0},useIconList:!0,recordTemplate:d,collectionClasses:r.collectionClasses||"a-RVDialog-list",selectionChange:function(){var t,i;"rv"!==e&&(i=v.tableModelView("getSelectedRecords")[0])&&(e="nav",t=u.indexOf(i),R.recordView("option","recordOffset",t),e=null)}}),w=v.data("apex-tableModelView")}else(h=s("#"+i,I).find(".nav")).grid({modelName:r.modelName,noDataMessage:r.noDataMessage,columns:[x],editable:!1,hasSize:!0,footer:!1,pagination:{scroll:!0},reorderColumns:!1,columnSort:!1,hideDeletedRows:!0,selectionChange:function(){var t,i;"rv"!==e&&(i=h.grid("getSelectedRecords")[0])&&(e="nav",t=u.indexOf(i),R.recordView("option","recordOffset",t),e=null)}}),w=h.data("apex-grid");else"tree"===y&&(s("#"+i,I).find(".nav").addClass("a-RVDialog-scroll").html("<div class='a-RVDialog-tree'></div>"),o={showRoot:!0,collapsibleRoot:!0,expandRoot:!0,getNodeAdapter:function(){return u},selectionChange:function(){var t,i,o;"rv"!==e&&(i=b.treeView("getSelectedNodes")[0])&&(o=u.parent(i),e="nav",o!==R.recordView("option","recordParent")&&R.recordView("option","recordParent",o),t=u.indexOf(i),R.recordView("option","recordOffset",t),e=null)}},(b=s("#"+i,I).find(".a-RVDialog-tree")).treeView(o),s.apex.treeView.treeModelListener(r.modelName,b),w=b.data("apex-treeView"));this.initDone=!1},open:function(){var e,t=null;E&&E.toolbar("refresh"),h&&h.grid("refreshColumns"),d.resize(),r.init&&!this.initDone&&r.init.call(this,u,h||v||b||null,R,E),this.initDone=!0,r.load&&(t=r.load.call(this,u)),"record"!==y&&(e=t?u.getRecord(t):R.recordView("getRecord"))&&setTimeout((function(){L(e)}),10),setTimeout((function(){R.recordView("focus")}),100)},close:function(){"table"===y?u.setData([],0):u.setData(null)},resize:function(){var t=A.width(),i=A.height();C?A.find("section").height(i).width(t).resize():(A.find("section,main,aside").height(i),t-=A.find("aside").outerWidth()||0,A.find("main").width(t),R.width(t),R.height(i).recordView("resize"),t=A.find("aside").width(),i-=A.find(".tb").outerHeight(),h?h.width(t).height(i).grid("resize"):b&&b.width(t).height(i),e.setOuterWidth(A.find(".tb"),t))}})).buttons=_?[{text:o.getMessage("APEX.DIALOG.CANCEL"),click:function(){R.recordView("setEditMode",!1),F(this).dialog("close")}},{text:D||o.getMessage("APEX.DIALOG.SAVE"),class:"ui-button--hot",click:function(){var e="",t=!0;R.recordView("setEditMode",!1),r.validate&&"string"==typeof(t=r.validate.call(this,u,(function(e,t){u.setValidity("valid",e,t)}),(function(e,t,i){u.setValidity("error",e,t,i)})))&&(e=t+"\n\n",t=!1),t&&!u.hasErrors()?(r.store&&r.store.call(this,u),F(this).dialog("close")):(R.recordView("refresh"),e+=apex.lang.getMessage("APEX.CORRECT_ERRORS"),apex.message.alert(e,(function(){let e,t,i=u.getErrors()[0];if(i){for([e,t]of p(i.fields))if(t.error)break;setTimeout((function(){R.recordView("gotoField",u.getRecordId(i.record),e)}),1)}})))}}]:[{text:D||o.getMessage("APEX.DIALOG.OK"),class:"ui-button--hot",click:function(){F(this).dialog("close")}}],d.dialogHelp&&d.buttons.unshift({text:o.getMessage("APEX.DIALOG.HELP"),class:"ui-button-help",click:function(){var e=d.dialogHelp;o.loadMessagesIfNeeded([e.titleKey,e.helpTextKey],(function(){var t={title:e.title,helpText:e.helpText};e.titleKey&&(t.title=o.getMessage(e.titleKey)),e.helpTextKey&&(t.helpText=o.getMessage(e.helpTextKey)),apex.theme.popupFieldHelp(t)}))}}),d.titleKey&&(d.title=o.getMessage(d.titleKey),delete d.titleKey),A.html(N.toString()).dialog(d).on("dialogopen",(function(){apex.navigation.beginFreezeScroll()})).on("dialogresize",(function(){F(this).closest(".ui-dialog").css("position","fixed")})).on("dialogclose",(function(){apex.navigation.endFreezeScroll()})),A.on("keydown",(function(e){var t;e.which===g.ENTER&&"INPUT"===e.target.nodeName&&(r.defaultButton&&(t=A.parent().find(".ui-button--hot").eq(0).focus(),setTimeout((function(){t.click()}),50)),e.preventDefault())})),r.useSplitter&&"record"!==y&&s.apex.splitter&&(O=r.splitterPosition||200,r.persistSplitter&&(M=apex.storage.getScopedSessionStorage({prefix:"ORA_WWV_apex.MED_"+r.persistSplitter,useAppId:!0}),O=parseInt(M.getItem("splitterPosition")||O,10)),C=A.find("."+k+"-body").splitter({position:O,collapsed:!1,minSize:120,orientation:"horizontal",positionedFrom:"begin",noCollapse:!0,change:function(e,t){M&&M.setItem("splitterPosition",t.lastPosition-t.lastPosition%1+"")}}),A.on("resize",(function(t){var i,o,r,l,d=s(t.target);i=d.height(),o=d.width(),(r=d.children(".resize").filter(":visible")).length>0&&(d.children(":not(.resize)").filter(":visible").each((function(){"fixed"!==(l=s(this).css("position"))&&"absolute"!==l&&(i-=s(this).outerHeight(!0))})),i=Math.floor(i/r.length),r.each((function(){var t=s(this);e.setOuterHeight(t,i),e.setOuterWidth(t,o),t.filter(":visible").trigger("resize")}))),t.stopPropagation()})));var X=A.data("ui-dialog"),$=X._destroy;return X._destroy=function(){$.call(X),t.destroy(r.modelName)},A}}(apex.util,apex.model,apex.debug,apex.lang,apex.item,apex.actions,apex.jQuery);
!function(e,t,i,n,o,a,l,r,s,d,c,u,h,g){"use strict";var p="a-IG",m="aria-hidden",f="text",_="select",C="colorpicker",I="row",v="column",E="delete",b="disabled",w="option",A="chart",R="primary",T="filter",S="highlight",N="flashback",L="aggregate",y="asc",O="last",k="none",V="N",D="_meta",M="label",x="class",H="action",G={type:"separator"},U="IN",F="NIN",P="BETWEEN",B="NUMBER",X="DATE",q="TIMESTAMP",$="TIMESTAMP_TZ",W="TIMESTAMP_LTZ",K="bar",Y="on",z="off",j="auto",Q={EQ:"EQUALS",NEQ:"NOT_EQUALS",LT:"LESS_THAN",LTE:"LESS_THAN_OR_EQUALS",GT:"GREATER_THAN",GTE:"GREATER_THAN_OR_EQUALS",LIKE:"LIKE",NLIKE:"NOT_LIKE",N:"IS_NULL",NN:"IS_NOT_NULL",C:"CONTAINS",NC:"DOES_NOT_CONTAIN",IN:"IN",NIN:"NOT_IN",BETWEEN:"BETWEEN",NBETWEEN:"NOT_BETWEEN",LAST:"IN_THE_LAST",NLAST:"NOT_IN_THE_LAST",NEXT:"IN_THE_NEXT",NNEXT:"NOT_IN_THE_NEXT",REGEXP:"MATCHES_REGULAR_EXPRESSION",S:"STARTS_WITH",NS:"DOES_NOT_START_WITH",OTEXT:"ORACLE_TEXT"},Z={SUM:"SUM",AVG:"AVG",CNT:"COUNT",CNT_DIST:"COUNT_DISTINCT",APPR_CNT_DIST:"APPROX_COUNT_DISTINCT",MIN:"MIN",MAX:"MAX",MEDIAN:"MEDIAN",LISTAGG:"LISTAGG"};const J=t.hasOwnProperty;function ee(e){return o.getMessage(e)}function te(e){return o.getMessage("APEX.IG."+e)}function ie(e,t){return void 0!==e?e:t}var ne={filter:te("FILTER"),chart:te("CHART"),groupby:te("GROUP_BY"),controlBreak:te("CONTROL_BREAK"),highlight:te("HIGHLIGHT"),aggregate:te("AGGREGATE"),flashback:te("FLASHBACK")},oe={MI:"MINUTE",H:"HOUR",D:"DAY",W:"WEEK",M:"MONTH",Y:"YEAR"},ae="LABEL",le="VALUE",re="X",se="Y",de="Z",ce="TARGET",ue="HIGH",he="LOW",ge=[{value:"$1,002.54",label:{style:"currency",currency:"USD",currencyDisplay:"symbol"}},{value:"1,002.54",label:{style:"decimal",maximumFractionDigits:2}},{value:"1,002.5400",label:{style:"decimal",maximumFractionDigits:4}},{value:"1,002",label:{style:"decimal",maximumFractionDigits:0}},{value:"1,002.54-",label:{style:"decimal",maximumFractionDigits:2}},{value:"-1,002.54",label:{style:"decimal",maximumFractionDigits:2}},{value:"<1,002.54>",label:{style:"decimal",maximumFractionDigits:2}}],pe=[{value:"DD-MON-RR",label:{pattern:"dd-MMM-yy"}},{value:"DD-MON-YYYY",label:{pattern:"dd-MMM-yyyy"}},{value:"DD-MON",label:{pattern:"dd-MMM"}},{value:"RR-MON-DD",label:{pattern:"yy-MMM-dd"}},{value:"YYYY-MM-DD",label:{pattern:"yyyy-MMM-dd"}},{value:"fmDay, fmDD fmMonth, YYYY",label:{formatType:"date",dateFormat:"full"}},{value:"DD-MON-YYYY HH24:MI",label:{pattern:"dd-MMM-yyyy HH:mm"}},{value:"DD-MON-YYYY HH24:MI:SS",label:{pattern:"dd-MMM-yyyy HH:mm:ss"}},{value:"DD-MON-YYYY HH:MIPM",label:{pattern:"dd-MMM-yyyy hh:mm a"}},{value:"Month",label:{month:"long"}},{value:"DD-MON-YYYY HH24.MI.SSXFF",label:{pattern:"dd-MMM-yyyy HH:mm:ss"}},{value:"DD-MON-YYYY HH:MI:SSXFF PM",label:{pattern:"dd-MMM-yyyy hh:mm:ss a"}},{value:"DD-MON-YYYY HH24:MI TZR",label:{pattern:"dd-MMM-yyyy HH:mm"}},{value:"DD-MON-YYYY HH24.MI.SSXFF TZR",label:{pattern:"dd-MMM-yyyy HH:mm:ss"}},{value:"DD-MON-YYYY HH.MI.SSXFF PM TZR",label:{pattern:"dd-MMM-yyyy hh:mm:ss a"}}],me=[{id:"search",groupTogether:!0,customCSS:"a-Toolbar-group--search",controls:[{type:"MENU",id:"column_filter_button",labelKey:"APEX.IG.SELECT_COLUMNS_TO_SEARCH",icon:"icon-search",iconOnly:!0,menu:{items:[{type:"toggle",action:"search-case-sensitive"},G,{type:"radioGroup",action:"filter-column"}]}},{type:"TEXT",id:"search_field",enterAction:"search"},{type:"BUTTON",action:"search"}]},{id:"reports",controls:[{type:"SELECT",action:"change-report"}]},{id:"views",controls:[{type:"RADIO_GROUP",labelKey:"APEX.IG.VIEW",action:"change-view"}]},{id:"actions1",controls:[{type:"MENU",id:"actions_button",labelKey:"APEX.IG.ACTIONS",menu:{items:[{type:H,action:"show-columns-dialog"},G,{type:H,action:"show-filter-dialog"},{type:"subMenu",id:"data_submenu",labelKey:"APEX.IG.DATA",icon:"icon-ig-data",menu:{items:[{type:H,action:"show-sort-dialog"},{type:H,action:"show-aggregate-dialog"},{type:H,action:"refresh"},{type:H,action:"show-flashback-dialog"}]}},{type:"subMenu",id:"format_submenu",labelKey:"APEX.IG.FORMAT",icon:"icon-ig-format",menu:{items:[{type:H,action:"show-control-break-dialog"},{type:H,action:"show-highlight-dialog"},{type:"toggle",action:"stretch-columns"},{type:"subMenu",labelKey:"APEX.IG.ROWS_PER_PAGE",hide:!0,id:"rows",icon:"icon-ig-rows",menu:{items:[{type:"radioGroup",action:"change-rows-per-page"}]}}]}},{type:"subMenu",id:"selection_submenu",labelKey:"APEX.IG.SELECTION",icon:"icon-ig-selection",menu:{items:[{type:"toggle",action:"selection-mode"},G,{type:H,action:"selection-copy",accelerator:"Ctrl+C"},G]}},G,{type:H,action:"chart-view"},G,{type:"subMenu",id:"save_report_submenu",labelKey:"APEX.IG.REPORT",icon:"icon-irr-saved-report",menu:{items:[{type:H,action:"save-report"},{type:H,action:"show-save-report-as-dialog"},{type:H,action:"show-edit-report-dialog"},G,{type:H,action:"delete-report"},G,{type:H,action:"reset-report"}]}},G,{type:H,action:"show-download-dialog"},G,{type:H,action:"show-help-dialog"}]}}]},{id:"actions2",controls:[{type:"TOGGLE",action:"edit"},{type:"BUTTON",hot:!0,action:"save"}]},{id:"actions3",controls:[{type:"BUTTON",action:"selection-add-row"}]},{id:"actions4",align:"end",controls:[{type:"BUTTON",action:"reset-report",labelKey:"APEX.IG.RESET",iconBeforeLabel:!0}]}];function fe(){var t,i=[];for(t=0;t<me.length;t++)i.push(e.extend(!0,{},me[t]));return i.toolbarFind=me.toolbarFind,i.toolbarRemove=me.toolbarRemove,i.toolbarInsertAfter=me.toolbarInsertAfter,i}function _e(e,t,i,n){var o,a,l,r,s,d,c=e;function u(e){var o,a;for(o=0;o<e.length;o++){if((a=e[o]).id===t||a.action===t)return i&&e.splice(o,1),n&&e.splice(o+1,0,n),a;if("subMenu"===a.type&&(a=u(a.menu.items)))return a}return null}for(o=0;o<c.length;o++){if((d=c[o]).id===t)return i&&c.splice(o,1),n&&c.splice(o+1,0,n),d;if(l=d.controls)for(a=0;a<l.length;a++){if((r=l[a]).id===t||r.action===t)return i&&l.splice(a,1),n&&l.splice(a+1,0,n),r;if(r.menu&&(s=u(r.menu.items)))return s}}return null}function Ce(e){return{label:e||"ENABLED",alignment:"center",defaultValue:!0,columnCssClasses:"js-colCheckbox",cellTemplate:"<span class='ro-checkbox &\"enabledClass\".'></span><span class='u-vh'>&\"enabledText\".</span>",width:80,noStretch:!0,seq:10}}function Ie(e,t){e.recordView("fieldElement",t).hide()}function ve(e,t){e.recordView("fieldElement",t).show()}function Ee(e){return new Date(parseInt(e.substr(0,4),10),parseInt(e.substr(4,2),10)-1,parseInt(e.substr(6,2),10),parseInt(e.substr(8,2),10),parseInt(e.substr(10,2),10),parseInt(e.substr(12,2),10))}function be(e){return("000"+e.getFullYear()).substr(-4)+("0"+(e.getMonth()+1)).substr(-2)+("0"+e.getDate()).substr(-2)+("0"+e.getHours()).substr(-2)+("0"+e.getMinutes()).substr(-2)+("0"+e.getSeconds()).substr(-2)}function we(e){var t,i,n=[];for(t=0;t<e.length;t++)""!==(i=e[t].replace(/^\s+|\s+$/gm,""))&&-1===n.indexOf(i)&&n.push(i);return n}function Ae(e){var t=e;switch(e){case"groupby":t="group-by";break;case"savedReport":t="saved-report";break;case"inactiveSettings":t="inactive-settings";break;case"invalidSettings":t="invalid-settings";break;case"controlBreak":t="control-break";break;case"saveAsReport":case"editReport":t="save-report"}return t}function Re(e,t,i,n,o,a){var l;for(a||t.push({value:o,label:a}),l=0;l<e.length;l++)t.push({value:e[l][i],label:e[l][n]})}function Te(t,i){var n;if(!e.isEmptyObject(i))for(n in i)J(i,n)&&t.attr("data-"+n,i[n])}function Se(t,i){var n,o=e.extend({id:"",type:f,value:"",maxChars:"",title:"",ariaDescribedBy:"",name:"",size:"",placeholder:"",readonly:!1,checked:!1,disabled:!1,required:!1,cssClasses:[],data:{},attributes:{}},i),a=o.cssClasses,l=o.attributes;if(t.markup("<input").attr("id",o.id).attr("type",o.type).attr("value",o.value).optionalAttr("maxlength",o.maxChars).optionalAttr("title",o.title).optionalAttr("aria-describedby",o.ariaDescribedBy).optionalAttr("name",o.name).optionalAttr("size",o.size).optionalAttr("placeholder",o.placeholder).optionalBoolAttr("readonly",o.readonly).optionalBoolAttr("checked",o.checked).optionalBoolAttr(b,o.disabled).optionalBoolAttr("required",o.required),a.length>0&&t.attr(x,e.isArray(a)?a.join(" "):a),Te(t,o.data),!e.isEmptyObject(l))for(n in l)J(l,n)&&t.attr(n,l[n]);t.markup(" />")}function Ne(t,i){Se(t,e.extend({cssClasses:"apex-item-text",maxChars:"4000"},i))}function Le(i,n){var o=e("#"+i+"_list");function a(e){o.iconList("setSelection",o.find('li[data-value="'+t.escapeHTMLAttr(e)+'"]'),!1)}o.iconList({multiple:!1,selectionChange:function(){e("#"+i).val(e(this).iconList("getSelectionValues")).change()}}),a(n),e("#"+i).change((function(){a(e("#"+i).val())}))}function ye(t,i){var n,o,a,l,r=e.extend({id:"",buttonClass:"",label:"",icon:"",iconOnly:!1,iconPosition:"right",tabindex:"",attributes:{},data:{}},i);if(n="a-Button"+(i.buttonClass?" "+i.buttonClass:""),o="a-Icon"+(i.icon?" "+i.icon:""),a=i.icon&&!i.iconOnly,t.markup("<button type='button'").optionalAttr("id",r.id).optionalAttr("tabindex",r.tabindex).attr(x,n),i.iconOnly&&r.label&&t.attr("title",r.label).attr("aria-label",r.label),!e.isEmptyObject(r.attributes))for(l in r.attributes)J(r.attributes,l)&&t.attr(l,r.attributes[l]);Te(t,r.data),t.markup(">"),a&&"left"===r.iconPosition&&t.markup("<span").attr(m,!0).attr(x,o+" a-Icon--left").markup("></span>"),i.iconOnly?t.markup("<span").attr(m,!0).attr(x,o).markup("></span>"):r.label&&t.markup("<span").attr(x,"a-Button-label").markup(">").content(r.label).markup("</span>"),a&&"right"===r.iconPosition&&t.markup("<span").attr(m,!0).attr(x,o+" a-Icon--right").markup("></span>"),t.markup("</button>")}function Oe(t,i){Se(t,e.extend({type:"checkbox"},i))}function ke(t,i){var n=e.extend({cssClasses:"",text:"",data:{}},i);t.markup("<a href='#'").attr(x,n.cssClasses),Te(t,n.data),t.markup(">").content(n.text).markup("</a>")}function Ve(t,i){var n,o=e.extend({cssClasses:"u-Form-label",labelFor:"",label:"",labelHidden:!1,labelTextHidden:!1},i);n=o.cssClasses,o.labelHidden&&(n+=" u-VisuallyHidden"),t.markup("<label").attr(x,n).attr("for",o.labelFor).markup(">"),o.labelTextHidden?t.markup("<span").attr(x,"u-VisuallyHidden").markup(">").content(o.label).markup("</span>"):t.content(o.label),t.markup("</label>")}function De(t,i){Se(t,e.extend({type:"radio"},i))}function Me(t){var i;for(e.isArray(t)||(t=[t]),i=0;i<t.length;i++)d(t[i][0]).show()}function xe(t){var i;for(e.isArray(t)||(t=[t]),i=0;i<t.length;i++)d(t[i][0]).hide()}function He(e,t){e.closest(".u-Form-fieldContainer").find(".u-Form-label").text(ee(t))}function Ge(t,i){var n;for(e.isArray(t)||(t=[t]),n=0;n<t.length;n++)t[n].prop("required",i).closest(".u-Form-fieldContainer").toggleClass("is-required",i)}function Ue(e,i){let n,a,l,d,c=null,u=null,h=null,g="apexDialogPromptInputId",p=t.htmlBuilder(),m=t.getTopApex().jQuery;"item"===e.type&&(u=e.columnItem,h=e.viewInst),p.markup("<div class='u-Form u-Form--labelsAbove u-Form--stretchInputs'>").markup("<div class='u-Form-fieldContainer'><div class='u-Form-labelContainer  u-tS'><span class='u-Form-label'>"),u&&u.item.setLabel||Ve(p,{labelFor:g,label:e.label||ee(e.labelKey)}),p.markup("</span></div><div class='u-Form-inputContainer'>"),d={id:g,value:e.value||"",required:!!e.required},"number"===e.type||"item"!==e.type&&Ne(p,d),p.markup("</div></div></div>"),n=m(p.toString()),l={title:ee(e.titleKey),dialogClass:"",confirm:!0,defaultButton:!0,beforeClose:function(){if(u){let e,t=u.item;a=t.getValue(),e=t.displayValueFor(a),a!==e&&(a={v:a,d:e}),t.setValue(c,null,!0),h._deactivateColumnItem(u),t.setLabel&&t.setLabel(null)}else a=m("#"+g).val()},callback:function(e){var t=!1;e&&(t=a),i(t)},init:function(t){if(u){let i=u.item,n=t.find(".u-Form-inputContainer");c=i.getValue(),i.setValue(i.nullValue||"",null,!0),n.empty().append(u.element$),h._activateColumnItem(u,g),i.setLabel&&i.setLabel(e.label)}},open:function(){m("#"+g).focus()}},e.okLabelKey&&(l.okLabelKey=e.okLabelKey),e.helpKey&&(l.extraButtons=[{text:ee("APEX.DIALOG.HELP"),CLASS:"ui-button-help",click:function(){o.loadMessagesIfNeeded([e.helpKey,e.helpTitleKey],(function(){r.popupFieldHelp({title:ee(e.helpTitleKey),helpText:ee(e.helpKey)})}))}}]),s.showDialog(n,l)}me.toolbarInsertAfter=function(e,t){_e(this,e,!1,t)},me.toolbarRemove=function(e){return _e(this,e,!0)},me.toolbarFind=function(e){return _e(this,e,!1)};var Fe={_allowInteraction:function(t){return e(t.target).closest(".a-IRR-sortWidget").length>0||this._super(t)}};e.ui.dialog&&(e.widget("ui.dialog",e.ui.dialog,Fe),e.widget("apex.popup",e.apex.popup,Fe)),e.widget("apex.interactiveGrid",{version:"21.1",widgetEventPrefix:"interactivegrid",options:{config:{toolbarData:null,modelInstanceId:null,initActions:null,columns:[],ajaxColumns:"",regionId:"",regionStaticId:"",columnGroups:[],ajaxIdentifier:"",itemsToSubmit:"",editable:!1,submitSelectedRows:!1,parentRegionStaticId:null,trackParentSelection:!0,lazyLoading:!1,filter:{row:!0,complex:!0,isRequired:!1,maxRowCount:null,oracleText:!1},appearance:{showNullValue:"",useFixedRowHeight:!0},pagination:{type:"scroll",showTotalRowCount:!1},text:{noDataFound:te("NO_DATA_FOUND"),moreDataFound:"",addRowButton:te("ADD_ROW"),help:""},toolbar:{reset:!0,save:!0,columnSelection:!0,searchField:!0,savedReports:!0,editing:!0,addRow:!0,actionMenu:!0},reportSettingsArea:{disabled:!1},features:{saveReport:{publicReportCs:"",isDeveloper:!1,authorizations:[]},download:!1,filter:!0,flashback:!0},initialSelection:!0,headingFixedTo:"page",maxHeight:null,views:{icon:!1,detail:!1,grid:{disabled:!1,features:{reorderColumns:!0,resizeColumns:!0,sort:!0,stretchColumns:null,highlight:!0,controlBreak:!0,aggregate:!0,changeRowsPerPage:!0,cellRangeActions:!0,singleRowView:!0,gridView:!0,rowSelector:{multiSelect:!0,selectAll:!0,hideControl:!1}}},chart:{disabled:!1,features:{}}},defaultModelOptions:{},defaultGridViewOptions:{},defaultIconViewOptions:{},defaultDetailViewOptions:{},defaultSingleRowOptions:{}},savedReports:[],data:null,selectionChange:null,viewChange:null,reportChange:null,reportSettingsChange:null,viewModelCreate:null,save:null,modeChange:null},_create:function(){var n,o=this,r=this.element,s=this.options,c=e(".a-IG").length;if(!s.config)throw new Error("Missing required config option.");if(!s.savedReports)throw new Error("Missing required saved reports configuration.");if(this.idPrefix=r[0].id||"ig"+(c+1),this.viewsImpl={},this.columnMap={},this.baseModelColumns={},this.primaryKeyColumns=[],this.parentColumnNames=[],this.parentItemValues=[],this.parentModel="",this.parentRecordId=null,this.editMode=!1,this.currentSavedReportIdx="",this.toolbar$=null,this.currentFilterColumnId=null,this.searchCaseSensitive=!1,this.ignoreResizeHandler=!1,this.actions=a.createContext("InteractiveGrid",r[0]),this.reportSettingsSeq=1,this.modelReportSettingsSeq={},this.isRTL="rtl"===r.css("direction"),r.addClass(p),this._defaultIGConfig(),(n=s.config).maxHeight&&r.height(n.maxHeight).css("overflow","hidden"),n.toolbar&&!n.toolbarData&&(n.toolbarData=fe()),this._defaultColumns(),this._createBaseColumnMap(),this._defaultSavedReports(),this._registerIGViews(),this._renderIG(),this._addActions(this.actions),n.initActions&&n.initActions(this.actions),n.toolbar&&(this._initToolbar(),this._updateToolbarElements()),this._forEachView((function(e,t){t.init(o)})),this._updateActions(),this.editableView=null,n.editable&&(this._forEachView((function(e,t){t.supports.edit&&(null===o.editableView?o.editableView=e:i.warn("Extra editable view ignored: "+e))})),null===this.editableView))throw new Error("No editable view for editable Interactive Grid");if(this.resize(),l.create(n.regionStaticId,{type:"InteractiveGrid",parentRegionId:n.parentRegionStaticId,widgetName:"interactiveGrid",refresh:function(){o.refresh()},focus:function(){o.focus()},widget:function(){return o.element},gotoError:function(e){o.gotoCell(null,e.record,e.column)},getSessionState:function(e){var t,i,n,a={beforeAsync:function(){var e=o._currentViewImpl();e.supports.edit&&e.lockActive&&e.lockActive()},afterAsync:function(){var e=o._currentViewImpl();e.supports.edit&&e.unlockActive&&e.unlockActive()}},l=[],r=[],s=o._currentViewImpl().getActiveRecordId();if(e)for(t=0;t<e.length;t++)(i=o._getColumnByStaticId(e[t]))?s&&r.push({n:i.name,v:d(e[t]).getValue()}):l.push(e[t]);return a.pageItems=l,r.length>0&&(n=o._currentViewImpl().model.getRecordMetadata(s),a.region=o._defaultAjaxRegionData({setSessionState:{values:r,protected:n.protected,salt:n.salt}})),a},alternateLoadingIndicator:function(e){var i,n=o._currentViewImpl();return"grid"===n.internalIdentifier&&!n.singleRowMode&&(i=n.view$.grid("getActiveCellFromColumnItem",e))?t.showSpinner(i,{spinnerClass:"u-Processing--cellRefresh"}):null}}),this._view(this._view(),{initialData:s.data,fetchData:n.lazyLoading}),"page"===n.headingFixedTo&&n.toolbar&&e.apex.stickyWidget&&e(".a-IG-header",r).stickyWidget({stickToEnd:!0,bottom:function(){return r.offset().top+e(".a-IG-body",r).outerHeight()-o._currentViewImpl().footerHeight()},toggleWidth:!0}),e("#"+n.regionStaticId).hasClass("resize")?r.addClass("resize").on("resize",(function(){o.resize()})):u.onElementResize(r[0],(function(){o.ignoreResizeHandler||o.resize()})),u.onVisibilityChange(r[0],(function(e){e&&(u.updateResizeSensors(r[0]),o.actions.update("search"),o.resize())})),n.parentRegionStaticId&&n.trackParentSelection){const i=e("#"+n.parentRegionStaticId+"_ig"),a=i.interactiveGrid("getViews"),l=i.interactiveGrid("option","config.views");this._forEachView((function(e,t){t.view$&&t.setNoDataMessage(te("SELECT_1_ROW_IN_MASTER"))})),i.on("interactivegridselectionchange.ig",t.debounce((function(e,t){const i=1===t.selectedRecords.length?t.selectedRecords[0]:null;o.setMasterRecord(t.model,i)}),300)),e.each(a,(function(e,t){const i=l[e].useModelFrom;let n=t;i&&l[i].shareModel&&(n=a[i]),n.model&&n.model.subscribe({onChange:function(){o.parentRecordId&&o.setMasterRecord(n.model,n.model.getRecord(o.parentRecordId))}})}))}},_setOption:function(t,i){var n=!1,o=this.options;"config"===t&&(i.modelInstanceId!==o.config.modelInstanceId&&(n=!0),i=e.extend(!0,o.config,i)),this._super(t,i),n&&this._setModelInstance(o.config.modelInstanceId)},_destroy:function(){var e=this,t=this.options.config;u.offElementResize(this.element[0]),this.element.removeClass(p).empty(),a.removeContext("InteractiveGrid",this.element[0]),this._destroyAllModels(),this._forEachView((function(t,i){i.destroy(e)})),l.destroy(t.regionStaticId)},_isCurrentlyEditable:function(){var e=this.options.config,t=this._currentReportSettings().flashback,i=t&&t.isEnabled;return e.editable&&!i},_setModelInstance:function(e,t,i){var n,o=this,a=!0,l=this.options.config,r=l.text.noDataFound;if(this.parentRecordId=null,l.modelInstanceId=e,null===e&&(r=te("SELECT_1_ROW_IN_MASTER"),a=!1),l.parentRegionStaticId&&(this.parentRecordId=l.modelInstanceId,this.parentItemValues=[],t&&i))for(n=0;n<this.parentColumnNames.length;n++)this.parentItemValues.push({n:this.parentColumnNames[n],v:t.getValue(i,this.parentColumnNames[n])});this._forEachView((function(e,t){t.view$&&(t.setNoDataMessage(r),o._setModel({viewImpl:t,updateComponent:!0,fetchData:a}))}))},_setInitialSelection:function(e){var t,i,n,o=this.options.config;t=this._currentViewImpl(),o.initialSelection&&t.supports.selection&&("scroll"!==o.pagination.type||0===e)&&((n=t.getSelectedRecords())&&0!==n.length||(i=t.model.recordAt(e))&&t.setSelectedRecords([i]))},_selectionChange:function(e){var t=this._currentViewImpl(),i=t.getSelectedRecords()||[];this._updateSelectionActions(),this._trigger("selectionChange",e,{selectedRecords:i,model:t.model})},_pageChange:function(e){var t=this;setTimeout((function(){t._setInitialSelection(e.offset)}),1)},_registerIGViews:function(){var e,t,n,o=this.options.config,a=0;for(e=0;e<Pe.length;e++)t=Pe[e],(n=o.views[t.internalIdentifier])&&!n.disabled&&(this._registerView(t),a+=1);0===a&&i.error("No views registered.")},_isViewRegistered:function(e){return!!this.viewsImpl[e]},_registerView:function(t){var i=this,n=e.extend(!0,{supports:{edit:!1,selection:!0,cellSelection:!1,highlight:!1,controlBreak:!1,aggregation:!1,singleRowView:!1,configurableColumns:!1,filter:!0,sort:!0,changeRowsPerPage:!0,download:!1,totalRows:!0},isConfigured:function(){return!!i._currentReportSettings().views[this.internalIdentifier]},initDialog:null,openDialog:function(){!this.dialog$&&this.initDialog&&this.initDialog(i),this.dialog$.dialog("open")},clearModelData:function(){this.model.getOption("parentModel")&&!this.model.getOption("parentRecordId")||(i.modelReportSettingsSeq[this.model.modelId()]=i.reportSettingsSeq,this.model.clearData())},setColumnConfig:function(){},init:function(){},updateActions:function(){},initView:function(){},viewChanged:function(){},setReportOptions:function(){},destroyView:function(){},destroy:function(){},getSelectedRecords:function(){return[]},setSelectedRecords:function(){},getActiveRecordId:function(){return null},getContextRecord:function(){return[]},gotoCell:null,selectCells:null,getColumns:null,canCopy2Clipboard:function(){return!1},setModelName:function(){},setEditMode:function(){},finishEditing:null,setNoDataMessage:function(){},focus:function(){},refreshColumns:function(){},footerHeight:function(){return 0},refresh:function(){},resize:function(){},show:function(){this.view$.show()},hide:function(){this.view$.hide()}},t);n.model=null,n.modelName=null,n.modelColumns=null,n.view$=null,n.elementId=n.internalIdentifier+"_vc",this.viewsImpl[n.internalIdentifier]=n},_forEachView:function(e){var t;for(t in this.viewsImpl)J(this.viewsImpl,t)&&e(t,this.viewsImpl[t])},_getPaginationConfig:function(t,i){var n={},o=t.pagination;return i&&t[i].pagination&&(n=e.extend({},t[i].pagination)),n.scroll=o.type===k||"scroll"===o.type,n.scroll&&(n.virtual=ie(n.virtual,o.showTotalRowCount)),n.showPageLinks=ie(n.showPageLinks,"set"===o.type&&o.showTotalRowCount),n.firstAndLastButtons=ie(n.firstAndLastButtons,"set"===o.type&&o.showTotalRowCount),n},_renderDialogContent:function(i){var n,o,a=this,l=t.htmlBuilder();n=function(e,t){a._renderColumnItem(l,e,t)},l.markup("<div").attr(x,"a-GV-columnItemContainer u-vh").attr(m,!0).markup(">"),i(n,l),l.markup("</div>"),o=e(l.toString()),this.element.append(o),apex.item.attach(o)},_createDialog:function(t,i,n){var o,a,l,r,s,d,c,u,h=e.extend(!0,{width:600,height:380,classPrefix:"a-IG-dialog",labelAlignment:"start",formCssClasses:"u-Form--labelsAbove u-Form--stretchInputs",useSplitter:!0,splitterPosition:280,persistSplitter:t,noDataMessage:te("NO_DATA_FOUND"),modelOptions:{shape:"record",editable:!0,onlyMarkForDelete:!1,identityField:"id"}},n);for(o in s=(t+="Dialog")+"$",d=this._getId(t.replace(/[A-Z]/g,(function(e){return"_"+e.toLowerCase()}))),(r=h.dialogHelp)||(h.dialogHelp=r={}),r.helpTextKey="APEX.IG.HELP."+(r.helpTextKey||h.titleKey),r.titleKey=r.titleKey?"APEX.IG.HELP."+r.titleKey:r.helpTextKey+"_TITLE",h.titleKey="APEX.IG."+h.titleKey,h.modelName=h.modelName?this._getId(h.modelName):d,a=h.modelOptions.fields)J(a,o)&&((l=a[o]).label&&(l.label=te(l.label),l.heading||"table"!==h.modelOptions.shape||(l.heading=l.label)),l.elementId&&(l.elementId=this._getId(l.elementId)));return n.checkboxColumn&&(u=h.init,h.init=function(t,i,n){i.on("click",".js-colCheckbox",(function(){var n=e(this),o=i.grid("getRecords",[n.parent()])[0],a=!t.getValue(o,"isEnabled");t.setValue(o,"enabledClass",a?"is-checked":""),t.setValue(o,"enabledText",te(a?"ENABLED":"DISABLED")),t.setValue(o,"isEnabled",a)})).on("keydown",".js-colCheckbox",(function(t){t.which===e.ui.keyCode.SPACE&&e(this).trigger("click")})),Ie(n,"isEnabled"),u.call(this,t,i,n)},a.enabledClass={volatile:!0,canHide:!1,hidden:!0,seq:0,defaultValue:"is-checked"},a.enabledText={volatile:!0,canHide:!1,hidden:!0,seq:0,defaultValue:te("ENABLED")}),this._renderDialogContent(i),c=e.apex.recordView.createModelEditDialog(d,h),n.viewDialog||(this[s]=c),c},_renderColumnItem:function(t,i,n){switch(t.markup("<div").attr(x,"a-GV-columnItem").markup(">"),n.id&&(n.id=this._getId(n.id)),i){case"checkbox":Oe(t,n);break;case _:!function(t,i){var n,o,a=e.extend({id:"",cssClasses:"apex-item-select",size:"1",title:"",required:!1,options:[]},i);for(t.markup("<select").optionalAttr("id",a.id).attr(x,a.cssClasses).attr("size",a.size).optionalAttr("title",a.title).optionalBoolAttr("required",a.required).markup(">"),n=0;n<a.options.length;n++)o=a.options[n],t.markup("<option").attr("value",o.value).optionalBoolAttr("selected",o.isSelected).markup(">").content(o.label||o.value).markup("</option>");t.markup("</select>")}(t,n);break;case f:Ne(t,n);break;case"textarea":!function(t,i){var n=e.extend({id:"",cssClasses:"apex-item-textarea",cols:"30",rows:"4",name:"",placeholder:"",disabled:!1,readonly:!1,required:!1,toolbar:!1,style:"resize: both;",wrap:"virtual"},i);n.toolbar&&(t.markup("<fieldset ").attr("id",i.id+"_fieldset").markup(">"),t.markup("<div").attr("id",n.id+"_toolbar").markup("></div>")),t.markup("<textarea").attr("id",n.id).attr(x,n.cssClasses).attr("cols",n.cols).attr("rows",n.rows).optionalAttr("name",n.name).optionalAttr("placeholder",n.placeholder).optionalAttr("style",n.style).optionalAttr("wrap",n.wrap).optionalBoolAttr(b,n.disabled).optionalBoolAttr("readonly",n.readonly).optionalBoolAttr("required",n.required).markup(">").markup("</textarea>"),n.toolbar&&t.markup("</fieldset>")}(t,n);break;case"radios":!function(t,i){var n,o,a,l=e.extend({id:"",label:"",name:"",radios:[]},i);for(t.markup("<div role='group'").attr("id",l.id).attr("aria-labelledby","id1").markup(">"),n=0;n<l.radios.length;n++)o=l.radios[n],a=l.id+"_"+n,De(t,{name:l.name,id:a,value:o.value,checked:o.checked,cssClasses:"a-IG-dialog-input-checkbox"}),Ve(t,{labelFor:a,cssClasses:"a-IG-dialog-label-checkbox",label:o.label});t.markup("</div>")}(t,n);break;case C:!function(t,i){t.markup("<div ").attr(x,"apex-item-group apex-item-group--color-picker a-Combobox-wrapper").markup(">"),Ne(t,e.extend({cssClasses:"color_picker apex-item-text apex-item-color-picker",data:{"display-as":"POPUP","display-mode":"FULL",colors:i.colors,"contrast-item":i.contrastItem||null,"max-colors":""+i.colors.split(";").length}},i)),t.markup("</div>")}(t,n);break;case"iconList":!function(t,i){var n,o,a=e.extend({id:"",iconOnly:!1,cssClasses:"",options:[]},i);for(t.markup("<fieldset ").attr(x,"a-IG-dialog-iconList").attr("id",a.id+"_fieldset").markup(">"),t.markup("<ul ").attr(x,"a-IG-dialog-iconList "+a.cssClasses).attr("id",a.id+"_list").markup(">"),n=0;n<a.options.length;n++)o=a.options[n],t.markup("<li").attr("data-value",o.value).attr(x,"a-IG-dialog-iconList-item"+(o.isSelected?" is-selected":"")).markup(">").markup("<span ").attr(x,"a-IG-dialog-iconList-link").attr("aria-label",o.label||o.value).attr("title",o.label||o.value).markup(">").markup("<span ").attr(x,"a-IG-dialog-iconList-icon a-Icon "+o.iconCssClasses).attr(m,!0).markup("></span>"),!1===a.iconOnly&&t.markup("<span ").attr(x,"a-IG-dialog-iconList-label").markup(">").content(o.label||o.value).markup("</span>"),t.markup("</span>").markup("</li>");t.markup("</ul>"),t.markup("<input ").attr("type","hidden").attr(m,!0).attr("id",a.id).markup(">"),t.markup("</fieldset>")}(t,n)}t.markup("</div>")},_renderReportSettingsDialog:function(){var t,i=[],n=[],o=this.options.config,a=o.features.saveReport.isDeveloper,l=this;a&&(i.push({value:R,label:te("PRIMARY")}),i.push({value:"alternative",label:te("ALTERNATIVE")})),i.push({value:"private",label:te("SAVED_REPORT_PRIVATE")}),o.features.saveReport.publicReportCs&&i.push({value:"public",label:te("SAVED_REPORT_PUBLIC")}),Re(o.features.saveReport.authorizations,n,"r","d","",te("SELECT")),this._createDialog("reportSettings",(function(e){e(_,{id:"SRD_TYPE",options:i}),e(f,{id:"SRD_NAME"}),e(_,{id:"SRD_AUTHORIZATION",options:n})}),{height:350,titleKey:"REPORT",defaultButton:!0,modelOptions:{fields:{id:{canHide:!1,hidden:!0,seq:0},type:{label:"TYPE",elementId:"SRD_TYPE",seq:10,defaultValue:"named"},name:{label:"NAME",elementId:"SRD_NAME",seq:20},authorizationId:{label:"AUTHORIZATION",elementId:"SRD_AUTHORIZATION",seq:30}}},load:function(i){var n,o=e(this),r=o.dialog(w,"saveAs"),s=e.extend({id:"",type:"",name:"",authorizationId:""},l._currentReportSettings());return n=r?"REPORT_SAVE_AS":"REPORT_EDIT",o.dialog(w,"title",te(n)),t=s.type,r&&(s.name="",(a||e.inArray(s.type,[R,"alternative"])>-1)&&(s.type="private")),i.setData(s),l._report()},init:function(i,n,o){var a=l._getElement("SRD_TYPE"),r=l._getElement("SRD_NAME"),s=l._getElement("SRD_AUTHORIZATION"),d=e(this);function c(){var e,i;switch(i=d.dialog(w,"saveAs")&&t===R,a.find("option[value="+R+"]").prop(b,i),e=a.val(),a.prop(b,!1),Ge(r,!0),xe(s),e){case R:t===R&&a.prop(b,!0),Ge(r,!1);break;case"alternative":Me(s)}}a.change(c),o.on("apexbeginrecordedit",c)},store:function(t){var i=e(this).dialog(w,"saveAs"),n=t.getRecord();i?(n.baseReportId=n.id,l.addReport(n)):l.updateReport(n.id,n),l._updateReportSettingsActions()}})},_renderDownloadDialog:function(){var t,i=this,n=te("MAILADDRESSES_COMMASEP"),o=this.options.config.features.download,a=[],l=[],r=[],s=o&&o.print&&o.print.orientation||"VERTICAL",d=o&&o.print&&o.print.paperSize||"LETTER",c=o&&o.print&&o.print.accessible||!1,u=V,h=V;o&&o.formats.length>0&&(t=o.formats[0]),o&&-1!==o.formats.indexOf("CSV")&&a.push({value:"CSV",label:te("FORMAT_CSV"),iconCssClasses:"icon-ig-dl-xls"}),o&&-1!==o.formats.indexOf("HTML")&&a.push({value:"HTML",label:te("FORMAT_HTML"),iconCssClasses:"icon-ig-dl-html"}),o&&-1!==o.formats.indexOf("PDF")&&(a.push({value:"PDF",label:te("FORMAT_PDF"),iconCssClasses:"icon-ig-dl-pdf"}),l=[{value:"LETTER",label:te("PRINT_PAGE_SIZE.LOV.LETTER.D")},{value:"LEGAL",label:te("PRINT_PAGE_SIZE.LOV.LEGAL.D")},{value:"TABLOID",label:te("PRINT_PAGE_SIZE.LOV.TABLOID.D")},{value:"A4",label:te("PRINT_PAGE_SIZE.LOV.A4.D")},{value:"A3",label:te("PRINT_PAGE_SIZE.LOV.A3.D")}],o&&o.print&&"CUSTOM"===o.print.paperSize&&l.unshift({value:"CUSTOM",label:te("PRINT_PAGE_SIZE.LOV.CUSTOM.D")}),r=[{value:"VERTICAL",label:te("PRINT_ORIENTATION.LOV.VERTICAL.D")},{value:"HORIZONTAL",label:te("PRINT_ORIENTATION.LOV.HORIZONTAL.D")}]),o&&-1!==o.formats.indexOf("XLSX")&&a.push({value:"XLSX",label:te("FORMAT_XLSX"),iconCssClasses:"icon-ig-dl-xls"}),this._createDialog("download",(function(e){e("iconList",{id:"DL_DOWNLOAD_FORMAT",options:a}),e(_,{id:"DL_PRINT_PAGE_SIZE",options:l}),e(_,{id:"DL_PRINT_ORIENTATION",options:r}),e("checkbox",{id:"DL_PRINT_ACCESSIBLE",value:"Y",checked:c}),e("checkbox",{id:"DL_PRINT_STRIP_RICH_TEXT",value:"Y"}),e("checkbox",{id:"DL_DATA_ONLY",value:"Y"}),e("checkbox",{id:"DL_SEND_AS_EMAIL",value:V}),e(f,{id:"DL_EMAIL_TO",placeholder:n}),e(f,{id:"DL_EMAIL_CC",placeholder:n}),e(f,{id:"DL_EMAIL_BCC",placeholder:n}),e(f,{id:"DL_EMAIL_SUBJECT"}),e("textarea",{id:"DL_EMAIL_BODY"})}),{height:500,titleKey:"DOWNLOAD",modelOptions:{fields:{id:{canHide:!1,hidden:!0,seq:0},format:{label:"DOWNLOAD_FORMAT",elementId:"DL_DOWNLOAD_FORMAT",seq:10},dataOnly:{label:"DOWNLOAD_DATA_ONLY",elementId:"DL_DATA_ONLY",seq:200},sendOrDownload:{label:"SEND_AS_EMAIL",elementId:"DL_SEND_AS_EMAIL",seq:200},emailTo:{label:"EMAIL_TO",elementId:"DL_EMAIL_TO",seq:210},emailCc:{label:"EMAIL_CC",elementId:"DL_EMAIL_CC",seq:220},emailBcc:{label:"EMAIL_BCC",elementId:"DL_EMAIL_BCC",seq:230},emailSubject:{label:"EMAIL_SUBJECT",elementId:"DL_EMAIL_SUBJECT",seq:240},emailBody:{label:"EMAIL_BODY",elementId:"DL_EMAIL_BODY",seq:250},sendEmail:{canHide:!1,hidden:!0,seq:0},printPageSize:{label:"PRINT_PAGE_SIZE.PROMPT",elementId:"DL_PRINT_PAGE_SIZE",seq:100,fieldColSpan:6},printOrientation:{label:"PRINT_ORIENTATION.PROMPT",elementId:"DL_PRINT_ORIENTATION",seq:110,fieldColSpan:6},printAccessible:{label:"PRINT_ACCESSIBLE.PROMPT",elementId:"DL_PRINT_ACCESSIBLE",seq:120},printStripRichText:{label:"PRINT_STRIP_RICH_TEXT.PROMPT",elementId:"DL_PRINT_STRIP_RICH_TEXT",seq:130}}},load:function(e){e.setData({id:0,format:t,dataOnly:h,sendEmail:V,printOrientation:s,printPageSize:d,printAccessible:c?"Y":V,printStripRichText:u})},init:function(t,n,o){var a,l,r=i._getElement("DL_DOWNLOAD_FORMAT"),s=i._getElement("DL_SEND_AS_EMAIL"),d=i._getElement("DL_EMAIL_TO"),c=i._getElement("DL_EMAIL_CC"),u=i._getElement("DL_EMAIL_BCC"),h=i._getElement("DL_EMAIL_SUBJECT"),g=i._getElement("DL_EMAIL_BODY"),p=i._getElement("DL_PRINT_PAGE_SIZE"),m=i._getElement("DL_PRINT_ORIENTATION"),f=i._getElement("DL_PRINT_ACCESSIBLE"),_=i._getElement("DL_PRINT_STRIP_RICH_TEXT"),C=i._getElement("DL_DATA_ONLY"),I=e(this),v=I.dialog(w,"buttons");function E(){!0===s.prop("checked")?(Me([d,c,u,h,g]),Ge([d,h],!0),v[a].text=te("SEND_AS_EMAIL"),I.dialog(w,"buttons",v),null!==o.recordView("getRecord")&&t.setValue(o.recordView("getRecord"),"sendEmail","Y")):(xe([d,c,u,h,g]),Ge([d,h],!1),v[a].text=te("DOWNLOAD"),I.dialog(w,"buttons",v),null!==o.recordView("getRecord")&&t.setValue(o.recordView("getRecord"),"sendEmail",V))}for(l=0;l<v.length;l++)if(v[l].text===ee("APEX.DIALOG.SAVE")){a=l;break}o.on("apexbeginrecordedit",(function(){var n=r.val();const a=i._getCurrentView().columns.some(e=>e.isVisible&&!i._getColumn(e.columnId).escape),l=function(){let e,t,n,o;const a=i._getCurrentView();function l(e){return e.some(e=>e.isEnabled&&!e.isInvalid)}return t=l(a.aggregations),n=l(a.highlights),e=a.columns.some(e=>e.break&&e.break.isEnabled),o=function(e){return e.some(e=>i._getColumn(e.columnId).layout.groupId)}(a.columns),e||t||n||o}(),d=[{fields:[p,m,f],active:e=>"PDF"===e},{fields:[_],active:e=>["CSV","XLSX"].includes(e)&&a},{fields:[C],active:e=>"CSV"!==e&&l}];Le(i._getId("DL_DOWNLOAD_FORMAT"),n),E(),!0===i.options.config.features.download.email?s.change(E):xe(s),r.change((function(){const i=e(this).val();t.setValue(o.recordView("getRecord"),"format",i),d.forEach(e=>{e.active(i)?Me(e.fields):xe(e.fields)})}))}))},store:function(e){var n,o=e.getRecord();t=o.format,c=o.printAccessible,s=o.printOrientation,d=o.printPageSize,u=o.printStripRichText,h=o.dataOnly,n={format:o.format,dataOnly:"Y"===o.dataOnly},"Y"===o.sendEmail&&(n.email={to:o.emailTo,subject:o.emailSubject},o.emailCc&&""!==o.emailCc&&(n.email.cc=o.emailCc),o.emailBcc&&""!==o.emailBcc&&(n.email.bcc=o.emailBcc),o.emailBody&&""!==o.emailBody&&(n.email.body=o.emailBody)),"PDF"===o.format&&(n.print={pageSize:o.printPageSize,orientation:o.printOrientation,accessible:"Y"===o.printAccessible,stripRichText:"Y"===o.printStripRichText}),["CSV","XLSX"].includes(o.format)&&(n.print={stripRichText:"Y"===o.printStripRichText}),i._downloadReport(n)}})},_columnFilterModelFields:function(e){var t=e+"_";return{type:{label:t+"TYPE",elementId:t+"TYPE",seq:100,canHide:!0,hidden:!0,defaultValue:v},columnId:{label:"COLUMN",elementId:t+"COLUMN",seq:120,fieldColSpan:6,canHide:!0,hidden:!0},operator:{label:"OPERATOR",elementId:t+"OPERATOR",seq:130,fieldColSpan:6,canHide:!0,hidden:!0,defaultValue:"EQ"},value:{label:"VALUE",elementId:t+"VALUE",seq:140,canHide:!0,hidden:!0},dateRangeValue:{label:"VALUE",elementId:t+"DATE_RANGE_VALUE",seq:141,fieldColSpan:6,canHide:!0,hidden:!0},dateRangeUnit:{label:"UNIT",elementId:t+"DATE_RANGE_UNIT",seq:142,fieldColSpan:6,canHide:!0,hidden:!0},isCaseSensitive:{label:"CASE_SENSITIVE",elementId:t+"CASE_SENSITIVE",seq:150,canHide:!0,hidden:!0,defaultValue:"N"},between:{label:"VALUE",elementId:t+"BETWEEN",seq:160,fieldColSpan:6,canHide:!0,hidden:!0},and:{label:"AND",elementId:t+"AND",seq:170,fieldColSpan:6,canHide:!0,hidden:!0},expression:{label:"EXPRESSION",elementId:t+"EXPRESSION",seq:180,canHide:!0,hidden:!0},hiddenValue:{seq:999,canHide:!0,hidden:!0},hiddenBetween:{seq:999,canHide:!0,hidden:!0},hiddenAnd:{seq:999,canHide:!0,hidden:!0}}},_renderSortControls:function(e,t){e(_,{id:t+"DIRECTION",required:!0,options:[{value:y,label:te("ASCENDING")},{value:"desc",label:te("DESCENDING")}]}),e(_,{id:t+"NULLS",required:!0,options:[{value:"first",label:te("FIRST")},{value:O,label:te("LAST")}]})},_columnFilterDialogControls:function(e,t){var i,n,o=[],a=this.options.config.columns,l=t+"_";for(i=0;i<a.length;i++)n=a[i],("FD"===t&&this._isColumnFilterable(n.id)||"HD"===t&&!this._getColumn(n.id).specialType&&!this._getColumn(n.id).isHidden)&&o.push({value:n.id,label:this._getColumnLabel(n.id)});e(_,{id:l+"TYPE",options:[{value:I,label:te("ROW")},{value:v,label:te("COLUMN")}]}),e(_,{id:l+"COLUMN",options:o}),e(_,{id:l+"OPERATOR",options:[]}),e(f,{maxChars:4e3,id:l+"VALUE"}),e(f,{maxChars:20,id:l+"DATE_RANGE_VALUE"}),e(_,{id:l+"DATE_RANGE_UNIT",options:[{value:"MI",label:te("MINUTES")},{value:"H",label:te("HOURS")},{value:"D",label:te("DAYS")},{value:"W",label:te("WEEKS")},{value:"M",label:te("MONTHS")},{value:"Y",label:te("YEARS")}]}),e("checkbox",{id:l+"CASE_SENSITIVE",value:"Y"}),e(f,{maxChars:100,id:l+"BETWEEN"}),e(f,{maxChars:100,id:l+"AND"}),e(f,{maxChars:40,id:l+"NAME"}),e("textarea",{id:l+"EXPRESSION",toolbar:!0})},_columnFilterInitActions:function(t,i,n,a,l){var r,s,d=this,c=a+"_",u="FD"===a,g=[],p=d._getElement(c+"TYPE"),m=d._getElement(c+"COLUMN"),f=d._getElement(c+"OPERATOR"),_=d._getElement(c+"VALUE"),C=d._getElement(c+"BETWEEN"),E=d._getElement(c+"AND"),A=d._getElement(c+"NAME"),R=d._getElement(c+"EXPRESSION"),S=d._getElement(c+"CASE_SENSITIVE"),N=d._getElement(c+"DATE_RANGE_VALUE"),L=d._getElement(c+"DATE_RANGE_UNIT");function y(){var e;u&&null!==n.recordView("getRecord")&&(e=d._shortenString(d._getSettingLabel(T,n.recordView("getRecord")),37),A.val(e).change())}function O(e){e.hasClass("a-Combobox")&&e.combobox("destroy"),e.hasClass("hasDatepicker")&&(e.parent().hasClass("a-Combobox-wrapper")&&e.unwrap(),e.datepicker("destroy")),e.attr("placeholder","")}function k(e,i){null!==n.recordView("getRecord")&&t.setValue(n.recordView("getRecord"),e,i)}function V(t){var i=p.val(),n=f.val();switch(xe([m,f,_,C,E,R,S,N,L]),u&&xe(A),k("type",i),i){case I:Me(_),d.options.config.filter.oracleText?(S.prop(b,!0),xe(S)):(S.prop(b,!1),Me(S)),He(_,"APEX.IG.SEARCH"),O(_),y();break;case v:Me([m,f]),He(_,"APEX.IG.VALUE"),e.inArray(n,[P,"NBETWEEN"])>-1?Me([C,E]):e.inArray(n,["LAST","NEXT","NLAST","NNEXT"])>-1?Me([N,L]):Me(_),D(t)}}function D(i){var l,s,u,I,A={},R=m.val();if(p.val()===v&&R){if((r=d._getColumn(R)).filter.textCase)switch(r.filter.textCase.toLowerCase()){case"upper":_.css({"text-transform":"uppercase"}),C.css({"text-transform":"uppercase"}),E.css({"text-transform":"uppercase"});break;case"lower":_.css({"text-transform":"lowercase"}),C.css({"text-transform":"lowercase"}),E.css({"text-transform":"lowercase"});break;default:_.css({"text-transform":"none"}),C.css({"text-transform":"none"}),E.css({"text-transform":"none"})}if("HD"===a)switch(r.dataType){case"VARCHAR2":A.EQ=te(Q.EQ),A.NEQ=te(Q.NEQ),A.N=te(Q.N),A.NN=te(Q.NN),A[U]=te(Q[U]),A[F]=te(Q[F]),A.C=te(Q.C),A.NC=te(Q.NC),A.S=te(Q.S),A.NS=te(Q.NS),A.REGEXP=te(Q.REGEXP);break;case B:A.EQ=te(Q.EQ),A.NEQ=te(Q.NEQ),A.GT=te(Q.GT),A.GTE=te(Q.GTE),A.LT=te(Q.LT),A.LTE=te(Q.LTE),A.N=te(Q.N),A.NN=te(Q.NN),A[U]=te(Q[U]),A[F]=te(Q[F]),A[P]=te(Q[P]),A.NBETWEEN=te(Q.NBETWEEN);break;case X:case q:case $:case W:A.EQ=te(Q.EQ),A.NEQ=te(Q.NEQ),A.GT=te(Q.GT),A.GTE=te(Q.GTE),A.LT=te(Q.LT),A.LTE=te(Q.LTE),A.N=te(Q.N),A.NN=te(Q.NN),e.inArray(r.filter.dateRanges,["all","past"])>-1&&(A.LAST=te(Q.LAST),A.NLAST=te(Q.NLAST)),e.inArray(r.filter.dateRanges,["all","future"])>-1&&(A.NEXT=te(Q.NEXT),A.NNEXT=te(Q.NNEXT)),A[P]=te(Q[P]),A.NBETWEEN=te(Q.NBETWEEN);break;case"CLOB":A.N=te(Q.N),A.NN=te(Q.NN)}else for(S.prop(b,!0),s=0;s<r.filter.operators.length;s++)if("$std$"===(u=r.filter.operators[s]).name)switch(r.filter.dataType){case"VARCHAR2":A.EQ=te(Q.EQ),A.NEQ=te(Q.NEQ),A.N=te(Q.N),A.NN=te(Q.NN),A[U]=te(Q[U]),A[F]=te(Q[F]);break;case B:A.EQ=te(Q.EQ),A.NEQ=te(Q.NEQ),A.GT=te(Q.GT),A.GTE=te(Q.GTE),A.LT=te(Q.LT),A.LTE=te(Q.LTE),A.N=te(Q.N),A.NN=te(Q.NN),A[U]=te(Q[U]),A[F]=te(Q[F]),A[P]=te(Q[P]),A.NBETWEEN=te(Q.NBETWEEN);break;case X:case q:case $:case W:A.EQ=te(Q.EQ),A.NEQ=te(Q.NEQ),A.GT=te(Q.GT),A.GTE=te(Q.GTE),A.LT=te(Q.LT),A.LTE=te(Q.LTE),A.N=te(Q.N),A.NN=te(Q.NN),e.inArray(r.filter.dateRanges,["all","past"])>-1&&(A.LAST=te(Q.LAST),A.NLAST=te(Q.NLAST)),e.inArray(r.filter.dateRanges,["all","future"])>-1&&(A.NEXT=te(Q.NEXT),A.NNEXT=te(Q.NNEXT)),A[P]=te(Q[P]),A.NBETWEEN=te(Q.NBETWEEN);break;case"CLOB":A.N=te(Q.N),A.NN=te(Q.NN)}else"$perform$"===u.name?e.inArray(r.filter.dataType,["VARCHAR2","CLOB"])>-1&&(A.C=te(Q.C),A.NC=te(Q.NC),A.S=te(Q.S),A.NS=te(Q.NS),A.REGEXP=te(Q.REGEXP),r.filter.textCase&&"MIXED"===r.filter.textCase.toUpperCase()&&S.prop(b,!1)):"CASE_INSENSITIVE"===u.name?r.filter.textCase&&"MIXED"===r.filter.textCase.toUpperCase()&&S.prop(b,!1):A[u.name]=te(Q[u.name]);I=t.getValue(n.recordView("getRecord"),"operator"),f.empty(),e.each(A,(function(t,i){f.append(e("<option></option>").attr("value",t).text(i))})),I&&null!==I&&e.inArray(I,A)&&f.val(I),null===f.val()&&f.val("EQ"),k("operator",f.val()),function(){var i,a,l,s;function u(t,i,n){var a,l,s,c,u,g=d._getColumnFormatMask(r.id);(a=-1!==g.toLowerCase().indexOf("hh"))&&(s=(new Date).getHours(),c="",(l=-1!==g.indexOf("HH"))||(c=s>11?"PM":"AM",0===s&&(s=12),s>12&&(s-=12))),e(t).hasClass("a-Combobox-wrapper")||e(t).wrap(e("<span class='a-Combobox-wrapper'></span>")),a?(apex.widget.datepicker(t,{buttonText:"<span class='a-Icon icon-calendar'></span><span class='u-VisuallyHidden'>"+o.formatMessage("APEX.DATEPICKER.ICON_TEXT","")+"</span>",showTime:!0,showOn:"button",defaultDate:Ee(n),time24h:l,defHour:("00"+s).substr(-2),defMinute:"00",defAmpm:c},g,h.getLanguage()),u=!1,n&&null!==n.match(/^\d{14}/)&&(u=Ee(n))&&!isNaN(u.getTime())&&apex.jQuery.timepicker.setCanonicalDate(e(t).get(0),u)):(apex.widget.datepicker(t,{buttonText:"<span class='a-Icon icon-calendar'></span><span class='u-VisuallyHidden'>"+o.formatMessage("APEX.DATEPICKER.ICON_TEXT","")+"</span>",defaultDate:Ee(n),showTime:!1,showOn:"button"},g,h.getLanguage()),n&&null!==n.match(/^\d{14}/)&&e(t).datepicker("setDate",Ee(n))),e(t).next("button").addClass("a-Button a-Button--withIcon a-Button--noLabel js-menuButton a-Button--calendar"),e(t).attr("placeholder",te("EXAMPLE")+": "+r.appearance.formatExample)}s=n.recordView("getRecord"),i=t.getValue(s,"hiddenValue"),a=t.getValue(s,"hiddenBetween"),l=t.getValue(s,"hiddenAnd"),O(_),O(C),O(E),e("#"+d._getId(c+"VALUE")+"_LABEL ").text(te("VALUE")),r.filter.dataType===X||r.filter.dataType===q||r.filter.dataType===$||r.filter.dataType===W?(r.filter.dataType===$&&e("#"+d._getId(c+"VALUE")+"_LABEL ").text(te("VALUE_TIMESTAMP_TZ")),u("#"+d._getId(c+"VALUE"),0,i),u("#"+d._getId(c+"BETWEEN"),0,a),u("#"+d._getId(c+"AND"),0,l)):(_.combobox({label:te("VALUE")}),C.combobox({label:te("VALUE")}),E.combobox({label:te("AND")}),_.val(i),C.val(a),E.val(l))}(),d._hasColumnFilterLov(R)?d._getFilterValues(R,!1,(function(e){if(g=[],e.regions[0].filterValues)for(l=e.regions[0].filterValues,s=0;s<l.length;s++)g.push({label:l[s],value:l[s]});C.hasClass("a-Combobox")&&C.combobox(w,"source",g),E.hasClass("a-Combobox")&&E.combobox(w,"source",g),_.hasClass("a-Combobox")&&_.combobox(w,"source",g)})):(O(_),O(C),O(E)),k("columnId",R),i&&(_.val("").change(),C.val("").change(),E.val("").change()),M()}}function M(){var t=f.val(),i=p.val();k("operator",t),i===v&&(xe([_,C,E,N,L,S]),null!==t&&(-1===e.inArray(r.filter.dataType,[X,q,$,W])&&_.hasClass("a-Combobox")&&(e.inArray(t,[U,F])>-1?(_.combobox(w,"multipleValues",!0),_.combobox(w,"multipleValueDelimiter","; "),_.prop("placeholder",o.formatMessage("APEX.IG.PLACEHOLDER_INVALUES",";"))):(_.combobox(w,"multipleValues",!1),_.prop("placeholder",""))),e.inArray(t,["C","NC","REGEXP","S","NS"])>-1&&!1===S.prop(b)&&Me(S),e.inArray(s,[P,"NBETWEEN"])>-1&&-1===e.inArray(t,[P,"NBETWEEN"])&&_.val("").change(),-1===e.inArray(s,[P,"NBETWEEN"])&&e.inArray(t,[P,"NBETWEEN"])>-1&&(C.val("").change(),E.val("").change()),e.inArray(s,["LAST","NEXT","NLAST","NNEXT"])>-1&&-1===e.inArray(t,["LAST","NEXT","NLAST","NNEXT"])&&_.val("").change(),e.inArray(t,[P,"NBETWEEN"])>-1?Me([C,E]):e.inArray(t,["LAST","NEXT","NLAST","NNEXT"])>-1?(Me([N,L]),H()):-1===e.inArray(t,["N","NN"])&&Me(_))),s=t,y()}function x(e){var i,o,a,l,r=d._getElement(c+e);if("VALUE"===e&&(i="hiddenValue"),"BETWEEN"===e&&(i="hiddenBetween"),"AND"===e&&(i="hiddenAnd"),t.setValidity("valid",n.recordView("getRecord").id,e.toLowerCase()),r.hasClass("hasDatepicker"))if(""===r.val())l="",a="";else{o=!1;try{o=r.datepicker(w,"showTime")?apex.jQuery.timepicker.getCanonicalDate(r.get(0)):r.datepicker("getDate")}catch(e){}o&&!isNaN(o.getTime())?(l=r.val(),a=be(o)):(""!==r.val()&&t.setValidity("error",n.recordView("getRecord").id,e.toLowerCase(),te("DATE_INVALID_VALUE")),l=r.val(),a=r.val())}else"uppercase"===r.css("text-transform")?(a=r.val().toUpperCase(),l=r.val().toUpperCase()):"lowercase"===r.css("text-transform")?(a=r.val().toLowerCase(),l=r.val().toLowerCase()):(a=r.val(),l=r.val());k(i,a),k(e.toLowerCase(),l),y()}function H(){_.val(N.val()+"~"+L.val()),k("value",_.val()),k("dateRangeValue",N.val()),k("dateRangeUnit",L.val()),y()}N.change(H),L.change(H),S.change((function(){var e=S.prop("checked");k("isCaseSensitive",e),S.prop("checked",e)})),p.change((function(){V(!0)})),m.change((function(){D(!0)})),f.change(M),_.change((function(){x("VALUE")})),C.change((function(){x("BETWEEN")})),E.change((function(){x("AND")})),n.on("apexbeginrecordedit",(function(){V(),e.isFunction(l)&&l()}))},_renderFilterDialog:function(){var t=this;this._createDialog(T,(function(e){t._columnFilterDialogControls(e,"FD")}),{titleKey:"FILTERS",dialogHelp:{helpTextKey:"FILTER"},checkboxColumn:!0,modelOptions:{shape:"table",fields:e.extend({id:{canHide:!1,hidden:!0,seq:0},isEnabled:Ce(),name:{headingAlignment:"start",label:"NAME",elementId:"FD_NAME",width:100,seq:105,escape:!1}},this._columnFilterModelFields("FD"))},load:function(i){var n,o,a,l,r,s=[],d=t.getFilters(),c=e(this).dialog(w,"id");if(d.length>0){for(n=0;n<d.length;n++){switch(o=(a=e.extend({id:"",type:"",columnId:"",operator:"",value:"",hiddenValue:"",dateRangeValue:"",dateRangeUnit:"",isCaseSensitive:!1,between:"",and:"",hiddenBetween:"",hiddenAnd:"",isEnabled:"",enabledClass:"",enabledText:"",name:"",expression:""},d[n])).isEnabled,a.enabledClass=o?"is-checked":"",a.enabledText=te(o?"ENABLED":"DISABLED"),a.name=t._getSettingLabel(T,a),a.type){case I:a.hiddenValue=a.value;break;case v:a.hiddenValue=a.value,e.inArray(a.operator,[P,"NBETWEEN"])>-1?(l=a.value.split("~"),a.hiddenBetween=l[0],a.hiddenAnd=l[1],a.hiddenValue="",a.value=""):e.inArray(a.operator,["LAST","NEXT","NLAST","NNEXT"])>-1&&(r=a.value.split("~"),a.dateRangeValue=r[0],a.dateRangeUnit=r[1],a.hiddenValue="",a.value=""),e.inArray(a.operator,[U,F])>-1&&(a.value=a.value.split("").join("; "),a.hiddenValue=a.value)}a.isCaseSensitive=a.isCaseSensitive?"Y":V,s.push(a)}i.setData(s)}else c=i.insertNewRecord();return c},init:function(e,i,n){Ie(n,"hiddenValue"),Ie(n,"hiddenBetween"),Ie(n,"hiddenAnd"),t._columnFilterInitActions(e,i,n,"FD")},validate:function(e,i,n){var o,a,l,r,s=!0;function d(e,t){return!isNaN(h.toNumber(e,t))}return e.forEach((function(e,c,u){switch(i(u,"between"),i(u,"and"),i(u,"value"),i(u,"expression"),e.type){case v:switch(o=t._getColumn(e.columnId),a=o.filter.dataType,l=o.appearance.formatMask,e.operator){case P:case"NBETWEEN":e.hiddenBetween&&""!==e.hiddenBetween||(s=!1,n(u,"between",te("VALUE_REQUIRED"))),e.hiddenAnd&&""!==e.hiddenAnd||(s=!1,n(u,"and",te("VALUE_REQUIRED"))),s&&(a===B?(d(e.hiddenBetween,l)?e.hiddenBetween=h.toNumber(e.hiddenBetween,l):(s=!1,n(u,"between",te("INVALID_NUMBER_FORMAT"))),d(e.hiddenAnd,l)?e.hiddenAnd=h.toNumber(e.hiddenAnd,l):(s=!1,n(u,"and",te("INVALID_NUMBER_FORMAT")))):[X,q,$,W].includes(a)&&(e.hiddenBetween!==be(Ee(e.hiddenBetween))&&(s=!1,n(u,"between",te("INVALID_VALUE"))),e.hiddenAnd!==be(Ee(e.hiddenAnd))&&(s=!1,n(u,"and",te("INVALID_VALUE")))));break;case"LAST":case"NEXT":case"NLAST":case"NNEXT":e.dateRangeValue&&""!==e.dateRangeValue||(s=!1,n(u,"dateRangeValue",te("VALUE_REQUIRED"))),e.dateRangeUnit&&""!==e.dateRangeUnit||(s=!1,n(u,"dateRangeUnit",te("VALUE_REQUIRED")));break;case"EQ":case"NEQ":case"GT":case"GTE":case"LT":case"LTE":case U:case F:e.hiddenValue&&""!==e.hiddenValue?a===B?(r=[U,F].includes(e.operator)?e.hiddenValue.split(";"):[e.hiddenValue]).some(e=>!d(e,l))?(s=!1,n(u,"value",te("INVALID_NUMBER_FORMAT"))):e.hiddenValue=r.map(e=>h.toNumber(e,l)).join(";"):[X,q,$,W].includes(a)&&e.hiddenValue!==be(Ee(e.hiddenValue))&&(s=!1,n(u,"value",te("DATE_INVALID_VALUE"))):(s=!1,n(u,"value",te("VALUE_REQUIRED")))}break;case I:e.hiddenValue&&""!==e.hiddenValue||(s=!1,n(u,"value",te("VALUE_REQUIRED")))}})),s},store:function(i){t._ifNoChangesDo((function(){var n,o,a,l={save:!1,skipNoChangesCheck:!0},r=i.getChanges();for(n=0;n<r.length;n++){switch(delete(a=(o=r[n]).record).enabledClass,delete a.enabledText,a.type){case I:delete a.expression,delete a.columnId,delete a.and,delete a.between,delete a.hiddenAnd,delete a.hiddenBetween,delete a.dateRangeValue,delete a.dateRangeUnit,delete a.operator,a.isCaseSensitive="Y"===a.isCaseSensitive;break;case v:a.value=a.hiddenValue,e.inArray(a.operator,[P,"NBETWEEN"])>-1?a.value=a.hiddenBetween+"~"+a.hiddenAnd:e.inArray(a.operator,["LAST","NEXT","NLAST","NNEXT"])>-1&&(a.value=a.dateRangeValue+"~"+a.dateRangeUnit),e.inArray(a.operator,[U,F])>-1&&(a.value=we(a.value.split(";")).join("")),delete a.dateRangeValue,delete a.dateRangeUnit,delete a.between,delete a.and,delete a.hiddenValue,delete a.hiddenBetween,delete a.hiddenAnd,delete a.expression,a.isCaseSensitive="Y"===a.isCaseSensitive}o.inserted?(delete a.id,a.columnType=v,t.addFilter(a,l)):o.updated?(a.columnType=v,t.updateFilter(a.id,a,l)):o.deleted&&t.deleteFilter(a.id,l)}t._setReportSettings({refreshModel:!0})}))}})},_renderColumnsDialog:function(){var t=this,i=[],n=this.options.config.views[this._view()].features;function o(i){var n,o,a,l,r=[],s=t._getCurrentView().columns;function d(e){return!(e.id!==a.columnId||e.specialType&&"actions"!==e.specialType||e.isHidden)}for(n=0;n<s.length;n++)a=s[n],(o=(o=e.grep(t.options.config.columns,d)).length>0&&o[0])&&(l={id:a.columnId,columnId:a.columnId,columnWidth:a.width,seq:n+1,heading:"actions"===o.specialType?te("ROW_ACTIONS"):o.heading.label,groupId:o.layout.groupId,canHide:o.features.canHide,isVisible:a.isVisible,enabledClass:a.isVisible?"is-checked":""},"ALL"===i||"VISIBLE"===i&&a.isVisible?r.push(l):"INVISIBLE"!==i||l.isVisible||r.push(l));return r}Re(this.options.config.columnGroups,i,"id","label","",""),this._createDialog("columns",(function(e){e(f,{id:"CD_COLUMN_WIDTH"}),e(_,{id:"CD_COLUMN_GROUP",options:i})}),{titleKey:"COLUMNS",modelOptions:{shape:"table",canDelete:!1,canAdd:!1,sequenceField:n.reorderColumns?"seq":null,fields:{id:{canHide:!1,hidden:!0,seq:0},isVisible:Ce("VISIBLE"),heading:{label:"COLUMN",headingAlignment:"start",elementId:"CD_COLUMN_HEADING",canHide:!0,hidden:!1,width:100,seq:20},groupId:{label:"GROUP",elementId:"CD_COLUMN_GROUP",canHide:!0,escape:!1,volatile:!0,hidden:!0,seq:30},columnWidth:{label:"WIDTH",elementId:"CD_COLUMN_WIDTH",canHide:!0,hidden:!0,seq:40},columnId:{label:"COLUMN",elementId:"CD_COLUMN",seq:0,canHide:!0,hidden:!0},seq:{canHide:!1,hidden:!0,seq:0},canHide:{canHide:!1,hidden:!0,seq:0},enabledClass:{volatile:!0,canHide:!1,hidden:!0,defaultValue:"is-checked",seq:0}}},load:function(e){e.setData(o(this.showColumns))},init:function(t,i,n,l){var r,s=this;this.showColumns||(this.showColumns="ALL"),r=[{type:"BUTTON",iconOnly:!0,icon:"icon-up-chevron",action:"move-up"},{type:"BUTTON",iconOnly:!0,icon:"icon-down-chevron",action:"move-down"},{type:"MENU",labelKey:"APEX.IG.SHOW",icon:"icon-ig-select-cols",iconOnly:!0,menu:{items:[{type:"radioGroup",action:"show-columns"}]}}],a.findContext("ModelEditDialog",this).add([{name:"show-columns",choices:[{label:te("ALL"),value:"ALL"},{label:te("VISIBLE"),value:"VISIBLE"},{label:te("INVISIBLE"),value:"INVISIBLE"}],get:function(){return s.showColumns},set:function(e){s.showColumns=e;var i=o(e);t.setData(i)}}]),l.toolbar({data:[{align:"start",controls:r}]}),i.on("click",".js-colCheckbox",(function(){var n,o,a=e(this);o=i.grid("getRecords",[a.parent()])[0],t.getValue(o,"canHide")&&(n=!t.getValue(o,"isVisible"),t.setValue(o,"enabledClass",n?"is-checked":""),t.setValue(o,"isVisible",n))})).on("keydown",".js-colCheckbox",(function(t){t.which===e.ui.keyCode.SPACE&&e(this).trigger("click")})),n.on("apexbeginrecordedit",(function(){""===t.getValue(n.recordView("getRecord"),"groupId")?Ie(n,"groupId"):ve(n,"groupId")})),Ie(n,"columnId"),Ie(n,"isVisible")},validate:function(e,t,i){var n,o=!0;return e.forEach((function(e,a,l){null!==(n=e.columnWidth)&&""!==n&&isNaN(parseInt(n,10))?(i(l,"columnWidth",te("INVALID_VALUE")),o=!1):t(l,"columnWidth")})),o},store:function(e){var i,n,o,a=!1,l=t._getCurrentView().columns,r=t._currentViewImpl().getColumns();for(l.sort((function(e,t){return e.seq-t.seq})),i=0;i<l.length;i++)!0===l[i].isFrozen&&(a=i+1);for(e.forEach((function(e){(o=e.columnWidth)&&null!==o||(o=""),o=o.toString(),t._currentViewColumn(e.columnId,{isVisible:e.isVisible,width:parseInt(o,10),seq:parseFloat(e.seq)})})),l.sort((function(e,t){return e.seq-t.seq})),i=0;i<l.length;i++)for(n=0;n<r.length;n++)if(l[i].columnId===r[n].id){r[n].seq=l[i].seq,r[n].canHide&&(r[n].hidden=!l[i].isVisible),r[n].width=l[i].width,l[i].seq=i,!1!==a&&i>=a&&(l[i].isFrozen=!1,r[n].frozen=!1),!1!==a&&i<a&&(l[i].isFrozen=!0,r[n].frozen=!0);break}t._setReportSettings({refreshView:!0,refreshColumns:!0})}})},_renderHighlightDialog:function(){var t,i,n=this,o=this.options.config.columns,a=[];for(i=0;i<o.length;i++)t=o[i],this._getColumn(t.id).specialType||this._getColumn(t.id).isHidden||a.push({value:t.id,label:this._getColumnLabel(t.id)});this._createDialog(S,(function(e){n._columnFilterDialogControls(e,"HD"),e(C,{id:"HD_BACKGROUND_COLOR",size:"7",colors:"#fff5ce;#d0f1cc;#cce5ff;#ffd6d2;#e8e8e8;#000000;#ffffff",contrastItem:n._getId("HD_TEXT_COLOR"),itemLabel:te("BACKGROUND_COLOR")}),e(C,{id:"HD_TEXT_COLOR",size:"7",colors:"#a96e17;#3baa2c;#0076df;#f44336;#767676;#000000;#ffffff",contrastItem:n._getId("HD_BACKGROUND_COLOR"),itemLabel:te("TEXT_COLOR")}),e(_,{id:"HD_HIGHLIGHT_TYPE",options:[{value:I,label:te("ROW")},{value:v,label:te("COLUMN")}]}),e(_,{id:"HD_HIGHLIGHT_COLUMN",options:a})}),{width:800,height:580,titleKey:"HIGHLIGHT",checkboxColumn:!0,modelOptions:{shape:"table",sequenceField:"seq",fields:e.extend({id:{canHide:!1,hidden:!0,seq:0},seq:{canHide:!1,hidden:!0,seq:0},isEnabled:Ce(),name:{label:"NAME",headingAlignment:"start",elementId:"HD_NAME",isRequired:!0,width:100,seq:15},highlightType:{label:"HIGHLIGHT",elementId:"HD_HIGHLIGHT_TYPE",seq:20,canHide:!0,hidden:!0},highlightColumnId:{label:"COLUMN",elementId:"HD_HIGHLIGHT_COLUMN",seq:30,canHide:!0,hidden:!0},backgroundColor:{label:"BACKGROUND_COLOR",elementId:"HD_BACKGROUND_COLOR",seq:40,fieldColSpan:4,canHide:!0,hidden:!0},textColor:{label:"TEXT_COLOR",elementId:"HD_TEXT_COLOR",seq:50,fieldColSpan:4,canHide:!0,hidden:!0},preview:{label:"COLOR_PREVIEW",cellTemplate:`<div id='${this._getId("HD_PREVIEW")}' class='a-IG-highlightPreview'>Aa</div><div class='a-IG-highlightContrast'>${apex.widget.util.colorPicker.renderColorContrastReport(this._getId("HD_CONTRAST"))}</div>`,seq:60,fieldColSpan:4,canHide:!0,hidden:!0}},this._columnFilterModelFields("HD"))},load:function(t){var i,o,a,l,r,s=[],d=n.getHighlights(),c=e(this).dialog(w,"id");if(d.length>0){for(i=0;i<d.length;i++){switch((l={id:(r=d[i]).id,seq:r.seq,name:r.name,highlightType:r.type,highlightColumnType:r.columnType,highlightColumnId:r.columnId,backgroundColor:r.backgroundColor,textColor:r.textColor,type:r.condition.type,columnType:r.condition.columnType,columnId:r.condition.columnId,operator:r.condition.operator,isCaseSensitive:r.condition.isCaseSensitive?"Y":V,value:r.condition.value,expression:r.condition.expression,isEnabled:r.isEnabled,hiddenValue:"",dateRangeValue:"",dateRangeUnit:"",between:"",and:"",hiddenBetween:"",hiddenAnd:"",enabledClass:"",enabledText:""}).enabledClass=l.isEnabled?"is-checked":"",l.enabledText=l.isEnabled?te("ENABLED"):te("DISABLED"),l.hiddenValue=l.value,l.type){case v:e.inArray(l.operator,[P,"NBETWEEN"])>-1?(o=l.value.split("~"),l.hiddenBetween=o[0],l.hiddenAnd=o[1],l.hiddenValue="",l.value=""):e.inArray(l.operator,["LAST","NEXT","NLAST","NNEXT"])>-1&&(a=l.value.split("~"),l.dateRangeValue=a[0],l.dateRangeUnit=a[1],l.hiddenValue="",l.value=""),e.inArray(l.operator,[U,F])>-1&&(l.value=l.value.split("").join("; "),l.hiddenValue=l.value)}s.push(l)}t.setData(s)}else c=t.insertNewRecord();return c},init:function(e,t,i){let o=n._getElement("HD_HIGHLIGHT_TYPE"),a=n._getElement("HD_HIGHLIGHT_COLUMN"),l=n._getElement("HD_TEXT_COLOR"),r=n._getElement("HD_BACKGROUND_COLOR"),s=n._getElement("HD_NAME");function c(){var e=o.val(),t=d(a.attr("id"));e===I?xe(a):(Me(a),t.setValue(t.getValue()))}l.add(r).change(()=>{let e,t=n._getElement("HD_PREVIEW"),i=n._getElement("HD_CONTRAST"),o=d(r[0].id).getValue()||"#ffffff",a=d(l[0].id),s=a.getValue()||"#000000";t.css({backgroundColor:o,color:s}),a.whenReady().then(()=>{e=a.contrastWith(o),apex.widget.util.colorPicker.updateColorContrastReport(i,e)})}),Ge(s,!0),Ie(i,"hiddenValue"),Ie(i,"hiddenBetween"),Ie(i,"hiddenAnd"),n._columnFilterInitActions(e,t,i,"HD",(function(){c(),l.change(),r.change()})),o.change(c)},validate:function(t,i,o){var a=!0;return t.forEach((function(t,l,r){switch(i(r,"between"),i(r,"and"),i(r,"value"),i(r,"expression"),i(r,"name"),i(r,"textColor"),i(r,"backgroundColor"),""===t.textColor&&""===t.backgroundColor&&(o(r,"textColor",te("VALUE_REQUIRED")),o(r,"backgroundColor",te("VALUE_REQUIRED"))),""===t.name&&o(r,"name",te("VALUE_REQUIRED")),t.type){case v:switch(t.operator){case P:case"NBETWEEN":t.hiddenBetween&&""!==t.hiddenBetween||(a=!1,o(r,"between",te("VALUE_REQUIRED"))),t.hiddenAnd&&""!==t.hiddenAnd||(a=!1,o(r,"and",te("VALUE_REQUIRED"))),a&&e.inArray(n._getColumn(t.columnId).filter.dataType,[X,q,$,W])>-1&&(t.hiddenBetween!==be(Ee(t.hiddenBetween))&&(a=!1,o(r,"between",te("INVALID_VALUE"))),t.hiddenAnd!==be(Ee(t.hiddenAnd))&&(a=!1,o(r,"and",te("INVALID_VALUE"))));break;case"LAST":case"NEXT":case"NLAST":case"NNEXT":t.dateRangeValue&&""!==t.dateRangeValue||(a=!1,o(r,"dateRangeValue",te("VALUE_REQUIRED"))),t.dateRangeUnit&&""!==t.dateRangeUnit||(a=!1,o(r,"dateRangeUnit",te("VALUE_REQUIRED")));break;case"EQ":case"NEQ":case"GT":case"GTE":case"LT":case"LTE":case U:case F:t.hiddenValue&&""!==t.hiddenValue?e.inArray(n._getColumn(t.columnId).filter.dataType,[X,q,$,W])>-1&&t.hiddenValue!==be(Ee(t.hiddenValue))&&(a=!1,o(r,"value",te("DATE_INVALID_VALUE"))):(a=!1,o(r,"value",te("VALUE_REQUIRED")))}break;case I:t.hiddenValue&&""!==t.hiddenValue||(a=!1,o(r,"value",te("VALUE_REQUIRED")))}})),a},store:function(t){n._ifNoChangesDo((function(){var i,o,a,l,r,s={save:!1,skipNoChangesCheck:!0},d=t.getChanges();for(i=0;i<d.length;i++){switch((l=(o=d[i]).record).type){case I:r={type:I,value:l.value,isCaseSensitive:"Y"===l.isCaseSensitive};break;case v:r={type:v,value:l.hiddenValue,columnId:l.columnId,operator:l.operator,columnType:v,isCaseSensitive:"Y"===l.isCaseSensitive},e.inArray(l.operator,[U,F])>-1&&(r.value=we(l.hiddenValue.split(";")).join("")),e.inArray(l.operator,[P,"NBETWEEN"])>-1?r.value=l.hiddenBetween+"~"+l.hiddenAnd:e.inArray(l.operator,["LAST","NEXT","NLAST","NNEXT"])>-1&&(r.value=l.dateRangeValue+"~"+l.dateRangeUnit)}a={id:l.id,seq:parseFloat(l.seq),name:l.name,type:l.highlightType,textColor:l.textColor,backgroundColor:l.backgroundColor,condition:r,isEnabled:l.isEnabled},l.highlightType===v?(a.type=v,a.columnType=v,a.columnId=l.highlightColumnId):l.highlightType===I&&(a.type=I,delete a.columnType,delete a.columnId),o.inserted?(delete a.id,n.addHighlight(a,s)):o.updated?n.updateHighlight(a.id,a,s):o.deleted&&n.deleteHighlight(a.id,s)}n._setReportSettings({refreshModel:!0,changeIdentifier:"views.grid.highlights"})}))}})},_loadColumnOptions:function(e,t){var i,n,o,a=this.options.config.columns;for(e.push({value:"",label:te("SELECT")}),i=0;i<a.length;i++)(o=a[i]).specialType||!o.features[t]||o.isHidden||(n||(n=o),e.push({value:o.id,label:this._getColumnLabel(o.id)}));return n},_renderSortDialog:function(){var e=[],t=this;this._loadColumnOptions(e,"sort"),this._createDialog("sort",(function(i){i(_,{id:"SD_COLUMN",required:!0,options:e}),t._renderSortControls(i,"SD_")}),{titleKey:"SORT",modelOptions:{shape:"table",identityField:"order",sequenceField:"seq",fields:{order:{canHide:!1,hidden:!0,seq:10},seq:{seq:20,canHide:!1,hidden:!0},columnId:{label:"COLUMN",headingAlignment:"start",elementId:"SD_COLUMN",isRequired:!0,width:100,seq:30,canHide:!0,hidden:!1},direction:{label:"DIRECTION",headingAlignment:"start",elementId:"SD_DIRECTION",width:60,seq:40,defaultValue:y,canHide:!0,hidden:!1},nulls:{label:"NULLS",elementId:"SD_NULLS",seq:50,defaultValue:O,canHide:!0,hidden:!0}}},load:function(e){var i,n,o=t.getSorts();for(i=0;i<o.length;i++)o[i].seq=i+1,o[i].order=i+1;return o.length>0?e.setData(o):n=e.insertNewRecord(),n},init:function(e,i,n){var o=t._getElement("SD_COLUMN"),a=t._getElement("SD_DIRECTION");o.change((function(){e.setValue(n.recordView("getRecord"),"columnId",o.val())})),a.change((function(){e.setValue(n.recordView("getRecord"),"direction",a.val())}))},validate:function(e){var t={},i=!0;return e.forEach((function(e){t[e.columnId]?i=!1:t[e.columnId]=!0})),!1!==i||te("SORT_ONLY_ONE_PER_COLUMN")},store:function(e){var i,n,o,a,l,r=e.getChanges(),s=t.getSorts();for(i=0;i<s.length;i++)s[i].seq=i+1;for(i=0;i<r.length;i++)if(a=(o=r[i]).record,l=o.original,a.seq=parseFloat(a.seq),o.inserted)s.push(a);else if(o.updated)if(l.columnId===a.columnId){for(n=0;n<s.length;n++)if(a.columnId===s[n].columnId){s[n]=a;break}}else{for(n=0;n<s.length;n++)if(l.columnId===s[n].columnId){s.splice(n,1);break}s.push(a)}else if(o.deleted)for(n=0;n<s.length;n++)if(a.columnId===s[n].columnId){s.splice(n,1);break}s.length>0&&(s=s.sort((function(e,t){return e.seq-t.seq}))),r.length>0&&t.setSorts(s)}})},_renderAggregateDialog:function(){var t,i,n=[],o=this;t=this._loadColumnOptions(n,"aggregate"),i=[{value:Z.CNT,label:te(Z.CNT)},{value:Z.CNT_DIST,label:te(Z.CNT_DIST)},{value:Z.MIN,label:te(Z.MIN)},{value:Z.MAX,label:te(Z.MAX)},{value:Z.MEDIAN,label:te(Z.MEDIAN)},{value:Z.SUM,label:te(Z.SUM)},{value:Z.AVG,label:te(Z.AVG)}],this._createDialog(L,(function(e){e(_,{id:"AD_COLUMN",required:!0,options:n}),e(_,{id:"AD_AGGREGATION",required:!0,options:i}),e(f,{maxlength:"30",id:"AD_TOOLTIP"}),e("checkbox",{id:"AD_SHOW_GRAND_TOTAL",value:"Y"})}),{titleKey:"AGGREGATION",dialogHelp:{helpTextKey:"AGGREGATE"},checkboxColumn:!0,modelOptions:{shape:"table",fields:{id:{canHide:!1,hidden:!0,seq:0},isEnabled:Ce(),columnId:{label:"COLUMN",headingAlignment:"start",elementId:"AD_COLUMN",isRequired:!0,defaultValue:"",seq:30,width:80,canHide:!0,hidden:!1},function:{label:"AGGREGATION",headingAlignment:"start",elementId:"AD_AGGREGATION",isRequired:!0,seq:40,width:80,defaultValue:"",canHide:!0,hidden:!1},tooltip:{label:"TOOLTIP",elementId:"AD_TOOLTIP",seq:50,defaultValue:"",canHide:!0,hidden:!0},showGrandTotal:{label:"SHOW_OVERALL_VALUE",elementId:"AD_SHOW_GRAND_TOTAL",seq:60,defaultValue:"Y",canHide:!0,hidden:!0}}},load:function(i){var n,a,l,r=[],s=e(this),d=s.dialog(w,"id"),c=s.dialog(w,"columnId"),u=o.getAggregates();function h(e){var t=o._getColumn(e);return l=t.filter.dataType===B?Z.SUM:Z.CNT,i.insertNewRecord(null,null,{columnId:e,isEnabled:!0,enabledClass:"is-checked",function:l})}if(u.length>0){for(n=0;n<u.length;n++)(a=e.extend({id:"",columnId:"",function:"",tooltip:"",showGrandTotal:"",isEnabled:"",enabledClass:"",enabledText:""},u[n])).enabledClass=a.isEnabled?"is-checked":"",a.enabledText=a.isEnabled?te("ENABLED"):te("DISABLED"),a.showGrandTotal=a.showGrandTotal?"Y":V,r.push(a);i.setData(r),c&&(d=h(c))}else d=h(c||t.id);return d},init:function(t,i,n){var a=o._getElement("AD_COLUMN"),l=o._getElement("AD_AGGREGATION"),r=o._getElement("AD_SHOW_GRAND_TOTAL");function s(){var i,r,s={},c=a.val();i=o._getColumn(c),c&&""!==c?(ve(n,"function"),ve(n,"tooltip"),ve(n,"showGrandTotal"),s[Z.CNT]=te(Z.CNT),"VARCHAR2"!==i.filter.dataType&&i.filter.dataType!==B&&i.filter.dataType!==X||(s[Z.CNT_DIST]=te(Z.CNT_DIST),s[Z.MIN]=te(Z.MIN),s[Z.MAX]=te(Z.MAX)),i.filter.dataType!==B&&i.filter.dataType!==X||(s[Z.MEDIAN]=te(Z.MEDIAN)),i.filter.dataType===B&&(s[Z.SUM]=te(Z.SUM),s[Z.AVG]=te(Z.AVG)),r=l.val(),l.empty(),l.append(e("<option></option>").attr("value","").text(te("SELECT"))),e.each(s,(function(t,i){l.append(e("<option></option>").attr("value",t).text(i))})),""!==r&&l.val(r),""!==l.val()&&null!==l.val()||(i.filter.dataType===B?l.val(Z.SUM):l.val(Z.CNT)),t.setValue(n.recordView("getRecord"),"columnId",c),d()):(Ie(n,"function"),Ie(n,"tooltip"),Ie(n,"showGrandTotal"),t.setValue(n.recordView("getRecord"),"columnId",""),l.val("").change())}function d(){t.setValue(n.recordView("getRecord"),"function",l.val())}Me(a),a.change(s),l.change(d),r.change((function(){t.setValue(n.recordView("getRecord"),"showGrandTotal",r.prop("checked")?"Y":"N")})),n.on("apexbeginrecordedit",(function(){s()}))},validate:function(e,t,i){var n,o={},a=!0;return e.forEach((function(e,l,r){n=e.columnId.toString()+e.function,o[n]?(a=!1,i(r,"columnId",te("DUPLICATE_AGGREGATION")),i(r,"function",te("DUPLICATE_AGGREGATION"))):(o[n]=!0,t(r,"columnId"),t(r,"function")),""===e.columnId&&(i(r,"columnId",te("DUPLICATE_AGGREGATION")),a=!1)})),a},store:function(e){o._ifNoChangesDo((function(){var t,i,n,a={save:!1,skipNoChangesCheck:!0},l=e.getChanges();for(t=0;t<l.length;t++)(i=l[t]).record.columnId&&""!==i.record.columnId&&(delete(n=i.record).enabledClass,delete n.enabledText,n.showGrandTotal="Y"===n.showGrandTotal,i.inserted?(delete n.id,n.columnType=v,o.addAggregate(n,a)):i.updated?o.updateAggregate(n.id,n,a):i.deleted&&o.deleteAggregate(n.id,a));o._setReportSettings({refreshModel:!0,changeIdentifier:"views.grid.aggregations"})}))}})},_renderControlBreakDialog:function(){var t,i=[],n=this;t=this._loadColumnOptions(i,"sort"),this._createDialog("controlBreak",(function(e){e(_,{id:"CBD_COLUMN",required:!0,options:i}),n._renderSortControls(e,"CBD_")}),{titleKey:"CONTROL_BREAK",checkboxColumn:!0,modelOptions:{shape:"table",sequenceField:"sequenceField",fields:{id:{canHide:!1,hidden:!0,seq:0},sequenceField:{canHide:!1,hidden:!0,seq:0},oldColumnId:{canHide:!1,hidden:!0,seq:0},isEnabled:Ce(),columnId:{label:"COLUMN",headingAlignment:"start",elementId:"CBD_COLUMN",isRequired:!0,seq:20,width:100,canHide:!0,hidden:!1},direction:{label:"DIRECTION",elementId:"CBD_DIRECTION",defaultValue:y,seq:30,canHide:!0,hidden:!0},nulls:{label:"NULLS",elementId:"CBD_NULLS",defaultValue:O,seq:40,canHide:!0,hidden:!0}}},load:function(i){var o,a,l,r,s=[],d=e(this).dialog(w,"id"),c=n._getCurrentView().columns;for(o=0;o<c.length;o++)(r=(a=c[o]).break)&&(l=e.extend({},{id:a.columnId,columnId:a.columnId,oldColumnId:a.columnId,direction:a.direction,nulls:a.nulls,sequenceField:parseFloat(r.order),isEnabled:r.isEnabled,enabledClass:r.isEnabled?"is-checked":""}),s.push(l));return s.length>0?(s.sort((function(e,t){return e.sequenceField<t.sequenceField?-1:e.sequenceField>t.sequenceField?1:0})),i.setData(s)):d=i.insertNewRecord({isEnabled:!0,id:t.columnId,columnId:t.columnId,oldColumnId:t.columnId,direction:t.sort?t.sort.direction:y,nulls:t.sort?t.sort.nulls:O}),d},init:function(e,t,i){var o=n._getElement("CBD_COLUMN"),a=n._getElement("CBD_DIRECTION"),l=n._getElement("CBD_NULLS");function r(){e.setValue(i.recordView("getRecord"),"columnId",o.val()),""===o.val()?xe([a,l]):Me([a,l])}o.change(r),a.change((function(){e.setValue(i.recordView("getRecord"),"direction",a.val())})),l.change((function(){e.setValue(i.recordView("getRecord"),"nulls",l.val())})),i.on("apexbeginrecordedit",r)},validate:function(e,t,i){var n={},o=!0;return e.forEach((function(e,t,a){n[e.columnId]?(o=!1,i(a,"columnId",te("DUPLICATE_CONTROLBREAK"))):n[e.columnId]=!0,""===e.columnId&&(o=!1)})),o},store:function(e){n._ifNoChangesDo((function(){var t,i,o,a={save:!1,skipNoChangesCheck:!0},l=e.getChanges();function r(){n.addControlBreak(n._currentViewImpl().modelColumns[n._getColumn(o.columnId).name],{isEnabled:o.isEnabled,order:parseFloat(o.sequenceField),direction:o.direction,nulls:o.nulls},a)}for(t=0;t<l.length;t++)i=l[t],o=i.record,i.inserted?r():i.updated?o.columnId!==o.oldColumnId?(n.deleteControlBreak(o.oldColumnId,a),r()):n.updateControlBreak(o.columnId,{isEnabled:o.isEnabled,order:parseFloat(o.sequenceField),direction:o.direction,nulls:o.nulls},a):i.deleted&&n.deleteControlBreak(o.columnId,a);n._setReportSettings({refreshModel:!0,refreshColumns:!0})}))}})},_addActions:function(n){var a=this,l=this.options.config;n.add([{name:"search-case-sensitive",labelKey:"APEX.IG.CASE_SENSITIVE",value:!1,get:function(){return a.searchCaseSensitive},set:function(e){a.searchCaseSensitive=e}},{name:"filter-column",labelKey:"APEX.IG.SELECT_COLUMNS_TO_SEARCH",get:function(){return a.currentFilterColumnId},set:function(e){a._setFilterColumn(e)}},{name:"search",labelKey:"APEX.IG.GO",getSearchValue:function(e){var t="";l.toolbar&&l.toolbar.searchField&&(t=a._tbFindElement("search_field").val()),e(t)},action:function(){this.getSearchValue((function(e){var t;e?(t=a.currentFilterColumnId?{type:v,columnType:v,columnId:a.currentFilterColumnId,operator:"C",value:e,isCaseSensitive:a.searchCaseSensitive}:{type:I,value:e,isCaseSensitive:a.searchCaseSensitive},a.addFilter(t)):a.refresh()}))}},{name:"change-report",labelKey:"APEX.IG.SAVED_REPORTS",hide:!0,choices:[],get:function(){return a._report()},set:function(e){a._ifNoChangesDo((function(t){t&&a.clearChanges(),a._report(e)}))}},{name:"change-view",labelKey:"APEX.IG.CHANGE_VIEW",choices:[],get:function(){return a._view()},set:function(e){a._view(e,{fetchData:!0})}},{name:"show-columns-dialog",labelKey:"APEX.IG.COLUMNS",icon:"icon-ig-select-cols",action:function(){return a._openDialog("columns"),!0}},{name:"show-filter-dialog",labelKey:"APEX.IG.FILTER",icon:"icon-ig-filter",hide:!0,action:function(){return a._openDialog(T),!0}},{name:"chart-view",labelKey:"APEX.IG.CHART",icon:"icon-ig-chart",hide:!a._isViewRegistered(A),action:function(){a._isViewRegistered(A)?(a.viewsImpl[A].isConfigured()&&a._view(A,{fetchData:!0}),a.viewsImpl[A].openDialog()):i.error("Chart view is not defined.")}},{name:"show-sort-dialog",labelKey:"APEX.IG.SORT",icon:"icon-ig-sort",action:function(){return a._openDialog("sort"),!0}},{name:"show-aggregate-dialog",labelKey:"APEX.IG.AGGREGATE",icon:"icon-ig-aggregate",action:function(){return a._openDialog(L),!0}},{name:"show-flashback-dialog",labelKey:"APEX.IG.FLASHBACK",icon:"icon-ig-flashback",hide:!0,action:function(){return a._openDialog(N),!0}},{name:"show-highlight-dialog",labelKey:"APEX.IG.HIGHLIGHT",icon:"icon-ig-highlight",hide:!0,action:function(){return a._openDialog(S),!0}},{name:"show-control-break-dialog",labelKey:"APEX.IG.CONTROL_BREAK",icon:"icon-ig-control-break",action:function(){return a._openDialog("controlBreak"),!0}},{name:"stretch-columns",labelKey:"APEX.IG.STRETCH_COLUMNS",hide:!0,get:function(){var e=a._view(),t=a._currentReportSettings().views[e];return t&&t.stretchColumns},set:function(e){var t=a._currentReportSettings(),i=a._view(),n=t.views[i];n&&(n.stretchColumns=e),a._setOperationUpdate(t),a._setReportSettings({changeIdentifier:"views.grid.columns"})}},{name:"change-rows-per-page",labelKey:"APEX.IG.ROWS_PER_PAGE",choices:[{labelKey:"APEX.IG.AUTO",value:"null"},{label:"5",value:5},{label:"10",value:10},{label:"15",value:15},{label:"20",value:20},{label:"25",value:25},{label:"50",value:50},{label:"100",value:100},{label:"1000",value:1e3}],get:function(){var e=a._currentReportSettings().rowsPerPage;return null===e?"null":e},set:function(e){var t=a._currentReportSettings();e="null"===e?null:parseInt(e,10),t.rowsPerPage=e,a._setOperationUpdate(t),a._setReportSettings({changeIdentifier:"rowsPerPage",refreshView:!0})}},{name:"save-report",labelKey:"APEX.IG.SAVE",icon:"icon-ig-save",action:function(){var e=a._currentReportSettings();a.updateReport(e.id,e)}},{name:"show-save-report-as-dialog",labelKey:"APEX.IG.SAVE_AS",icon:"icon-ig-save-as",action:function(){return a._openDialog("saveAsReport"),!0}},{name:"show-edit-report-dialog",labelKey:"APEX.IG.EDIT",icon:"icon-ig-edit",action:function(){return a._openDialog("editReport"),!0}},{name:"delete-report",labelKey:"APEX.IG.DELETE",icon:"icon-ig-delete",action:function(){s.confirm(te("DELETE_REPORT_CONFIRM"),(function(e){e&&a.deleteReport(a._report())}))}},{name:"show-download-dialog",labelKey:"APEX.IG.DOWNLOAD",icon:"icon-ig-download",hide:!0,action:function(){return a._openDialog("download"),!0}},{name:"show-help-dialog",labelKey:"APEX.IG.HELP",icon:"icon-ig-help",action:function(){var i=a.options.config;o.loadMessagesIfNeeded(["APEX.IG.HELP.ACTIONS.INTRO_HEADING","APEX.IG.HELP.ACTIONS.INTRO","APEX.IG.HELP.ACTIONS.REPORTING_HEADING","APEX.IG.HELP.ACTIONS.REPORTING","APEX.IG.HELP.ACTIONS.EDITING_HEADING","APEX.IG.HELP.ACTIONS.EDITING"],(function(){var n=t.htmlBuilder();function o(t,i){var n=e.extend({headingKey:"",helpText:"",helpTextKey:""},i);n.headingKey&&t.markup("<h2>").content(ee(n.headingKey)).markup("</h2>"),n.helpText&&t.markup("<div").attr(x,"apex-help-custom").markup(">").markup(n.helpText).markup("</div>"),n.helpTextKey&&t.markup("<p>").markup(ee(n.helpTextKey)).markup("</p>")}i.text.help&&o(n,{helpText:i.text.help}),o(n,{headingKey:"APEX.IG.HELP.ACTIONS.INTRO_HEADING",helpTextKey:"APEX.IG.HELP.ACTIONS.INTRO"}),o(n,{headingKey:"APEX.IG.HELP.ACTIONS.REPORTING_HEADING",helpTextKey:"APEX.IG.HELP.ACTIONS.REPORTING"}),i.editable&&o(n,{headingKey:"APEX.IG.HELP.ACTIONS.EDITING_HEADING",helpTextKey:"APEX.IG.HELP.ACTIONS.EDITING"}),r.popupFieldHelp({title:te("HELP.ACTIONS_TITLE"),helpText:n.toString()})}))}},{name:"selection-mode",onLabelKey:"APEX.IG.SEL_MODE_CELL",offLabelKey:"APEX.IG.SEL_MODE_ROW",shortcut:"F8",hide:!0,get:function(){var e=a._currentViewImpl();return!e.view$||!e.supports.cellSelection||!e.selectCells()},set:function(e){var t=a._currentViewImpl();t.view$&&t.supports.cellSelection&&t.selectCells(!e)}},{name:"selection-duplicate",type:H,labelKey:"APEX.IG.DUPLICATE_ROWS",icon:"icon-ig-duplicate",hide:!0,action:function(){var e,t=a._currentViewImpl();if(t.supports.edit&&(e=t.getSelectedRecords()).length>0)return t.model.copyRecords(e,null,e[e.length-1]),!0}},{name:"selection-delete",labelKey:"APEX.IG.DELETE_ROWS",icon:"icon-ig-delete",hide:!0,action:function(){var e,t,i=a._currentViewImpl();if(i.supports.edit){for(t=i.getSelectedRecords(),e=0;e<t.length;e++)i.model.allowDelete(t[e])||(t.splice(e,1),e-=1);t.length>0&&i.model.deleteRecords(t)}}},{name:"selection-refresh",labelKey:"APEX.IG.REFRESH_ROWS",icon:"icon-ig-refresh",action:function(){var e,t=a._currentViewImpl();t.supports.edit&&(e=t.getSelectedRecords()).length>0&&t.model.fetchRecords(e)}},{name:"selection-revert",labelKey:"APEX.IG.REVERT_CHANGES",icon:"icon-ig-revert",hide:!0,action:function(){var e,t,i=a._currentViewImpl();if(i.supports.edit){for(t=i.getSelectedRecords(),e=0;e<t.length;e++)i.model.canRevertRecord(t[e])||(t.splice(e,1),e-=1);t.length>0&&(i.model.revertRecords(t),a._updateSelectionActions())}}},{name:"selection-copy",labelKey:"APEX.IG.COPY_CB",icon:"icon-ig-copy",action:function(){var e=a._currentViewImpl();e.canCopy2Clipboard()&&(e.focus(),apex.clipboard.copy())}},{name:"refresh",labelKey:"APEX.IG.REFRESH",icon:"icon-ig-refresh",action:function(){a.refresh()}},{name:"reset-report",labelKey:"APEX.IG.RESET",disabled:!0,icon:"icon-ig-reset",action:function(){a._resetReportSettings()}},{name:"edit",labelKey:"APEX.IG.EDIT",hide:!0,get:function(){return a.editMode},set:function(e){a._setEditMode(e)}},{name:"save",labelKey:"APEX.IG.SAVE",hide:!0,shortcut:"Ctrl+Alt+S",action:function(){var e,t=a.options.config,i=a.editableViewImpl.model.name;c.anyErrors(!1,i,!0)?s.alert(ee("APEX.CORRECT_ERRORS"),(function(){})):a.editableViewImpl.finishEditing().done((function(){var n=null;void 0===t.saveLoadingIndicatorPosition&&void 0===t.saveLoadingIndicator||(n={loadingIndicatorPosition:t.saveLoadingIndicatorPosition||null,loadingIndicator:t.saveLoadingIndicator||null}),(e=c.save(null,n,i,!0))&&(e.done((function(e){var t,i,n="",o="";if(e.errors)s.clearErrors(),s.showErrors(e.errors),n="error";else if(e.regions){for(t=0;t<e.regions.length;t++)(i=e.regions[t]).fetchedData&&i.fetchedData.successMessage&&(o&&(o+="<br>"),o+=i.fetchedData.successMessage);o||(o=te("CHANGES_SAVED")),s.showPageSuccess(o),n="success"}a._selectionChange(null),a._trigger("save",null,{status:n})})).fail((function(){a._trigger("save",null,{status:"fail"})})).always((function(){a.actions.enable("save")})),a.actions.disable("save"))}))}},{name:"selection-add-row",label:l.text.addRowButton,hide:!0,action:function(){var e=a._currentViewImpl(),t=e.getSelectedRecords();if(!e.supports.singleRowView||!e.singleRowMode)return e.focus(),e.model.insertNewRecord(null,t[t.length-1]),!0;a.getActions().invoke("insert-record")}},{name:"single-row-view",label:te("SINGLE_ROW_VIEW"),icon:"icon-ig-single-row-view",hide:!0,action:function(e,t){var i,n=null,o=a.editMode,l=a._currentViewImpl();if(l.supports.singleRowView&&l.singleRowView$&&l.singleRowView$.length&&!l.singleRowMode)return t&&(n=l.getContextRecord(t)[0]),n||(n=l.getSelectedRecords()[0]),o&&l.view$.grid("setEditMode",!1),l.singleRowMode=!0,l.view$.hide(),l.curInst=l.singleRowView$.recordView("instance"),a._updateSummary(),(i=a._tbFind("selection_submenu"))&&(i.disabled=!0),l.singleRowView$.show().recordView("resize"),n&&l.setSelectedRecords([n]),o?l.singleRowView$.recordView("setEditMode",!0):l.singleRowView$.recordView("focus"),!0}},{name:"row-add-row",label:te("ADD_ROW"),icon:"icon-ig-add-row",hide:!0,action:function(e,t){var i=a._currentViewImpl(),n=i.getContextRecord(t);return i.focus(),i.model.insertNewRecord(null,n[0]),!0}},{name:"row-duplicate",label:te("DUPLICATE_ROW"),icon:"icon-ig-duplicate",hide:!0,action:function(e,t){var i=a._currentViewImpl(),n=i.getContextRecord(t);return i.model.copyRecords(n,null,n[0]),!0}},{name:"row-delete",label:te("DELETE_ROW"),icon:"icon-ig-delete",hide:!0,action:function(e,t){var i=a._currentViewImpl(),n=i.getContextRecord(t);i.model.deleteRecords(n)}},{name:"row-refresh",label:te("REFRESH_ROW"),icon:"icon-ig-refresh",action:function(e,t){var i=a._currentViewImpl(),n=i.getContextRecord(t);i.model.fetchRecords(n)}},{name:"row-revert",label:te("REVERT_CHANGES"),icon:"icon-ig-revert",hide:!0,action:function(e,t){var i=a._currentViewImpl(),n=i.getContextRecord(t);i.focus(),i.model.revertRecords(n)}}])},_initToolbar:function(){var e,t=this.options.config.toolbarData,i=this;delete t.toolbarFind,delete t.toolbarRemove,delete t.toolbarInsertAfter,this.toolbar$=this._getElement("toolbar").toolbar({actionsContext:this.actions,data:t}),e=this._tbFindElement("actions_button_menu"),this._tbFindElement("column_filter_button").hide(),this._tbFindElement("search_field").hide(),this._tbFindElement("actions_button").hide(),this._currentReportSettings().defaultFilterColumn?this._setFilterColumn(this._currentReportSettings().defaultFilterColumn.columnId):this._setFilterColumn(null),e.on("menubeforeopen",(function(){var t;(t=e.menu("find","rows"))&&(t.hide="set"!==i.options.config.pagination.type)}))},_getId:function(e){return e?this.idPrefix+"_"+e:""},_getIdSelector:function(e){return"#"+this._getId(e)},_getElement:function(t){return e(this._getIdSelector(t))},_setEditMode:function(e){var t,i,n={},o=this._currentViewImpl(),a=!1,l=this,r=this.options.config.columns;function s(){o.setEditMode(l.editMode),e&&setTimeout((function(){o.focus()}),100)}if(this.editMode=e,e){for(t=0;t<r.length;t++)r[t].validation&&r[t].validation.isRequired&&(n[r[t].id]=r[t]);if(Object.keys(n).length>0){for(i=this._getCurrentView().columns,t=0;t<i.length;t++)n[i[t].columnId]&&!i[t].isVisible&&(i[t].isVisible=!0,this._setOperationUpdate(i[t]),a=!0);a&&this._setReportSettings({changeIdentifier:"views.grid.columns"},s)}}a||s()},_configureView:function(e){this.viewsImpl[e].isConfigured()&&this._view(e,{fetchData:!0}),this.viewsImpl[e].openDialog()},_getColumn:function(e){return this.columnMap[e]},_getColumnByName:function(e){var t,n=this.options.config.columns;for(t=0;t<n.length;t++)if(n[t].name===e)return n[t];i.warn("No column exists with name: ",e)},_getColumnByStaticId:function(e){var t,n=this.options.config.columns;for(t=0;t<n.length;t++)if(n[t].staticId===e)return n[t];i.warn("No column exists with static ID: ",e)},_getTextTransformClass:function(e){var t,i=e.filter.textCase;return i&&(t={lower:"u-textLower",upper:"u-textUpper"}[i.toLowerCase()]),t},_convertNamesToLabels:function(e){var t,i=this.options.config.columns,n={};for(t=0;t<i.length;t++)n[i[t].name]=i[t].heading.label;return e&&""!==e?e.replace(/(")(.*?)(")/g,(function(e,t,i){return'"'+n[i]+'"'})):e},_convertLabelsToNames:function(e){var t,i=this.options.config.columns,n={};for(t=0;t<i.length;t++)n[i[t].heading.label]=i[t].name;return e&&""!==e?e.replace(/(")(.*?)(")/g,(function(e,t,i){return'"'+n[i]+'"'})):e},_getColumnFormatMask:function(e){var t,n,o=this._getColumn(e).appearance.dateFormatMask;if(o&&""!==o){t=apex.jQuery.datepicker.parseDate("yymmdd","20160302");try{n=apex.jQuery.datepicker.parseDate(o,apex.jQuery.datepicker.formatDate(o,t)),apex.jQuery.datepicker.formatDate("yymmdd",t)!==apex.jQuery.datepicker.formatDate("yymmdd",n)&&(i.warn("Date format mask is unusable for a date picker - using default: ",o),o="yy-mm-dd")}catch(e){i.warn("Date format mask is unusable for a date picker - using default: ",o),o="yy-mm-dd"}}else i.warn("No date format mask exists for column - using default: ",e),o="yy-mm-dd";return o},_getColumnLabel:function(e){var t,n=this._getColumn(e);return n.isHidden?i.info("_getColumnLabel called on hidden column, check calling logic",e):t=n.heading.label,t},_isColumnFilterable:function(e){var t=this._getColumn(e);return!t.specialType&&t.filter&&!t.isHidden},_hasColumnFilterLov:function(e){var t=this._getColumn(e);return t.filter&&t.filter.hasLov},_getColumnType:function(){return v},_getCurrentView:function(){var e=this._view(),t=this.options,i=t.config.views,n=i[e].useModelFrom;return n&&i[n].shareModel&&(e=n),t.savedReports[this.currentSavedReportIdx].views[e]},_currentViewImpl:function(){return this.viewsImpl[this._view()]},_view:function(t,i){var n,o,a,l,r,s,d,c,u=this,h=this.options.config,g=this.actions,p=!1,m=!1,f=this._currentReportSettings(),_=!1,C=[],I=e.extend({initialData:null,fetchData:!1},i);if(!t)return f.currentView;if(r=this._currentViewImpl(),this.viewsImpl[t].isConfigured()){for(a in f.currentView=t,l=this._currentViewImpl(),s=h.views[t].features,d=l.supports,r&&r.view$&&r.hide(),l.view$?(l.show(),this._updateModelRegionData(l),l.pendingRefresh&&(l.pendingRefresh=!1,l.refresh()),this._setReportSettings({changeIdentifier:"view.change"})):(this._getElement(l.elementId).show(),l.view$=this._getElement(l.elementId),l.setColumnConfig({baseModelColumns:this.baseModelColumns,igConfig:h,ig:this,currentReportSettings:f}),I.viewImpl=l,this._setModel(I),I.viewImpl.supports.edit&&(this.editableViewImpl=I.viewImpl),l.initView({ig$:this.element,ig:this,igConfig:h,currentReportSettings:f}),this._setInitialSelection(0),_=!0),o=this._refreshReportSettings(),this._updateSummary(),C.push({labelKey:"APEX.IG.ALL_TEXT_COLUMNS",value:null}),l.modelColumns)if(J(l.modelColumns,a)&&l.modelColumns[a].id&&this._isColumnFilterable(l.modelColumns[a].id)&&(p=!0,-1!==e.inArray(this._getColumn(l.modelColumns[a].id).filter.dataType,["VARCHAR2","CLOB"])))for(n=0;n<this._getColumn(l.modelColumns[a].id).filter.operators.length;n++)-1!==e.inArray(this._getColumn(l.modelColumns[a].id).filter.operators[n].name,["$perform$","C"])&&(m=!0,C.push({label:l.modelColumns[a].label,value:l.modelColumns[a].id}));h.filter.oracleText&&(m=!0),g.lookup("filter-column").choices=C,g.updateChoices("filter-column"),this._updateChangeViewActions(),this._toggleEnableAction(m,"search"),h.toolbar&&h.toolbar.searchField&&h.toolbar.columnSelection&&this._tbFindElement("column_filter_button").prop(b,!m),_||o||l.resize(),this._toggleEnableAction(h.editable&&d.edit,["edit","save","selection-add-row","selection-add-row","row-add-row","selection-duplicate","row-duplicate","selection-delete","row-delete","selection-revert","row-revert"]),this._toggleEnableAction(h.editable&&d.edit&&d.singleRowView,["insert-record","delete-record","revert-record","duplicate-record"]),this._toggleEnableAction(d.controlBreak&&s.controlBreak,"show-control-break-dialog"),this._toggleEnableAction(d.aggregation&&s.aggregate,"show-aggregate-dialog"),this._toggleEnableAction(d.highlight&&s.highlight,"show-highlight-dialog"),this._toggleEnableAction(d.changeRowsPerPage&&s.changeRowsPerPage,"change-rows-per-page"),this._toggleEnableAction(d.singleRowView&&s.singleRowView,["single-row-view","refresh-record"]),this._toggleShowAction(l.canCopy2Clipboard(),"selection-copy"),this._toggleShowAction(d.cellSelection,"selection-mode"),(c=this._tbFind("selection_submenu"))&&(c.disabled=!d.selection),this._toggleEnableAction(d.configurableColumns,["show-columns-dialog","stretch-columns"]),this._toggleEnableAction(d.filter&&h.features.filter,"show-filter-dialog"),p||this._toggleEnableAction(!1,"show-filter-dialog"),this._toggleEnableAction(d.sort,"show-sort-dialog"),this._toggleEnableAction(d.download&&h.features.download,"show-download-dialog"),this._trigger("viewChange",null,{view:t,created:_}),this._selectionChange(null),this._forEachView((function(e,i){i.viewChanged(e===t,u,h)}))}else this.viewsImpl[t].openDialog()},_destroyAllModels:function(){var e=this;this._forEachView((function(t,i){e._setModel({viewImpl:i,remove:!0}),i.view$&&(i.hide(),i.destroyView(e),i.view$=null)}))},_report:function(e){var t,i,n=this.options;if(!e)return this._currentReportSettings().id;for(this._destroyAllModels(),s.hidePageSuccess(),t=0;t<n.savedReports.length;t++)if(n.savedReports[t].id===e){this.currentSavedReportIdx=t;break}i=this._currentViewImpl(),this._forEachView((function(e,t){t.view$&&t.hide()})),i.view$||(i.view$=this._getElement(i.elementId)),this._updateSummary(),i.view$.show(),i.setColumnConfig({baseModelColumns:this.baseModelColumns,igConfig:n.config,currentReportSettings:this._currentReportSettings(),ig:this}),this.reportSettingsSeq+=1,this._setModel({viewImpl:i}),i.initView({ig$:this.element,ig:this,igConfig:n.config,currentReportSettings:this._currentReportSettings()}),this._updateActions(),this.editMode=!1,this.actions.update("edit"),this._updateChangeViewActions(),this._clearToolbarSearch(),this._trigger("viewChange",null,{view:i.internalIdentifier,created:!0}),this._refreshReportSettings(),this._updateModelRegionData(i),this.refresh(),this._trigger("reportChange",null,{report:this._report()})},_currentReportSettings:function(){return this.options.savedReports[this.currentSavedReportIdx]},_updateModelRegionData:function(e){var t=e.internalIdentifier,i=this.options.config.views,n=i[t].useModelFrom,o=e.model.getOption("regionData");o.reportId=this._report(),n&&i[n].shareModel&&(t=n),o.view=t},_updateSummary:function(){var e=this.getCurrentView(),t=e.title,i=this._currentReportSettings(),n=i.name;n||i.type!==R||(n=te("PRIMARY_REPORT")),e.supports.singleRowView&&e.singleRowMode&&(t+=" ("+ee("SINGLE_ROW_VIEW")+")"),this._getElement("summary").text(o.formatMessage("APEX.IG.SUMMARY",n,t))},_shortenString:function(e,t){var i=t||20;return e.length>i?e.substr(0,i)+"...":e},_adjustControlBreakSort:function(){var t,i,n=[],o=this._getCurrentView().columns;for(t=0;t<o.length;t++)!o[t].sort||null===o[t].sort.order||o[t].break&&o[t].break.isEnabled||n.push({columnId:o[t].columnId,order:o[t].sort.order});for(n.sort((function(e,t){return e.order-t.order})),t=0;t<n.length;t++)for(i=0;i<o.length;i++)n[t].columnId===o[i].columnId&&e.extend(this._currentViewImpl().modelColumns[this._getColumn(o[i].columnId).name],{sortIndex:t+1})},_getSettingLabel:function(t,i){var n,a,l="APEX.IG.",r=["EQ","NEQ","GT","GTE","LT","LTE","LIKE","NLIKE","C","NC","REGEXP","S","NS","OTEXT"],s=["N","NN"],d=[P,"NBETWEEN"],c=["LAST","NLAST","NEXT","NNEXT"];function u(e,t){return e&&null!==e.match(/^\d{14}/)?apex.jQuery.timepicker.formatCanonicalDate(Ee(e),t):""}switch(t){case T:switch(i.type){case v:l+="X.",e.inArray(i.operator,r)>-1&&(l+=Q[i.operator]+".Y",n=e.inArray(this._getColumn(i.columnId).filter.dataType,[X,q,$,W])>-1?o.formatMessage(l,this._getColumnLabel(i.columnId),u(i.hiddenValue?i.hiddenValue:i.value,this._getColumnFormatMask(i.columnId))):o.formatMessage(l,this._getColumnLabel(i.columnId),i.value)),e.inArray(i.operator,[U,F])>-1&&(l+=Q[i.operator]+".Y",n=o.formatMessage(l,this._getColumnLabel(i.columnId),i.value.split("").join("; "))),e.inArray(i.operator,s)>-1&&(l+=Q[i.operator],n=o.formatMessage(l,this._getColumnLabel(i.columnId))),e.inArray(i.operator,d)>-1&&(l+=Q[i.operator]+".Y.AND.Z",a=i.hiddenBetween||i.hiddenAnd?[i.hiddenBetween,i.hiddenAnd]:i.value.split("~"),n=e.inArray(this._getColumn(i.columnId).filter.dataType,[X,q,$,W])>-1?o.formatMessage(l,this._getColumnLabel(i.columnId),u(a[0],this._getColumnFormatMask(i.columnId)),u(a[1],this._getColumnFormatMask(i.columnId))):o.formatMessage(l,this._getColumnLabel(i.columnId),a[0],a[1])),e.inArray(i.operator,c)>-1&&(2!==(a=i.value.split("~")).length&&(a=["","MI"]),"1"===a[0]?(l+=Q[i.operator]+"_"+oe[a[1]],n=o.formatMessage(l,this._getColumnLabel(i.columnId))):(l+=Q[i.operator]+".Y."+oe[a[1]]+"S",n=o.formatMessage(l,this._getColumnLabel(i.columnId),a[0])));break;case"complex":n=i.name;break;case I:l+="SEARCH_FOR.X",n=o.formatMessage(l,i.value)}break;case"controlBreak":n=this._getColumnLabel(i.columnId);break;case L:n=te(i.function)+" ("+this._getColumnLabel(i.columnId)+")";break;case S:n=this._shortenString(i.name?i.name:this._getColumnLabel(i.condition.columnId));break;case N:1===i.minsAgo?n=ee(l+="REPORT_DATA_AS_OF_ONE_MINUTE_AGO"):(l+="REPORT_DATA_AS_OF.X.MINUTES_AGO",n=o.formatMessage(l,i.minsAgo))}return n},_getSettingSummaryLabel:function(e,t){var i,n="APEX.IG.";switch(e){case T:switch(t.type){case v:i=this._getColumnLabel(t.columnId);break;case"complex":i=this._shortenString(t.name);break;case I:i="'"+this._shortenString(t.value,18)+"'"}break;case"controlBreak":i=this._getColumnLabel(t.columnId);break;case S:i=this._shortenString(t.name?t.name:this._getColumnLabel(t.condition.columnId));break;case N:1===t.minsAgo?i=ee(n+="ONE_MINUTE_AGO"):(n+="X.MINUTES_AGO",i=o.formatMessage(n,t.minsAgo));break;case L:i=this._shortenString(this._getColumnLabel(t.columnId))}return i},_getTotalReportSettings:function(){var e,t=0,i=this._getCurrentView(),n=this._currentReportSettings();switch(n.filters&&(t+=n.filters.length),n.flashback&&(t+=1),this._view()){case"grid":for(e=0;e<i.columns.length;e++)i.columns[e].break&&(t+=1);i.highlights&&(t+=i.highlights.length),i.aggregations&&(t+=i.aggregations.length);break;case A:i&&(t+=1)}return t},_renderReportSettings:function(t){var i,n=[],a=this,l=this._getCurrentView(),r=this._currentReportSettings(),s=this._getTotalReportSettings()>0;t.markup("<div").attr(x,"a-MediaBlock a-IG-controlsContainer").attr("id",this._getId("report_settings")),s||t.attr("style","display:none;"),t.markup(">"),t.markup("<div").attr(x,"a-MediaBlock-graphic").markup(">"),t.markup("<h3").attr(x,"u-VisuallyHidden").markup(">").content(te("REPORT_SETTINGS")).markup("</h3>"),ye(t,{buttonClass:"a-Button a-IG-button a-IG-button--controls"}),t.markup("</div>"),function(t){function s(t,i){var n={},l=e.extend({type:"",id:"",active:!1,label:"",excludeToggle:!1,isInvalid:!1,linkStyle:""},i),r="a-IG-controls-item a-IG-controls-item--"+l.type;n.setting=l.type,n["setting-id"]=l.id,l.isInvalid&&(r+=" is-error"),t.markup("<li").attr(x,r).attr("role","group").attr("aria-labelledby","control_text"+l.id).markup(">"),t.markup("<span").attr(x,"a-IG-controls-cell").markup(">"),l.excludeToggle||(Oe(t,{id:a._getId("control_"+l.id),cssClasses:"a-IG-controlsCheckbox",checked:l.active,data:n,disabled:l.isInvalid}),Ve(t,{labelFor:a._getId("control_"+l.id),cssClasses:"a-IG-controlsCheckboxLabel",label:te("TOGGLE"),labelTextHidden:!0})),t.markup("</span>"),t.markup("<span").attr(x,"a-IG-controls-cell").markup(">").markup("<span").attr(x,"a-Icon a-IG-controlsIcon icon-ig-"+Ae(l.type)).markup(">").markup("</span>").markup("</span>"),t.markup("<span").attr(x,"a-IG-controls-cell a-IG-controls-cell--label").markup(">"),l.isInvalid?t.markup("<span").attr("id","control_text"+l.id).attr(x,"a-IG-controlsLabel").markup(">").markup(l.label).markup("</span>"):(t.markup("<a href='#'").attr(x,"a-IG-controlsLabel").attr("data-setting",l.type).attr("data-setting-id",l.id).optionalAttr("style",l.linkStyle).markup(">"),t.markup("<span").attr(x,"u-VisuallyHidden").markup(">").content(te("EDIT")).markup("</span>"),t.markup("<span").attr("id","control_text"+l.id).markup(">").markup(l.label).markup("</span>"),t.markup("</a>")),t.markup("</span>"),t.markup("<span").attr(x,"a-IG-controls-cell a-IG-controls-cell--remove").markup(">"),ye(t,{buttonClass:"a-Button a-Button--noUI a-IG-button a-IG-button--remove",iconOnly:!0,icon:"icon-remove",label:o.formatMessage("APEX.IG.REMOVE_CONTROL",ne[l.type]),data:n}),t.markup("</span>"),t.markup("</li>")}if(t.markup("<div").attr(x,"a-MediaBlock-content").markup(">"),t.markup("<ul").attr(x,"a-IG-controls").markup(">"),r.views.chart&&a._view()===A&&s(t,{type:A,excludeToggle:!0,label:te("EDIT_CHART")}),r.filters)for(i=0;i<r.filters.length;i++)"d"!==r.filters[i].operation&&s(t,{type:T,id:r.filters[i].id,active:r.filters[i].isEnabled,label:a._getSettingLabel(T,r.filters[i]),isInvalid:r.filters[i].isInvalid});if(a._currentViewImpl().supports.controlBreak&&l){for(i=0;i<l.columns.length;i++)l.columns[i].break&&"d"!==l.columns[i].break.operation&&n.push(l.columns[i]);if(n.length>0)for(n.sort((function(e,t){var i=e.break.order,n=t.break.order;return i<n?-1:i>n?1:0})),i=0;i<n.length;i++)s(t,{type:"controlBreak",id:n[i].columnId,active:n[i].break.isEnabled,label:a._getSettingLabel("controlBreak",n[i])})}if(a._currentViewImpl().supports.highlight&&l.highlights)for(i=0;i<l.highlights.length;i++)"d"!==l.highlights[i].operation&&s(t,{type:S,id:l.highlights[i].id,active:l.highlights[i].isEnabled,label:a._getSettingLabel(S,l.highlights[i]),isInvalid:l.highlights[i].isInvalid,linkStyle:"background:"+l.highlights[i].backgroundColor+";color:"+l.highlights[i].textColor});if(a._currentViewImpl().supports.aggregation&&l.aggregations)for(i=0;i<l.aggregations.length;i++)"d"!==l.aggregations[i].operation&&s(t,{type:L,id:l.aggregations[i].id,active:l.aggregations[i].isEnabled,label:a._getSettingLabel(L,l.aggregations[i])});r.flashback&&"d"!==r.flashback.operation&&s(t,{type:N,active:r.flashback.isEnabled,label:a._getSettingLabel(N,r.flashback)}),t.markup("</ul></div>")}(t),function(t){var i=0,o=0;function d(e,t,n){var l,r,s,d="",u=[],h=!0;for(l=0;l<n.length;l++)"d"!==n[l].operation&&("controlBreak"===t?r=n[l].break.isEnabled:(r=n[l].isEnabled,s=n[l].isInvalid),s?o+=1:r?(u.push(l),h||(d+=", "),d+=a._getSettingSummaryLabel(t,n[l]),h=!1):i+=1);u.length>0&&c(e,{type:t,id:n[u[0]],count:u.length,label:d})}function c(t,i){var n=e.extend({type:"",id:"",count:0,label:""},i);t.markup("<li").attr(x,"a-IG-reportSummary-item a-IG-reportSummary-item--"+n.type).markup(">"),t.markup("<a href='#'").attr(x,"a-IG-reportSummary-label").attr("data-setting",n.type).optionalAttr("data-setting-id",n.id).markup(">"),t.markup("<span").attr(x,"a-IG-reportSummary-icon").markup(">"),t.markup("<span").attr(x,"a-Icon icon-ig-"+Ae(n.type)).markup("></span>"),(n.count>1||"inactiveSettings"===n.type||"invalidSettings"===n.type)&&t.markup("<span").attr(x,"a-IG-reportSummary-count").markup(">").content(n.count).markup("</span>"),t.markup("</span>"),t.markup("<span").attr(x,"a-IG-reportSummary-value").markup(">").content(n.label).markup("</span>"),t.markup("</a>")}t.markup("<div").attr(x,"a-IG-reportSummaryContainer"),"expanded"===r.reportSettingsArea&&t.attr("style","display:none;"),t.attr("id",a._getId("report_settings_summary")),s||t.attr("style","display:none;"),t.markup(">"),t.markup("<ul").attr(x,"a-IG-reportSummary").markup(">"),r.views.chart&&a._view()===A&&c(t,{type:A,label:te("EDIT_CHART")}),r.filters&&d(t,T,r.filters),n.length>0&&d(t,"controlBreak",n),l.highlights&&d(t,S,l.highlights),l.aggregations&&d(t,L,l.aggregations),r.flashback&&(r.flashback.isEnabled?c(t,{type:N,label:a._getSettingSummaryLabel(N,r.flashback)}):i+=1),i>0&&c(t,{type:"inactiveSettings",count:i,label:te(1===i?"INACTIVE_SETTING":"INACTIVE_SETTINGS")}),o>0&&c(t,{type:"invalidSettings",count:o,label:te(1===i?"INVALID_SETTING":"INVALID_SETTINGS")}),t.markup("</ul></div>")}(t),t.markup("</div>")},_initReportSettings:function(){var t=this,i=this.options.config.maxHeight,n=this._getElement("report_settings"),o=t._currentReportSettings();function a(e,i,a){if(o.reportSettingsArea===e){var l=n.data("apex-collapsible").controllingElement$.is(":focus");o.reportSettingsArea=i,t._setOperationUpdate(o),t._setReportSettings({},(function(){l&&t._getElement("report_settings").data("apex-collapsible").controllingElement$.focus()})),t._getElement("report_settings_summary")[a](),t.resize()}}this._getTotalReportSettings()>0&&(this._on(n,{"click a.a-IG-controlsLabel":function(t){var i=e(t.currentTarget);this._openDialog(i.data("setting"),{id:i.data("setting-id")+""}),t.preventDefault()},"click a.a-IG-reportSummary-label":function(t){var i=e(t.currentTarget),o=i.data("setting");"inactiveSettings"===o||"invalidSettings"===o?n.collapsible("expand"):this._openDialog(o,{id:i.data("setting-id")+""}),t.preventDefault()},"click input.a-IG-controlsCheckbox":function(t){var i=e(t.target),n=i.prop("checked"),o=i.data("setting"),a=i.data("setting-id")+"";switch(o){case T:this.updateFilter(a,{isEnabled:n});break;case L:this.updateAggregate(a,{isEnabled:n});break;case S:this.updateHighlight(a,{isEnabled:n});break;case"controlBreak":this.updateControlBreak(a,{isEnabled:n});break;case N:this.updateFlashback({isEnabled:n})}},"click button.a-IG-button--remove":function(t){var i=e(t.currentTarget),n=i.data("setting"),o=i.data("setting-id")+"";switch(t.preventDefault(),n){case T:this.deleteFilter(o);break;case L:this.deleteAggregate(o);break;case S:this.deleteHighlight(o);break;case"controlBreak":this.deleteControlBreak(o);break;case N:this.deleteFlashback();break;case A:this.deleteChart()}}}),n.collapsible({content:"div.a-MediaBlock-content",collapsed:"collapsed"===o.reportSettingsArea,collapse:function(){a("expanded","collapsed","show")},expand:function(){a("collapsed","expanded","hide")}}),i&&n.find(".a-Collapsible-content").css({"max-height":(i-(e(".a-IG-header",this.element).outerHeight()||0))/3+"px",overflow:"auto"}))},_isSettingsCheckboxFocused:function(t,i){var n;return!(!document.activeElement||"checkbox"!==document.activeElement.type)&&((n=e(document.activeElement).data()).setting===i&&""+n.settingId===t)},_focusOnSettingsCheckbox:function(e,t,i){var n;e&&(n=".a-IG-controlsCheckbox[data-setting="+i+"]",t&&(n+="[data-setting-id="+t+"]"),this._getElement("report_settings").find(n).focus())},_currentViewColumn:function(t,i){var n,o,a=this._getCurrentView().columns;for(n=0;n<a.length;n++)if(a[n].columnId===t){o=a[n];break}return e.isPlainObject(i)&&(o=e.extend(!0,o,i),this._setOperationUpdate(o)),o},_refreshReportSettings:function(){var e,i=this._getElement("report_settings"),n=t.htmlBuilder();return!(!i[0]||(e=i[0].clientHeight,this._renderReportSettings(n),i.replaceWith(n.toString()),this._initReportSettings(),e===this._getElement("report_settings")[0].clientHeight))&&(this.resize(),!0)},_defaultAjaxRegionData:function(t){var i=this.options.config,n=e.extend(!0,{id:i.regionId,ajaxIdentifier:i.ajaxIdentifier,ajaxColumns:i.ajaxColumns,reportId:this._report(),view:this._view()},t);return this._isCurrentlyEditable()&&(n.allowedOperations=i.editable.allowedOperations.protected),n},_call:function(e,t){var i=this.options.config,o={regions:[this._defaultAjaxRegionData(e)]};return i.parentRegionStaticId&&this.parentItemValues.length>0&&(o.regions[0].parentItems={values:this.parentItemValues}),i.loadingIndicator&&(t.loadingIndicator=i.loadingIndicator),(i.callServer||n.plugin)(o,t)},_setReportSettings:function(t,i){function n(e){var t;for(t=0;t<e.length;t++)e[t].operation||(e.splice(t,1),t-=1)}var o,a,l={},r=this.options.config,d=this,c=e.extend({refreshView:!1,refreshModel:!1,affectsOtherViewsModels:!1,refreshColumns:!1,changeIdentifier:""},t);return(o=e.extend(!0,{},this._currentReportSettings())).filters&&o.filters.length>0&&n(o.filters),r.views.grid&&n(o.views.grid.columns),r.views.icon&&n(o.views.icon.columns),r.views.detail&&n(o.views.detail.columns),r.features.saveReport&&r.features.saveReport.publicReportCs&&(l.publicReportCs=r.features.saveReport.publicReportCs),a={success:function(e){var t,n=d._defaultSavedReport(e.regions[0].setReportSettings[0]);s.hidePageSuccess(),d._view()!==n.currentView&&d._view(n.currentView,{fetchData:!0}),d.options.savedReports[d.currentSavedReportIdx]=n,d._updateChangeReportAction(),d._updateChangeViewActions(),d._updateReportSettingsActions(),d._refreshReportSettings(),t=d._currentViewImpl(),d._updateModelRegionData(t),n=d._currentReportSettings(),d._forEachView((function(e,t){t.setReportOptions(d,e===n.currentView,n,c.changeIdentifier),t.supports.highlight&&"views.grid.highlights"!==c.changeIdentifier&&t.setReportOptions(d,e===n.currentView,n,"views.grid.highlights")})),c.refreshColumns&&t.refreshColumns(),c.refreshView?t.refresh():c.refreshModel&&(d.reportSettingsSeq+=1,c.affectsOtherViewsModels?d._forEachView((function(e,t){t.model&&t.clearModelData()})):t.clearModelData()),i&&i(),d._trigger("reportSettingsChange",null,{report:n.id})}},"view.change"===c.changeIdentifier&&(a.queue={name:"set.report.settings.replace",action:"replace"}),e.extend(l,{setReportSettings:[o]}),this._call(l,a)},_downloadReport:function(t){var o,a,r=this.options.config,d=this;o={pageItems:r.itemsToSubmit,regions:[{id:r.regionId,ajaxIdentifier:r.ajaxIdentifier,ajaxColumns:r.ajaxColumns,reportId:this._report(),view:this._view(),download:e.extend({downloadCs:r.features.download.downloadCs},t)}],salt:$v("pSalt")},(a=l(r.regionStaticId).getParentItems())&&(o.regions[0].parentItems=a),t.email?n.plugin(o,{dataType:f,loadingIndicator:d.element,loadingIndicatorPosition:"centered",success:function(){s.showPageSuccess(te("EMAIL_SENT"))}}):n.plugin(o,{loadingIndicator:d.element,loadingIndicatorPosition:"centered",success:function(e){var t;s.showPageSuccess(te("FILE_PREPARED")),t=n.ajaxUrl({regions:[{id:r.regionId,reportId:d._report(),ajaxIdentifier:r.ajaxIdentifier,downloadFileId:e.regions[0].download.id}],salt:$v("pSalt")}),i.info("Calling URL to get file:",t),i.info("URL length:",t.length),g.download(t)}})},_saveReport:function(e,t){var n,o={},a=this,l=this.options.config;if(l.features.saveReport)return o.saveReport=e,l.features.saveReport.publicReportCs&&(o.publicReportCs=l.features.saveReport.publicReportCs),this._call(o,{success:function(e){switch(a.options.savedReports=a._defaultSavedReports({reports:e.regions[0].savedReports}),a._updateChangeReportAction(),a._updateReportSettingsActions(),a._refreshReportSettings(),a._updateModelRegionData(a._currentViewImpl()),t){case"i":case"u":switch(a._currentReportSettings().type){case R:n=te("REPORT.SAVED.DEFAULT");break;case"alternative":n=te("REPORT.SAVED.ALTERNATIVE");break;case"private":n=te("REPORT.SAVED.PRIVATE");break;case"public":n=te("REPORT.SAVED.PUBLIC")}break;case"d":n=te("REPORT.DELETED")}s.showPageSuccess(n),"d"===t&&a.refresh()}});i.warn("Unable to save report settings because the configuration disallows it.")},_getFilterValues:function(t,i,n){var o=this;return this._call({getFilterValues:{columnId:t,columnType:v,respectFilters:i}},{success:function(t){e.isFunction(n)&&n.call(o,t)}})},_updateChangeReportAction:function(){var e,t,i,n,o=[],a=this.options.config,l=this.options.savedReports,r=this.actions;if(l.length>1){for(e=0;e<l.length;e++){switch(n=(t=l[e]).name,t.type){case R:i="APEX.IG.SAVED_REPORT_DEFAULT",t.name||(n=te("PRIMARY_REPORT"));break;case"alternative":i="APEX.IG.SAVED_REPORT_DEFAULT";break;case"private":i="APEX.IG.SAVED_REPORT_PRIVATE";break;case"public":i="APEX.IG.SAVED_REPORT_PUBLIC"}o.push({group:ee(i),label:n,value:t.id})}this.actions.lookup("change-report").hide=!(!a.toolbar||a.toolbar&&a.toolbar.savedReports)}else this.actions.lookup("change-report").hide=!0;this.actions.update("change-report"),r.lookup("change-report").choices=o,r.updateChoices("change-report")},_updateAction:function(e,t){this.actions.lookup(t)&&this.actions[e](t)},_toggleEnableAction:function(e,t){this._toggleAction("enable",e,t)},_toggleShowAction:function(e,t){this._toggleAction("show",e,t)},_toggleAction:function(t,i,n){var o,a=this;switch(t){case"show":o=i?"show":"hide";break;case"enable":o=i?"enable":"disable"}e.isArray(n)?e.each(n,(function(){a._updateAction(o,this)})):this._updateAction(o,n)},_updateToolbarElements:function(){var e=this.options.config.toolbar;e&&(e.searchField&&(e.columnSelection&&this._tbFindElement("column_filter_button").show(),this._tbFindElement("search_field").show()),e.actionMenu&&this._tbFindElement("actions_button").show())},_updateActions:function(){var e=this,t=this.options.config,i=t.features,n=!1,o=!1,a=!1,l=this._isCurrentlyEditable(),r=t.editable.allowedOperations,s=l&&r.create,d=l&&r[E],c=l&&(r.update||r[E]),u=t.toolbar,h=l&&(r.update||r.create)&&(!u||u&&u.editing),g=l&&(r.create||r.update||r[E])&&(!u||u&&u.save),p=!u||u&&u.searchField,m=!u||u&&u.reset,f="set"===t.pagination.type;i.saveReport&&this._updateChangeReportAction(),this._toggleShowAction(i.filter,"show-filter-dialog"),this._toggleShowAction(i.download,"show-download-dialog"),this._toggleShowAction(i.flashback,"show-flashback-dialog"),this._updateReportSettingsActions(),this._toggleShowAction(s,["selection-add-row","row-add-row","selection-duplicate","row-duplicate"]),this._toggleShowAction(d,["selection-delete","row-delete"]),this._toggleShowAction(c,["selection-revert","row-revert"]),this._toggleShowAction(h,"edit"),this._toggleShowAction(g,"save"),this._toggleShowAction(p,"search"),this._toggleShowAction(m,"reset-report"),this._forEachView((function(i,r){var c=t.views[i].features;r.supports.singleRowView&&c.singleRowView&&(n=!0),r.supports.highlight&&c.highlight&&(o=!0),r.supports.configurableColumns&&null===c.stretchColumns&&!1!==c.gridView&&(a=!0),r.updateActions({ig:e,editable:l,canDelete:d,canCreate:s,canEdit:h})})),this._toggleShowAction(n,["single-row-view","refresh-record"]),this._toggleShowAction(s&&n,["insert-record","duplicate-record"]),this._toggleShowAction(d&&n,["delete-record"]),this._toggleShowAction(c&&n,["revert-record"]),this._toggleShowAction(o,"show-highlight-dialog"),this._toggleShowAction(f,"change-rows-per-page"),this._toggleShowAction(a,"stretch-columns")},_updateReportSettingsActions:function(){var e=this._currentReportSettings(),t=this.options.config.features.saveReport,i=!e.isReadOnly;this._toggleEnableAction(t&&i&&e.baseReportId,"save-report"),this._toggleEnableAction(t,"show-save-report-as-dialog"),this._toggleEnableAction(t&&i,"show-edit-report-dialog"),this._toggleEnableAction(t&&i&&e.type!==R,"delete-report"),this._toggleEnableAction(e.baseReportId,"reset-report")},_updateChangeViewActions:function(){var e=[],t=this.actions;this._forEachView((function(t,i){i.isConfigured()&&e.push({label:i.title,value:t,icon:i.icon})})),this._toggleShowAction(e.length>1,"change-view"),t.lookup("change-view").choices=e,t.updateChoices("change-view")},_updateSelectionActions:function(){var e,t,i,n,o=this.options.config,a=this._currentViewImpl(),l=o.editable&&a.supports.edit;a.singleRowMode||(a.selectCells&&a.selectCells()?(n=a.view$.grid("getSelectedRange").recordIds.length,this._toggleEnableAction(!1,["selection-refresh"]),this._toggleEnableAction(0!==n,["selection-copy"]),l&&(this._toggleEnableAction(this._isCurrentlyEditable()&&0!==n,["selection-fill","selection-clear","selection-revert"]),this._toggleEnableAction(!1,["selection-duplicate","selection-delete","selection-revert","row-delete"]),this._toggleEnableAction(n>=2,["selection-copy-down"]))):(n=(e=a.getSelectedRecords())?e.length:0,this._toggleEnableAction(0!==n,["selection-refresh","selection-copy"]),l&&(this._toggleEnableAction(this._isCurrentlyEditable()&&0!==n,["selection-duplicate","selection-delete","selection-revert","selection-fill","selection-clear"]),o.editable.allowedOperations[E]&&(t=e.some((function(e){return a.model.allowDelete(e)})),this._toggleEnableAction(t,["row-delete","selection-delete","selection-fill","selection-clear"])),i=e.some((function(e){return a.model.canRevertRecord(e)})),this._toggleEnableAction(i,["row-revert","selection-revert"]),this._toggleEnableAction(n>=2,["selection-copy-down"]))))},_setFilterColumn:function(e){var t;this.currentFilterColumnId=e,t=e?o.formatMessage("APEX.IG.SEARCH.COLUMN",this._getColumn(e).heading.label):this.options.config.filter.oracleText?te("SEARCH.ORACLE_TEXT"):te("SEARCH.ALL_COLUMNS"),this._tbFindElement("search_field").attr({placeholder:t,title:t})},_defaultIGConfig:function(){var t,i,n=this.options.config;if(n.filter.maxRowCount&&(n.text.moreDataFound=o.formatMessage("APEX.IG.MORE_DATA_FOUND",n.filter.maxRowCount)),n.columnGroups.length>0)for(t=0;t<n.columnGroups.length;t++)(i=n.columnGroups[t]).label||(i.label=i.heading);n.editable&&(n.editable=e.extend(!0,{allowedOperations:{create:!0,update:!0,delete:!0,protected:""},autoAddRow:!0},n.editable),n.editable.allowedOperations.create||(n.editable.autoAddRow=!1)),n.features.download&&(n.features.download=e.extend({formats:[],email:!0},n.features.download)),n.views.icon&&(n.views.icon=e.extend(!0,{disabled:!1,labelColumn:"",features:{sort:!0,highlight:!0,rowSelector:{multiSelect:!0,selectAll:!1,hideControl:!1}}},n.views.icon)),n.views.detail&&(n.views.detail=e.extend(!0,{disabled:!1,beforeRows:"",row:"",afterRows:"",features:{sort:!0,controlBreak:!0}},n.views.detail))},_defaultColumns:function(){var t,i,n=this.options.config.columns;for(t=0;t<n.length;t++)(i=e.extend(!0,{id:"",name:"",staticId:"",dataType:"VARCHAR2",specialType:"",isHidden:!1,isReadOnly:!0,heading:{heading:"",label:"",alignment:"center"},layout:{columnAlignment:"start",groupId:"",useGroupFor:"both"},appearance:{columnCssClasses:"",formatExample:""},validation:{isRequired:!1,restrictedCharacters:""},link:{text:"",attributes:""},filter:{operators:[{name:"$std$"},{name:"$perform$"}],dateRanges:"all",isRequired:!1,hasLov:!0,dataType:"VARCHAR2"},accessibility:{usedAsRowHeader:!1},features:{canHide:!0,highlight:!0,compute:!0,sort:!0,controlBreak:!0,aggregate:!0,groupBy:!0},isPrimaryKey:!1,parentColumnName:"",default:{value:"",duplicate:!0},escape:!0,helpid:""},n[t])).heading.label||(i.heading.label=i.heading.heading),"VARCHAR2"!==i.filter.dataType||i.filter.textCase||(i.filter.textCase="MIXED"),n[t]=i},_createBaseColumnMap:function(){var e,t,i,n=this.options.config.columns,o=0;for(e=0;e<n.length;e++)t=n[e],i=this.baseModelColumns[t.id]={index:e-o,hidden:t.isHidden,readonly:t.isReadOnly,escape:t.escape,id:t.id,dataType:t.dataType},t.isHidden?i.canHide=!1:(i.heading=t.heading.heading,i.headingAlignment=t.heading.alignment,i.label=t.heading.label,i.alignment=t.layout.columnAlignment,t.appearance.formatMask&&(i.formatMask=t.appearance.formatMask)),t.parentColumnName&&(i.parentField=t.parentColumnName,this.parentColumnNames.push(t.parentColumnName)),this.columnMap[t.id]=t,t.isPrimaryKey&&this.primaryKeyColumns.push(t.name),"actions"===t.specialType&&(o+=1);this.baseModelColumns[D]={index:e-o,seq:e,hidden:!0,canHide:!1}},_defaultSavedReport:function(t){var n,o,a,l,r,s,d,c=this,u=this.options.config,h=u.views;function g(t,i){var n,o,a,l={};if(i){for(n=0;n<t.length;n++)l[t[n].columnId]=1;for(n=0;n<u.columns.length;n++)l[(o=u.columns[n]).id]||t.push({columnId:o.id,operation:"i",isVisible:!1})}for(n=0;n<t.length;n++)(a=e.extend({seq:null,columnType:v,columnId:"",isVisible:!0,isFrozen:!1,width:null,priority:null,break:!1,sort:!1},t[n])).seq!==n+1&&(a.seq=n+1,c._setOperationUpdate(a)),a.break&&(a.break=e.extend({order:null,isEnabled:!0,direction:y,nulls:O},a.break)),a.sort&&(a.sort=e.extend({order:null,direction:y,nulls:O},a.sort)),c._getColumn(a.columnId)?t[n]=a:(t.splice(n,1),n-=1)}if(!h[(o=e.extend(!0,{id:"",baseReportId:"",name:"",isCurrent:!1,type:R,isReadOnly:!0,authorizationId:"",rowsPerPage:null,showRowNumbers:!1,reportSettingsArea:"collapsed",defaultFilterColumn:!1,flashback:!1,versionNumber:"",filters:[],currentView:"grid",views:{grid:!1,chart:!1,icon:!1,detail:!1}},t)).currentView]||h[o.currentView].disabled){for(n in o.currentView=null,h)if(J(h,n)&&h[n]&&!h[n].disabled){o.currentView=n;break}this.options.data=null,u.lazyLoading=!0,i.warn("Current view not available. Using view %s. Forcing lazy load.",o.currentView)}for(o.flashback&&(o.flashback=e.extend({minsAgo:null,isEnabled:!0},o.flashback)),n=0;n<o.filters.length;n++)(a=e.extend(!0,{id:"",type:I,isCaseSensitive:!1,value:"",isEnabled:!0},o.filters[n])).columnId&&!a.columnType&&(a.columnType=v),a.type!==v||this._getColumn(a.columnId)?o.filters[n]=a:(o.filters.splice(n,1),n-=1);if(o.views.grid||h.grid){for(o.views.grid=e.extend(!0,{editMode:!1,singleRowView:{excludeNullValues:!1,onlyDisplayColumns:!0},columns:[],aggregations:[],highlights:[],initialBreakState:"collapsed",stretchColumns:!0},o.views.grid),g(o.views.grid.columns,!0),n=0;n<o.views.grid.aggregations.length;n++)(l=e.extend({id:"",function:"",columnType:v,columnId:"",tooltip:"",showGrandTotal:!0,isEnabled:!0},o.views.grid.aggregations[n])).label||(l.label=l.function),this._getColumn(l.columnId)?o.views.grid.aggregations[n]=l:(o.views.grid.aggregations.splice(n,1),n-=1);for(n=0;n<o.views.grid.highlights.length;n++)(r=e.extend(!0,{id:"",name:"",type:I,columnType:v,columnId:"",backgroundColor:"",textColor:"",condition:{type:v,columnType:v,columnId:"",operator:"",isCaseSensitive:!1,value:"",expression:""},isEnabled:!0},o.views.grid.highlights[n])).type===v&&!this._getColumn(r.columnId)||r.condition.type===v&&!this._getColumn(r.condition.columnId)?(o.views.grid.highlights.splice(n,1),n-=1):o.views.grid.highlights[n]=r}if((o.views.icon||h.icon)&&(o.views.icon=e.extend(!0,{columns:[],initialBreakState:"collapsed"},o.views.icon),g(o.views.icon.columns)),(o.views.detail||h.detail)&&(o.views.detail=e.extend(!0,{columns:[],initialBreakState:"collapsed"},o.views.detail),g(o.views.detail.columns)),o.views.chart)for(s in o.views.chart=e.extend(!0,{type:K,orientation:"vertical",stack:z},o.views.chart),o.views.chart.axis&&(o.views.chart.axis=e.extend({label:"",value:"",valueDecimalPlaces:""},o.views.chart.axis)),o.views.chart.chartColumns)J(o.views.chart.chartColumns,s)&&(d=o.views.chart.chartColumns[s],(d=e.extend({columnType:v},d)).sort&&(d.sort=e.extend({order:null,direction:y,nulls:O},d.sort)),o.views.chart.chartColumns[s]=d);return o},_defaultSavedReports:function(t){var i,n=!1,o=e.extend({reports:this.options.savedReports},t);for(i=0;i<o.reports.length;i++)o.reports[i]=this._defaultSavedReport(o.reports[i]),o.reports[i].isCurrent&&(n=!0,this.currentSavedReportIdx=i);return n||(this.currentSavedReportIdx=0),o.reports},_renderColumnHeaderMenu:function(t,i,n,o){function a(t,i){var n=e.extend(!0,{buttonClass:"a-IRR-button a-IRR-sortWidget-button",label:"",iconOnly:!0,icon:"",isToggle:!1,toggleState:null,attributes:{},data:{}},i);t.markup("<li").attr(x,"a-IRR-sortWidget-actions-item").markup(">"),n.isToggle&&(n.attributes["aria-pressed"]=n.toggleState,n.toggleState&&(n.buttonClass+=" is-active"),delete n.isToggle,delete n.toggleState),ye(t,n),t.markup("</li>")}var l,r,s,d=!1,c=this._getId("column_header_search"),u=this._getColumn(o),h=this._currentReportSettings().views.grid.columns,g=0;for(t.markup("<ul").attr(x,"a-IRR-sortWidget-actions").markup(">"),u.features.controlBreak&&a(t,{label:te("CONTROL_BREAK"),icon:"icon-ig-control-break",data:{option:"break"}}),u.features.aggregate&&a(t,{label:te("AGGREGATE"),icon:"icon-ig-aggregate",data:{option:"aggregate"}}),l=0;l<h.length;l++)if(h[l].columnId===o){d=h[l].isFrozen;break}for(l=0;l<h.length;l++)h[l].isVisible&&!this._getColumn(h[l].columnId).isHidden&&h[l].seq>g&&(g=h[l].seq),h[l].columnId===o&&(s=h[l].seq);s<g&&a(t,{label:te(d?"UNFREEZE":"FREEZE"),icon:"icon-ig-frozen-column",isToggle:!0,toggleState:d,data:{option:"freeze"}}),u.features.canHide&&a(t,{label:te("HIDE"),icon:"icon-ig-remove-col",data:{option:"hide"}}),u.helpid&&a(t,{label:te("HELP"),icon:"icon-ig-help",data:{option:"help"}}),t.markup("</ul>"),i&&(t.markup("<div").attr(x,"a-IRR-sortWidget-search").markup(">"),Ve(t,{labelFor:c,cssClasses:"a-IRR-sortWidget-searchLabel",label:te("SEARCH"),labelTextHidden:!0}),u.filter.textCase&&(r=this._getTextTransformClass(u)),Se(t,{id:c,cssClasses:"a-IRR-sortWidget-searchField"+(r?" "+r:""),placeholder:te("FILTER_WITH_DOTS")}),n&&(t.markup("<div").attr(x,"a-IRR-sortWidget-rows").attr("id",this._getId("column_header_menu_rows")).markup(">"),t.markup("</div>")),t.markup("</div>"))},_setOperationUpdate:function(e){e.operation&&"i"===e.operation||(e.operation="u")},_renderIG:function(){var e=this,i=this.element,n=t.htmlBuilder(),o=this.options.config,a=this._getId("summary");o.toolbar&&n.markup("<div").attr(x,"a-IG-header").markup("><div").attr("id",this._getId("toolbar")).markup(">").markup("</div></div>"),n.markup("<div").attr(x,"a-IG-body").markup(">"),o.reportSettingsArea&&this._renderReportSettings(n),n.markup("<div class='u-vh'").attr("id",a).markup("></div><div").attr(x,"a-IG-contentContainer").attr("id",this._getId("content_container")).markup(">"),this._forEachView((function(t,i){n.markup("<div").attr("id",e._getId(i.elementId)).attr(x,i.cssClass).attr("aria-labelledby",a).markup(" style='display:none'></div>")})),n.markup("</div></div>"),i.append(n.toString()),o.reportSettingsArea&&this._initReportSettings()},_resetReportSettings:function(){var e=this;this._ifNoChangesDo((function(t){if(e._currentReportSettings().baseReportId)return e._call({resetReportSettings:[e._report()]},{success:function(i){var n=e._defaultSavedReport(i.regions[0].resetReportSettings[0]);e.options.savedReports[e.currentSavedReportIdx]=n,t&&e.clearChanges(),e._report(n.id),e._updateChangeReportAction()}})}))},_openDialog:function(e,t){var i,n=this;function o(e){var t=e+"Dialog$",i="_render"+e.substr(0,1).toUpperCase()+e.substr(1)+"Dialog";return n[t]||n[i](),n[t]}function a(e,t){var i=o(e);t&&i.dialog(w,"id",t),i.dialog("open")}switch(t=t||{},e){case"columns":case T:case"sort":case S:case"controlBreak":a(e,t.id);break;case L:o(e).dialog(w,{id:t.id,columnId:t.columnId}).dialog("open");break;case N:Ue({labelKey:"APEX.IG.MINUTES_AGO",titleKey:"APEX.IG.FLASHBACK",okLabelKey:"APEX.DIALOG.SAVE",helpKey:"APEX.IG.HELP.FLASHBACK",helpTitleKey:"APEX.IG.HELP.FLASHBACK_TITLE",value:i=(i=n._currentReportSettings().flashback)?i.minsAgo:5},(function(e){!1!==e&&n.updateFlashback({isEnabled:!0,minsAgo:parseInt(e,10)})}));break;case A:this.viewsImpl[A].openDialog();break;case"editReport":o("reportSettings").dialog(w,"saveAs",!1).dialog("open");break;case"saveAsReport":o("reportSettings").dialog(w,"saveAs",!0).dialog("open");break;case"download":a(e)}},_setModel:function(t){var i,n,o,a,l,r,s,d,u,h,g,p=!1,m=!1,f=!1,_=this.options.config,C=_.pagination.showTotalRowCount,I=t.viewImpl,v=I.internalIdentifier,b=_.views[v];I.model&&(c.release(I.modelName),I.modelName=null,I.model=null),t.remove||(b.useModelFrom&&_.views[b.useModelFrom].shareModel?d=(h=(u=this.getViews(b.useModelFrom)).internalIdentifier)+"_shared":(u=I,h=v,d=b.shareModel?h+"_shared":h),(g=this._isCurrentlyEditable()&&u.supports.edit)&&(p=_.editable.allowedOperations.create,m=_.editable.allowedOperations.update,f=_.editable.allowedOperations[E]),_.parentRegionStaticId&&null===_.modelInstanceId&&(g=!1),s=_.modelInstanceId?[_.regionStaticId+"_"+d,_.modelInstanceId]:_.regionStaticId+"_"+d,I.modelName=s,I.model=c.get(s),I.model||(u.supports.totalRows||(C=!1),(i=e.extend({},_.defaultModelOptions,{recordIsArray:!0,hasTotalRecords:C,regionId:_.regionId,regionStaticId:_.regionStaticId,ajaxIdentifier:_.ajaxIdentifier,pageItemsToSubmit:_.itemsToSubmit,parentRecordId:this.parentRecordId,fields:I.modelColumns,editable:g,saveSelection:g&&_.submitSelectedRows,paginationType:"progressive",regionData:{reportId:this._report(),view:h,ajaxColumns:_.ajaxColumns}})).types||(i.types={default:{operations:{canAdd:p,canEdit:m,canDelete:f}}}),e.each(["identityField","metaField","typeField","sequenceField"],(function(e,t){I.specialColumns[t]&&(i[t]=I.specialColumns[t])})),_.parentRegionStaticId&&(this.parentModel?i.parentModel=this.parentModel:(n=e("#"+_.parentRegionStaticId+"_ig"),i.parentModel=_.parentRegionStaticId+"_"+n.interactiveGrid("getCurrentViewId"))),g&&(i.regionData.allowedOperations=_.editable.allowedOperations.protected),t.initialData?(o=t.initialData.values,a=C?t.initialData.totalRows:null,l=t.initialData.moreData,r=t.initialData.dataOverflow,I.model=c.create(s,i,o,a,l,r)):t.fetchData?I.model=c.create(s,i):I.model=c.create(s,i,[],0),this.modelReportSettingsSeq[s]=this.reportSettingsSeq),this._trigger("viewModelCreate",null,{viewId:v,model:I.model}),t.updateComponent&&(this.reportSettingsSeq>this.modelReportSettingsSeq[s]&&(this._updateModelRegionData(I),I.clearModelData()),I.setModelName(I.modelName,I.modelColumns)))},_anyChanges:function(){var e=this.editableViewImpl;return!!(e&&this._isCurrentlyEditable()&&e.model&&c.anyChanges(!1,e.model.name,!0))},_ifNoChangesDo:function(e,t){var i=this,n=this._anyChanges();t||(t=e,e=!1),n?e||setTimeout((function(){s.confirm(te("UNSAVED_CHANGES_CONTINUE_CONFIRM"),(function(e){e?(i._setEditMode(!1),t(n)):i._refreshReportSettings()}))}),1):t(n)},_clearToolbarSearch:function(){var e=this.options.config;e.toolbar&&e.toolbar.searchField&&e.toolbarData&&this._tbFindElement("search_field").val("")},_tbFind:function(e){var t=null,i=this.getToolbar();return i&&(t=i.toolbar("find",e)),t},_tbFindElement:function(t){var i=this.getToolbar();return i?i.toolbar("findElement",t):e()},resize:function(){var t,i,n,o,a=this.options.config,l=0,r=0,s=this.element,d=s.width(),c=this._currentViewImpl(),u=e(".a-IG-contentContainer",s).children().addBack();this.ignoreResizeHandler=!0,u.width(d),a.maxHeight&&(t=s.height(),n=e(".a-IG-header",s),o=e(".a-IG-controlsContainer",s),n.filter(":visible").length>0&&(l=n.outerHeight()),o.filter(":visible").length>0&&(r=o.outerHeight()),i=t-(l+r),u.height(i)),e.apex.stickyWidget&&s.find(".a-IG-header.js-stickyWidget-toggle").stickyWidget("refresh"),c&&c.view$&&c.resize(),this.ignoreResizeHandler=!1},refresh:function(){var e=this;this._ifNoChangesDo((function(){e._forEachView((function(e,t){t.model&&t.clearModelData()}))}))},clearChanges:function(){var e;this.editableViewImpl&&(e=this.editableViewImpl.model)&&e.isChanged()&&e.clearChanges()},setMasterRecord:function(e,t){if(this.options.config.parentRegionStaticId)if(this.parentModel=e.modelId(),t){const i=e.getRecordId(t);this._setModelInstance(i,e,t),e.getRecordMetadata(i).deleted?this.actions.disable("selection-add-row"):this.actions.enable("selection-add-row")}else this._setModelInstance(null),this.actions.disable("selection-add-row");else i.warn("No master region defined.")},gotoCell:function(e,t,i){var n;this._view()!==this.editableView&&this._view(this.editableView),n=this._currentViewImpl(),e&&this._setModelInstance(e),n.gotoCell&&n.gotoCell(t,i)},getActions:function(){return this.actions},getToolbar:function(){return this.toolbar$},getSelectedRecords:function(){var e=this._currentViewImpl();return e.supports.selection?e.getSelectedRecords():null},setSelectedRecords:function(e,t,i){var n,o,a,l,r=this._currentViewImpl();if(r.supports.selection){if(e.length&&"string"==typeof e[0])for(l=r.model,o=e,e=[],n=0;n<o.length;n++)(a=l.getRecord(o[n]))&&e.push(a);r.setSelectedRecords(e,t,i)}},getReports:function(e){var t,n=this.options.savedReports;if(!e)return n;for(t=0;t<n.length;t++)if(n[t].id===e)return n[t];i.warn("No report exists with ID: ",e)},addReport:function(t,n){var o=e.extend(t,{operation:"i",isEnabled:!0}),a=e.extend({save:!0},n);this.options.config.features.saveReport?(this.getReports().push(o),a.save&&this._saveReport(o,"i")):i.warn("Unable to add report settings because the configuration disallows it.")},updateReport:function(t,n,o){var a,l,r=this.getReports(),s=e.extend({save:!0},o);if(this.options.config.features.saveReport){for(a=0;a<r.length;a++)if((l=r[a]).id===t){this._setOperationUpdate(n),l=e.extend(!0,l,n);break}s.save&&this._saveReport(l,"u")}else i.warn("Unable to update report settings because the configuration disallows it.")},deleteReport:function(t,n){var o={},a=e.extend({save:!0},n);this.options.config.features.saveReport?(o.id=t,o.operation="d",a.save&&this._saveReport(o,"d")):i.warn("Unable to delete report settings because the configuration disallows it.")},getFilters:function(e){var t,n=this._currentReportSettings().filters;if(!e)return n;for(t=0;t<n.length;t++)if(n[t].id===e)return n[t];i.warn("No filter exists with ID: ",e)},addFilter:function(t,i){var n=this,o=e.extend(t,{operation:"i",isEnabled:!0}),a=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1,validate:!0},i);function l(){o.columnName&&(o.columnId=n._getColumnByName(o.columnName).id,delete o.columnName),n.getFilters().push(o),a.save&&n._setReportSettings({refreshModel:a.refreshData,affectsOtherViewsModels:!0})}a.skipNoChangesCheck?l():this._ifNoChangesDo(l)},updateFilter:function(t,i,n){var o=this,a=this.getFilters(),l=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1,validate:!0},n);function r(){var n,r=o._isSettingsCheckboxFocused(t,T);for(n=0;n<a.length;n++)if(a[n].id===t){o._setOperationUpdate(i),a[n]=e.extend(!0,a[n],i);break}l.save&&o._setReportSettings({refreshModel:l.refreshData,affectsOtherViewsModels:!0},(function(){o._focusOnSettingsCheckbox(r,t,T)}))}l.skipNoChangesCheck?r():this._ifNoChangesDo(r)},deleteFilter:function(t,i){var n=this,o=this.getFilters(),a=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},i);function l(){var i;for(i=0;i<o.length;i++)if(o[i].id===t){o[i]=e.extend(!0,o[i],{operation:"d"});break}a.save&&n._setReportSettings({refreshModel:a.refreshData,affectsOtherViewsModels:!0})}a.skipNoChangesCheck?l():this._ifNoChangesDo(l)},getHighlights:function(e){var t,n=this._getCurrentView().highlights;if(!e)return n;for(t=0;t<n.length;t++)if(n[t].id===e)return n[t];i.warn("No highlight exists with ID: ",e)},addHighlight:function(t,i){var n=this,o=e.extend(t,{operation:"i",isEnabled:!0}),a=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},i);function l(){o.columnName&&(o.columnId=n._getColumnByName(o.columnName).id,delete o.columnName),n.getHighlights().push(o),a.save&&n._setReportSettings({refreshModel:a.refreshData,affectsOtherViewsModels:!0})}a.skipNoChangesCheck?l():this._ifNoChangesDo(l)},updateHighlight:function(t,i,n){var o=this,a=this.getHighlights(),l=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},n);function r(){var n,r=o._isSettingsCheckboxFocused(t,S);for(n=0;n<a.length;n++)if(a[n].id===t){o._setOperationUpdate(i),a[n]=e.extend(!0,a[n],i),i.type===I&&(delete a[n].columnId,delete a[n].columnType);break}l.save&&o._setReportSettings({refreshModel:l.refreshData,affectsOtherViewsModels:!0},(function(){o._focusOnSettingsCheckbox(r,t,S)}))}l.skipNoChangesCheck?r():this._ifNoChangesDo(r)},deleteHighlight:function(t,i){var n=this,o=this.getHighlights(),a=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},i);function l(){var i;for(i=0;i<o.length;i++)if(o[i].id===t){o[i]=e.extend(!0,o[i],{operation:"d"});break}a.save&&n._setReportSettings({refreshModel:a.refreshData,affectsOtherViewsModels:!0})}a.skipNoChangesCheck?l():this._ifNoChangesDo(l)},getAggregates:function(){var e=[];return this._currentViewImpl().supports.aggregation&&(e=this._getCurrentView().aggregations),e},addAggregate:function(t,i){var n=this,o=e.extend(t,{operation:"i"}),a=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},i);function l(){n.getAggregates().push(o),a.save&&n._setReportSettings({refreshModel:a.refreshData})}a.skipNoChangesCheck?l():this._ifNoChangesDo(l)},updateAggregate:function(t,i,n){var o=this,a=this.getAggregates(),l=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},n);function r(){var n,r=o._isSettingsCheckboxFocused(t,L);for(n=0;n<a.length;n++)if(a[n].id===t){o._setOperationUpdate(i),a[n]=e.extend(!0,a[n],i);break}l.save&&o._setReportSettings({refreshModel:l.refreshData},(function(){o._focusOnSettingsCheckbox(r,t,L)}))}l.skipNoChangesCheck?r():this._ifNoChangesDo(r)},deleteAggregate:function(t,i){var n=this,o=this.getAggregates(),a=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},i);function l(){var i;for(i=0;i<o.length;i++)if(o[i].id===t){o[i]=e.extend(!0,o[i],{operation:"d"});break}a.save&&n._setReportSettings({refreshModel:a.refreshData})}a.skipNoChangesCheck?l():this._ifNoChangesDo(l)},getFlashback:function(){return this._currentReportSettings().flashback},addFlashback:function(t,i){var n=this,o=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},i);function a(){n._currentReportSettings().flashback=e.extend(t,{isEnabled:!0}),n._setOperationUpdate(n._currentReportSettings()),o.save&&n._setReportSettings({refreshModel:o.refreshData,affectsOtherViewsModels:!0,changeIdentifier:"editable"})}o.skipNoChangesCheck?a():this._ifNoChangesDo(a)},updateFlashback:function(t,i){var n=this,o=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},i);function a(){var i=n._isSettingsCheckboxFocused("",N);n._setOperationUpdate(n._currentReportSettings()),n._currentReportSettings().flashback=e.extend(n._currentReportSettings().flashback,t),o.save&&n._setReportSettings({refreshModel:o.refreshData,affectsOtherViewsModels:!0,changeIdentifier:"editable"},(function(){n._focusOnSettingsCheckbox(i,"",N)}))}o.skipNoChangesCheck?a():this._ifNoChangesDo(a)},deleteFlashback:function(t){var i=this,n=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},t);function o(){i._setOperationUpdate(i._currentReportSettings()),i._currentReportSettings().flashback=!1,n.save&&i._setReportSettings({refreshModel:n.refreshData,affectsOtherViewsModels:!0,changeIdentifier:"editable"})}n.skipNoChangesCheck?o():this._ifNoChangesDo(o)},addControlBreak:function(t,i,n){var o=this,a=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},n||{});function l(){var n,l,r=0,s=o._getCurrentView().columns;for(n=0;n<s.length;n++)if(s[n].columnId===t.id){l=s[n];break}if(!i.order){for(n=0;n<s.length;n++)s[n].break&&(r+=1);i.order=r+1}l=e.extend(!0,l,{isVisible:!i.isEnabled,break:{order:i.order,isEnabled:i.isEnabled,direction:i.direction,nulls:i.nulls}}),o._setOperationUpdate(l),i.isEnabled&&o._adjustControlBreakSort(),i.isEnabled?e.extend(t,{controlBreakIndex:i.order,controlBreakDirection:i.direction,hidden:!0}):e.extend(t,{controlBreakIndex:0,controlBreakDirection:null,hidden:!1}),a.save&&o._setReportSettings({refreshModel:a.refreshData,refreshColumns:a.refreshData})}a.skipNoChangesCheck?l():this._ifNoChangesDo(l)},updateControlBreak:function(t,i,n){var o=this,a=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},n||{});function l(){var n,l,r=o._getCurrentView().columns,s=o._isSettingsCheckboxFocused(t,"controlBreak");for(n=0;n<r.length;n++)if(r[n].columnId===t){l=r[n];break}l=e.extend(!0,l,{isVisible:!i.isEnabled,break:{order:i.order,isEnabled:i.isEnabled,direction:i.direction,nulls:i.nulls}}),o._setOperationUpdate(l),i.isEnabled?e.extend(o._currentViewImpl().modelColumns[o._getColumn(t).name],{controlBreakIndex:l.break.order,controlBreakDirection:l.break.direction,hidden:!0}):e.extend(o._currentViewImpl().modelColumns[o._getColumn(t).name],{controlBreakIndex:0,controlBreakDirection:null,hidden:!1}),o._adjustControlBreakSort(),a.save&&o._setReportSettings({refreshModel:a.refreshData,refreshColumns:a.refreshData},(function(){o._focusOnSettingsCheckbox(s,t,"controlBreak")}))}a.skipNoChangesCheck?l():this._ifNoChangesDo(l)},deleteControlBreak:function(t,i){var n=this,o=e.extend({save:!0,refreshData:!0,skipNoChangesCheck:!1},i||{});function a(){var i,a,l=n._getCurrentView().columns;for(i=0;i<l.length;i++)if(l[i].columnId===t){a=l[i];break}a=e.extend(!0,a,{isVisible:!0,break:!1}),n._setOperationUpdate(a),e.extend(n._currentViewImpl().modelColumns[n._getColumn(t).name],{controlBreakIndex:0,controlBreakDirection:null,hidden:!1}),n._adjustControlBreakSort(),o.save&&n._setReportSettings({refreshModel:o.refreshData,refreshColumns:o.refreshData})}o.skipNoChangesCheck?a():this._ifNoChangesDo(a)},getSorts:function(){var t,i,n,o=[],a=this._getCurrentView().columns;for(t=0;t<a.length;t++)(i=a[t]).sort&&(n=e.extend({},{columnId:i.columnId,order:i.sort.order,direction:i.sort.direction,nulls:i.sort.nulls}),o.push(n));for(o.length>0&&(o=o.sort((function(e,t){return e.order-t.order}))),t=0;t<o.length;t++)delete o[t].order;return o},setSorts:function(e){var t,i,n,o,a,l,r,s=this,d=this.options.config,c=this._currentViewImpl(),u=c.internalIdentifier,h=d.views[u],g=this._getCurrentView().columns,p=null;this._ifNoChangesDo((function(){for(h.useModelFrom&&d.views[h.useModelFrom].shareModel&&(c=s.getViews(h.useModelFrom)),c.supports.configurableColumns&&(p=c.getColumns()),i=0;i<e.length;i++){for(a=e[i],o=!1,t=0;t<g.length;t++)if(l=g[t],a.columnId===l.columnId){o=!0;break}o||g.push({columnId:a.columnId,operation:"i",columnType:v,isVisible:!1,isFrozen:!1})}for(t=0;t<g.length;t++){if(l=g[t],o=!1,p)for(n=0;n<p.length;n++)if(l.columnId===p[n].id){r=p[n];break}for(i=0;i<e.length;i++)if((a=e[i]).columnId===l.columnId){o=!0,a.order=i+1;break}o?(delete a.columnId,l.sort&&a.order===l.sort.order&&a.direction===l.sort.direction&&a.nulls===l.sort.nulls||(l.sort=a,s._setOperationUpdate(l),r&&(r.sortIndex=l.sort.order,r.sortDirection=l.sort.direction))):l.sort&&(l.sort=!1,s._setOperationUpdate(l),r&&(r.sortIndex=null,r.sortDirection=null))}s._adjustControlBreakSort(),s._setReportSettings({refreshModel:!0,refreshColumns:!0}),c!==s._currentViewImpl()&&(c.refreshColumns(),c.refresh())}))},getChart:function(){return this._currentReportSettings().views.chart},setChart:function(t){var i,n=this,o=this.getChart(),a=this._currentViewImpl(),l={};o?(i=e.extend(o,t),this._setOperationUpdate(i)):i=e.extend({operation:"i"},t),this._currentReportSettings().views.chart=i,this._view()===A?(l.ig=this,l.igConfig=this.options.config,a.initView(l),this._setReportSettings({refreshView:!0,refreshModel:!0})):this._setReportSettings({},(function(){n._view(A,{fetchData:!0})}))},deleteChart:function(){var e=this,t=this._currentViewImpl();this._currentReportSettings().views.chart={operation:"d"},this._setReportSettings({},(function(){t.destroyView(e),t.view$=null}))},getViews:function(e){return e?this.viewsImpl[e]:this.viewsImpl},getCurrentView:function(){return this.getViews(this.getCurrentViewId())},getCurrentViewId:function(){return this._view()},focus:function(){var e=this.options.config;e.toolbar&&e.toolbar.searchField&&this.toolbar$?this._tbFindElement("search_field").focus():this._currentViewImpl().focus()}}),e.apex.interactiveGrid.copyDefaultToolbar=fe;var Pe=[];function Be(e){Pe.push(e)}e.apex.interactiveGrid.registerView=Be;var Xe=["selection-fill","selection-clear","selection-copy-down"],qe={setColumnConfig:function(i){var n,o,a,l,r,s,c,u,h={},g=i.baseModelColumns,p=i.igConfig,m=p.views[this.internalIdentifier].features,f=i.currentReportSettings,_=i.ig,C=y,I=!1!==p.editable;for(n=0;n<f.views.grid.columns.length;n++)o=f.views.grid.columns[n],a=_._getColumn(o.columnId),(c=e.extend(!0,{},a.defaultGridColumnOptions||{},g[o.columnId])).elementId=a.staticId,c.seq=o.seq,void 0===c.noStretch&&(void 0!==a.layout.noStretch?c.noStretch=a.layout.noStretch:null!==m.stretchColumns?c.noStretch=!m.stretchColumns:c.noStretch=!f.views.grid.stretchColumns),a.isHidden||(c.hidden=!o.isVisible,c.frozen=o.isFrozen,o.width&&(c.width=o.width),o.sort&&(c.sortIndex=o.sort.order,c.sortDirection=o.sort.direction),(s=o.break)&&s.isEnabled&&(C=s.direction,c.controlBreakIndex=s.order,c.controlBreakDirection=C),a.layout.groupId&&("both"===a.layout.useGroupFor?c.useGroupFor="srv,heading":c.useGroupFor=a.layout.useGroupFor,c.groupName=a.layout.groupId),c.helpid=a.helpid,c.canHide=a.features.canHide,c.canSort=a.features.sort,a.link.attributes&&(c.linkAttributes=a.link.attributes),a.link.text&&(c.linkText=a.link.text),a.link.targetColumn&&(c.linkTargetColumn=a.link.targetColumn)),a.accessibility.usedAsRowHeader&&(c.usedAsRowHeader=a.accessibility.usedAsRowHeader),a.appearance.columnCssClasses&&(c.columnCssClasses=a.appearance.columnCssClasses),a.appearance.fieldColSpan&&(c.fieldColSpan=a.appearance.fieldColSpan),a.appearance.fieldCssClasses&&(c.fieldCssClasses=a.appearance.fieldCssClasses),a.validation&&(c.isRequired=a.validation.isRequired),a.appearance.cellTemplate&&(c.cellTemplate=a.appearance.cellTemplate),I&&(c.noCopy=!a.default.duplicate,void 0===c.defaultValue&&(u=a.default.value,e.isPlainObject(u)&&void 0!==u.d&&c.elementId&&(u.d=d(c.elementId).displayValueFor(u.d)),c.defaultValue=u)),"actions"===a.specialType&&(r="a-Button--noLabel a-Button--iconTextButton a-Button--actions js-menuButton",ye(l=t.htmlBuilder(),{label:te("ROW_ACTIONS"),buttonClass:r,iconOnly:!0,icon:"icon-ig-actions",attributes:{"data-menu":_._getId("row_actions_menu"),"aria-haspopup":!0,"aria-expanded":!1}}),c.cellTemplate=l.toString(),l.clear(),ye(l,{label:te("SEL_ACTIONS"),buttonClass:r+" js-selectionMenu",iconOnly:!0,icon:"icon-ig-actions",attributes:{"data-menu":_._getId("selection_actions_menu"),"aria-haspopup":!0,"aria-expanded":!1}}),c.heading=l.toString(),c.columnCssClasses?c.columnCssClasses+=" has-button":c.columnCssClasses="has-button",c.headingCssClasses?c.headingCssClasses+=" has-button":c.headingCssClasses="has-button",delete c.index,c.virtual=!0,c.noHeaderActivate=!0,c.elementId=null,0===n&&(c.frozen=!0,o.isFrozen=!0),c.noStretch=!0,c.canSort=!1,c.width||(c.width=42)),h[a.name]=c;h[D]=g[D],this.modelColumns=h,this.specialColumns={identityField:0===_.primaryKeyColumns.length?null:_.primaryKeyColumns,metaField:D}},init:function(e){var t=e.options.config;e.getActions().add([{name:"selection-copy-down",labelKey:"APEX.IG.COPY_DOWN",icon:"icon-ig-copy-down",hide:!0,action:function(){var t=e._currentViewImpl();t.singleRowMode||t.view$.grid("copyDownSelection")}},{name:"selection-clear",labelKey:"APEX.IG.CLEAR",icon:"icon-ig-clear",hide:!0,action:function(){var t=e._currentViewImpl();t.singleRowMode||t.view$.grid("fillSelection","")}},{name:"selection-fill",labelKey:"APEX.IG.FILL",icon:"icon-ig-fill",hide:!0,getFillValue:function(e,t,i,n){let o={labelKey:"APEX.IG.FILL_LABEL",titleKey:"APEX.IG.FILL_TITLE"};i&&(o.label=i),t&&e&&(o.type="item",o.columnItem=t,o.viewInst=e),Ue(o,n)},action:function(){let t=e._currentViewImpl();if(!t.singleRowMode){let e,i,n,o=null,a=null,l=t.view$.grid("instance");l.options.selectCells&&(e=l.getSelectedRange(),e&&1===e.columns.length&&(i=e.columns[0],n=l.options.columns[0][i],a=n.label||n.heading,o=l.columnItems[i],!n.readonly&&o&&o.element$.parent()[0]===l.columnItemsContainer$[0]||(o=null,a=null))),this.getFillValue(l,o,a,e=>{!1!==e&&t.view$.grid("fillSelection",e)})}}}]),this._initMenus(t,e)},initView:function(i){var n,o,a,l,d,c,u,g=null,p=t.htmlBuilder(),m=!0,f=i.igConfig,_=f.defaultGridViewOptions,C=_.multiple,I=_.selectAll,E=f.views.grid.features,A=!1,R=_.rowHeader||k,T=i.ig,S=T.actions,N=T._isCurrentlyEditable(),V=f.columnGroups,D=!!N&&f.editable.autoAddRow,H=this,G=!0,U=null,F=null;function P(e,t){T.editMode=t.editMode,T.actions.update("edit"),T._trigger("modeChange",e,t)}function $(e){U.hide(),F.removeClass("is-active").attr("aria-expanded","false"),e&&(F.focus(),H.view$.grid("focus")),F=null,T._off(T.document,"mousedown"),T._off(T.window,"blur"),T._off(U)}function W(){var e,t,i,n=T._currentReportSettings().views.grid.columns,o=H.view$.grid("getColumns"),a=0,l=!1,r=!1;for(e=0;e<n.length;e++)n[e]&&n[e].isVisible&&!T._getColumn(n[e].columnId).isHidden&&n[e].seq>a&&(a=n[e].seq,l=e);if(!1!==l){for(t=n[l],e=0;e<o.length;e++)t.columnId!==o[e].id||o[e].hidden||(i=o[e]);t.isFrozen&&(t.isFrozen=!1,i.frozen=!1,r=!0,T._setOperationUpdate(t))}r?T._setReportSettings({refreshView:!0,refreshColumns:!0}):(T._setReportSettings(),H.singleRowView$&&H.singleRowView$.recordView("refreshFields").recordView("refresh"))}if(!E.gridView&&!E.singleRowView)throw new Error("Interactive Grid grid view must have at least one of grid or single row");switch(e("div.a-GV-columnItemContainer",i.ig$).appendTo(i.ig$),E.gridView&&(p.markup("<div").attr(x,"a-IRR-sortWidget").attr("style","display:none;").attr("id",T._getId("column_header_menu")).markup(">").markup("</div>"),U=e(p.toString()),e("body").append(U),(u=i.currentReportSettings.views.grid.aggregations).length>0&&(R!==k&&"plain"!==R||(R=M))),E.rowSelector&&(R===k&&(R="plain"),A=!E.rowSelector.hideControl,void 0===C&&(C=E.rowSelector.multiSelect),C&&void 0===I&&(I=E.rowSelector.selectAll)),f.headingFixedTo){case k:m=!1,l=!1,d=!1;break;case"region":m=!0,l=!1,d=!1;break;case"page":m=!1,l=function(){return r.defaultStickyTop()+(e(".a-IG-header",i.ig$).outerHeight()||0)},d=_.stickyFooter||!0}if(V.length)for(g={},n=0;n<V.length;n++)g[(o=e.extend({},V[n])).id]=o,delete o.id;if(E.gridView){_.contextMenu&&!J(_.contextMenu,"actionsContext")&&(_.contextMenu.actionsContext=T.actions),f.editable&&!1===f.editable.allowedOperations.create&&!1===f.editable.allowedOperations.update&&(G=!1);let n=T._getPaginationConfig(f,"defaultGridViewOptions");c={modelName:H.modelName,editable:N,autoAddRecord:D,rowHeader:R,rowHeaderCheckbox:A,aggregateLabels:this._gridAggregateLabels(),highlights:this._gridHighlightsFromReport(i.currentReportSettings),multiple:C,selectAll:I,noDataMessage:f.text.noDataFound,moreDataMessage:f.text.moreDataFound,showNullAs:f.appearance.showNullValue,fixedRowHeight:ie(_.fixedRowHeight,f.appearance.useFixedRowHeight),columns:[H.modelColumns],columnSort:E.sort,reorderColumns:ie(_.reorderColumns,E.reorderColumns),resizeColumns:ie(_.resizeColumns,E.resizeColumns),pagination:n,rowsPerPage:ie(_.rowsPerPage,i.currentReportSettings.rowsPerPage),hasSize:m,stickyTop:l,stickyFooter:d,allowEditMode:G,persistSelection:ie(_.persistSelection,f.submitSelectedRows||n.virtual),activateColumnHeader:function(i,n){var o,a,l,d,c,u,g,p=[],m=t.htmlBuilder();function f(i){var n,o,a,l=t.htmlBuilder();for(n=0;n<i.length;n++)e.isPlainObject(i[n])?(o=i[n].r,a=i[n].d):o=a=i[n],ke(l,{cssClasses:"a-IRR-sortWidget-row",text:a,data:{"return-value":o}});T._getElement("column_header_menu_rows").html(l.toString())}function _(e){var t=U.find(":focusable");e||(o=t.first()).data("first",!0),(a=t.last()).data("last",!0)}U.is(":visible")?$():((l=T._isColumnFilterable(n.column.id))&&(d=T._hasColumnFilterLov(n.column.id)),F=n.header$,n.header$.addClass("is-active").attr("aria-expanded","true"),T._renderColumnHeaderMenu(m,l,d,n.column.id),c>220?(u=n.column.frozen?2:1,c=n.header$.outerWidth(),U.css("min-width",c-u)):U.css("min-width","0"),g=T.isRTL?"right":"left",U.html(m.toString()).show().css({left:0,top:0}).position({my:g+" top",at:g+" bottom",of:n.header$,collision:"fit"}),d?T._getFilterValues(n.column.id,!0,(function(e){e.regions[0].filterValues&&(T._getElement("column_header_search").focus(),f(p=e.regions[0].filterValues),_())})):(_(),o.focus()),T._on(U,{"click button.a-IRR-sortWidget-button":function(t){var i,o,a,l=y;switch(e(t.currentTarget).data(w)){case"hide":H.view$.grid("hideColumn",n.column),T._currentViewColumn(n.column.id,{isVisible:!1}),W(),$(!0);break;case"break":(i=T._currentViewColumn(n.column.id)).sort&&(l=i.sort.direction),T.addControlBreak(n.column,{isEnabled:!0,direction:l}),$(!0);break;case"aggregate":T._openDialog(L,{columnId:n.column.id}),$();break;case"freeze":if(o=T._currentReportSettings().views.grid.columns,H.view$.grid(n.column.frozen?"unfreezeColumn":"freezeColumn",n.column),n.column.frozen)for(a=0;a<o.length;a++)(i=o[a]).seq<=n.column.seq&&!i.isFrozen&&(i.isFrozen=!0,T._setOperationUpdate(i));else for(a=0;a<o.length;a++)(i=o[a]).seq>=n.column.seq&&i.isFrozen&&(i.isFrozen=!1,T._setOperationUpdate(i));T._setReportSettings(),$(!0);break;case"help":$(!0),r.popupFieldHelp(T._getColumn(n.column.id).helpid,apex.env.APP_SESSION)}},keydown:function(t){var i;t.which===e.ui.keyCode.ESCAPE?($(!0),t.preventDefault()):t.which===e.ui.keyCode.TAB&&(!(i=!!t.shiftKey)&&e(t.target).data("last")&&(t.preventDefault(),o.focus()),i&&e(t.target).data("first")&&(t.preventDefault(),a.focus()))},"keydown input.a-IRR-sortWidget-searchField":function(t){var i,o,a,r=e(t.target).val();if(l&&t.which===e.ui.keyCode.ENTER){if((a=this._getColumn(n.column.id).filter.dataType)===X)try{i=apex.jQuery.timepicker.parseDateString(r,this._getColumn(n.column.id).appearance.dateFormatMask),T.addFilter({type:v,columnType:v,columnId:n.column.id,operator:"EQ",value:be(i),isCaseSensitive:!1})}catch(e){s.alert(te("INVALID_DATE_FORMAT"))}else a===B?(o=h.toNumber(r,this._getColumn(n.column.id).appearance.dateFormatMask),isNaN(o)?s.alert(te("INVALID_NUMBER_FORMAT")):T.addFilter({type:v,columnType:v,columnId:n.column.id,operator:"EQ",value:o,isCaseSensitive:!1})):T.addFilter({type:v,columnType:v,columnId:n.column.id,operator:"VARCHAR2"===a||"CLOB"===a?"C":"EQ",value:r,isCaseSensitive:!1});$(!0),t.preventDefault()}},"keyup input.a-IRR-sortWidget-searchField":function(e){if(d){var t=e.target.value;f(p.filter((function(e){return e.d?e.d.toLowerCase().indexOf(t.toLowerCase())>-1:e.toLowerCase().indexOf(t.toLowerCase())>-1}))),_(!0)}},"click a.a-IRR-sortWidget-row":function(t){var i,o,a,l,r=e(t.currentTarget).data("returnValue"),c=T._getColumn(n.column.id);d&&((i=c.filter.dataType)===X||i.indexOf(q)>-1?(o=r.indexOf("~"),a=r.substring(0,o),l=r.substring(o+1),o>0&&T.addFilter({type:v,columnType:v,columnId:n.column.id,operator:a,value:l,isCaseSensitive:!1})):i===B?(l=h.toNumber(r,c.appearance.dateFormatMask),isNaN(l)?s.alert(te("INVALID_NUMBER_FORMAT")):T.addFilter({type:v,columnType:v,columnId:n.column.id,operator:"EQ",value:l,isCaseSensitive:!1})):T.addFilter({type:v,columnType:v,columnId:n.column.id,operator:"EQ",value:r,isCaseSensitive:!0}),$(!0),t.preventDefault())}}),T._on(T.document,{mousedown:function(t){!e(t.target).closest(U).length>0&&!e(t.target).closest(n.header$).length>0&&U.is(":visible")&&$()}}),T._on(T.window,{blur:function(){U.is(":visible")&&$()}}))},cancelColumnHeader:function(){U.is(":visible")&&$()},sortChange:function(e,t){T._ifNoChangesDo((function(){var e,i,n,o,a,l=t.column.sortIndex,r=H.view$.grid("getColumns");for(n=1,e=0;e<r.length;e++)(i=r[e]).sortIndex&&("change"===t.action?i===t.column&&(n=i.sortIndex):"add"===t.action?i.sortIndex>=n&&(n=i.sortIndex+1):"remove"===t.action?i===t.column?(delete i.sortIndex,delete i.sortDirection,(o=T._currentViewColumn(t.column.id)).sort=!1,T._setOperationUpdate(o)):i.sortIndex>l&&(i.sortIndex-=1,T._currentViewColumn(i.id,{sort:{order:i.sortIndex}})):"clear"!==t.action&&"set"!==t.action||(delete i.sortIndex,delete i.sortDirection,(o=T._currentViewColumn(i.id)).sort=!1,T._setOperationUpdate(o)));"clear"!==t.action&&"remove"!==t.action&&(t.column.sortIndex=n,t.column.sortDirection=t.direction,a=t.direction===y?O:"first",T._currentViewColumn(t.column.id,{sort:{order:n,direction:t.direction,nulls:a}})),T._setReportSettings({refreshModel:!0,refreshColumns:!0})}))},columnReorder:function(e,t){var i,n,o,a,l,r=T._currentReportSettings().views.grid.columns,s=r[t.newPosition].isFrozen;for(o=r,a=t.oldPosition,l=t.newPosition,o.splice(l,0,o.splice(a,1)[0]),r[t.newPosition]&&(r[t.newPosition].isFrozen=s),i=0;i<r.length;i++)r[i]||r.splice(i,1);for(i=0;i<r.length;i++)(n=r[i]).seq!==i+1&&(n.seq=i+1,T._setOperationUpdate(n));W()},columnResize:function(e,t){T._currentViewColumn(t.column.id,{width:t.width}),T._setReportSettings()},modeChange:P,selectionChange:function(t){var i=H.view$.grid("getSelection");e(".js-selectionMenu",H.view$).prop(b,0===i.length),H._selectionChange(T,t)},pageChange:function(e,t){T._pageChange(t)}},u.length>0&&(c.aggregateTooltips=this._gridAggregateTooltipsFromReport(T,i.currentReportSettings)),g&&(c.columnGroups=g),H.view$.grid({},_,c),H.curInst=H.view$.grid("instance")}else H.view$.hide(),H.singleRowMode=!0;H.supports.singleRowView&&E.singleRowView&&(H.singleRowView$=e("<div id='"+T._getId("singleRow_vc")+"' class='a-IG-recordView'></div>").attr("aria-labelledby",T._getId("summary")),H.view$.after(this.singleRowView$),H.singleRowView$.width(H.view$.width()),f.maxHeight&&H.singleRowView$.height(H.view$.height()),(a=e.apex.recordView.copyDefaultToolbar())[0].controls.unshift({type:"MENU",labelKey:"APEX.IG.SRV_CHANGE_MENU",iconOnly:!0,icon:"icon-ig-actions",menuId:T._getId("srv_actions_menu")}),E.gridView&&(S.remove(["close-single-row-view"]),S.add([{name:"close-single-row-view",labelKey:"APEX.IG.REPORT_VIEW",action:function(){var e,t=T.editMode;return t&&H.singleRowView$.recordView("setEditMode",!1),H.singleRowMode=!1,H.singleRowView$.hide(),H.curInst=H.view$.grid("instance"),T._updateSummary(),(e=T._tbFind("selection_submenu"))&&(e.disabled=!H.supports.selection),H.view$.show().grid("resize"),t&&H.view$.grid("setEditMode",!0),H.view$.grid("focus"),!0}}]),a[0].controls.unshift({type:"BUTTON",action:"close-single-row-view"})),H.singleRowView$.recordView({},f.defaultSingleRowOptions,{modelName:H.modelName,actionsContext:S,toolbar:a,editable:N,autoAddRecord:D,noDataMessage:f.text.noDataFound,moreDataMessage:f.text.moreDataFound,showNullAs:f.appearance.showNullValue,fields:[H.modelColumns],fieldGroups:g,hasSize:m,modeChange:P,recordChange:function(e){H._selectionChange(T,e)}}),E.gridView?(H.singleRowView$.hide(),H.singleRowMode=!1):H.curInst=H.singleRowView$.recordView("instance"))},viewChanged:function(e,t,i){t._toggleEnableAction(e&&i.editable&&this.supports.edit,Xe),e&&this._selectionChange(t)},updateActions:function(e){var t=e.ig,i=t.options.config;t._toggleShowAction(e.canEdit&&this.supports.edit&&this.supports.cellSelection&&i.views.grid.features.cellRangeActions,Xe)},setReportOptions:function(e,t,i,n){var o,a=this,l=e.options.config;(o={"views.grid.aggregations":function(){a._hasGridView()&&a.view$.grid(w,"aggregateTooltips",a._gridAggregateTooltipsFromReport(e,i))},"views.grid.highlights":function(){a._hasGridView()&&a.view$.grid(w,"highlights",a._gridHighlightsFromReport(i))},"views.grid.columns":function(){var t,n,o,r,s,d,c=l.views.grid.features,u=i.views.grid.columns,h=a.getColumns(),g=!1!==c.gridView,p=!1;for(t=0;t<u.length;t++)for(s=u[t],o=e._getColumn(s.columnId),n=0;n<h.length;n++)if((r=h[n]).id===s.columnId){g&&(d=r.noStretch,void 0!==o.defaultGridColumnOptions&&void 0!==o.defaultGridColumnOptions.noStretch||(void 0!==o.layout.noStretch?r.noStretch=o.layout.noStretch:null!==c.stretchColumns?r.noStretch=!c.stretchColumns:r.noStretch=!i.views.grid.stretchColumns),r.noStretch!==d&&(p=!0)),r.hidden===s.isVisible&&r.canHide&&(r.hidden=!s.isVisible,p=!0);break}p&&(a.refreshColumns(),a.refresh())},editable:function(){var t=e._isCurrentlyEditable();a.model.getOption("identityField")&&a.model.setOption("editable",t),a.singleRowView$&&(a.singleRowView$.recordView(w,"editable",t),a.singleRowView$.recordView(w,"autoAddRecord",t)),a._hasGridView()&&(a.view$.grid(w,"editable",t),a.view$.grid(w,"autoAddRecord",t)),e._updateActions()},rowsPerPage:function(){a._hasGridView()&&(a.view$.grid(w,"rowsPerPage",i.rowsPerPage),t||(a.pendingRefresh=!0))}})[n]&&a.view$&&o[n]()},_selectionChange:function(e,t){t&&e._selectionChange(t)},_initMenus:function(t,i){var n=null,o=null,a=null,l=this,r=t.views.grid.features,s=[],d=[],c=[],u=i._tbFind("selection_submenu");function h(e){c.push(e),u&&u.push(e)}u&&(u=u.menu.items,l._selectionMenuItems=u,l._selectionMenuStart=u.length),c.push({type:H,action:"selection-copy",accelerator:"Ctrl+C"}),c.push(G),n=e("<div/>",{id:i._getId("row_actions_menu")}).appendTo("body"),o=e("<div/>",{id:i._getId("srv_actions_menu")}).appendTo("body"),a=e("<div/>",{id:i._getId("selection_actions_menu")}).appendTo("body"),l.supports.singleRowView&&(s.push({id:"srv",type:H,action:"single-row-view"}),s.push(G)),t.editable&&(t.editable.allowedOperations.create&&(s.push({id:"ins",type:H,action:"row-add-row"}),d.push({id:"ins",type:H,label:t.text.addRowButton,action:"insert-record"}),s.push({id:"dup",type:H,action:"row-duplicate"}),d.push({id:"dup",type:H,action:"duplicate-record"}),h({id:"dup",type:H,action:"selection-duplicate"}),s.push(G),h(G)),(t.editable.allowedOperations[E]||t.editable.allowedOperations.create)&&(s.push({id:"del",type:H,action:"row-delete"}),d.push({id:"del",type:H,action:"delete-record"})),t.editable.allowedOperations[E]&&h({id:"del",type:H,action:"selection-delete"})),s.push(G),s.push({id:"refresh",type:H,action:"row-refresh"}),d.push({id:"refresh",type:H,action:"refresh-record"}),h(G),h({id:"refresh",type:H,action:"selection-refresh"}),t.editable&&((t.editable.allowedOperations.update||t.editable.allowedOperations[E])&&(s.push({id:"revert",type:H,action:"row-revert"}),d.push({id:"revert",type:H,action:"revert-record"}),h({id:"revert",type:H,action:"selection-revert"})),r.cellRangeActions&&(h(G),h({id:"copy_down",type:H,action:"selection-copy-down"}),h({id:"fill",type:H,action:"selection-fill"}),h({id:"clear",type:H,action:"selection-clear"}))),n.menu({actionsContext:i.actions,items:s,beforeOpen:function(){var e,o=l.view$.find(".js-menuButton.is-active").closest("tr");l.singleRowMode?(i._updateAction("hide","single-row-view"),e=l.getSelectedRecords()):e=l.view$.grid("getRecords",[o]),t.editable&&(t.editable.allowedOperations.create&&(n.menu("find","dup").disabled=!l.model.allowAdd(null,"copy"),n.menu("find","ins").disabled=!l.model.allowAdd(null,"new")),(t.editable.allowedOperations.update||t.editable.allowedOperations[E])&&i._toggleEnableAction(l.model.canRevertRecord(e[0]),["row-revert"]),t.editable.allowedOperations[E]||i._toggleShowAction(l.model.allowDelete(e[0]),"row-delete"),t.editable.allowedOperations[E]&&i._toggleEnableAction(l.model.allowDelete(e[0]),["row-delete"]))},afterClose:function(){l.singleRowMode&&i._updateAction("show","single-row-view"),i._updateSelectionActions()}}),o.menu({actionsContext:i.actions,items:d,beforeOpen:function(){var e=l.getSelectedRecords();t.editable&&(t.editable.allowedOperations.create&&(o.menu("find","dup").disabled=!l.model.allowAdd(null,"copy"),o.menu("find","ins").disabled=!l.model.allowAdd(null,"new")),(t.editable.allowedOperations.update||t.editable.allowedOperations[E])&&(o.menu("find","revert").disabled=!e.length||!l.model.canRevertRecord(e[0])),t.editable.allowedOperations[E]||i._toggleShowAction(l.model.allowDelete(e[0]),"delete-record"),t.editable.allowedOperations[E]&&(o.menu("find","del").disabled=!e.length||!l.model.allowDelete(e[0])))}}),a.menu({actionsContext:i.actions,items:c,beforeOpen:function(){i._updateSelectionActions()}}),u&&i._tbFindElement("actions_button_menu").on("menubeforeopen.gridview",(function(){i._updateSelectionActions()})),l.rowActionMenu$=n,l.srvActionMenu$=o,l.selActionMenu$=a},_gridAggregateLabels:function(){var t=null;return this.aggregateLabels||(this.aggregateLabels=t={},e.each(Z,(function(e,i){t[i]={label:te(i),overallLabel:te(i+"_OVERALL")}}))),this.aggregateLabels},_gridAggregateTooltipsFromReport:function(e,t){var i,n,o=null,a=t.views.grid.aggregations;if(a.length>0)for(o={},i=0;i<a.length;i++)(n=a[i]).tooltip&&(o[n.function+"|"+e._getColumn(n.columnId).name]=n.tooltip);return o},_gridHighlightsFromReport:function(e){var t,i,n={},o=e.views.grid.highlights;for(t=0;t<o.length;t++)n[(i=o[t]).id]={seq:i.seq,row:i.type===I,color:i.textColor,background:i.backgroundColor};return n},_hasGridView:function(){return this.view$.is(":apex-grid")},destroyView:function(e){this._hasGridView()&&this.view$.grid("destroy"),this.singleRowView$&&this.singleRowView$.remove(),e._getElement("column_header_menu").remove()},destroy:function(){this.rowActionMenu$&&this.rowActionMenu$.length>0&&(this.rowActionMenu$.remove(),this.rowActionMenu$=null),this.selActionMenu$&&this.selActionMenu$.length>0&&(this.selActionMenu$.remove(),this.selActionMenu$=null),this._selectionMenuStart&&this._selectionMenuItems&&(this._selectionMenuItems.length=this._selectionMenuStart,this._selectionMenuItems=this._selectionMenuStart=null)},getContextRecord:function(t){var i;return this.singleRowMode?[this.singleRowView$.recordView("getRecord")]:(i=e(t).closest("tr")).length>0?this.view$.grid("getRecords",[i]):[]},getColumns:function(){return this.singleRowMode?this.curInst.getFields():this.curInst.getColumns()},canCopy2Clipboard:function(){return!this.singleRowMode&&this.curInst.option("allowCopy")},selectCells:function(e){if(!this.singleRowMode){if(void 0===e)return this.view$.grid(w,"selectCells");this.view$.grid(w,"selectCells",e)}},getSelectedRecords:function(){var e;return this.singleRowMode?(e=this.curInst.getRecord())?[e]:[]:this.curInst.getSelectedRecords()},setSelectedRecords:function(e,t,i){var n;this.singleRowMode?((n=this.model.indexOf(e[0]))<0&&(n=0),this.singleRowView$.recordView(w,"recordOffset",n)):this.view$.grid("setSelectedRecords",e,t,i)},getActiveRecordId:function(){return this.curInst.getActiveRecordId()},setModelName:function(e){this.view$&&this.view$.grid("instance").option("modelName",e),this.singleRowView$&&this.singleRowView$.recordView("instance").option("modelName",e)},setEditMode:function(e){this.curInst.setEditMode(e)},finishEditing:function(){return this.curInst.finishEditing()},setNoDataMessage:function(e){this.curInst.option("noDataMessage",e)},focus:function(){this.curInst.focus()},refreshColumns:function(){this._hasGridView()&&this.view$.grid("refreshColumns"),this.singleRowView$&&this.singleRowView$.recordView("refreshFields")},footerHeight:function(){if(!this.singleRowMode)return this.view$.find(".a-GV-footer").outerHeight()||0},refresh:function(){this._hasGridView()&&this.view$.grid("refresh"),this.singleRowView$&&this.singleRowView$.recordView("refresh")},resize:function(){this.curInst.resize()},show:function(){this.curInst.element.show()},hide:function(){this.curInst.element.hide()}},$e={setColumnConfig:function(t){var i,n,o={},a={},l=t.baseModelColumns,r=t.igConfig,s=t.ig,d=!1!==r.editable,c=0;for(n in l)J(l,n)&&(c+=1,o=e.extend(!0,{},l[n]),n!==D?(i=s._getColumn(n),o.elementId=i.staticId,o.seq=c,d&&"actions"===i.specialType&&(delete o.index,o.virtual=!0,o.elementId=null),a[i.name]=o):a[D]=o);this.modelColumns=a,this.specialColumns={identityField:0===s.primaryKeyColumns.length?null:s.primaryKeyColumns,metaField:D}},initView:function(e){var t=!0,i=!1,n=e.igConfig,o=e.ig,a="icon"===this.internalIdentifier?n.defaultIconViewOptions:n.defaultDetailViewOptions;switch(n.headingFixedTo){case k:t=!1;break;case"page":t=!1,i=!0}this.view$.tableModelView(this.viewConfig(e,{modelName:this.modelName,noDataMessage:n.text.noDataFound,moreDataMessage:n.text.moreDataFound,showNullAs:n.appearance.showNullValue,hasSize:t,columns:this.modelColumns,pagination:o._getPaginationConfig(n,"icon"===this.internalIdentifier?"defaultIconViewOptions":"defaultDetailViewOptions"),rowsPerPage:ie(a.rowsPerPage,e.currentReportSettings.rowsPerPage),stickyFooter:i,selectionChange:function(e){o._selectionChange(e)},pageChange:function(e,t){o._pageChange(t)}}))},destroyView:function(){this.view$.tableModelView("destroy")},setReportOptions:function(e,t,i,n){var o,a=this;(o={rowsPerPage:function(){a.view$.tableModelView(w,"rowsPerPage",i.rowsPerPage),t||(a.pendingRefresh=!0)}})[n]&&a.view$&&o[n]()},getSelectedRecords:function(){return this.view$.tableModelView("getSelectedRecords")},setSelectedRecords:function(e,t,i){this.view$.tableModelView("setSelectedRecords",e,t,i)},setModelName:function(e){this.view$.tableModelView(w,"modelName",e)},setNoDataMessage:function(e){this.view$.tableModelView(w,"noDataMessage",e)},footerHeight:function(){return this.view$.find(".a-GV-footer").outerHeight()||0},refresh:function(){this.view$.tableModelView("refresh")},resize:function(){this.view$.tableModelView("resize")},isConfigured:function(){return!0}};Be(e.extend({},$e,{title:te("ICON"),internalIdentifier:"icon",cssClass:"a-IG-iconView",icon:"icon-ig-icons",supports:{sort:!0},viewConfig:function(t,i){var n,o=t.igConfig,a=o.views.icon.features,l=!1,r=o.views.icon;return i=e.extend(!0,{iconListOptions:{}},o.defaultIconViewOptions,i),r.customIcon?(r.customIcon.trim().toLowerCase().match(/\s*<li/)?i.recordTemplate=r.customIcon:i.recordTemplate="<li>"+r.customIcon+"</li>",r.customIcon.toLowerCase().indexOf("href=")>=0&&(l=!0)):(i.labelColumn=r.labelColumn,r.iconClassColumn&&(i.iconClassColumn=r.iconClassColumn),r.imageURLColumn&&(i.imageURLColumn=r.imageURLColumn),r.imageAttributes&&(i.imageAttributes=r.imageAttributes),r.linkAttributes&&(i.linkAttributes=r.linkAttributes),r.linkTarget&&(i.linkTarget=!0,l=!0),i.linkTargetColumn&&(l=!0)),i.useIconList=!0,n=i.iconListOptions,l&&void 0===n.navigation&&(n.navigation=!0),a.rowSelector&&void 0===n.multiple&&void 0===n.itemSelector&&(n.multiple=a.rowSelector.multiSelect,n.navigation?n.itemSelector=!1:n.itemSelector=!a.rowSelector.hideControl),i.iconListOptions.contextMenu&&!J(i.iconListOptions.contextMenu,"actionsContext")&&(i.iconListOptions.contextMenu.actionsContext=t.ig.actions),i},focus:function(){this.view$.tableModelView("focus")},getContextRecord:function(t){var i;return this.view$.tableModelView("option").useIconList&&(i=e(t).closest(".a-IconList-item")).length?this.view$.tableModelView("getRecords",i):[]},canCopy2Clipboard:function(){var e=this.view$.tableModelView("option","iconListOptions");return void 0===e.allowCopy||e.allowCopy}})),Be(e.extend({},qe,{title:te("GRID"),internalIdentifier:"grid",cssClass:"a-IG-gridView",icon:"icon-ig-report",supports:{cellSelection:!0,edit:!0,highlight:!0,controlBreak:!0,aggregation:!0,singleRowView:!0,configurableColumns:!0,download:!0},gotoCell:function(e,t){return this.singleRowMode?this.curInst.gotoField(e,t):this.curInst.gotoCell(e,t)},lockActive:function(){this.curInst.lockActive()},unlockActive:function(){this.curInst.unlockActive()}})),Be(e.extend({},$e,{title:te("DETAIL"),internalIdentifier:"detail",cssClass:"a-IG-detailView",icon:"icon-ig-details",supports:{selection:!1,sort:!0},viewConfig:function(t,i){var n=t.igConfig,o=n.views.detail;return i.beforeTemplate=o.beforeRows,i.recordTemplate=o.row,i.afterTemplate=o.afterRows,i.useIconList=!1,(i=e.extend(!0,{},n.defaultDetailViewOptions,i)).fixedRowHeight=ie(i.fixedRowHeight,n.appearance.useFixedRowHeight),i},focus:function(){this.view$.find(":focusable").first().focus()}})),Be({title:te("CHART"),internalIdentifier:A,cssClass:"a-IG-chartView",icon:"icon-ig-chart",supports:{totalRows:!1,selection:!1,sort:!1,changeRowsPerPage:!1},initDialog:function(t){var i,n,a,l,r=[],s=[],d=[],c=te("SELECT"),u=t.options.config.columns;for(r.push({value:"",label:c}),s.push({value:"",label:c}),d.push({value:"",label:c}),a=0;a<u.length;a++)(n=u[a]).specialType||n.isHidden||(l||(l=n),r.push({value:n.id,label:t._getColumnLabel(n.id)}),n.dataType===B&&s.push({value:n.id,label:t._getColumnLabel(n.id)}),n.dataType!==B&&n.dataType!==X||d.push({value:n.id,label:t._getColumnLabel(n.id)}));i=[{value:"",label:te("SELECT")},{value:Z.CNT,label:te(Z.CNT)},{value:Z.CNT_DIST,label:te(Z.CNT_DIST)},{value:Z.APPR_CNT_DIST,label:te(Z.APPR_CNT_DIST)},{value:Z.MIN,label:te(Z.MIN)},{value:Z.MAX,label:te(Z.MAX)},{value:Z.SUM,label:te(Z.SUM)},{value:Z.AVG,label:te(Z.AVG)}],this.dialog$=t._createDialog("chart",(function(e){e("iconList",{id:"CH_TYPE",iconOnly:!1,options:[{value:"area",label:te("AREA"),iconCssClasses:"icon-region-chart-area"},{value:K,label:te("BAR"),iconCssClasses:"icon-region-chart-bar"},{value:"bubble",label:te("BUBBLE"),iconCssClasses:"icon-region-chart-bubble"},{value:"donut",label:te("DONUT"),iconCssClasses:"icon-region-chart-donut"},{value:"funnel",label:te("FUNNEL"),iconCssClasses:"icon-region-chart-funnel"},{value:"line",label:te("LINE"),iconCssClasses:"icon-region-chart-line"},{value:"lineWithArea",label:te("LINE_WITH_AREA"),iconCssClasses:"icon-region-chart-line-area"},{value:"pie",label:te("PIE"),iconCssClasses:"icon-region-chart-pie"},{value:"polar",label:te("POLAR"),iconCssClasses:"icon-region-chart-polar"},{value:"radar",label:te("RADAR"),iconCssClasses:"icon-region-chart-radar"},{value:"range",label:te("RANGE"),iconCssClasses:"icon-region-chart-range-bar"},{value:"scatter",label:te("SCATTER"),iconCssClasses:"icon-region-chart-scatter"},{value:"stock",label:te("STOCK"),iconCssClasses:"icon-region-chart-stock"}]}),e(_,{id:"CH_ORIENTATION",options:[{value:"vertical",label:te("VERTICAL")},{value:"horizontal",label:te("HORIZONTAL")}]}),e(_,{id:"CH_LABEL_COLUMN",options:r}),e(_,{id:"CH_VALUE_COLUMN",options:s}),e(_,{id:"CH_VALUE_FUNCTION",options:i}),e(_,{id:"CH_X_COLUMN",options:d}),e(_,{id:"CH_X_FUNCTION",options:i}),e(_,{id:"CH_Y_COLUMN",options:s}),e(_,{id:"CH_Y_FUNCTION",options:i}),e(_,{id:"CH_Z_COLUMN",options:s}),e(_,{id:"CH_Z_FUNCTION",options:i}),e(_,{id:"CH_OPEN_COLUMN",options:s}),e(_,{id:"CH_OPEN_FUNCTION",options:i}),e(_,{id:"CH_CLOSE_COLUMN",options:s}),e(_,{id:"CH_CLOSE_FUNCTION",options:i}),e(_,{id:"CH_HIGH_COLUMN",options:s}),e(_,{id:"CH_HIGH_FUNCTION",options:i}),e(_,{id:"CH_LOW_COLUMN",options:s}),e(_,{id:"CH_LOW_FUNCTION",options:i}),e(_,{id:"CH_VOLUME_COLUMN",options:s}),e(_,{id:"CH_VOLUME_FUNCTION",options:i}),e(_,{id:"CH_TARGET_COLUMN",options:s}),e(_,{id:"CH_TARGET_FUNCTION",options:i}),e(_,{id:"CH_SERIES_COLUMN",options:r}),e(_,{id:"CH_STACK",options:[{value:z,label:te("OFF")},{value:Y,label:te("ON")}]}),e(_,{id:"CH_SORT_BY",options:[]}),t._renderSortControls(e,"CH_SORT_"),e(f,{id:"CH_AXIS_LABEL_TITLE",maxChars:255}),e(f,{id:"CH_AXIS_VALUE_TITLE",maxChars:255}),e(f,{id:"CH_AXIS_VALUE_DECIMAL"})}),{viewDialog:!0,width:750,height:450,titleKey:"CHART",modelOptions:{fields:{id:{canHide:!1,hidden:!0,seq:0},type:{label:"TYPE",elementId:"CH_TYPE",seq:10,defaultValue:K},orientationId:{label:"ORIENTATION",elementId:"CH_ORIENTATION",seq:20,fieldColSpan:7,defaultValue:"vertical"},labelColumnId:{label:"LABEL_COLUMN",elementId:"CH_LABEL_COLUMN",seq:30,fieldColSpan:7,defaultValue:""},valueColumnId:{label:"VALUE_COLUMN",elementId:"CH_VALUE_COLUMN",seq:40,fieldColSpan:7,defaultValue:""},valueFunctionId:{label:"AGGREGATION",elementId:"CH_VALUE_FUNCTION",seq:45,fieldColSpan:5,defaultValue:""},xColumnId:{label:"X_COLUMN",elementId:"CH_X_COLUMN",seq:50,fieldColSpan:7,defaultValue:""},xFunctionId:{label:"AGGREGATION",elementId:"CH_X_FUNCTION",seq:55,fieldColSpan:5,defaultValue:""},yColumnId:{label:"Y_COLUMN",elementId:"CH_Y_COLUMN",seq:60,fieldColSpan:7,defaultValue:""},yFunctionId:{label:"AGGREGATION",elementId:"CH_Y_FUNCTION",seq:65,fieldColSpan:5,defaultValue:""},openColumnId:{label:"OPEN_COLUMN",elementId:"CH_OPEN_COLUMN",seq:70,fieldColSpan:7,defaultValue:""},openFunctionId:{label:"AGGREGATION",elementId:"CH_OPEN_FUNCTION",seq:75,fieldColSpan:5,defaultValue:""},closeColumnId:{label:"CLOSE_COLUMN",elementId:"CH_CLOSE_COLUMN",seq:80,fieldColSpan:7,defaultValue:""},closeFunctionId:{label:"AGGREGATION",elementId:"CH_CLOSE_FUNCTION",seq:85,fieldColSpan:5,defaultValue:""},highColumnId:{label:"HIGH_COLUMN",elementId:"CH_HIGH_COLUMN",seq:90,fieldColSpan:7,defaultValue:""},highFunctionId:{label:"AGGREGATION",elementId:"CH_HIGH_FUNCTION",seq:95,fieldColSpan:5,defaultValue:""},lowColumnId:{label:"LOW_COLUMN",elementId:"CH_LOW_COLUMN",seq:100,fieldColSpan:7,defaultValue:""},lowFunctionId:{label:"AGGREGATION",elementId:"CH_LOW_FUNCTION",seq:105,fieldColSpan:5,defaultValue:""},volumeColumnId:{label:"VOLUME_COLUMN",elementId:"CH_VOLUME_COLUMN",seq:110,fieldColSpan:7,defaultValue:""},volumeFunctionId:{label:"AGGREGATION",elementId:"CH_VOLUME_FUNCTION",seq:115,fieldColSpan:5,defaultValue:""},targetColumnId:{label:"TARGET_COLUMN",elementId:"CH_TARGET_COLUMN",seq:120,fieldColSpan:7,defaultValue:""},targetFunctionId:{label:"AGGREGATION",elementId:"CH_TARGET_FUNCTION",seq:125,fieldColSpan:5,defaultValue:""},zColumnId:{label:"Z_COLUMN",elementId:"CH_Z_COLUMN",seq:130,fieldColSpan:7,defaultValue:""},zFunctionId:{label:"AGGREGATION",elementId:"CH_Z_FUNCTION",seq:135,fieldColSpan:5,defaultValue:""},seriesColumnId:{label:"SERIES_COLUMN",elementId:"CH_SERIES_COLUMN",seq:140,fieldColSpan:7,defaultValue:""},stackId:{label:"STACK",elementId:"CH_STACK",seq:143,fieldColSpan:5,defaultValue:z},sortBy:{label:"SORT_BY",elementId:"CH_SORT_BY",seq:145,fieldColSpan:7,defaultValue:te("LABEL_COLUMN")},sortDirection:{label:"DIRECTION",elementId:"CH_SORT_DIRECTION",seq:147,fieldColSpan:3,defaultValue:y},sortNulls:{label:"NULLS",elementId:"CH_SORT_NULLS",seq:149,fieldColSpan:2,defaultValue:O},axisLabelTitle:{label:"AXIS_LABEL_TITLE",elementId:"CH_AXIS_LABEL_TITLE",seq:150,fieldColSpan:7},axisValueTitle:{label:"AXIS_VALUE_TITLE",elementId:"CH_AXIS_VALUE_TITLE",seq:170,fieldColSpan:7},axisValueDecimal:{label:"AXIS_VALUE_DECIMAL",elementId:"CH_AXIS_VALUE_DECIMAL",seq:180,fieldColSpan:3}}},init:function(i,n,o){var a,l,r={},s=t._getElement("CH_TYPE"),d=t._getElement("CH_ORIENTATION"),c=t._getElement("CH_LABEL_COLUMN"),u=t._getElement("CH_VALUE_COLUMN"),h=t._getElement("CH_X_COLUMN"),g=t._getElement("CH_Y_COLUMN"),p=t._getElement("CH_Z_COLUMN"),m=t._getElement("CH_OPEN_COLUMN"),f=t._getElement("CH_CLOSE_COLUMN"),_=t._getElement("CH_HIGH_COLUMN"),C=t._getElement("CH_LOW_COLUMN"),I=t._getElement("CH_VOLUME_COLUMN"),v=t._getElement("CH_TARGET_COLUMN"),E=t._getElement("CH_SERIES_COLUMN"),b=t._getElement("CH_STACK"),w=t._getElement("CH_AXIS_LABEL_TITLE"),A=t._getElement("CH_AXIS_VALUE_TITLE"),R=t._getElement("CH_AXIS_VALUE_DECIMAL"),T=t._getElement("CH_VALUE_FUNCTION"),S=t._getElement("CH_X_FUNCTION"),N=t._getElement("CH_Y_FUNCTION"),L=t._getElement("CH_Z_FUNCTION"),y=t._getElement("CH_OPEN_FUNCTION"),O=t._getElement("CH_CLOSE_FUNCTION"),k=t._getElement("CH_HIGH_FUNCTION"),V=t._getElement("CH_LOW_FUNCTION"),D=t._getElement("CH_VOLUME_FUNCTION"),M=t._getElement("CH_TARGET_FUNCTION"),x=t._getElement("CH_SORT_BY"),H=t._getElement("CH_SORT_DIRECTION"),G=t._getElement("CH_SORT_NULLS"),U=x.val();function F(){var t=s.val();switch(xe([d,c,u,h,g,p,m,f,_,C,I,v,E,b,w,A,R,T,S,N,L,y,O,k,V,D,M,x,H,G]),function(){var e=o.recordView("getRecord");function t(t,n){i.setValue(e,t,n)}t("sortBy",x.val()),t("sortDirection",H.val()),t("sortNulls",G.val()),t("orientationId",d.val()),t("stackId",b.val())}(),a=[d,c,u,E,b,T,w,A,R,x,H,G],l=[c,u,T,x,H,G],t){case"area":Me(a),Ge([c,u],!0),Ge([h,g,p,m,f,_,C],!1),x.empty(),(r={})[ae]=te("LABEL_COLUMN"),r[le]=te("VALUE_COLUMN"),e.each(r,(function(t,i){x.append(e("<option></option>").attr("value",t).text(i))}));break;case K:Me([d,c,u,p,E,b,T,L,w,A,R,x,H,G]),Ge([c,u],!0),Ge([h,g,p,m,f,_,C],!1),U=x.val(),x.empty(),(r={})[ae]=te("LABEL_COLUMN"),r[le]=te("VALUE_COLUMN"),r[de]=te("Z_COLUMN"),e.each(r,(function(t,i){x.append(e("<option></option>").attr("value",t).text(i))})),null===U&&""===U||x.val(U);break;case"bubble":Me([c,h,g,p,S,N,L,w,A,R,x,H,G]),Ge([c,h,g,p],!0),Ge([u,m,f,_,C],!1),U=x.val(),x.empty(),(r={})[ae]=te("LABEL_COLUMN"),r[re]=te("X_COLUMN"),r[se]=te("Y_COLUMN"),r[de]=te("Z_COLUMN"),e.each(r,(function(t,i){x.append(e("<option></option>").attr("value",t).text(i))})),null===U&&""===U||x.val(U);break;case"donut":Me([c,u,T,x,H,G,R]),Ge([c,u],!0),Ge([h,g,p,m,f,_,C],!1),U=x.val(),x.empty(),(r={})[ae]=te("LABEL_COLUMN"),r[le]=te("VALUE_COLUMN"),e.each(r,(function(t,i){x.append(e("<option></option>").attr("value",t).text(i))})),null===U&&""===U||x.val(U);break;case"funnel":Me([d,c,u,v,T,M,x,H,G]),Ge([c,u],!0),Ge([h,g,p,m,f,_,C],!1),U=x.val(),x.empty(),(r={})[ae]=te("LABEL_COLUMN"),r[le]=te("VALUE_COLUMN"),r[ce]=te("TARGET_COLUMN"),e.each(r,(function(t,i){x.append(e("<option></option>").attr("value",t).text(i))})),null===U&&""===U||x.val(U);break;case"line":case"lineWithArea":Me(a),Ge([c,u],!0),Ge([h,g,p,m,f,_,C],!1),U=x.val(),x.empty(),(r={})[ae]=te("LABEL_COLUMN"),r[le]=te("VALUE_COLUMN"),e.each(r,(function(t,i){x.append(e("<option></option>").attr("value",t).text(i))})),null===U&&""===U||x.val(U);break;case"pie":Me([c,u,T,R,x,H,G]),Ge([c,u],!0),Ge([h,g,p,m,f,_,C],!1);break;case"polar":case"radar":Me(l),Ge([c,u],!0),Ge([h,g,p,m,f,_,C],!1),U=x.val(),x.empty(),(r={})[ae]=te("LABEL_COLUMN"),r[le]=te("VALUE_COLUMN"),e.each(r,(function(t,i){x.append(e("<option></option>").attr("value",t).text(i))})),null===U&&""===U||x.val(U);break;case"range":Me([d,c,_,C,p,E,k,V,L,w,A,R,x,H,G]),Ge([_,C],!0),Ge([c,u,h,g,p,m,f],!1),U=x.val(),x.empty(),(r={})[ae]=te("LABEL_COLUMN"),r[ue]=te("HIGH_COLUMN"),r[he]=te("LOW_COLUMN"),r[de]=te("Z_COLUMN"),e.each(r,(function(t,i){x.append(e("<option></option>").attr("value",t).text(i))})),null===U&&""===U||x.val(U);break;case"stock":Me([c,m,f,_,C,I,y,O,k,V,D]),Ge([c,m,f,_,C],!0),Ge([u,h,g,p],!1);break;case"scatter":Me([c,h,g,E,S,N,w,A,R,x,H,G]),Ge([c,h,g],!0),Ge([u,p,m,f,_,C],!1),U=x.val(),x.empty(),(r={})[ae]=te("LABEL_COLUMN"),r[re]=te("X_COLUMN"),r[se]=te("Y_COLUMN"),e.each(r,(function(t,i){x.append(e("<option></option>").attr("value",t).text(i))})),null===U&&""===U||x.val(U)}}s.change(F),o.on("apexbeginrecordedit",(function(){var e=s.val();Le(t._getId("CH_TYPE"),e),F()}))},load:function(i){var n,o,a=e.extend({},t.getChart());for(n in a.axis&&(a.axis.label&&(a.axisLabelTitle=a.axis.label),a.axis.value&&(a.axisValueTitle=a.axis.value),a.axis.valueDecimalPlaces&&(a.axisValueDecimal=a.axis.valueDecimalPlaces),delete a.axis),a.stackId=a.stack,delete a.stack,a.orientationId=a.orientation,delete a.orientation,a.chartColumns)if(J(a.chartColumns,n))switch(o=a.chartColumns[n],n){case"LABEL":a.type in{bar:1,bubble:1,area:1,funnel:1,pie:1,donut:1,polar:1,radar:1,line:1,lineWithArea:1,range:1,stock:1,scatter:1}&&(a.labelColumnId=o.columnId,o.sort&&(a.sortBy="LABEL",a.sortDirection=o.sort.direction,a.sortNulls=o.sort.nulls));break;case"VALUE":a.valueColumnId=o.columnId,o.function&&(a.valueFunctionId=o.function),o.sort&&(a.sortBy="VALUE",a.sortDirection=o.sort.direction,a.sortNulls=o.sort.nulls);break;case"X":a.xColumnId=o.columnId,o.function&&(a.xFunctionId=o.function),o.sort&&(a.sortBy="X",a.sortDirection=o.sort.direction,a.sortNulls=o.sort.nulls);break;case"Y":a.yColumnId=o.columnId,o.function&&(a.yFunctionId=o.function),o.sort&&(a.sortBy="Y",a.sortDirection=o.sort.direction,a.sortNulls=o.sort.nulls);break;case"Z":a.zColumnId=o.columnId,o.function&&(a.zFunctionId=o.function),o.sort&&(a.sortBy="Z",a.sortDirection=o.sort.direction,a.sortNulls=o.sort.nulls);break;case"OPEN":a.openColumnId=o.columnId,o.function&&(a.openFunctionId=o.function);break;case"CLOSE":a.closeColumnId=o.columnId,o.function&&(a.closeFunctionId=o.function);break;case"HIGH":a.highColumnId=o.columnId,o.function&&(a.highFunctionId=o.function),o.sort&&(a.sortBy="HIGH",a.sortDirection=o.sort.direction,a.sortNulls=o.sort.nulls);break;case"LOW":a.lowColumnId=o.columnId,o.function&&(a.lowFunctionId=o.function),o.sort&&(a.sortBy="LOW",a.sortDirection=o.sort.direction,a.sortNulls=o.sort.nulls);break;case"VOLUME":a.volumeColumnId=o.columnId,o.function&&(a.volumeFunctionId=o.function);break;case"TARGET":a.targetColumnId=o.columnId,o.function&&(a.targetFunctionId=o),o.sort&&(a.sortBy="TARGET",a.sortDirection=o.sort.direction,a.sortNulls=o.sort.nulls);break;case"SERIES_NAME":a.seriesColumnId=o.columnId}delete a.chartColumns,i.setData(a)},validate:function(e,t,i){var n,a=!0,l=e.getRecord();return l.sortBy&&(n=l.sortBy.toLowerCase()+"ColumnId",J(l,n)?t(l.sortBy,"sortBy"):(i(l.sortBy,"sortBy",o.formatMessage("APEX.IG.INVALID_SORT_BY",l.sortBy)),a=!1)),a},store:function(i){var n,o,a,l,r,s,d,c,u,h,g,p,m=e.extend({},i.getRecord());m.axis={},m.axis={label:m.axisLabelTitle,value:m.axisValueTitle,valueDecimalPlaces:m.axisValueDecimal},delete m.axisLabelTitle,delete m.axisValueTitle,delete m.axisValueDecimal,m.stack=m.stackId,m.orientation=m.orientationId,m.chartColumns={},m.type in{bar:1,bubble:1,area:1,funnel:1,pie:1,donut:1,polar:1,radar:1,line:1,lineWithArea:1,range:1,stock:1,scatter:1}?m.labelColumnId&&(n={columnId:m.labelColumnId,columnType:v},m.sortBy===ae&&(n.sort={order:1,direction:m.sortDirection,nulls:m.sortNulls}),m.chartColumns.LABEL=n):delete m.chartColumns.LABEL,m.type in{bar:1,area:1,funnel:1,pie:1,donut:1,polar:1,radar:1,line:1,lineWithArea:1}?m.valueColumnId&&(o={columnId:m.valueColumnId,columnType:v},m.sortBy===le&&(o.sort={order:1,direction:m.sortDirection,nulls:m.sortNulls}),m.valueFunctionId&&(o.function=m.valueFunctionId),m.chartColumns.VALUE=o):delete m.chartColumns.VALUE,m.type in{bubble:1,scatter:1}?(m.xColumnId&&(a={columnId:m.xColumnId,columnType:v},"X"===m.sortBy&&(a.sort={order:1,direction:m.sortDirection,nulls:m.sortNulls}),m.xFunctionId&&(a.function=m.xFunctionId),m.chartColumns.X=a),m.yColumnId&&(l={columnId:m.yColumnId,columnType:v},"Y"===m.sortBy&&(l.sort={order:1,direction:m.sortDirection,nulls:m.sortNulls}),m.yFunctionId&&(l.function=m.yFunctionId),m.chartColumns.Y=l)):(delete m.chartColumns.X,delete m.chartColumns.Y),m.type in{bar:1,bubble:1}?m.zColumnId&&(r={columnId:m.zColumnId,columnType:v},"Z"===m.sortBy&&(r.sort={order:1,direction:m.sortDirection,nulls:m.sortNulls}),m.zFunctionId&&(r.function=m.zFunctionId),m.chartColumns.Z=r):delete m.chartColumns.Z,"stock"===m.type?(m.openColumnId&&(s={columnId:m.openColumnId,columnType:v},m.openFunctionId&&(s.function=m.openFunctionId),m.chartColumns.OPEN=s),m.closeColumnId&&(d={columnId:m.closeColumnId,columnType:v},m.closeFunctionId&&(d.function=m.closeFunctionId),m.chartColumns.CLOSE=d),m.volumeColumnId&&(h={columnId:m.volumeColumnId,columnType:v},m.volumeFunctionId&&(h.function=m.volumeFunctionId),m.chartColumns.VOLUME=h)):(delete m.chartColumns.OPEN,delete m.chartColumns.CLOSE,delete m.chartColumns.VOLUME),m.type in{range:1,stock:1}?(m.highColumnId&&(c={columnId:m.highColumnId,columnType:v},"HIGH"===m.sortBy&&(c.sort={order:1,direction:m.sortDirection,nulls:m.sortNulls}),m.highFunctionId&&(c.function=m.highFunctionId),m.chartColumns.HIGH=c),m.lowColumnId&&(u={columnId:m.lowColumnId,columnType:v},"LOW"===m.sortBy&&(u.sort={order:1,direction:m.sortDirection,nulls:m.sortNulls}),m.lowFunctionId&&(u.function=m.lowFunctionId),m.chartColumns.LOW=u)):(delete m.chartColumns.HIGH,delete m.chartColumns.LOW),"funnel"===m.type?m.targetColumnId&&(g={columnId:m.targetColumnId,columnType:v},"TARGET"===m.sortBy&&(g.sort={order:1,direction:m.sortDirection,nulls:m.sortNulls}),m.targetFunctionId&&(g.function=m.targetFunctionId),m.chartColumns.TARGET=g):delete m.chartColumns.TARGET,m.seriesColumnId&&(p={columnId:m.seriesColumnId,columnType:v},m.chartColumns.SERIES_NAME=p),delete m.sortBy,delete m.sortDirection,delete m.sortNulls,delete m.stackId,delete m.orientationId,delete m.xColumnId,delete m.xFunctionId,delete m.yFunctionId,delete m.yColumnId,delete m.valueColumnId,delete m.valueFunctionId,delete m.labelColumnId,delete m.zColumnId,delete m.zFunctionId,delete m.openColumnId,delete m.openFunctionId,delete m.closeColumnId,delete m.closeFunctionId,delete m.volumeColumnId,delete m.volumeFunctionId,delete m.highColumnId,delete m.highFunctionId,delete m.lowColumnId,delete m.lowFunctionId,delete m.targetColumnId,delete m.targetFunctionId,delete m.seriesColumnId,t.setChart(m)}})},setColumnConfig:function(t){var i,n,o,a,l,r={},s={},d=t.baseModelColumns,c=t.ig,u=t.igConfig,h=t.currentReportSettings.views.chart.chartColumns,g=["CLOSE","HIGH","LABEL","LOW","OPEN","SERIES_NAME","TARGET","VALUE","VOLUME","X","Y","Z"],p=0;for(l=0;l<g.length;l++)J(h,o=g[l])&&((r=e.extend(!0,{},d[h[o].columnId])).seq=p,r.index=p,s[o]=r,p+=1);if(u.parentRegionStaticId)for(n in d)J(d,n)&&(a=d[n]).parentField&&(i=c._getColumn(n),(r=e.extend(!0,{},a)).seq=p,r.virtual=!0,delete r.index,s[i.name]=r,p+=1);this.modelColumns=s,this.specialColumns={}},initView:function(t){var i,n,o,a,l,r,s,d,c,u,h=t.ig,g=this,p=h._currentReportSettings().views.chart,m=t.igConfig,f=[],_="disabled";require(["ojs/ojcore","ojs/ojchart","ojs/ojvalidation"],(function(t){function C(i){var n,o=t.ConverterFactory.CONVERTER_TYPE_NUMBER,a=h._getColumn(i);return a.filter.dataType===X||a.filter.dataType===q||a.filter.dataType===$||a.filter.dataType===W?(o=t.ConverterFactory.CONVERTER_TYPE_DATETIME,n=function(t){var i=t.appearance.formatMask;i?e.each(pe,(function(e,t){t.value===i&&(i=t.label)})):i={formatType:"date",dateFormat:"medium"};return i}(a)):a.filter.dataType===B&&(n=function(t){var i,n=t.appearance.formatExample.trim();p.axis&&p.axis.valueDecimalPlaces&&(i=p.axis.valueDecimalPlaces);n?e.each(ge,(function(e,t){t.value===n&&(n=t.label)})):n={style:"decimal",maximumFractionDigits:i||2};return n}(a)),n?t.Validation.converterFactory(o).createConverter(n):{}}switch(p.chartColumns.LABEL.columnId&&((l=h._getColumn(p.chartColumns.LABEL.columnId)).filter.dataType!==X&&l.filter.dataType!==q&&l.filter.dataType!==$&&l.filter.dataType!==W||(_="enabled")),n={legend:{rendered:j,position:"end"},orientation:p.orientation,stack:p.stack,animationOnDisplay:j,animationOnDataChange:j,hoverBehavior:"dim",groups:[],series:[],valueFormats:[],timeAxisType:_,translations:{labelNoData:m.text.noDataFound}},p.type){case"area":case K:o=e.extend({},n,{type:p.type,legend:p.chartColumns.SERIES_NAME?{rendered:j}:{rendered:z},coordinateSystem:"cartesian",valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"y",converter:C(p.chartColumns.VALUE.columnId)}],xAxis:{},yAxis:{}});break;case"bubble":o=e.extend({},n,{type:p.type,legend:{rendered:z},coordinateSystem:"cartesian",xAxis:{},yAxis:{}});break;case"donut":o=e.extend({},n,{type:"pie",styleDefaults:{pieInnerRadius:.5},legend:{rendered:j},hideAndShowBehavior:"withRescale",valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"value",converter:C(p.chartColumns.VALUE.columnId)}]});break;case"pie":o=e.extend({},n,{type:p.type,styleDefaults:{pieInnerRadius:0},legend:{rendered:j},hideAndShowBehavior:"withRescale",valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"value",converter:C(p.chartColumns.VALUE.columnId)}]});break;case"funnel":o=e.extend({},n,{type:p.type,legend:{rendered:j},valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"value",converter:C(p.chartColumns.VALUE.columnId)}]}),p.chartColumns.TARGET&&o.valueFormats.push({type:"target",converter:C(p.chartColumns.TARGET.columnId)});break;case"line":case"lineWithArea":o=e.extend({},n,{type:p.type,legend:p.chartColumns.SERIES_NAME?{rendered:j}:{rendered:z},coordinateSystem:"cartesian",valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"value",converter:C(p.chartColumns.VALUE.columnId)}],xAxis:{},yAxis:{}});break;case"polar":o=e.extend({},n,{type:K,coordinateSystem:p.type,legend:{rendered:z},valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"value",converter:C(p.chartColumns.VALUE.columnId)}],polarGridShape:"circle",stack:Y});break;case"radar":o=e.extend({},n,{type:"area",coordinateSystem:"polar",legend:{rendered:z},valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"value",converter:C(p.chartColumns.VALUE.columnId)}],polarGridShape:"polygon",stack:Y});break;case"range":o=e.extend({},n,{type:K,legend:p.chartColumns.SERIES_NAME?{rendered:j}:{rendered:z},valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"high",converter:C(p.chartColumns.HIGH.columnId)},{type:"low",converter:C(p.chartColumns.LOW.columnId)}],xAxis:{},yAxis:{}});break;case"scatter":o=e.extend({},n,{type:p.type,legend:p.chartColumns.SERIES_NAME?{rendered:j}:{rendered:z},coordinateSystem:"cartesian",valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"x",converter:C(p.chartColumns.X.columnId)},{type:"y",converter:C(p.chartColumns.Y.columnId)}],xAxis:{},yAxis:{}});break;case"stock":o=e.extend({},n,{type:p.type,zoomAndScroll:"delayed",initialZooming:"first",legend:{rendered:j},dataCursor:Y,dataCursorBehavior:"smooth",valueFormats:[{type:M,converter:C(p.chartColumns.LABEL.columnId)},{type:"high",converter:C(p.chartColumns.HIGH.columnId)},{type:"low",converter:C(p.chartColumns.LOW.columnId)},{type:"open",converter:C(p.chartColumns.OPEN.columnId)},{type:"close",converter:C(p.chartColumns.CLOSE.columnId)}],xAxis:{},yAxis:{}}),p.chartColumns.VOLUME&&o.valueFormats.push({type:"volume",converter:C(p.chartColumns.VOLUME.columnId)}),o.series.type="candlestick"}if(p.type in{area:1,bar:1,bubble:1,line:1,lineWithArea:1,range:1,stock:1,scatter:1}){switch(p.type){case"stock":r=p.chartColumns.OPEN.columnId;break;case"range":r=p.chartColumns.HIGH.columnId;break;case"scatter":case"bubble":r=p.chartColumns.X.columnId;break;default:r=p.chartColumns.VALUE.columnId}p.axis&&(p.axis.label&&(s=p.axis.label),p.axis.value&&(d=p.axis.value)),o.xAxis={title:s,baselineScaling:"zero",majorTick:{rendered:Y},minorTick:{rendered:z},tickLabel:{rendered:Y,converter:C(p.chartColumns.LABEL.columnId),scaling:k},position:j,rotation:z},o.yAxis={title:d,baselineScaling:"zero",position:"stock"===p.type?"end":j,majorTick:{rendered:Y},minorTick:{rendered:z},tickLabel:{rendered:Y,converter:C(r),scaling:k}}}if(p.type in{bar:1,area:1,polar:1,radar:1,range:1,line:1,lineWithArea:1,bubble:1,scatter:1,stock:1}){switch(i={path:"groups",uniqueIndexField:"LABEL",item:{name:"LABEL"}},p.type){case"bubble":a={name:"LABEL",x:"X",y:"Y",z:"Z",labelPosition:"'none'"};break;case"scatter":a={name:"LABEL",x:"X",y:"Y",labelPosition:"'none'"};break;case"stock":a={name:"LABEL",open:"OPEN",close:"CLOSE",high:"HIGH",low:"LOW",volume:"VOLUME"};break;case"range":a={name:"LABEL",high:"HIGH",low:"LOW",labelPosition:"'none'"};break;default:a={label:"VALUE",value:"VALUE",name:"LABEL",labelPosition:"'none'"}}f=p.chartColumns.SERIES_NAME?[i,{path:"series",uniqueIndexField:"SERIES_NAME",item:{name:"SERIES_NAME",displayInLegend:Y}},{path:"series/[SERIES_NAME]/items",item:a}]:[i,{path:"series/0/items",item:a}]}if(p.type in{pie:1,donut:1,funnel:1}&&(c=g.model.getFieldKey("LABEL"),f=[{path:"series",uniqueIndexField:"LABEL",item:function(e,t){return{name:""+t[c],displayInLegend:Y}}},{path:"series/[LABEL]/items",item:{value:"VALUE",targetValue:"TARGET"}}]),p.chartColumns.VALUE){if(p.chartColumns.VALUE.sort)switch(p.chartColumns.VALUE.sort.direction){case"asc":u="ascending";break;case"desc":u="descending"}}else p.chartColumns.LABEL.sort?u="label-"+p.chartColumns.LABEL.sort.direction:(p.chartColumns.SERIES_NAME&&(u="label-asc"),u="off");o.sorting=u,g._dataTransformOptions={showNullAs:m.appearance.showNullValue,offset:0,template:f},g._chartOptions=o,g._updateChartData(),g.view$.ojChart(o).css({"max-width":"100%"}),g._subscribeModel(),(m.lazyLoad||g.model.getTotalRecords()<0)&&g.refresh()}))},_updateChartData:function(){var t;if(t=this.model.transform(this._dataTransformOptions,this._chartOptions),-1===e.inArray(t.type,["pie","funnel","scatter","bubble","stock","polar","radar"])&&t.series.length>1&&"mixedFrequency"!==t.timeAxisType&&"skipGaps"!==t.timeAxisType){u.chartSortArray(t.groups,t.sorting);for(var i=0;i<t.series.length;i++)u.chartFillGaps(t.groups,t.series[i].items,t.sorting,!0)}},_subscribeModel:function(){var e=this,t=this.view$;this._observedModel&&this._observedModel.unSubscribe(this._observerId),this._observedModel=this.model,this._observerId=this.model.subscribe({viewId:t[0].id,onChange:function(t){"refresh"===t&&e.refresh()},progressView:t})},refresh:function(){var e=this;if(this.view$.hasClass("oj-chart")){if(null===this.view$[0].offsetParent)return void(this._pendingRefresh=!0);this._pendingRefresh=!1,this.model.fetch(0,(function(t){t&&i.warn("No data fetched for chart"),e._updateChartData(),e.resize()}))}},resize:function(){if(this.view$.hasClass("oj-chart")){if(this._pendingRefresh)return void this.refresh();this.view$.ojChart("refresh")}},destroyView:function(){this.model&&this.model.unSubscribe(this.view$[0].id),this.view$.ojChart("destroy")},setModelName:function(){this._subscribeModel(),this.view$.hasClass("oj-chart")&&(this.model.getTotalRecords()<0?this.refresh():(this._updateChartData(),this.resize()))},setNoDataMessage:function(e){var t=this.view$;t.hasClass("oj-chart")&&t.ojChart(w,"translations.labelNoData",e)}})}(apex.jQuery,apex.util,apex.debug,apex.server,apex.lang,apex.actions,apex.region,apex.theme,apex.message,apex.item,apex.model,apex.widget.util,apex.locale,apex.navigation);