@mescius/spread-sheets-ai-addon 18.2.1 → 18.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* SpreadJS Library 18.2.
|
|
3
|
+
* SpreadJS Library 18.2.2
|
|
4
4
|
*
|
|
5
5
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
6
6
|
*
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* https://developer.mescius.com/spreadjs
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
!function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("@mescius/spread-sheets")):"function"==typeof define&&define.amd?define(["@mescius/spread-sheets"],t):"object"==typeof exports?exports.Spread=t(require("@mescius/spread-sheets")):t(GC)}((function(t){!function(){var n,e={"./dist/plugins/ai/agents/formula/explain-formula.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},l=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function f(t,n,e){return c(this,void 0,void 0,(function(){var i,r,a,c;return l(this,(function(l){switch(l.label){case 0:return i=u(),r=i.Formula_Exp_Sys+(0,s.tio)(t),a=i.Formula_Exp_User+n,[4,(0,o.nio)(t,r,a,{stream:!0})];case 1:return c=l.sent(),[2,(0,o.eio)(c,e)]}}))}))}Object.defineProperty(n,"__esModule",{value:!0}),n.iio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/agents/util.js"),s=e("./dist/plugins/ai/agents/formula/generate-formula.js"),a=new i.Common.ResourceManager(r.SR,"AI"),u=a.getResource.bind(a),n.iio=f},"./dist/plugins/ai/agents/formula/generate-formula.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},f=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function d(t,n){return l(this,void 0,void 0,(function(){var e,i,r,o;return f(this,(function(s){switch(s.label){case 0:return e=c(),i=e.Formula_Gen_Sys+h(t)+e.Formula_Gen_Exclude,r=e.Formula_Gen_User+n,[4,(0,a.nio)(t,i,r)];case 1:return o=s.sent(),[2,(0,a.eio)(o)]}}))}))}function h(t){var n=t.getAIContext(),e=t.getActiveSheet();return e?(n+=e.getAIContext(),n+=(0,o.oio)(e,s.TableContextArgs.all&~s.TableContextArgs.data)):n}Object.defineProperty(n,"__esModule",{value:!0}),n.tio=n.sio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/context/table.js"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/agents/util.js"),u=new i.Common.ResourceManager(r.SR,"AI"),c=u.getResource.bind(u),n.sio=d,n.tio=h},"./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},d=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function h(t,n,e,o){return f(this,void 0,void 0,(function(){var s,a,u,c;return d(this,(function(f){switch(f.label){case 0:return i?(s=l(),a=s.PT_Layout_Exp_Sys,a+=n.getAIContext(p(n)),u=s.PT_Layout_Exp_User,e&&(u+=s.PT_Layout_Exp_User_REQ+e),[4,(0,r.nio)(t,a,u,{stream:!0})]):[2,l().ERROR_NO_PACKAGE+"Pivot Table"];case 1:return c=f.sent(),[2,(0,r.eio)(c,o)]}}))}))}function p(t){var n=t.getRange().content,e=s.PivotTableContextArgs.all;return n.rowCount*n.colCount>u.PT_CONST.MAX_DATA_LENGTH&&(e=e&~s.PivotTableContextArgs.data|s.PivotTableContextArgs.totalData),e}Object.defineProperty(n,"__esModule",{value:!0}),n.rio=n.aio=void 0,i=e("PivotTable"),r=e("./dist/plugins/ai/agents/util.js"),o=e("Common"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/ai.ns.js"),u=e("./dist/plugins/ai/ai-constants.js"),c=new o.Common.ResourceManager(a.SR,"AI"),l=c.getResource.bind(c),n.aio=h,n.rio=p},"./dist/plugins/ai/agents/pivot-table/generate-pivot-layout-suggestion.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},h=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function p(t,n,e,i){return d(this,void 0,void 0,(function(){var r,l,d,p,g;return h(this,(function(h){switch(h.label){case 0:if(!a)return[2,f().ERROR_NO_PACKAGE+"Pivot Table"];r=f();try{l=n?n.getAIContext(e||o.PivotTableContextArgs.source):(0,u.uio)(t,o.PivotTableContextArgs.source)}catch(t){return[2,r.ERROR_CANNOT_FIND_PIVOT_TABLE]}return d="".concat(r.PT_Layout_Sug_Sys).concat(l),i&&(d+=(0,c.Vi)(r.PT_Layout_Sug_History,[r.REPLACE_MAP.SUG_HISTORY],[i])),p="".concat(r.PT_Layout_Sug_User),[4,(0,s.nio)(t,d,p)];case 1:return g=h.sent(),[2,(0,s.eio)(g)]}}))}))}Object.defineProperty(n,"__esModule",{value:!0}),n.cio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/interface.js"),s=e("./dist/plugins/ai/agents/util.js"),a=e("PivotTable"),u=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js"),c=e("./dist/plugins/ai/context/util.js"),l=new i.Common.ResourceManager(r.SR,"AI"),f=l.getResource.bind(l),n.cio=p},"./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},f=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function d(t,n,e,i){return l(this,void 0,void 0,(function(){var r,u,l,d,p;return f(this,(function(f){switch(f.label){case 0:if(!s)return[2,c().ERROR_NO_PACKAGE+"Pivot Table"];r=c();try{u=e?e.getAIContext(i||(0,a.rio)(e)):h(t,(0,a.rio)(e))}catch(t){return[2,r.ERROR_CANNOT_FIND_PIVOT_TABLE]}return l="".concat(r.PT_Layout_Gen_Sys).concat(u).concat(r.PT_Layout_Example),d="".concat(r.PT_Layout_Gen_User).concat(n),[4,(0,o.nio)(t,l,d)];case 1:return p=f.sent(),[2,(0,o.eio)(p)]}}))}))}function h(t,n){var e,i,r,o,a;if(!s)return c().ERROR_NO_PACKAGE+"Pivot Table";if(i=(e=t.getActiveSheet()).getActiveRowIndex(),r=e.getActiveColumnIndex(),!(o=e.pivotTables.all()).length)throw new Error;return(a=e.pivotTables.findPivotTable(i,r)||o[0]).getAIContext(n)}Object.defineProperty(n,"__esModule",{value:!0}),n.uio=n.lio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/agents/util.js"),s=e("PivotTable"),a=e("./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js"),u=new i.Common.ResourceManager(r.SR,"AI"),c=u.getResource.bind(u),n.lio=d,n.uio=h},"./dist/plugins/ai/agents/query/query.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},l=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function f(t,n,e){return c(this,void 0,void 0,(function(){var i,r,o,a;return l(this,(function(c){switch(c.label){case 0:return i=u(),r="".concat(i.Query_Sys," ").concat(d(t)),o="".concat(i.Query_User_Context," ").concat(n,"\n").concat(e,"\n").concat(i.Query_User_Keep_Structure),[4,(0,s.nio)(t,r,o)];case 1:return a=c.sent(),[2,(0,s.eio)(a)]}}))}))}function d(t){var n=t.getAIContext(r.WorkbookContextArgs.sheetNames|r.WorkbookContextArgs.activeSheet),e=t.getActiveSheet();return n+=e.getAIContext(r.WorksheetContextArgs.selections|r.WorksheetContextArgs.axisInfo)}Object.defineProperty(n,"__esModule",{value:!0}),n.fio=void 0,i=e("Common"),r=e("./dist/plugins/ai/interface.js"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/agents/util.js"),a=new i.Common.ResourceManager(o.SR,"AI"),u=a.getResource.bind(a),n.fio=f},"./dist/plugins/ai/agents/textSentiment/text-sentiment.js":function(t,n,e){"use strict";var i,r,o,s,a,u=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},c=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function l(t,n){return u(this,void 0,void 0,(function(){var e,i,r,s;return c(this,(function(u){switch(u.label){case 0:return e=a(),i=e.TextSentiment_Sys,r="".concat(e.TextSentiment_User," ").concat(n),[4,(0,o.nio)(t,i,r)];case 1:return s=u.sent(),[2,(0,o.eio)(s)]}}))}))}Object.defineProperty(n,"__esModule",{value:!0}),n.hio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/agents/util.js"),s=new i.Common.ResourceManager(r.SR,"AI"),a=s.getResource.bind(s),n.hio=l},"./dist/plugins/ai/agents/translate/translate.js":function(t,n,e){"use strict";var i,r,o,s,a,u=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},c=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function l(t,n,e){return u(this,void 0,void 0,(function(){var i,r,s,u;return c(this,(function(c){switch(c.label){case 0:return i=a(),r=i.Translate_Sys,s="".concat(i.Translate_User_Text).concat(n).concat(i.Translate_User_To," ").concat(e),[4,(0,o.nio)(t,r,s)];case 1:return u=c.sent(),[2,(0,o.eio)(u)]}}))}))}Object.defineProperty(n,"__esModule",{value:!0}),n.dio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/agents/util.js"),s=new i.Common.ResourceManager(r.SR,"AI"),a=s.getResource.bind(s),n.dio=l},"./dist/plugins/ai/agents/util.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h,p,g,v,m,y,b,w,S,A=this&&this.nJr||function(){return A=Object.assign||function(t){var n,e,i,r;for(e=1,i=arguments.length;e<i;e++)for(r in n=arguments[e])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},A.apply(this,arguments)},T=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},j=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function E(t,n){return T(this,void 0,void 0,(function(){return j(this,(function(e){try{if(m(t))return[2,x(t,n)];if(y(t))return[2,R(t,n)];if(v(t))return[2,C(t)];if(b(t))return[2,O(t)];throw new Error(c().ERROR_UNSUPPORTED_TYPE)}catch(t){throw new Error("".concat(c().ERROR_RESPONSE_FAILED).concat(t.message))}}))}))}function _(t,n,e,i){return T(this,void 0,void 0,(function(){return j(this,(function(r){return n+=(0,a.pio)(),[2,t.aiCaller.fetchAI(A({messages:[{role:"system",content:n},{role:"user",content:e}]},i))]}))}))}function C(t){var n=S(t,p);if(n)return n;throw new Error(c().ERROR_NO_CONTENT)}function O(t){var n,e;try{return n=(0,r.parseJSON)(t),(e=S(n,p))||(t.includes(l)?N(t):t)}catch(n){return t}}function x(t,n){return T(this,void 0,void 0,(function(){var e,i;return j(this,(function(r){switch(r.label){case 0:return(e=t.headers.get("content-type")||h).includes(d)?[2,R(t.body,n)]:[4,t.text()];case 1:return[2,O(i=r.sent())]}}))}))}function N(t){var n,e,i,o,s,a,u=h,c=t.split("\n");for(n=0,e=c;n<e.length;n++)if(i=e[n],!w(i)){if((o=i.slice(l.length).trim())===f)break;try{s=(0,r.parseJSON)(o),(a=S(s,g))&&(u+=a)}catch(t){}}return u}function R(t,n){return T(this,void 0,void 0,(function(){var e,i,o,s,a,u,c,d,p,v,m,y,b,A,T;return j(this,(function(j){switch(j.label){case 0:e=h,i=h,o=t.getReader(),s=new TextDecoder,a=!1,j.label=1;case 1:j.trys.push([1,,5,6]),j.label=2;case 2:return a?[3,4]:[4,o.read()];case 3:if(u=j.sent(),c=u.done,d=u.value,c)return[3,4];for(i+=s.decode(d,{stream:!0}),p=i.split("\n"),i=p.pop()||h,v=0,m=p;v<m.length;v++)if(y=m[v],!w(y)){if((b=y.slice(l.length).trim())===f)return[2,e];b&&(A=(0,r.parseJSON)(b),(T=S(A,g))&&(e+=T,a=null==n?void 0:n({deltaData:T,wholeData:e})))}return[3,2];case 4:return i.trim()&&i.startsWith(l)&&I(i,e,n),[2,e];case 5:return o.releaseLock(),[7];case 6:return[2]}}))}))}function I(t,n,e){var i,o,s,a;try{if((i=t.slice(l.length).trim())&&i!==f&&(o=(0,r.parseJSON)(i),s=S(o,g)))return a=n+s,null==e||e({deltaData:s,wholeData:a}),a}catch(t){}return n}function L(t){var n,e,i=document.createElement(o.HTML_CONST.DIV);i.innerHTML=t,document.body.appendChild(i),(n=document.createRange()).selectNodeContents(i),(e=window.getSelection()).removeAllRanges(),e.addRange(n);try{document.execCommand("copy")}catch(t){}e.removeAllRanges(),document.body.removeChild(i)}Object.defineProperty(n,"__esModule",{value:!0}),n.Yio=n.nio=n.eio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai-common.js"),o=e("./dist/plugins/ai/ai-constants.js"),s=e("./dist/plugins/ai/ai.ns.js"),a=e("./dist/plugins/ai/context/util.js"),u=new i.Common.ResourceManager(s.SR,"AI"),c=u.getResource.bind(u),l="data: ",f="[DONE]",d="text/event-stream",h="",p="choices.0.message.content",g="choices.0.delta.content",v=function(t){return"object"==typeof t&&null!==t},m=function(t){return v(t)&&"body"in t&&"headers"in t},y=function(t){return v(t)&&"getReader"in t},b=function(t){return"string"==typeof t},w=function(t){return!t.trim()||!t.startsWith(l)},S=function(t,n){return n.split(".").reduce((function(t,n){return null==t?void 0:t[n]}),t)},n.eio=E,n.nio=_,n.Yio=L},"./dist/plugins/ai/ai-common.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l;function f(t,n,e){var i,o,s,a,u;return void 0===e&&(e=!1),i=r.PT_CONST.BTN_CLASS,o=r.HTML_CONST.DIV,s=r.HTML_CONST.CLASS,a=r.HTML_CONST.TITLE,u=r.COMMON_CONST.ICON_CLASS,"<".concat(o," ").concat(s,'="').concat(e?i+" ":"").concat(u," ").concat(t,'" ').concat(a,'="').concat(n,'"></').concat(o,">")}function d(t){var n=r.COMMON_CONST.LOADING_MASK_CLASS,e=r.COMMON_CONST.LOADING_SPIN_CLASS,i=r.HTML_CONST.DIV,o=r.HTML_CONST.CLASS,s=l.En(i,null,null,n,t);return s.html("\n <".concat(i," ").concat(o,'="').concat(n,'">\n <').concat(i," ").concat(o,'="').concat(e,'"></').concat(i,">\n </").concat(i,">\n ")),function(){s.remove()}}function h(t){var n=r.COMMON_CONST.LOADING_MASK_CLASS,e=l(t).find(".".concat(n));e&&e.remove()}function p(t,n,e){return!!t.includes(c().AI_ERROR)&&(a.ErrorOverlay.show(n,g(e)),!0)}function g(t,n){void 0===n&&(n="TopRight");var e=t.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height,type:n}}function v(t){if(!t)return r.keyword_null;try{return JSON.parse(t)}catch(e){try{if(t.length>r.MAX_JSON_LENGTH)throw new Error("JSON string is too large to process.");var n=t;return n=(n=(n=(n=(n=(n=n.replace(/(['"]?)(\w+)\1(\s*):(\s*)/g,'"$2"$3:$4')).replace(/:(\s*)'([^']*)'/g,(function(t,n,e){return":".concat(n,'"').concat(e,'"')}))).replace(/([{,])(\s*)([a-zA-Z_]\w*)(\s*):/g,'$1$2"$3"$4:')).replace(/,(?=\s*[}\]])/g,"")).replace(/:(\s*)(\w+)(\s*[,}])/g,':"$2"$3')).replace(/(:\s*)(True|False|None)/g,(function(t,n,e){switch(e){case"True":return n+"true";case"False":return n+"false";case"None":return n+"null"}})),JSON.parse(n)}catch(t){throw new Error(t)}}}Object.defineProperty(n,"__esModule",{value:!0}),n.parseJSON=n.getGenerateErrorDialogPosition=n.gio=n.vio=n.mio=n.yio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai-constants.js"),o=e("Core"),s=e("./dist/plugins/ai/ai.ns.js"),a=e("./dist/plugins/ai/error-overlay.js"),u=new i.Common.ResourceManager(s.SR,"AI"),c=u.getResource.bind(u),l=o.GC$,n.yio=f,n.mio=d,n.vio=h,n.gio=p,n.getGenerateErrorDialogPosition=g,n.parseJSON=v},"./dist/plugins/ai/ai-constants.js":function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.keyword_undefined=n.keyword_null=n.HTML_CONST=n.EVENT_CONST=n.COMMON_CONST=n.FORMULA_CONST=n.PT_CONST=n.MAX_JSON_LENGTH=n.AI_Formula_Panel_NS=n.AI_Pivot_Panel_NS=void 0,n.AI_Pivot_Panel_NS=".pt-ai-panel",n.AI_Formula_Panel_NS=".formula-ai-panel";var e="gc-ai-",i=e+"pt-",r=e+"text-header-",o=e+"formula-generator-",s=e+"formula-explain-",a=e+"formula-header-";n.MAX_JSON_LENGTH=1e4,n.PT_CONST={MAX_DATA_LENGTH:2e3,PANEL_ALL_CLASS:"gc-panel-all",PANEL_ADDON_CLASS:"gc-panel-addon",PANEL_SHOW_RIGHT_CLASS:"gc-panel-show-right",BTN_CLASS:i+"button",CAPSULE_CLASS:i+"capsule",GEN_CLASS:i+"gen",GEN_SPIN_LINE_CLASS:i+"gen-spinner-line",SUG_CONTAINER_CLASS:i+"sug-container",SUG_DROPDOWN_CLASS:i+"sug-dropdown",SUG_DROPDOWN_HEADER_CLASS:i+"sug-dropdown-header",SUG_ITEM_CLASS:i+"sug-item",SUG_ITEM_CONTAINER_CLASS:i+"sug-item-container",ANA_CLASS:i+"ana",ANA_CONTAINER_CLASS:i+"analyze-container",ANA_BUTTONS_CLASS:i+"analyze-buttons",MAX_SUGGESTIONS:5},n.FORMULA_CONST={GENERATOR_CLASS:o,GENERATOR_CONTAINER_CLASS:o+"container",GENERATOR_BUTTON_CONTAINER_CLASS:o+"button-container",EXPLAIN_CLASS:s,EXPLAIN_CONTAINER_CLASS:s+"container",EXPLAIN_CONTENT_CLASS:s+"content",EXPLAIN_CONTENT_CONTAINER_CLASS:s+"content-container",EXPLAIN_BUTTON_CLASS:s+"button",EXPLAIN_BUTTON_CONTAINER_CLASS:s+"button-container",EDITOR_CONTAINER_CLASS:e+"formula-editor-container",ASSISTANT_AREA_CLASS:e+"assistant-area",FORMULA_EDITOR_THEME:e+"formula-editor-theme",OPEN_BUTTON_CLASS:e+"open-button",RESIZE_HANDLE_CLASS:e+"resize-handle",HEADER_CLASS:a,DEFAULT_ASSISTANT_AREA_HEIGHT:200,MIN_EDITOR_CONTAINER_HEIGHT:60,PROMPT_TEXT_COLOR:"gray",INPUT_TEXT_COLOR:"black"},n.COMMON_CONST={ICON_CLASS:e+"icon",ICON_DISABLED_CLASS:e+"icon-disabled",ICON_BACKGROUND_CLASS:e+"icon-background",TEXT_CLASS:e+"text",TEXT_CONTAINER_CLASS:e+"text-container",TEXT_ICON_CLASS:e+"text-container-icons",TEXT_HEADER_CLASS:e+"text-header",TEXT_HEADER_LEFT_CLASS:r+"left",TEXT_HEADER_RIGHT_CLASS:r+"right",TEXT_HEADER_TITLE_CLASS:r+"title",HIDE_CLASS:e+"hide",SEPARATOR_CLASS:e+"separator",LOADING_MASK_CLASS:e+"loading-mask",LOADING_SPIN_CLASS:e+"spinner",GENERATE:e+"generate",ANALYZE:e+"analyze",CLOSE:e+"close",BACK:e+"back",SEND:e+"send",COPY:e+"copy",COPIED:e+"copied",RESET:e+"reset",REFRESH:e+"refresh",ARROW_UP:e+"arrow-up",STOP:e+"stop",AI:e+"ai"},n.EVENT_CONST={CLICK:"click",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEMOVE:"mousemove",INPUT:"input",KEYDOWN:"keydown",FOCUS:"focus",BLUR:"blur",KEYUP:"keyup",TRANSITION:"transition",TRANSITIONEND:"transitionend",PASTE:"paste"},n.HTML_CONST={ACTIVE_CLASS:"active",HEIGHT:"height",LOADING:e+"loading",SCROLL_HEIGHT:"scrollHeight",SCROLL_TOP:"scrollTop",AUTO:"auto",PX:"px",DIV:"div",SPAN:"span",BUTTON:"button",CLASS:"class",TITLE:"title",DISPLAY:"display"},n.keyword_null=null,n.keyword_undefined=void 0},"./dist/plugins/ai/ai-definition.js":function(){},"./dist/plugins/ai/ai-inject.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},l=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty(n,"__esModule",{value:!0}),i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=new i.Common.ResourceManager(o.SR,"AI"),a=s.getResource.bind(s),u=function(){function t(){}return t.prototype.injectAIRequest=function(t){this.aiRequest=t},t.prototype.injectAIEnvs=function(t){var n,e,i=this;if(!(t&&t.model&&t.key&&t.basePath))throw new Error(a().ERROR_NO_AI_INJECT);n=this,e=JSON.parse(JSON.stringify(t)),n.aiRequest=function(t){return c(i,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return t.model=e.model,[4,fetch(e.basePath,{method:"POST",headers:{Authorization:"Bearer ".concat(e.key),"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:if(!(n=i.sent()).ok)throw new Error("".concat(a().ERROR_RESPONSE_FAILED," ").concat(n.status));return[2,n]}}))}))}},t.prototype.fetchAI=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(n){if(!this.aiRequest)throw new Error(a().ERROR_NO_AI_INJECT);return[2,this.aiRequest(t)]}))}))},t.prototype.dispose=function(){this.aiRequest=void 0},t}(),r.Workbook.ch("AI",{init:function(){this.aiCaller=new u}}),r.Workbook.prototype.injectAI=function(t){if("function"==typeof t)this.aiCaller.injectAIRequest(t);else{if("object"!=typeof t)throw new Error(a().ERROR_NO_AI_INJECT);this.aiCaller.injectAIEnvs(t)}},r.Workbook.ch("AI",{dispose:function(){var t;null===(t=this.aiCaller)||void 0===t||t.dispose(),this.aiCaller=void 0}})},"./dist/plugins/ai/ai.entry.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d=this&&this.JKr||(Object.create?function(t,n,e,i){void 0===i&&(i=e);var r=Object.getOwnPropertyDescriptor(n,e);r&&!("get"in r?!n.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return n[e]}}),Object.defineProperty(t,i,r)}:function(t,n,e,i){void 0===i&&(i=e),t[i]=n[e]}),h=this&&this.XKr||function(t,n){for(var e in t)"default"===e||Object.prototype.hasOwnProperty.call(n,e)||d(n,t,e)};Object.defineProperty(n,"__esModule",{value:!0}),n.bio=n.Sio=n.dio=n.hio=n.fio=n.aio=n.cio=n.lio=n.iio=n.sio=void 0,e("./dist/plugins/ai/ai-inject.js"),e("./dist/plugins/ai/context/workbook.js"),e("./dist/plugins/ai/context/worksheet.js"),e("./dist/plugins/ai/context/table.js"),e("./dist/plugins/ai/context/pivot-table.js"),e("./dist/plugins/ai/agents/formula/generate-formula.js"),e("./dist/plugins/ai/agents/formula/explain-formula.js"),e("./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js"),e("./dist/plugins/ai/agents/pivot-table/generate-pivot-layout-suggestion.js"),e("./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js"),e("./dist/plugins/ai/agents/translate/translate.js"),e("./dist/plugins/ai/agents/textSentiment/text-sentiment.js"),e("./dist/plugins/ai/agents/query/query.js"),e("./dist/plugins/ai/functions/translate.js"),e("./dist/plugins/ai/functions/text-sentiment.js"),e("./dist/plugins/ai/functions/query.js"),e("./dist/plugins/ai/functions/function-description.js"),e("./dist/plugins/ai/features/formula/formula-editor-enhance.js"),e("./dist/plugins/ai/features/pivot-table/pivot-panel-enhance.js"),i=e("./dist/plugins/ai/agents/formula/generate-formula.js"),Object.defineProperty(n,"sio",{enumerable:!0,get:function(){return i.sio}}),r=e("./dist/plugins/ai/agents/formula/explain-formula.js"),Object.defineProperty(n,"iio",{enumerable:!0,get:function(){return r.iio}}),o=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js"),Object.defineProperty(n,"lio",{enumerable:!0,get:function(){return o.lio}}),s=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-layout-suggestion.js"),Object.defineProperty(n,"cio",{enumerable:!0,get:function(){return s.cio}}),a=e("./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js"),Object.defineProperty(n,"aio",{enumerable:!0,get:function(){return a.aio}}),u=e("./dist/plugins/ai/agents/query/query.js"),Object.defineProperty(n,"fio",{enumerable:!0,get:function(){return u.fio}}),c=e("./dist/plugins/ai/agents/textSentiment/text-sentiment.js"),Object.defineProperty(n,"hio",{enumerable:!0,get:function(){return c.hio}}),l=e("./dist/plugins/ai/agents/translate/translate.js"),Object.defineProperty(n,"dio",{enumerable:!0,get:function(){return l.dio}}),f=e("./dist/plugins/ai/context/pivot-table.js"),Object.defineProperty(n,"Sio",{enumerable:!0,get:function(){return f.Sio}}),Object.defineProperty(n,"bio",{enumerable:!0,get:function(){return f.bio}}),h(e("./dist/plugins/ai/ai.ns.js"),n),e("./dist/plugins/ai/ai-definition.js")},"./dist/plugins/ai/ai.ns.js":function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.SR=void 0;var i=e("./dist/plugins/ai/ai.res.en.js");n.SR={en:i}},"./dist/plugins/ai/ai.res.en.js":function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.PT_Layout_Sug_Sys=n.PT_Layout_Exp_Error=n.PT_Layout_Exp_User_REQ=n.PT_Layout_Exp_User=n.PT_Layout_Exp_Sys=n.PT_Layout_Gen_Error=n.PT_Layout_Gen_User=n.PT_Layout_Example=n.PT_Layout_Schema=n.PT_SubtotalType_Schema=n.PT_Layout_Gen_Sys=n.PT_Col_Total=n.PT_Row_Total=n.PT_Data=n.PT_Layout=n.PT_Source_Fields=n.PT_Data_Range=n.PT_Filter_Range=n.PT_Data_Refer=n.PT_Des=n.Table_Data=n.Table_Columns=n.Table_DataRange=n.Table_Range=n.Table_Des=n.Ws_Selection=n.Ws_CurrentFormula=n.Ws_AxisInfo=n.Ws_CustomNames=n.Ws_Des=n.Wb_AcSheet=n.Wb_Sheet_Name=n.Wb_Sheet_Column_Headers=n.Wb_Column_Headers=n.Wb_SheetNames=n.Wb_CustomNames=n.Wb_Des=n.STRICT_ARRAY_HINT=n.STRICT_JSON_ARRAY_HINT=n.JSON_CONSTRUCT=n.AI_ERROR=n.RETURN_LANGUAGE=n.ERROR_CANNOT_FIND_PIVOT_TABLE=n.ERROR_NO_PACKAGE=n.ERROR_NO_AI_INJECT=n.ERROR_NO_CONTENT=n.ERROR_RESPONSE_FAILED=n.ERROR_UNSUPPORTED_TYPE=n.REPLACE_MAP=n.WRAP=void 0,n.LanguagePrompt=n.RangeSchema=n.Text_Sentiment_Function_Description=n.TextSentiment_User=n.TextSentiment_Sys=n.Translate_Function_Description=n.Translate_User_To=n.Translate_User_Text=n.Translate_Sys=n.Query_Error=n.Query_Function_Description=n.Query_User_Keep_Structure=n.Query_User_Context=n.Query_Sys=n.Formula_Assistant_Close=n.Formula_Explain_Title=n.Formula_Assistant_Title=n.Generate_Formula=n.Apply_Formula=n.Formula_Exp_Close=n.Formula_Exp_Title=n.Formula_Exp_Error=n.Formula_Exp_User=n.Formula_Exp_Sys=n.Formula_Gen_Error=n.Formula_Gen_Title=n.Formula_Input_Prompt=n.Formula_Gen_User=n.Formula_Gen_Exclude=n.Formula_Gen_Sys=n.Ana_Placeholder=n.Ana_Stop=n.Ana_Send=n.Ana_Copy=n.Ana_Back=n.Gen_Sug=n.GEN_Close=n.Gen_Refresh=n.Gen_ShowSuggestion=n.Gen_Reset=n.Gen_Send=n.Gen_Placeholder=n.DataAnalyze=n.GenerateLayout=n.PT_Layout_Sug_User=n.PT_Layout_Sug_History=void 0,n.WRAP="\n",n.REPLACE_MAP={Name:"${Name}",Index:"${Index}",RowCount:"${RowCount}",ColCount:"${ColCount}",ROW:"${ROW}",COL:"${COL}",Selections:"${Selections}",Language:"${Language}",SUG_HISTORY:"${SUG_HISTORY}",HEADER_RANGE:"${HEADER_RANGE}",HEADER_DATA:"${HEADER_DATA}",CONTENT_RANGE:"${CONTENT_RANGE}",CONTENT_DATA:"${CONTENT_DATA}",FORMULA:"${FORMULA}"},n.ERROR_UNSUPPORTED_TYPE="Unsupported Response Body Type",n.ERROR_RESPONSE_FAILED="Failed to Process Response: ",n.ERROR_NO_CONTENT="No Valid Content Found in the JSON Object",n.ERROR_NO_AI_INJECT="The AI request callback or environment variables have not been injected.",n.ERROR_NO_PACKAGE="Package Not Loaded: ",n.ERROR_CANNOT_FIND_PIVOT_TABLE="Cannot Find Pivot Table in the Current Sheet",n.RETURN_LANGUAGE=n.WRAP+"Please answer in the following language: ",n.AI_ERROR="__AI_ERROR__",n.JSON_CONSTRUCT='Construct the response as a structured object, then serialize it to a JSON string, strictly following the expected format.\nIncorrect example (JSON format error, missing closing bracket):\n[ ["foo", [["a", "A"], ["b", "B"]]], ["bar", [["x", "X"]] ]\n\nCorrect example:\n[ ["foo", [["a", "A"], ["b", "B"]]], ["bar", [["x", "X"]]] ]\n',n.STRICT_JSON_ARRAY_HINT="The final output must be a valid JSON string or "+n.AI_ERROR+". Do not include any Markdown formatting, explanations, or comments. Do not add ```json or ```. The output must start with [ and end with ], otherwise it will cause a program error.",n.STRICT_ARRAY_HINT="Maintain the original array structure. Do not change the order, length, or dimensions of the array.",n.Wb_Des=n.WRAP+"The following is the workbook context:"+n.WRAP,n.Wb_CustomNames="Custom Names:"+n.WRAP,n.Wb_SheetNames="Sheet Names (sorted by sheet index):"+n.WRAP,n.Wb_Column_Headers="Column Headers: ",n.Wb_Sheet_Column_Headers="Column Headers for Each Sheet: ".concat(n.WRAP,"Schema: [Column Header Name, Absolute Index (0 is the first worksheet column)]").concat(n.WRAP),n.Wb_Sheet_Name="Sheet Name: ",n.Wb_AcSheet="Active Sheet Information: (Name: "+n.REPLACE_MAP.Name+", Index: "+n.REPLACE_MAP.Index+")"+n.WRAP,n.Ws_Des=n.WRAP+'The following is the context for worksheet "'+n.REPLACE_MAP.Name+'":'+n.WRAP,n.Ws_CustomNames="Custom Names:"+n.WRAP,n.Ws_AxisInfo="Row Count: "+n.REPLACE_MAP.RowCount+", Column Count: "+n.REPLACE_MAP.ColCount+n.WRAP,n.Ws_CurrentFormula="The current cell's formula is: "+n.REPLACE_MAP.FORMULA+n.WRAP,n.Ws_Selection="Active Row Index: "+n.REPLACE_MAP.ROW+", Active Column Index: "+n.REPLACE_MAP.COL+", Selections Array: "+n.REPLACE_MAP.Selections+n.WRAP,n.Table_Des=n.WRAP+'The following is the context for table "'+n.REPLACE_MAP.Name+'":'+n.WRAP,n.Table_Range="Table Range: ",n.Table_DataRange="Table Data Range: ",n.Table_Columns="Table Columns: "+n.WRAP+"Schema: [Column Name, Relative Index (0 is the first table column), Absolute Index (0 is the first worksheet column)]"+n.WRAP,n.Table_Data="Table Data: "+n.WRAP,n.PT_Des=n.WRAP+'The following is the context for pivot table "'+n.REPLACE_MAP.Name+'":'+n.WRAP,n.PT_Data_Refer="Data Source: ",n.PT_Filter_Range="Page Filter Area Range: ",n.PT_Data_Range="Data Area Range: ",n.PT_Source_Fields="Source Field Names: ",n.PT_Layout="Current Layout: "+n.WRAP,n.PT_Data="Pivot Table Data: "+n.WRAP,n.PT_Row_Total="\nPivot Table Row Header and Row Total Information.\nRow Header Relative Range:\n".concat(n.REPLACE_MAP.HEADER_RANGE,",\nRow Header Data is:\n").concat(n.REPLACE_MAP.HEADER_DATA,",\nCorresponding Row Total Relative Range:\n").concat(n.REPLACE_MAP.CONTENT_RANGE,",\nRow Total Data is:\n").concat(n.REPLACE_MAP.CONTENT_DATA,"\n\n"),n.PT_Col_Total="\nPivot Table Column Header and Column Total Information.\nColumn Header Relative Range:\n".concat(n.REPLACE_MAP.HEADER_RANGE,",\nColumn Header Data is:\n").concat(n.REPLACE_MAP.HEADER_DATA,",\nCorresponding Column Total Relative Range:\n").concat(n.REPLACE_MAP.CONTENT_RANGE,",\nColumn Total Data is:\n").concat(n.REPLACE_MAP.CONTENT_DATA,"\n"),n.PT_Layout_Gen_Sys="As an Excel pivot table expert, provide the pivot panel layout **schema** (this is important) matching the request.\nIf the user\u2019s requirement is unclear or ambiguous, automatically select and return a layout you consider appropriate, do not return ".concat(n.AI_ERROR," in these cases!\nReturn ").concat(n.AI_ERROR," only when there is missing context or a logical contradiction that makes it **impossible** to provide any valid layout. Note: as long as you have any possible way to fulfill the request, do not return ").concat(n.AI_ERROR,", this is important!\nRefer to the following context data:")+n.WRAP,n.PT_SubtotalType_Schema="SubtotalType: 0=Average, 1=Count, 2=Count Numbers, 3=Max, 4=Min, 5=Product, 6=StdDev (Sample), 7=StdDevP (Population), 8=Sum, 9=Var (Sample), 10=VarP (Population).",n.PT_Layout_Schema="The Pivot Table Layout Schema is a JSON array: `[FilterFields, RowFields, ColFields, ValueFields]`. Each field array contains items, where each item is another array with 2 or 3 elements.\n- `FilterFields`, `RowFields`, `ColFields` items: `[sourceName, displayName]`\n- `ValueFields` items: `[sourceName, displayName, subtotalType]`\nItems within each field array are sorted by index. "+n.PT_SubtotalType_Schema,n.PT_Layout_Example='\nExample:\nSource field names: `["name", "grade", "class", "gender", "score"]`\nRequirement: "Get the sum of scores by gender and class"\nReturn value:\n`[ [], [ ["gender", "gender"], ["class", "class"] ], [], [ ["score", "Sum of score", 8] ] ]`\nIf the request is to update an existing layout, modify the current layout according to the user\'s request instead of creating a new one from scratch.\nRemember: Always return only the JSON array or '.concat(n.AI_ERROR,". Never return anything else. This is the highest priority requirement.\n"),n.PT_Layout_Gen_User="Please generate the pivot panel layout based on the requirement: ",n.PT_Layout_Gen_Error="Sorry, the AI pivot table layout generation failed. Please describe your requirements more specifically, check the current pivot table status, or try generating again.",n.PT_Layout_Exp_Sys="As an Excel pivot table expert, return a data analysis of the pivot panel layout. Return ".concat(n.AI_ERROR," only if, after fully analyzing the context and requirements, no valid solution can be generated. Format the explanation using HTML tags suitable for direct use as `innerHTML` for better readability.\nDo not include any Markdown formatting, explanations, or comments outside the HTML.\nRefer to the following context data:"),n.PT_Layout_Exp_User="Please analyze the data. Keep the analysis concise (ideally under 20 lines). ",n.PT_Layout_Exp_User_REQ="Focus the analysis on the following [key point, main idea, or question]: ",n.PT_Layout_Exp_Error="Sorry, the AI pivot table analysis failed. Please describe your problem more specifically, check the current pivot table status, or try generating again.",n.PT_Layout_Sug_Sys='As an Excel pivot table expert, based on the provided data fields, suggest 3 practical layouts for building a pivot table. Each suggestion must strictly follow this format:\n`[Suggestion description (max 10 words), Layout array]`\nThe overall structure must be a JSON array containing exactly 3 such pairs:\n`[\n ["Suggestion1", [[], [], [], []]],\n ["Suggestion2", [[], [], [], []]],\n ["Suggestion3", [[], [], [], []]]\n]`\nThe second item (Layout array) must contain exactly four arrays: `[FilterFields, RowFields, ColFields, ValueFields]`.\nField item formats:\n- Filter/Row/Column: `[sourceName, displayName]`\n- Value: `[sourceName, displayName, subtotalType]`\n'.concat(n.PT_SubtotalType_Schema,"\n").concat(n.STRICT_JSON_ARRAY_HINT,'\nThe returned result must be a strictly formatted JSON string processable by `JSON.parse`.\nThe top level must be an array containing three `[description, layout]` pairs.\nEach layout must be an array of 4 arrays (no more, no less). The outer array shell for the layout is mandatory.\nIncorrect examples:\n`["Description", [[], [], [], [], []]]`\n`["Description", [], [], [], []]`\n`[["foo", [["a", "A"], ["b", "B"]]], ["bar", [["x", "X"]]]`\nCorrect example (using source fields `["name", "grade", "class", "gender", "score"]`):\n`[\n ["Score sum by gender/class", [ [], [["gender","gender"],["class","class"]], [], [["score","Sum of score",8]] ]],\n ["Average score by grade", [ [], [["grade","grade"]], [], [["score","Average of score",0]] ]],\n ["Student count by class", [ [], [["class","class"]], [], [["name","Count of name",1]] ]]\n]`\nReturn ').concat(n.AI_ERROR," only if no suitable suggestions can be made.\nRefer to the following context data:")+n.WRAP,n.PT_Layout_Sug_History="\n\nAvoid repeating these previous suggestions:\n".concat(n.REPLACE_MAP.SUG_HISTORY,"\n")+n.WRAP,n.PT_Layout_Sug_User="Please provide 3 suggestions for a pivot table layout: ",n.GenerateLayout="Smart Pivot Layout Generation",n.DataAnalyze="Intelligent Data Analysis",n.Gen_Placeholder="Enter your requirement",n.Gen_Send="Send the requirement to AI",n.Gen_Reset="Reset Layout to Initial State",n.Gen_ShowSuggestion="Show Suggestions",n.Gen_Refresh="Refresh Suggestions",n.GEN_Close="Hide Layout Panel",n.Gen_Sug="AI Suggestions",n.Ana_Back="Back to Pivot Panel",n.Ana_Copy="Copy Analysis",n.Ana_Send="Send the question to AI",n.Ana_Stop="Stop Generating",n.Ana_Placeholder="Enter your question",n.Formula_Gen_Sys="As an Excel formula expert, provide **only the formula** (this is important) matching the request. Return ".concat(n.AI_ERROR," only for non-formula requests or if no solution exists.\nRefer to the following context data:")+n.WRAP,n.Formula_Gen_Exclude=n.WRAP+"The formula should not contain the following functions: ARRAYTOTEXT,AVERAGEIPS,CALL,CELL,COUNTIPS,CUBEKPIMEMBER,CUBEMEMBER,CUBEMEMBERPROPERTY,CUBERANKEDMEMBER,CUBESET,CUBESETCOUNT,CUBEVALUE,DETECTLANGUAGE,FILTERXML,FORECAST.ETS,FORECAST.ETS(CONFINT),FORECAST.ETS(SEASONALITY),FORECAST.ETS(STAT),FORECAST.LINEAR,INFO,JIS,NUMBERVALUE,PHONETIC,REGISTER.ID,REST,RTDCLEAR,RTDDATABASE,RTDEXECUTE,RTDREFRESH,RTDSTATUS,SECRET,SQL.REQUEST,STDEV.A,STEVEN,TRANSLATE,VAR.A",n.Formula_Gen_User="Please generate a correct formula based on the requirement: ",n.Formula_Input_Prompt="Describe the formula you need.",n.Formula_Gen_Title="Smart Formula Generation",n.Formula_Gen_Error="Sorry, the AI formula generation failed. Please describe your requirements more specifically (e.g., specify the function type, provide an example, or break down the logic).",n.Formula_Exp_Sys="As an Excel formula expert, explain the provided formula. Return ".concat(n.AI_ERROR," only for non-formula input or if no explanation can be generated.\nFormat the explanation using HTML tags suitable for direct use as `innerHTML` for better readability.\nProvide **only the HTML explanation** (this is important). Do not include any Markdown formatting or other text outside the HTML.\nStructure the explanation logically (e.g., [Overall Meaning, Breakdown, Parameter Details, Contextual Example]).\nRefer to the following context data:")+n.WRAP,n.Formula_Exp_User="Please explain the formula concisely (ideally under 15 lines): ",n.Formula_Exp_Error="Sorry, the AI formula explanation failed due to an unsupported formula structure.",n.Formula_Exp_Title="Formula Explanation",n.Formula_Exp_Close="Close the Explanation Panel",n.Apply_Formula="Apply Formula",n.Generate_Formula="Generate Formula",n.Formula_Assistant_Title="Smart Formula Assistant",n.Formula_Explain_Title="Explain Formula",n.Formula_Assistant_Close="Close the Assistant Panel",n.Query_Sys="As an Excel expert, refer to the following context data:"+n.WRAP,n.Query_User_Context="The Input data is:",n.Query_User_Keep_Structure=" Return **only a JSON string representing a JavaScript array with the same structure as the input**. Do not include explanations. (This is important).\n".concat(n.STRICT_ARRAY_HINT,"\n").concat(n.STRICT_JSON_ARRAY_HINT,"\nIf no query item has a solution, return ").concat(n.AI_ERROR,'. If only some items lack solutions, return an empty string `\'\'` for those specific items.\nExample: Get the capital of a country.\nInput: `[["China"], ["India"], ["United States"]]` -> Output: `[["Beijing"], ["New Delhi"], ["Washington DC"]]`\nInput: `[["a"], ["b"]]` -> Output: ').concat(n.AI_ERROR,'\nInput: `[["China"], ["a"]]` -> Output: `[["Beijing"], [""]]`'),n.Query_Function_Description="Returns an AI-generated answer based on the provided text content.",n.Query_Error="Sorry, the AI query failed. Please describe your requirements more specifically.",n.Translate_Sys="You are a language translation assistant. Translate the texts in the provided string array into the specified language.\n".concat(n.STRICT_ARRAY_HINT,"\n").concat(n.STRICT_JSON_ARRAY_HINT,'\nThe output must be a JSON array with the exact same structure as the input, containing the translations. Each translated text should correspond to the original text\'s position.\nExample:\nInput: `[["Text1", "Text2"], ["Text3", "Text4"], ...]`\nOutput: `[["Translation1", "Translation2"], ["Translation3", "Translation4"], ...]`\nIf a text item cannot be translated, return an empty string `\'\'` for that item.\nIf *all* text items cannot be translated, return ').concat(n.AI_ERROR,".\n**Crucially:** If *at least one* text item can be translated, you *must* return the full array structure with translations and empty strings `''` for untranslatable items. Returning ").concat(n.AI_ERROR," in this case is strictly forbidden."),n.Translate_User_Text='Please translate these texts: "',n.Translate_User_To='" to ',n.Translate_Function_Description="Translates the provided text into the specified language.",n.TextSentiment_Sys="You are a sentiment analysis expert. Classify the sentiment of each review in the provided array. Provide **only the classification** for each review.\n".concat(n.STRICT_ARRAY_HINT,"\n").concat(n.STRICT_JSON_ARRAY_HINT,'\nThe output must be a JSON array with the exact same structure as the input, containing the sentiment classifications.\nExample:\nInput: `[["review 1", "review 2"], ["review 3", "review 4"], ...]`\nOutput: `[["sentiment 1", "sentiment 2"], ["sentiment 3", "sentiment 4"], ...]`\nIf a review cannot be analyzed, return an empty string `\'\'` for that item.\nIf *all* reviews cannot be analyzed, return ').concat(n.AI_ERROR,'. Otherwise, return the full array structure with classifications and empty strings `\'\'`.\nUse "positive" to represent a positive text sentiment.\nUse "negative" to represent a negative text sentiment.\nUse "neutral" to represent a neutral text sentiment.\n'),n.TextSentiment_User="Please classify the sentiment of these reviews: ",n.Text_Sentiment_Function_Description="Classifies the sentiment of the provided text as Positive, Negative, or Neutral.",n.RangeSchema="Range Schema: [Row, Column, Row Count, Column Count]",n.LanguagePrompt=n.WRAP+"Answer in language: "+n.REPLACE_MAP.Language},"./dist/plugins/ai/context/pivot-table.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d=this&&this.iJr||function(t,n,e){if(e||2===arguments.length)for(var i=0,r=n.length,o;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return t.concat(o||Array.prototype.slice.call(n))};function h(t){var n=i.PivotTableFieldType,e=[n.filterField,n.rowField,n.columnField,n.valueField];return e.map((function(e){return t.getFieldsByArea(e).map((function(i){var r=i.fieldName,o=i.sourceName,s=[o,r];return e===n.valueField?d(d([],s,!0),[String(t.subTotalType(r))],!1):s}))}))}function p(t,n){t.dh.Qy.execute({cmd:"ApplyAIPivotLayout",sheetName:t.getHost().name(),cmdOption:{ptId:t.jKe(),layout:n}})}Object.defineProperty(n,"__esModule",{value:!0}),n.bio=n.Sio=void 0,i=e("PivotTable"),r=e("Pivot"),o=e("./dist/plugins/ai/context/util.js"),s=e("Common"),a=e("Core"),u=e("./dist/plugins/ai/interface.js"),c=e("./dist/plugins/ai/ai.ns.js"),(null==i?void 0:i.PivotTable)&&(l=new s.Common.ResourceManager(c.SR,"AI"),f=l.getResource.bind(l),i.PivotTable.prototype.getAIContext=function(t){var n,e,s,c,l,d,p,g,v,m,y,b,w,S,A,T,j,E,_,C,O,x,N,R,I,L,P,k=this;if(void 0===t&&(t=u.PivotTableContextArgs.all),e=(n=f()).WRAP,s=n.REPLACE_MAP,c=(0,o.Vi)(n.PT_Des,[s.Name],[this.name()]),l=this.getRange(),t&u.PivotTableContextArgs.range&&(c+=n.RangeSchema+" ",l.page&&(c+=n.PT_Filter_Range+(0,o.Aio)(l.page)+", "),c+=n.PT_Data_Range+(0,o.Aio)(l.content)+e),t&u.PivotTableContextArgs.source){for(d=this.getHost().getParent(),p=this.dh.L,(g=d.fMt.cut[p]).EYt&&(c+=n.PT_Data_Refer+g.EYt+e),v=g.Pq,m=[],y=0,b=Object.keys(v);y<b.length;y++)S=v[w=b[y]],m.push(S.Zc);c+=n.PT_Source_Fields+JSON.stringify(m)+e}return t&u.PivotTableContextArgs.layout&&(c+=n.PT_Layout_Schema+e+n.PT_Layout+JSON.stringify(h(this))+e),t&u.PivotTableContextArgs.data&&!this.Oy()&&(A=this.getHost(),c+=n.PT_Data+JSON.stringify((0,o.wio)(A,l.content))+e),t&u.PivotTableContextArgs.totalData&&!this.Oy()&&l.content.rowCount>0&&l.content.colCount>0&&(T=this.getHost(),E=(j=this.options.grandTotalPosition)===i.GrandTotalPosition.both||j===i.GrandTotalPosition.row,_=j===i.GrandTotalPosition.both||j===i.GrandTotalPosition.col,C=this.eZt.row,O=this.eZt.col,x=this.rZt.HWt[4].getRange(),N=1,R=1,(I=this.dataPosition()).display&&(L=this.getFieldsByArea(3).length,I.positionType===r.DataPosition.row?N=L:R=L),P=function(t,n,e){var i=k.rZt.HWt[t].getRange(),r=new a.Range(C+i.row,O+i.col,i.rowCount,i.colCount),u=n(x),c=new a.Range(C+u.row,O+u.col,u.rowCount,u.colCount);return(0,o.Vi)(e,[s.HEADER_RANGE,s.HEADER_DATA,s.CONTENT_RANGE,s.CONTENT_DATA],[(0,o.Aio)(i),JSON.stringify((0,o.wio)(T,r)),(0,o.Aio)(u),JSON.stringify((0,o.wio)(T,c))])},E&&(c+=P(3,(function(t){return new a.Range(t.row,t.col+t.colCount-R,t.rowCount,R)}),n.PT_Row_Total)+e),_&&(c+=P(2,(function(t){return new a.Range(t.row+t.rowCount-N,t.col,N,t.colCount)}),n.PT_Col_Total)+e)),c}),n.Sio=h,n.bio=p},"./dist/plugins/ai/context/table.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c;function l(t,n){var e,i,r,o,s,a="",u=t.tables.all().length>0;return u&&(e=t.getViewportTopRow(1),i=t.getViewportLeftColumn(1),r=t.getViewportBottomRow(1)-e+1,o=t.getViewportRightColumn(1)-i+1,(s=t.tables.AB(e,i,r,o)).forEach((function(t){a+=t.getAIContext(n)}))),a}Object.defineProperty(n,"__esModule",{value:!0}),n.oio=void 0,i=e("Common"),r=e("Tables"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/context/util.js"),u=new i.Common.ResourceManager(o.SR,"AI"),c=u.getResource.bind(u),r.Table.prototype.getAIContext=function(t){var n,e,i,r,o,u;return void 0===t&&(t=s.TableContextArgs.all),e=(n=c()).WRAP,i=n.REPLACE_MAP,r=(0,a.Vi)(n.Table_Des,[i.Name],[this.name()]),o=this.range(),u=this.Mf,t&s.TableContextArgs.range&&(r+="".concat(n.RangeSchema," ").concat(n.Table_Range).concat((0,a.Aio)(o),", ").concat(n.Table_DataRange).concat((0,a.Aio)(this.dataRange())).concat(e)),t&s.TableContextArgs.columns&&(r+=n.Table_Columns+this.BSt.map((function(t,n){return"['".concat(t.name(),"',").concat(n,",").concat(n+o.col,"]")})).join(e)+e),t&s.TableContextArgs.data&&(r+=n.Table_Data+JSON.stringify((0,a.wio)(u,o))+e),r},n.oio=l},"./dist/plugins/ai/context/util.js":function(t,n,e){"use strict";var i,r,o,s,a;function u(t,n,e){for(var i=0;i<n.length;i++)t=t.replace(n[i],e[i]);return t}function c(){var t=o.Fe(o.culture());return a().RETURN_LANGUAGE+(t.displayName||"English")}function l(t,n){void 0===n&&(n=!1);var e="[".concat(t.row,",").concat(t.col,",").concat(t.rowCount,",").concat(t.colCount,"]");return n?a().RangeSchema+e:e}function f(t,n){var e=n.row,i=n.col,r=n.rowCount,o=n.colCount;return Array.from({length:r},(function(n,r){return Array.from({length:o},(function(n,o){return t.getText(e+r,i+o)}))}))}function d(t,n,e,i){var r,o,s,a,u,c=null!==(r=t.getRow())&&void 0!==r?r:0,l=null!==(o=t.getColumn())&&void 0!==o?o:0,f="",d=t.getExpression();return d&&(s=void 0,a=void 0,n?(s=e.Lp,a=(u=e.getActiveSheet())?u.Uw():null):(s=null==i?void 0:i.Lp,a=null==i?void 0:i.qgt),s&&(f=s.unparse(a,d,c,l,!1,!0,2))),{name:t.getName(),formula:f,comment:t.getComment()}}Object.defineProperty(n,"__esModule",{value:!0}),n.Tio=n.wio=n.Aio=n.pio=n.Vi=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=i.Common.CultureManager,s=new i.Common.ResourceManager(r.SR,"AI"),a=s.getResource.bind(s),n.Vi=u,n.pio=c,n.Aio=l,n.wio=f,n.Tio=d},"./dist/plugins/ai/context/workbook.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l;Object.defineProperty(n,"__esModule",{value:!0}),i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/context/util.js"),u=new i.Common.ResourceManager(o.SR,"AI"),c=u.getResource.bind(u),l=i.Common.lt.ht,r.Workbook.prototype.getAIContext=function(t){var n,e,i,r,o,u,f=this;return void 0===t&&(t=s.WorkbookContextArgs.all),n=c(),e=n.WRAP,i=n.Wb_Des,t&s.WorkbookContextArgs.names&&(r=this.getCustomNames()).length>0&&(i+=n.Wb_CustomNames+r.map((function(t){return JSON.stringify((0,a.Tio)(t,!0,f))})).join(e)+e),t&s.WorkbookContextArgs.sheetNames&&(o=this.sheets).length>0&&(i+=n.Wb_SheetNames+JSON.stringify(o.map((function(t){return t.name()})))+e),t&s.WorkbookContextArgs.eachSheetColumnHeaders&&(o=this.sheets).length>0&&(i+=n.Wb_Sheet_Column_Headers+o.map((function(t){var i,r,o=n.Wb_Sheet_Name+t.name()+", "+n.Wb_Column_Headers+"["+e,s=t.getColumnCount();for(i=0;i<s;i++)r=t.getValue(0,i),l(r)||(o+="[".concat(r,", ").concat(i,"]").concat(e));return o+="]"+e}))+e),t&s.WorkbookContextArgs.activeSheet&&(u=this.getActiveSheet())&&(i+=(0,a.Vi)(n.Wb_AcSheet,[n.REPLACE_MAP.Name,n.REPLACE_MAP.Index],[u.name(),this.getActiveSheetIndex()+""])),i}},"./dist/plugins/ai/context/worksheet.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c;Object.defineProperty(n,"__esModule",{value:!0}),i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/context/util.js"),u=new i.Common.ResourceManager(o.SR,"AI"),c=u.getResource.bind(u),r.Worksheet.prototype.getAIContext=function(t){var n,e,i,r,o,u,l,f=this;return void 0===t&&(t=s.WorksheetContextArgs.all),e=(n=c()).WRAP,i=n.REPLACE_MAP,r=(0,a.Vi)(n.Ws_Des,[i.Name],[this.name()]),t&s.WorksheetContextArgs.names&&(o=this.getCustomNames()).length>0&&(r+=n.Ws_CustomNames+o.map((function(t){return JSON.stringify((0,a.Tio)(t,!1,void 0,f))})).join(e)+e),t&s.WorksheetContextArgs.selections&&(u="("+n.RangeSchema+"): "+this.getSelections().map((function(t){return(0,a.Aio)(t)})).join(", "),r+=(0,a.Vi)(n.Ws_Selection,[i.ROW,i.COL,i.Selections],[this.getActiveRowIndex()+"",this.getActiveColumnIndex()+"",u])),t&s.WorksheetContextArgs.axisInfo&&(r+=(0,a.Vi)(n.Ws_AxisInfo,[i.RowCount,i.ColCount],[this.getRowCount()+"",this.getColumnCount()+""])),t&s.WorksheetContextArgs.currentFormula&&(l=this.getFormula(this.getActiveRowIndex(),this.getActiveColumnIndex()))&&(r+=(0,a.Vi)(n.Ws_CurrentFormula,[i.FORMULA],[l])),r}},"./dist/plugins/ai/error-overlay.js":function(t,n){"use strict";var e,i;Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorOverlay=void 0,e=10,i=function(){function t(){}return t.show=function(t,n){var e,i;this.cleanup(),this.overlay=document.createElement("div"),this.overlay.className="gc-ai-error-overlay",this.dialog=document.createElement("div"),this.dialog.className="gc-ai-error-dialog",this.dialog.textContent=t,this.overlay.appendChild(this.dialog),this.overlay.addEventListener("click",this.cleanup.bind(this)),document.body.appendChild(this.overlay),e=this.calculateDialogPosition(n,this.dialog.offsetWidth,this.dialog.offsetHeight),i=this.adjustPosition(e,this.dialog.offsetWidth,this.dialog.offsetHeight),this.dialog.style.left=i.left,this.dialog.style.top=i.top},t.adjustPosition=function(t,n,i){var r=parseInt(t.left,10),o=parseInt(t.top,10),s=window.innerWidth||document.documentElement.clientWidth,a=window.innerHeight||document.documentElement.clientHeight,u=function(t,n,e){return Math.min(Math.max(t,n),e)},c=u(r,e,s-n-e),l=u(o,e,a-i-e);return{left:"".concat(c,"px"),top:"".concat(l,"px")}},t.calculateDialogPosition=function(t,n,i){var r,o,s=t.x,a=t.y,u=t.width,c=t.height,l=t.type;switch(l){case"LeftTop":r=s-n-e,o=a;break;case"LeftBottom":r=s-n-e,o=a+c-i;break;case"RightTop":r=s+u+e,o=a;break;case"RightBottom":r=s+u+e,o=a+c-i;break;case"TopLeft":r=s,o=a-i-e;break;case"TopRight":r=s+u-n,o=a-i-e;break;case"BottomLeft":r=s,o=a+c+e;break;case"BottomRight":r=s+u-n,o=a+c+e;break;default:return{left:"calc(50% - ".concat(n/2,"px)"),top:"calc(50% - ".concat(i/2,"px)")}}return{left:"".concat(r,"px"),top:"".concat(o,"px")}},t.cleanup=function(){this.overlay&&(this.overlay.removeEventListener("click",this.cleanup.bind(this)),document.body.removeChild(this.overlay),this.overlay=null,this.dialog=null)},t.overlay=null,t.dialog=null,t}(),n.ErrorOverlay=i},"./dist/plugins/ai/features/formula/explain-formula.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d=this&&this.qKr||(h=function(t,n){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},h(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}h(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),h;function p(t,n){var e,i;function r(t){3===(t=t.replace(/^#/,"")).length&&(t=t.split("").map((function(t){return t+t})).join(""));var n=parseInt(t,16);return[n>>16&255,n>>8&255,255&n]}function o(t){var n=t.match(/\d+/g);if(n)return[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}if(void 0===n&&(n=.98),t.startsWith("#"))e=r(t);else{if(!t.startsWith("rgb"))return t;if(!(e=o(t)))return t}return i=e.map((function(t){return Math.max(0,Math.floor(t*n))})),"rgb(".concat(i.join(", "),")")}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaExplain=void 0,i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/ai-common.js"),a=e("./dist/plugins/ai/agents/formula/explain-formula.js"),u=e("./dist/plugins/ai/ai-constants.js"),c=new i.Common.ResourceManager(o.SR,"AI"),l=c.getResource.bind(c),f=function(t){function n(n,e,i){var r,o=t.call(this)||this;return o.yoe=!1,o.eventElements=[],(r=o).jio=i,r.Eio=n,r._io=e,r.Hc(),o}return d(n,t),n.prototype.Hc=function(){var t,n,e,i=this,r=l(),o=i._io,a=i.Eio,c=u.HTML_CONST.DIV,f=u.HTML_CONST.CLASS,d=u.EVENT_CONST.CLICK,h=u.FORMULA_CONST.EXPLAIN_BUTTON_CLASS,p=u.FORMULA_CONST.EXPLAIN_CONTAINER_CLASS,g=u.FORMULA_CONST.EXPLAIN_CONTENT_CLASS,v=u.FORMULA_CONST.FORMULA_EDITOR_THEME,m=u.COMMON_CONST.TEXT_HEADER_CLASS,y=u.COMMON_CONST.TEXT_HEADER_LEFT_CLASS,b=u.COMMON_CONST.TEXT_HEADER_RIGHT_CLASS,w=u.COMMON_CONST.TEXT_HEADER_TITLE_CLASS,S=u.COMMON_CONST.CLOSE,A=u.COMMON_CONST.AI,T=u.COMMON_CONST.ICON_CLASS,j=u.COMMON_CONST.REFRESH;o.attr("title",r.Formula_Explain_Title),o.html("\n<".concat(c," ").concat(f,'="').concat(h," ").concat(T,'"></').concat(c,">\n<").concat(c," ").concat(f,'="').concat(j," ").concat(T,'"></').concat(c,">\n ")),t=o.find(".".concat(h)),n=o.find(".".concat(j)),t.bind(d+u.AI_Formula_Panel_NS,(function(){i.Oio(),t.removeClass("show"),n.addClass("show")})),t.addClass("show"),n.bind(d+u.AI_Formula_Panel_NS,(function(){i.$io()})),a.addClass(p),a.addClass(v),a.html("\n<".concat(c," ").concat(f,'="').concat(m,'">\n <').concat(c," ").concat(f,'="').concat(y,'">\n ').concat((0,s.yio)(A,""),"\n <").concat(c," ").concat(f,'="').concat(w,'">').concat(r.Formula_Exp_Title,"</").concat(c,">\n </").concat(c,">\n <").concat(c," ").concat(f,'="').concat(b,'">\n ').concat((0,s.yio)(S,r.Formula_Exp_Close),"\n </").concat(c,">\n</").concat(c,">\n<").concat(c," ").concat(f,'="').concat(g,'"></').concat(c,">\n")),(e=a.find(".".concat(T,".").concat(S))).bind(d+u.AI_Formula_Panel_NS,(function(){i.Cio(),t.addClass("show"),n.removeClass("show")})),i.eventElements=[t,n,e],i.Eio=a,i._io=o},n.prototype.setTheme=function(t){var n=this,e=n.Eio,i=e.find(".".concat(u.FORMULA_CONST.EXPLAIN_CONTENT_CLASS));i.css("backgroundColor",p(t.editorContentStyle.backgroundColor))},n.prototype.Oio=function(){var t=this;t.notify("show"),t.Eio.show(),t.$io()},n.prototype.$io=function(){var t,n,e,i,o,s=this,c=l(),f=s.jio,d=s.Eio,h=s._io.find(".".concat(u.COMMON_CONST.REFRESH)),p=s.jio.text().trim();p&&(t=this.Mio=(0,r.generateRandomId)(),h.addClass(u.HTML_CONST.LOADING),n=u.FORMULA_CONST.EXPLAIN_CONTENT_CLASS,e=u.HTML_CONST.SCROLL_TOP,i=u.HTML_CONST.SCROLL_HEIGHT,(o=d.find(".".concat(n))).html(""),(0,a.iio)(f.Vv,p,(function(n){if(s.yoe||s.Mio!==t)return!0;var r=n.wholeData.includes(c.AI_ERROR);return o.html(r?c.Formula_Exp_Error:n.wholeData),o.prop(e,o.prop(i)),!!r||void 0})).then((function(){s.yoe||s.Mio!==t||h.removeClass(u.HTML_CONST.LOADING)})).catch((function(t){var n=(null==t?void 0:t.message)===c.ERROR_NO_AI_INJECT?c.ERROR_NO_AI_INJECT:c.Formula_Exp_Error;o.html(n),h.removeClass(u.HTML_CONST.LOADING)})))},n.prototype.Cio=function(){this.notify("hide"),this.Eio.hide()},n.prototype.show=function(){var t=this;t._io.show(),t.Eio.show()},n.prototype.showExplainButton=function(){this._io.show()},n.prototype.hide=function(){var t=this;t._io.hide(),t.Eio.hide()},n.prototype.destroy=function(){t.prototype.destroy.call(this);var n=this;n.eventElements.forEach((function(t){t.unbind(u.AI_Formula_Panel_NS)})),n.Eio.empty(),n.Eio.remove(),n.Eio=u.keyword_null,n._io.empty(),n._io.remove(),n._io=u.keyword_null,n.eventElements=[],n.jio=u.keyword_null,n.yoe=!0},n}(r.TypedEventNotifier),n.FormulaExplain=f},"./dist/plugins/ai/features/formula/formula-editor-enhance.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h,p;Object.defineProperty(n,"__esModule",{value:!0}),i=e("Common"),r=e("FormulaPanel"),o=e("./dist/plugins/ai/ai-constants.js"),s=e("Core"),a=e("./dist/plugins/ai/features/formula/generate-formula.js"),u=e("./dist/plugins/ai/features/formula/explain-formula.js"),c=e("./dist/plugins/ai/ai.ns.js"),l=s.GC$,f=null,d=new i.Common.ResourceManager(c.SR,"AI"),h=d.getResource.bind(d),p=function(){function t(){this.eventElements=[]}return t.prototype.init=function(t,n){var e,i,r,s,c,d,p,g,v,m=this,y=o.HTML_CONST.DIV,b=o.FORMULA_CONST.EDITOR_CONTAINER_CLASS,w=o.FORMULA_CONST.ASSISTANT_AREA_CLASS,S=o.FORMULA_CONST.OPEN_BUTTON_CLASS,A=o.FORMULA_CONST.RESIZE_HANDLE_CLASS,T=o.FORMULA_CONST.EXPLAIN_CONTENT_CONTAINER_CLASS,j=o.FORMULA_CONST.EXPLAIN_BUTTON_CONTAINER_CLASS,E=o.FORMULA_CONST.GENERATOR_CONTAINER_CLASS,_=o.FORMULA_CONST.DEFAULT_ASSISTANT_AREA_HEIGHT,C=o.FORMULA_CONST.MIN_EDITOR_CONTAINER_HEIGHT,O=o.FORMULA_CONST.FORMULA_EDITOR_THEME,x=o.EVENT_CONST.CLICK,N=o.EVENT_CONST.MOUSEDOWN,R=o.EVENT_CONST.MOUSEUP,I=o.EVENT_CONST.MOUSEMOVE,L=o.EVENT_CONST.TRANSITION,P=o.COMMON_CONST.ICON_CLASS,k=l.En(y,f,f,b,t),D=l.En(y,f,f,"".concat(w," ").concat(O),t),M=l.En(y,f,f,"".concat(P," ").concat(S),k);function F(t){var n,e=t.clientY-p;p=t.clientY,n=Math.min(v-C,Math.max(g-e,_)),D.height(n),k.height(v-n),g=n}function U(){D.css(L,"height 0.3s ease"),k.css(L,"height 0.3s ease"),t.style.cursor="auto",i.css("cursor","grab"),document.removeEventListener(I,F),document.removeEventListener(R,U)}return M.attr("title",h().Formula_Assistant_Title),e=l.En(y,f,f,j,k),i=l.En(y,f,f,A,D),r=l.En(y,f,f,E,D),s=l.En(y,f,f,T,D),m.Wc=t,t.style.overflow="hidden",m.FcV=k,m.Nio=D,m.xio=M,c=m.rir=new a.FormulaGenerator(r,n),d=m.Rio=new u.FormulaExplain(s,e,n),M.bind(x+o.AI_Formula_Panel_NS,(function(){m.show()})),p=0,g=0,v=l(t).height(),i.bind(N+o.AI_Formula_Panel_NS,(function(n){n.preventDefault(),v=l(t).height(),D.css(L,"none"),k.css(L,"none"),p=n.clientY,g=D.height(),t.style.cursor="grabbing",i.css("cursor","grabbing"),document.addEventListener(I,F),document.addEventListener(R,U)})),c.addListener("close",(function(){m.hide()})),d.addListener("show",(function(){r.hide()})),d.addListener("hide",(function(){m.Iio()})),m.hide(),m.eventElements=[M,i],k[0]},t.prototype.Iio=function(){var t=this,n=t.Wc,e=o.HTML_CONST.HEIGHT,i=o.FORMULA_CONST.DEFAULT_ASSISTANT_AREA_HEIGHT,r=l(n).height();t.FcV.css(e,"".concat(r-i,"px")),t.Nio.css(e,i+"px"),t.rir.show()},t.prototype.setTheme=function(t){var n=this,e=t.editorContentStyle,i=o.FORMULA_CONST.FORMULA_EDITOR_THEME,r=document.createElement("style");r.textContent="\n .".concat(i," {\n color: ").concat(e.color,";\n background-color: ").concat(e.backgroundColor,";\n font: ").concat(e.font,";\n }\n "),document.head.appendChild(r),n.Rio.setTheme(t)},t.prototype.show=function(){var t,n=this;n.Iio(),t=o.HTML_CONST.DISPLAY,n.Nio.css(t,"flex"),n.Rio.showExplainButton(),n.xio.hide()},t.prototype.hide=function(){var t=this,n=o.HTML_CONST.HEIGHT;t.Nio.css(n,"0"),t.Nio.hide(),t.FcV.css(n,"100%"),t.rir.hide(),t.Rio.hide(),t.xio.show()},t.prototype.destroy=function(){var t=this;t.eventElements.forEach((function(t){t.unbind(o.AI_Formula_Panel_NS)})),t.rir.destroy(),t.Rio.destroy(),t.xio.remove(),t.Nio.empty(),t.Nio.remove(),t.xio=f,t.Wc=f,t.Nio=f,t.rir=f,t.Rio=f},t}(),r&&r.FormulaEditor&&r.FormulaEditor.ch("AI",{onCreate:function(t){var n=t.container,e=this.Lio=new p;t.container=e.init(n,this)},onDestroy:function(){var t;this.Lio.destroy()},onThemeChange:function(t){var n;this.Lio.setTheme(t)}})},"./dist/plugins/ai/features/formula/generate-formula.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h=this&&this.qKr||(p=function(t,n){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},p(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}p(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),p;function g(t,n,e,i,r){t!==e.Formula_Input_Prompt&&""!==(null==t?void 0:t.trim())&&(i.removeClass("show"),r.addClass("show"),(0,u.sio)(n.Vv,t).then((function(t){i.addClass("show"),r.removeClass("show"),(0,s.gio)(t,e.Formula_Gen_Error,i[0])||(n.text(t),n.format())})).catch((function(t){a.ErrorOverlay.show(t.message,(0,s.getGenerateErrorDialogPosition)(i[0])),i.addClass("show"),r.removeClass("show")})))}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaGenerator=void 0,i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/ai-common.js"),a=e("./dist/plugins/ai/error-overlay.js"),u=e("./dist/plugins/ai/agents/formula/generate-formula.js"),c=e("./dist/plugins/ai/ai-constants.js"),l=new i.Common.ResourceManager(o.SR,"AI"),f=l.getResource.bind(l),d=function(t){function n(n,e){var i,r=t.call(this)||this;return r.eventElements=[],(i=r).jio=e,i.Wc=n,i.Hc(),r}return h(n,t),n.prototype.Hc=function(){var t,n,e,i,r=this,o=r.Wc,a=f(),u=r.jio,l=c.HTML_CONST.DIV,d=c.HTML_CONST.CLASS,h=c.HTML_CONST.TITLE,p=c.HTML_CONST.LOADING,v=c.EVENT_CONST.CLICK,m=c.EVENT_CONST.KEYDOWN,y=c.EVENT_CONST.PASTE,b=c.COMMON_CONST.TEXT_HEADER_CLASS,w=c.COMMON_CONST.TEXT_HEADER_LEFT_CLASS,S=c.COMMON_CONST.TEXT_HEADER_RIGHT_CLASS,A=c.COMMON_CONST.TEXT_HEADER_TITLE_CLASS,T=c.COMMON_CONST.CLOSE,j=c.COMMON_CONST.AI,E=c.COMMON_CONST.ICON_CLASS,_=c.COMMON_CONST.TEXT_CONTAINER_CLASS,C=c.COMMON_CONST.TEXT_CLASS,O=c.COMMON_CONST.TEXT_ICON_CLASS,x=c.COMMON_CONST.ICON_BACKGROUND_CLASS,N=c.COMMON_CONST.REFRESH;return o.html("\n<".concat(l," ").concat(d,'="').concat(b,'">\n <').concat(l," ").concat(d,'="').concat(w,'">\n ').concat((0,s.yio)(j,""),"\n <").concat(l," ").concat(d,'="').concat(A,'">').concat(a.Formula_Gen_Title,"</").concat(l,">\n </").concat(l,">\n <").concat(l," ").concat(d,'="').concat(S,'">\n ').concat((0,s.yio)(T,a.Formula_Assistant_Close),"\n </").concat(l,">\n</").concat(l,">\n\n<").concat(l," ").concat(d,'="').concat(_,'">\n <').concat(l," ").concat(d,'="').concat(C,'" contenteditable="true" placeholder="').concat(a.Formula_Input_Prompt,'"></').concat(l,">\n <").concat(l," ").concat(d,'="').concat(O,'">\n <').concat(l," ").concat(d,'="').concat(c.FORMULA_CONST.GENERATOR_BUTTON_CONTAINER_CLASS,'">\n <').concat(l," ").concat(d,'="').concat(x," ").concat(E,'" ').concat(h,'="').concat(a.Gen_Send,'"></').concat(l,">\n <").concat(l," ").concat(d,'="').concat(N," ").concat(E," ").concat(p,'" ').concat(h,'="').concat(a.Gen_Send,'"></').concat(l,">\n </").concat(l,">\n </").concat(l,">\n</").concat(l,">")),t=o.find(".".concat(E,".").concat(T)),n=o.find(".".concat(x)),e=o.find(".".concat(C)),i=o.find(".".concat(N)),n.addClass("show"),i.removeClass("show"),t.bind(v+c.AI_Formula_Panel_NS,(function(){r.notify("close")})),n.bind(v+c.AI_Formula_Panel_NS,(function(){g(e.text(),u,a,n,i)})),e.bind(m+c.AI_Formula_Panel_NS,(function(t){"Enter"!==t.key||t.shiftKey?"Escape"===t.key&&(e.text(""),t.stopPropagation()):(t.preventDefault(),g(e.text(),u,a,n,i),t.stopPropagation())})),e.bind(y+c.AI_Formula_Panel_NS,(function(t){var n,e,i,r;t.preventDefault(),n=(t.clipboardData||new DataTransfer).getData("text/plain"),(e=window.getSelection())&&0!==e.rangeCount&&((i=e.getRangeAt(0)).deleteContents(),r=document.createTextNode(n),i.insertNode(r),i.setStartAfter(r),i.setEndAfter(r),e.removeAllRanges(),e.addRange(i))})),r.eventElements=[t,n,e],o},n.prototype.show=function(){this.Wc.show()},n.prototype.hide=function(){this.Wc.hide()},n.prototype.destroy=function(){t.prototype.destroy.call(this);var n=this;n.eventElements.forEach((function(t){t.unbind(c.AI_Formula_Panel_NS)})),n.Wc.empty(),n.Wc.remove(),n.Wc=c.keyword_null,n.jio=c.keyword_null},n}(r.TypedEventNotifier),n.FormulaGenerator=d},"./dist/plugins/ai/features/pivot-table/pivot-panel-enhance.js":function(t,n,e){"use strict";var i,r,o,s,a,u;Object.defineProperty(n,"__esModule",{value:!0}),n.PivotPanel_AI=void 0,r=e("PivotTable"),o=e("./dist/plugins/ai/features/pivot-table/widgets/analyze-container.js"),s=e("./dist/plugins/ai/features/pivot-table/widgets/capsule-container.js"),a=e("./dist/plugins/ai/features/pivot-table/widgets/generate-container.js"),u=function(){function t(t){this.panel=t,this.initUI()}return t.prototype.initUI=function(){var t=this.panel,n=t.GY.Ti,e=n.querySelector(".gc-panel-addon"),i=n.querySelector(".gc-panel-left"),r=n.querySelector(".gc-panel-right");this.capsule=new s.PT_CapsuleContainer(i,t),this.generate=new a.PT_GenerateContainer(e,t),this.analyze=new o.PT_AnalyzeContainer(r,t)},t.prototype.destroy=function(){this.capsule.destroy(),this.generate.destroy(),this.analyze.destroy()},t}(),n.PivotPanel_AI=u,r&&(null===(i=r.PivotPanel)||void 0===i||i.ch("ai",{onAttach:function(){this.Pio&&this.Pio.destroy(),this.Pio=new u(this)},onDestroy:function(){this.Pio.destroy(),delete this.Pio}}))},"./dist/plugins/ai/features/pivot-table/widgets/ai-pt-container-base.js":function(t,n,e){"use strict";var i,r;Object.defineProperty(n,"__esModule",{value:!0}),n.PT_AIContainerBase=void 0,i=e("./dist/plugins/ai/ai-constants.js"),r=function(){function t(t,n){this.yoe=!1,this.hostElement=t,this.ptPanelHost=n.GY.Ti,this.pt=n.z,this.spread=this.pt.getHost().parent,this.initUI(),this.bindEvents()}return t.prototype.initUI=function(){},t.prototype.bindEvents=function(){},t.prototype.unbindEvents=function(){},t.prototype.Dio=function(t,n){n?t.addClass(i.COMMON_CONST.ICON_DISABLED_CLASS):t.removeClass(i.COMMON_CONST.ICON_DISABLED_CLASS)},t.prototype.destroy=function(){this.unbindEvents(),this.hostElement=null,this.ptPanelHost=null,this.yoe=!0},t}(),n.PT_AIContainerBase=r},"./dist/plugins/ai/features/pivot-table/widgets/analyze-container.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h,p,g=this&&this.qKr||(v=function(t,n){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},v(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}v(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),v;Object.defineProperty(n,"__esModule",{value:!0}),n.PT_AnalyzeContainer=void 0,i=e("./dist/plugins/ai/features/pivot-table/widgets/ai-pt-container-base.js"),r=e("Core"),o=e("Common"),s=e("./dist/plugins/ai/ai.ns.js"),a=e("./dist/plugins/ai/ai-constants.js"),u=e("./dist/plugins/ai/ai-common.js"),c=e("./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js"),l=e("./dist/plugins/ai/agents/util.js"),f=r.GC$,d=new o.Common.ResourceManager(s.SR,"AI"),h=d.getResource.bind(d),p=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return g(n,t),n.prototype.initUI=function(){var t=h(),n=a.PT_CONST.ANA_CONTAINER_CLASS,e=a.PT_CONST.ANA_BUTTONS_CLASS,i=a.PT_CONST.ANA_CLASS,r=a.HTML_CONST.DIV,o=a.HTML_CONST.CLASS,s=a.COMMON_CONST.AI,c=a.COMMON_CONST.BACK,l=a.COMMON_CONST.ICON_BACKGROUND_CLASS,d=a.COMMON_CONST.SEND,p=a.COMMON_CONST.COPY,g=a.COMMON_CONST.ICON_DISABLED_CLASS,v=a.COMMON_CONST.TEXT_CONTAINER_CLASS,m=a.COMMON_CONST.TEXT_CLASS,y=a.COMMON_CONST.TEXT_ICON_CLASS,b=a.COMMON_CONST.STOP,w=a.COMMON_CONST.HIDE_CLASS,S=a.COMMON_CONST.TEXT_HEADER_CLASS,A=a.COMMON_CONST.TEXT_HEADER_LEFT_CLASS,T=a.COMMON_CONST.TEXT_HEADER_TITLE_CLASS,j=f.En(r,a.keyword_null,a.keyword_null,i,this.hostElement);j.html("\n<".concat(r," ").concat(o,'="').concat(e,'">\n ').concat((0,u.yio)(c,t.Ana_Back),"\n</").concat(r,">\n<").concat(r," ").concat(o,'="').concat(S,'">\n <').concat(r," ").concat(o,'="').concat(A,'">\n ').concat((0,u.yio)(s,""),"\n <").concat(r," ").concat(o,'="').concat(T,'">').concat(t.DataAnalyze,"</").concat(r,">\n </").concat(r,">\n</").concat(r,">\n<").concat(r," ").concat(o,'="').concat(v,'">\n <').concat(r," ").concat(o,'="').concat(m,'" contenteditable="true" placeholder="').concat(t.Ana_Placeholder,'"></').concat(r,">\n <").concat(r," ").concat(o,'="').concat(y,'">\n <').concat(r," ").concat(o,'="').concat(l," ").concat(d," ").concat(g,'">\n ').concat((0,u.yio)(d,t.Ana_Send),"\n </").concat(r,">\n <").concat(r," ").concat(o,'="').concat(l," ").concat(b," ").concat(w,'">\n ').concat((0,u.yio)(b,t.Ana_Stop),"\n </").concat(r,">\n </").concat(r,">\n</").concat(r,">\n<").concat(r," ").concat(o,'="').concat(n,'">\n <').concat(r," ").concat(o,'="').concat(m,'"></').concat(r,">\n <").concat(r," ").concat(o,'="').concat(y,'">\n <').concat(r," ").concat(o,'="').concat(l,'">\n ').concat((0,u.yio)(p,t.Ana_Copy),"\n </").concat(r,">\n </").concat(r,">\n</").concat(r,">\n")),this.analyzeContainer=j},n.prototype.bindEvents=function(){var t=this,n=a.EVENT_CONST.CLICK,e=a.EVENT_CONST.KEYDOWN,i=a.EVENT_CONST.INPUT,o=a.COMMON_CONST.BACK,s=a.COMMON_CONST.SEND,u=a.COMMON_CONST.STOP,c=a.COMMON_CONST.COPY,d=a.COMMON_CONST.HIDE_CLASS,h=a.COMMON_CONST.ICON_CLASS,p=a.COMMON_CONST.TEXT_CONTAINER_CLASS,g=a.COMMON_CONST.TEXT_CLASS,v=a.COMMON_CONST.ICON_BACKGROUND_CLASS,m=a.COMMON_CONST.COPIED,y=a.PT_CONST.PANEL_ALL_CLASS,b=a.PT_CONST.ANA_CONTAINER_CLASS,w=a.PT_CONST.PANEL_SHOW_RIGHT_CLASS,S=this.analyzeContainer,A=f(this.ptPanelHost),T=S.find(".".concat(p)),j=S.find(".".concat(b)),E=T.find(".".concat(g)),_=j.find(".".concat(g)),C=T.find(".".concat(v,".").concat(s)),O=T.find(".".concat(v,".").concat(u)),x=j.find(".".concat(h,".").concat(c)),N=S.find(".".concat(h,".").concat(o)),R=function(){var n=""===E.text().trim();t.Dio(C,n)},I=function(t){t?(C.removeClass(d),O.addClass(d)):(C.addClass(d),O.removeClass(d)),R()},L=function(n){var e=E.text().trim();e&&(t.Mio=(0,r.generateRandomId)(),t.Gio(e,t.Mio,(function(){I(!0),t.Mio=a.keyword_null})),I(!1)),n.stopPropagation()},P=function(n){t.Mio=a.keyword_null,I(!0),n.stopPropagation()};C.bind(n+a.AI_Pivot_Panel_NS,L),O.bind(n+a.AI_Pivot_Panel_NS,P),E.bind(e+a.AI_Pivot_Panel_NS,(function(t){"Enter"!==t.key||t.shiftKey||(t.preventDefault(),L(t)),"Escape"===t.key&&E.text(""),R()})),T.bind(i+a.AI_Pivot_Panel_NS,R),N.bind(n+a.AI_Pivot_Panel_NS,(function(){A.find(".".concat(y)).removeClass(w)})),x.bind(n+a.AI_Pivot_Panel_NS,(function(){(0,l.Yio)(_.html()),x.removeClass(c).addClass(m),setTimeout((function(){return x.removeClass(m).addClass(c)}),1e3)})),this.eventElements=[C,E,N,x,O,T]},n.prototype.Gio=function(t,n,e){var i=this,r=i.analyzeContainer,o=r.find(".".concat(a.PT_CONST.ANA_CONTAINER_CLASS)),s=o.find(".".concat(a.COMMON_CONST.TEXT_CLASS)),u=h();(0,c.aio)(this.spread,this.pt,t,(function(t){if(i.yoe||i.Mio!==n)return e(),!0;var r=t.deltaData.includes(u.AI_ERROR);return s.html(r?u.PT_Layout_Exp_Error:t.wholeData),r?(e(),!0):void 0})).then((function(t){if(i.yoe||i.Mio!==n)e();else{var r=t.includes(u.AI_ERROR);s.html(r?u.PT_Layout_Exp_Error:t),e()}})).catch((function(t){var n=(null==t?void 0:t.message)===u.ERROR_NO_AI_INJECT?u.ERROR_NO_AI_INJECT:u.Formula_Exp_Error;s.html(n),e()}))},n.prototype.unbindEvents=function(){this.eventElements.forEach((function(t){t.unbind(a.AI_Pivot_Panel_NS)})),this.eventElements=[]},n.prototype.destroy=function(){t.prototype.destroy.call(this),this.analyzeContainer.remove(),this.analyzeContainer=a.keyword_null},n}(i.PT_AIContainerBase),n.PT_AnalyzeContainer=p},"./dist/plugins/ai/features/pivot-table/widgets/capsule-container.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h=this&&this.qKr||(p=function(t,n){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},p(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}p(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),p;function g(t,n){var e,i=a.HTML_CONST.ACTIVE_CLASS,r=a.HTML_CONST.HEIGHT,o=a.HTML_CONST.SCROLL_HEIGHT,s=a.HTML_CONST.AUTO,u=a.HTML_CONST.PX,l=a.EVENT_CONST.TRANSITIONEND;t=c(t),n||(n=t.hasClass(i)),n?(t.css(r,t.prop(o)+u),requestAnimationFrame((function(){return t.css(r,"0")})),t.removeClass(i)):(t.addClass(i),e=t.prop(o),t.css(r,"0"),requestAnimationFrame((function(){return t.css(r,e+u)})),t.bind(l,(function n(){t.hasClass(i)&&t.css(r,s),t.unbind(l,n)})))}Object.defineProperty(n,"__esModule",{value:!0}),n.toggleGenerateContainer=n.PT_CapsuleContainer=void 0,i=e("./dist/plugins/ai/features/pivot-table/widgets/ai-pt-container-base.js"),r=e("Core"),o=e("Common"),s=e("./dist/plugins/ai/ai.ns.js"),a=e("./dist/plugins/ai/ai-constants.js"),u=e("./dist/plugins/ai/ai-common.js"),c=r.GC$,l=new o.Common.ResourceManager(s.SR,"AI"),f=l.getResource.bind(l),d=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return h(n,t),n.prototype.initUI=function(){var t=f(),n=a.PT_CONST.CAPSULE_CLASS,e=a.COMMON_CONST.GENERATE,i=a.COMMON_CONST.ANALYZE;this.aiCapsule=c.En(a.HTML_CONST.DIV,a.keyword_null,a.keyword_null,n,this.hostElement),this.aiCapsule.html("\n ".concat((0,u.yio)(e,t.GenerateLayout,!0),"\n ").concat((0,u.yio)(i,t.DataAnalyze,!0),"\n"))},n.prototype.bindEvents=function(){var t=this,n=c(t.ptPanelHost),e=t.aiCapsule,i=a.PT_CONST.PANEL_SHOW_RIGHT_CLASS,r=a.PT_CONST.PANEL_ALL_CLASS,o=a.PT_CONST.PANEL_ADDON_CLASS,s=a.EVENT_CONST.CLICK,u=a.COMMON_CONST.ICON_CLASS,l=a.COMMON_CONST.GENERATE,f=a.COMMON_CONST.ANALYZE,d=n.find(".".concat(r)),h=n.find(".".concat(o)),p=e.find(".".concat(u,".").concat(l)),v=e.find(".".concat(u,".").concat(f));p.bind(s+a.AI_Pivot_Panel_NS,(function(t){g(h)})),v.bind(s+a.AI_Pivot_Panel_NS,(function(t){d.hasClass(i)?d.removeClass(i):d.addClass(i)}))},n.prototype.unbindEvents=function(){this.aiCapsule.unbind(a.AI_Pivot_Panel_NS)},n.prototype.destroy=function(){t.prototype.destroy.call(this),this.aiCapsule.remove()},n}(i.PT_AIContainerBase),n.PT_CapsuleContainer=d,n.toggleGenerateContainer=g},"./dist/plugins/ai/features/pivot-table/widgets/generate-container.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h,p,g,v,m,y,b=this&&this.qKr||(w=function(t,n){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},w(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}w(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),w;function S(t){return!(!y(t)||3!==t.length)&&t.every((function(t){return y(t)&&2===t.length&&A(t[1])}))}function A(t){return!(!y(t)||4!==t.length)&&t.every((function(t,n){return y(t)&&T(t,3===n)}))}function T(t,n){return!!y(t)&&t.every((function(t){return y(t)&&n?3===t.length:2===t.length}))}Object.defineProperty(n,"__esModule",{value:!0}),n.PT_GenerateContainer=void 0,i=e("Core"),r=e("Common"),o=e("./dist/plugins/ai/features/pivot-table/widgets/ai-pt-container-base.js"),s=e("./dist/plugins/ai/features/pivot-table/widgets/capsule-container.js"),a=e("./dist/plugins/ai/ai.ns.js"),u=e("./dist/plugins/ai/ai-common.js"),c=e("./dist/plugins/ai/ai-constants.js"),l=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js"),f=e("./dist/plugins/ai/context/pivot-table.js"),d=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-layout-suggestion.js"),h=e("./dist/plugins/ai/error-overlay.js"),p=i.GC$,g=new r.Common.ResourceManager(a.SR,"AI"),v=g.getResource.bind(g),m=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.Fio=!1,n.kio=!1,n.Uio=!1,n.Hio=[],n.eventElements=[],n.globalEvents=[],n}return b(n,t),n.prototype.initUI=function(){var t=v(),n=c.PT_CONST.GEN_SPIN_LINE_CLASS,e=c.PT_CONST.GEN_CLASS,i=c.PT_CONST.SUG_CONTAINER_CLASS,r=c.PT_CONST.SUG_DROPDOWN_CLASS,o=c.PT_CONST.SUG_DROPDOWN_HEADER_CLASS,s=c.PT_CONST.SUG_ITEM_CONTAINER_CLASS,a=c.HTML_CONST.DIV,l=c.HTML_CONST.CLASS,f=c.COMMON_CONST.REFRESH,d=c.COMMON_CONST.SEND,h=c.COMMON_CONST.RESET,g=c.COMMON_CONST.AI,m=c.COMMON_CONST.CLOSE,y=c.COMMON_CONST.ARROW_UP,b=c.COMMON_CONST.ICON_BACKGROUND_CLASS,w=c.COMMON_CONST.ICON_DISABLED_CLASS,S=c.COMMON_CONST.TEXT_CONTAINER_CLASS,A=c.COMMON_CONST.TEXT_CLASS,T=c.COMMON_CONST.TEXT_ICON_CLASS,j=c.COMMON_CONST.SEPARATOR_CLASS,E=c.COMMON_CONST.TEXT_HEADER_CLASS,_=c.COMMON_CONST.TEXT_HEADER_LEFT_CLASS,C=c.COMMON_CONST.TEXT_HEADER_RIGHT_CLASS,O=c.COMMON_CONST.TEXT_HEADER_TITLE_CLASS,x=p.En(a,c.keyword_null,c.keyword_null,e,this.hostElement);x.html("\n<".concat(a," ").concat(l,'="').concat(n,'"></').concat(a,">\n\n<").concat(a," ").concat(l,'="').concat(E,'">\n <').concat(a," ").concat(l,'="').concat(_,'">\n ').concat((0,u.yio)(g,""),"\n <").concat(a," ").concat(l,'="').concat(O,'">').concat(t.GenerateLayout,"</").concat(a,">\n </").concat(a,">\n <").concat(a," ").concat(l,'="').concat(C,'">\n ').concat((0,u.yio)(m,t.GEN_Close),"\n </").concat(a,">\n</").concat(a,">\n\n<").concat(a," ").concat(l,'="').concat(S,'">\n <').concat(a," ").concat(l,'="').concat(A,'" contenteditable="true" placeholder="').concat(t.Gen_Placeholder,'"></').concat(a,">\n <").concat(a," ").concat(l,'="').concat(T,'">\n ').concat((0,u.yio)(h+" "+w,t.Gen_Reset),"\n <").concat(a," ").concat(l,'="').concat(j,'"></').concat(a,">\n <").concat(a," ").concat(l,'="').concat(b," ").concat(d," ").concat(w,'">\n ').concat((0,u.yio)(d,t.Gen_Send),"\n </").concat(a,">\n </").concat(a,">\n</").concat(a,">\n\n<").concat(a," ").concat(l,'="').concat(i,'">\n <span>').concat(t.Gen_Sug,"</span>\n ").concat((0,u.yio)(y,t.Gen_ShowSuggestion),"\n</").concat(a,">\n\n<").concat(a," ").concat(l,'="').concat(r,'">\n <').concat(a," ").concat(l,'="').concat(o,'"> ').concat((0,u.yio)(f,t.Gen_Refresh)," </").concat(a,">\n <").concat(a," ").concat(l,'="').concat(s,'"></').concat(a,">\n</").concat(a,">\n")),this.genContainer=x},n.prototype.bindEvents=function(){var t,n,e,i,r,o=this,a=this.genContainer,l=p(o.ptPanelHost),f=o.spread,g=o.pt,m=v(),y=c.PT_CONST.SUG_CONTAINER_CLASS,b=c.PT_CONST.SUG_DROPDOWN_CLASS,w=c.PT_CONST.SUG_ITEM_CONTAINER_CLASS,A=c.PT_CONST.SUG_ITEM_CLASS,T=c.PT_CONST.PANEL_ADDON_CLASS,j=c.HTML_CONST.LOADING,E=c.HTML_CONST.DIV,_=c.EVENT_CONST.CLICK,C=c.EVENT_CONST.KEYDOWN,O=c.EVENT_CONST.INPUT,x=c.COMMON_CONST.ICON_CLASS,N=c.COMMON_CONST.REFRESH,R=c.COMMON_CONST.RESET,I=c.COMMON_CONST.SEND,L=c.COMMON_CONST.CLOSE,P=c.COMMON_CONST.TEXT_CONTAINER_CLASS,k=c.COMMON_CONST.TEXT_CLASS,D=c.COMMON_CONST.ICON_BACKGROUND_CLASS,M=l.find(".".concat(T)),F=a.find(".".concat(P)),U=a.find(".".concat(k)),G=a.find(".".concat(y)),H=a.find(".".concat(b)),B=a.find(".".concat(w)),q=a.find(".".concat(x,".").concat(N)),J=function(){B.html(""),q.addClass(j)},X=function(t){B.empty();var n=[];return t.forEach((function(t,n){var e,i=p.En(E,c.keyword_null,c.keyword_null,A);i.attr("data-suggestion",n),i.text(t[0]),e=t[1],i.bind(_+c.AI_Pivot_Panel_NS,(function(t){try{o.qio(e)}catch(t){h.ErrorOverlay.show(m.PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(G[0]))}finally{H.hide(),t.stopPropagation()}})),B.append(i)})),n};function $(){if(!o.Fio){o.Fio=!0,J();var t=o.Hio.length?o.Hio.join("\n"):c.keyword_null;(0,d.cio)(f,g,c.keyword_undefined,t).then((function(t){if(!o.yoe)if(q.removeClass(j),(0,u.gio)(t,m.PT_Layout_Gen_Error,G[0]))H.hide();else try{var n=(0,u.parseJSON)(t);S(n),X(n),o.Jio(n),o.kio=!0}catch(t){h.ErrorOverlay.show(m.PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(G[0])),H.hide()}finally{o.Fio=!1}})).catch((function(t){var n=(null==t?void 0:t.message)===m.ERROR_NO_AI_INJECT?m.ERROR_NO_AI_INJECT:m.PT_Layout_Gen_Error;h.ErrorOverlay.show(n,(0,u.getGenerateErrorDialogPosition)(G[0])),q.removeClass(j),H.hide(),o.Fio=!1}))}}G.bind(_+c.AI_Pivot_Panel_NS,(function(t){H.isVisible()?H.hide():(H.show(),o.Fio||o.kio||$()),t.stopPropagation()})),t=function(t){!H.isVisible()||H[0].contains(t.target)||G[0].contains(t.target)||H.hide()}.bind(this),document.addEventListener(_,t,!0),q.bind(_+c.AI_Pivot_Panel_NS,(function(t){$(),t.stopPropagation()})),n=function(t){if(!o.Uio){var n=U.text();n&&(o.Uio=!0,o.mio(),o.Bio(n)),t.stopPropagation()}},e=a.find(".".concat(x,".").concat(R)),i=a.find(".".concat(D,".").concat(I)),r=a.find(".".concat(x,".").concat(L)),e.bind(_+c.AI_Pivot_Panel_NS,(function(t){o.c5(),t.stopPropagation()})),i.bind(_+c.AI_Pivot_Panel_NS,n),U.bind(C+c.AI_Pivot_Panel_NS,(function(t){"Enter"!==t.key||t.shiftKey||(t.preventDefault(),n(t)),"Escape"===t.key&&(U.text(""),o.Dio(i,!0)),t.stopPropagation()})),U.bind(O+c.AI_Pivot_Panel_NS,(function(t){var n=""===U.text().trim();o.Dio(i,n)})),r.bind(_+c.AI_Pivot_Panel_NS,(function(t){(0,s.toggleGenerateContainer)(M,!1),t.stopPropagation()})),F.bind(_+c.AI_Pivot_Panel_NS,(function(t){U.focus(),t.stopPropagation()})),this.eventElements=[G,H,q,e,i,F,U],this.globalEvents=[t]},n.prototype.Bio=function(t){var n=this,e=n.spread,i=n.pt;(0,l.lio)(e,t,i).then((function(t){var e,i,r,o;if(!n.yoe){e=c.COMMON_CONST.ICON_BACKGROUND_CLASS,i=c.COMMON_CONST.SEND,r=n.genContainer.find(".".concat(e,".").concat(i));try{if(t.includes(v().AI_ERROR))h.ErrorOverlay.show(v().PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(r[0]));else{if(!A(o=(0,u.parseJSON)(t)))return void h.ErrorOverlay.show(v().PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(r[0]));n.qio((0,u.parseJSON)(t))}}catch(t){h.ErrorOverlay.show(v().PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(r[0]))}finally{n.Uio=!1,n.vio()}}})).catch((function(t){var e,i,r;n.yoe||(e=c.COMMON_CONST.ICON_BACKGROUND_CLASS,i=c.COMMON_CONST.SEND,r=n.genContainer.find(".".concat(e,".").concat(i)),h.ErrorOverlay.show(t.message,(0,u.getGenerateErrorDialogPosition)(r[0])),n.Uio=!1,n.vio())}))},n.prototype.mio=function(){if(!this.Xio){var t=p(this.ptPanelHost).find("."+c.PT_CONST.PANEL_ALL_CLASS);this.Xio=(0,u.mio)(t)}},n.prototype.vio=function(){this.Xio&&(this.Xio(),delete this.Xio)},n.prototype.qio=function(t){if(!this.zio){this.zio=(0,f.Sio)(this.pt);var n=this.genContainer.find(".".concat(c.COMMON_CONST.ICON_CLASS,".").concat(c.COMMON_CONST.RESET));this.Dio(n,!1)}(0,f.bio)(this.pt,t)},n.prototype.c5=function(){if(this.zio){this.qio(this.zio),delete this.zio;var t=this.genContainer.find(".".concat(c.COMMON_CONST.ICON_CLASS,".").concat(c.COMMON_CONST.RESET));this.Dio(t,!0)}this.Hio=[]},n.prototype.Jio=function(t){var n=this.Hio;t.forEach((function(t){n.push(t[0])})),n.length>c.PT_CONST.MAX_SUGGESTIONS&&(n=n.slice(n.length-c.PT_CONST.MAX_SUGGESTIONS,n.length)),this.Hio=n},n.prototype.unbindEvents=function(){this.eventElements.forEach((function(t){t.unbind(c.AI_Pivot_Panel_NS)})),this.globalEvents.forEach((function(t){document.removeEventListener(c.EVENT_CONST.CLICK,t)})),this.eventElements=[],this.globalEvents=[]},n.prototype.destroy=function(){t.prototype.destroy.call(this),this.vio(),this.genContainer.remove(),this.genContainer=c.keyword_null,this.zio=c.keyword_null,this.Hio=c.keyword_null},n}(o.PT_AIContainerBase),n.PT_GenerateContainer=m,y=Array.isArray},"./dist/plugins/ai/functions/define-ai-function.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d;function h(t,n,e){var i=t.getValue(n,e);return u(i)?"":"object"==typeof i?i instanceof Date?t.getText(n,e):i instanceof r.CalcError?i:"":i}function p(t,n){if(t)return Object.keys(n).forEach((function(e){var i=n[e];Object.keys(i).forEach((function(n){t[e][n]=i[n]}))})),t}function g(t,n,e){var i,o,s,a,u=t.getRowCount(),c=t.getColumnCount(),l=n.getRow(0),f=n.getColumn(0),d=Math.min(n.getRowCount(0),u-l),p=Math.min(n.getColumnCount(0),c-f),g=[],v={};for(i=0;i<d;i++){for(o=[],s=0;s<p;s++)(a=h(e,l+i,f+s))instanceof r.CalcError&&(v[i]||(v[i]={}),v[i][s]=a,a=""),o.push(a);g.push(o)}return{array:JSON.stringify(g),errorMap:v}}function v(t,n,e){var i,r;return h(e,n.getRow(0),n.getColumn(0))}function m(t){var n=t.functionName,e=t.minArgs,i=t.maxArgs,r=t.evaluateFunction,u=t.argsLimit,h=t.defaultValue,p=void 0===h?l:h,g=t.acceptsArray,v=void 0===g?f:g,m=t.acceptsReference,y=void 0===m?d:m,b=t.errorCode,w=void 0===b?a:b,S=t.description,A=new s(n,e,i);A.R9t=u,A.defaultValue=p,A.evaluateAsync=function(){var t,n,e,i,o=Array.from(arguments),s=o[0],a=o[1],u=(null==a?void 0:a.rT)||(null===(t=s.ctx)||void 0===t?void 0:t.source);if(!u)return w;if(e=(n=u.Mf).parent,!n||!e)return w;try{return!1===(i=r(n,o))?w:c}catch(t){}return w},A.acceptsArray=v,A.acceptsReference=y,A.description=S,o.Mmt[n]=A}Object.defineProperty(n,"__esModule",{value:!0}),n.defineAIFunction=n.getTextFromCalcReference=n.getArrayTextFromCalcReference=n.restoreCalcErrors=void 0,i=e("Common"),r=e("CalcEngine"),o=r.Functions,s=o.AsyncFunction,a=r.Errors.Value,u=i.Common.lt.ht,c="#BUSY!",l=function(){return c},f=function(){return!0},d=function(){return!0},n.restoreCalcErrors=p,n.getArrayTextFromCalcReference=g,n.getTextFromCalcReference=v,n.defineAIFunction=m},"./dist/plugins/ai/functions/function-description.js":function(t,n,e){"use strict";var i,r,o,s,a,u=this&&this.iJr||function(t,n,e){if(e||2===arguments.length)for(var i=0,r=n.length,o;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return t.concat(o||Array.prototype.slice.call(n))};function c(){return{name:"SJS.AI.QUERY",isFunc:!0,description:a().Query_Function_Description,parameters:[{name:"prompt"},{name:"value"}]}}function l(){return{name:"SJS.AI.TEXTSENTIMENT",isFunc:!0,description:a().Text_Sentiment_Function_Description,parameters:[{name:"value"},{name:"positive"},{name:"negative"},{name:"neutral",optional:!0}]}}function f(){return{name:"SJS.AI.TRANSLATE",isFunc:!0,description:a().Translate_Function_Description,parameters:[{name:"value"},{name:"language"}]}}Object.defineProperty(n,"__esModule",{value:!0}),n.getAITranslateFunctionDescription=n.getAITextSentimentFunctionDescription=n.getAIQueryFunctionDescription=void 0,i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=new i.Common.ResourceManager(o.SR,"AI"),a=s.getResource.bind(s),r.Worksheet.ch("AI",{getAllFunctions:function(t){t.funcs=u(u([],t.funcs,!0),[c(),l(),f()],!1)}}),n.getAIQueryFunctionDescription=c,n.getAITextSentimentFunctionDescription=l,n.getAITranslateFunctionDescription=f},"./dist/plugins/ai/functions/query.js":function(t,n,e){"use strict";var i,r,o,s,a,u;Object.defineProperty(n,"__esModule",{value:!0}),i=e("CalcEngine"),r=e("./dist/plugins/ai/agents/query/query.js"),o=e("./dist/plugins/ai/ai-common.js"),s=e("./dist/plugins/ai/functions/define-ai-function.js"),a=e("./dist/plugins/ai/functions/function-description.js"),u=i.Errors.Value,(0,s.defineAIFunction)({functionName:"SJS.AI.QUERY",minArgs:2,maxArgs:2,evaluateFunction:function(t,n){var e,a,c=t.parent,l=n[0],f=n[1],d=n[2],h={},p=f.rT||(null===(e=l.ctx)||void 0===e?void 0:e.source);return!(f&&f instanceof i.CalcReference&&(f=(0,s.getTextFromCalcReference)(p,f,t))instanceof i.CalcError)&&(d&&d instanceof i.CalcReference&&(d=(a=(0,s.getArrayTextFromCalcReference)(p,d,t)).array,h=a.errorMap),(0,r.fio)(c,d,f).then((function(t){l.setAsyncResult(new i.CalcArray((0,s.restoreCalcErrors)((0,o.parseJSON)(t),h)))})).catch((function(t){l.setAsyncResult(u)})),!0)},errorCode:u,description:a.getAIQueryFunctionDescription})},"./dist/plugins/ai/functions/text-sentiment.js":function(t,n,e){"use strict";var i,r,o,s,a,u;function c(t,n,e,i){switch(void 0===i&&(i=""),t=t.toLowerCase()){case"positive":return n;case"negative":return e;case"neutral":return i;default:return t}}Object.defineProperty(n,"__esModule",{value:!0}),i=e("CalcEngine"),r=e("./dist/plugins/ai/agents/textSentiment/text-sentiment.js"),o=e("./dist/plugins/ai/ai-common.js"),s=e("./dist/plugins/ai/functions/define-ai-function.js"),a=e("./dist/plugins/ai/functions/function-description.js"),u=i.Errors.Value,(0,s.defineAIFunction)({functionName:"SJS.AI.TEXTSENTIMENT",minArgs:3,maxArgs:4,evaluateFunction:function(t,n){var e,a,l=t.parent,f=n[0],d=n[1],h=n[2],p=n[3],g=n[4],v={},m=d.rT||(null===(e=f.ctx)||void 0===e?void 0:e.source);return d&&d instanceof i.CalcReference&&(d=(a=(0,s.getArrayTextFromCalcReference)(m,d,t)).array,v=a.errorMap),h&&h instanceof i.CalcReference&&(h=(0,s.getTextFromCalcReference)(m,h,t)),p&&p instanceof i.CalcReference&&(p=(0,s.getTextFromCalcReference)(m,p,t)),g&&g instanceof i.CalcReference&&(g=(0,s.getTextFromCalcReference)(m,g,t)),(0,r.hio)(l,d).then((function(t){var n,e,r,a,u=(0,o.parseJSON)(t)||[],l=[];for(n=0;n<u.length;n++){for(e=u[n],r=[],a=0;a<e.length;a++)r.push(c(e[a],h,p,g));l.push(r)}f.setAsyncResult(new i.CalcArray((0,s.restoreCalcErrors)(l,v)))})).catch((function(t){f.setAsyncResult(u)})),!0},errorCode:u,description:a.getAITextSentimentFunctionDescription})},"./dist/plugins/ai/functions/translate.js":function(t,n,e){"use strict";var i,r,o,s,a,u;Object.defineProperty(n,"__esModule",{value:!0}),i=e("CalcEngine"),r=e("./dist/plugins/ai/agents/translate/translate.js"),o=e("./dist/plugins/ai/ai-common.js"),s=e("./dist/plugins/ai/functions/define-ai-function.js"),a=e("./dist/plugins/ai/functions/function-description.js"),u=i.Errors.Value,(0,s.defineAIFunction)({functionName:"SJS.AI.TRANSLATE",minArgs:2,maxArgs:2,evaluateFunction:function(t,n){var e,a,c=t.parent,l=n[0],f=n[1],d=n[2],h={},p=f.rT||(null===(e=l.ctx)||void 0===e?void 0:e.source);return f&&f instanceof i.CalcReference&&(f=(a=(0,s.getArrayTextFromCalcReference)(p,f,t)).array,h=a.errorMap),!(d&&d instanceof i.CalcReference&&(d=(0,s.getTextFromCalcReference)(p,d,t))instanceof i.CalcError)&&((0,r.dio)(c,f,d).then((function(t){l.setAsyncResult(new i.CalcArray((0,s.restoreCalcErrors)((0,o.parseJSON)(t),h)))})).catch((function(t){l.setAsyncResult(u)})),!0)},errorCode:u,description:a.getAITranslateFunctionDescription})},"./dist/plugins/ai/interface.js":function(t,n){"use strict";var e,i,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.PivotTableContextArgs=n.TableContextArgs=n.WorksheetContextArgs=n.WorkbookContextArgs=void 0,function(t){t[t.names=1]="names",t[t.sheetNames=2]="sheetNames",t[t.activeSheet=4]="activeSheet",t[t.eachSheetColumnHeaders=8]="eachSheetColumnHeaders",t[t.all=15]="all"}(e=n.WorkbookContextArgs||(n.WorkbookContextArgs={})),function(t){t[t.names=1]="names",t[t.selections=2]="selections",t[t.axisInfo=4]="axisInfo",t[t.currentFormula=8]="currentFormula",t[t.all=15]="all"}(i=n.WorksheetContextArgs||(n.WorksheetContextArgs={})),function(t){t[t.range=1]="range",t[t.columns=2]="columns",t[t.data=4]="data",t[t.all=7]="all"}(r=n.TableContextArgs||(n.TableContextArgs={})),function(t){t[t.range=1]="range",t[t.source=2]="source",t[t.layout=4]="layout",t[t.data=8]="data",t[t.totalData=16]="totalData",t[t.group=32]="group",t[t.filter=64]="filter",t[t.all=111]="all"}(o=n.PivotTableContextArgs||(n.PivotTableContextArgs={}))},CalcEngine:function(n){"use strict";n.exports=t.Spread.CalcEngine},Common:function(n){"use strict";n.exports=t.Spread},Core:function(n){"use strict";n.exports=t.Spread.Sheets},FormulaPanel:function(n){"use strict";n.exports=t.Spread.Sheets.FormulaPanel},Pivot:function(n){"use strict";n.exports=t.Pivot},PivotTable:function(n){"use strict";n.exports=t.Spread.Pivot},Tables:function(n){"use strict";n.exports=t.Spread.Sheets.Tables}},i={};function r(t){var n,o=i[t];return void 0!==o?o.exports:(n=i[t]={exports:{}},e[t].call(n.exports,n,n.exports,r),n.exports)}n=r("./dist/plugins/ai/ai.entry.js"),(((t=void 0===t?{}:t).Spread=t.Spread||{}).Sheets=t.Spread.Sheets||{}).AI=n}()}));
|
|
12
|
+
!function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("@mescius/spread-sheets")):"function"==typeof define&&define.amd?define(["@mescius/spread-sheets"],t):"object"==typeof exports?exports.Spread=t(require("@mescius/spread-sheets")):t(GC)}((function(t){!function(){var n,e={"./dist/plugins/ai/agents/formula/explain-formula.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},l=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function f(t,n,e){return c(this,void 0,void 0,(function(){var i,r,a,c;return l(this,(function(l){switch(l.label){case 0:return i=u(),r=i.Formula_Exp_Sys+(0,s.tio)(t),a=i.Formula_Exp_User+n,[4,(0,o.nio)(t,r,a,{stream:!0})];case 1:return c=l.sent(),[2,(0,o.eio)(c,e)]}}))}))}Object.defineProperty(n,"__esModule",{value:!0}),n.iio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/agents/util.js"),s=e("./dist/plugins/ai/agents/formula/generate-formula.js"),a=new i.Common.ResourceManager(r.SR,"AI"),u=a.getResource.bind(a),n.iio=f},"./dist/plugins/ai/agents/formula/generate-formula.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},f=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function d(t,n){return l(this,void 0,void 0,(function(){var e,i,r,o;return f(this,(function(s){switch(s.label){case 0:return e=c(),i=e.Formula_Gen_Sys+h(t)+e.Formula_Gen_Exclude,r=e.Formula_Gen_User+n,[4,(0,a.nio)(t,i,r)];case 1:return o=s.sent(),[2,(0,a.eio)(o)]}}))}))}function h(t){var n=t.getAIContext(),e=t.getActiveSheet();return e?(n+=e.getAIContext(),n+=(0,o.oio)(e,s.TableContextArgs.all&~s.TableContextArgs.data)):n}Object.defineProperty(n,"__esModule",{value:!0}),n.tio=n.sio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/context/table.js"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/agents/util.js"),u=new i.Common.ResourceManager(r.SR,"AI"),c=u.getResource.bind(u),n.sio=d,n.tio=h},"./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},d=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function h(t,n,e,o){return f(this,void 0,void 0,(function(){var s,a,u,c;return d(this,(function(f){switch(f.label){case 0:return i?(s=l(),a=s.PT_Layout_Exp_Sys,a+=n.getAIContext(p(n)),u=s.PT_Layout_Exp_User,e&&(u+=s.PT_Layout_Exp_User_REQ+e),[4,(0,r.nio)(t,a,u,{stream:!0})]):[2,l().ERROR_NO_PACKAGE+"Pivot Table"];case 1:return c=f.sent(),[2,(0,r.eio)(c,o)]}}))}))}function p(t){var n=t.getRange().content,e=s.PivotTableContextArgs.all;return n.rowCount*n.colCount>u.PT_CONST.MAX_DATA_LENGTH&&(e=e&~s.PivotTableContextArgs.data|s.PivotTableContextArgs.totalData),e}Object.defineProperty(n,"__esModule",{value:!0}),n.rio=n.aio=void 0,i=e("PivotTable"),r=e("./dist/plugins/ai/agents/util.js"),o=e("Common"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/ai.ns.js"),u=e("./dist/plugins/ai/ai-constants.js"),c=new o.Common.ResourceManager(a.SR,"AI"),l=c.getResource.bind(c),n.aio=h,n.rio=p},"./dist/plugins/ai/agents/pivot-table/generate-pivot-layout-suggestion.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},h=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function p(t,n,e,i){return d(this,void 0,void 0,(function(){var r,l,d,p,g;return h(this,(function(h){switch(h.label){case 0:if(!a)return[2,f().ERROR_NO_PACKAGE+"Pivot Table"];r=f();try{l=n?n.getAIContext(e||o.PivotTableContextArgs.source):(0,u.uio)(t,o.PivotTableContextArgs.source)}catch(t){return[2,r.ERROR_CANNOT_FIND_PIVOT_TABLE]}return d="".concat(r.PT_Layout_Sug_Sys).concat(l),i&&(d+=(0,c.Vi)(r.PT_Layout_Sug_History,[r.REPLACE_MAP.SUG_HISTORY],[i])),p="".concat(r.PT_Layout_Sug_User),[4,(0,s.nio)(t,d,p)];case 1:return g=h.sent(),[2,(0,s.eio)(g)]}}))}))}Object.defineProperty(n,"__esModule",{value:!0}),n.cio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/interface.js"),s=e("./dist/plugins/ai/agents/util.js"),a=e("PivotTable"),u=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js"),c=e("./dist/plugins/ai/context/util.js"),l=new i.Common.ResourceManager(r.SR,"AI"),f=l.getResource.bind(l),n.cio=p},"./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},f=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function d(t,n,e,i){return l(this,void 0,void 0,(function(){var r,u,l,d,p;return f(this,(function(f){switch(f.label){case 0:if(!s)return[2,c().ERROR_NO_PACKAGE+"Pivot Table"];r=c();try{u=e?e.getAIContext(i||(0,a.rio)(e)):h(t,(0,a.rio)(e))}catch(t){return[2,r.ERROR_CANNOT_FIND_PIVOT_TABLE]}return l="".concat(r.PT_Layout_Gen_Sys).concat(u).concat(r.PT_Layout_Example),d="".concat(r.PT_Layout_Gen_User).concat(n),[4,(0,o.nio)(t,l,d)];case 1:return p=f.sent(),[2,(0,o.eio)(p)]}}))}))}function h(t,n){var e,i,r,o,a;if(!s)return c().ERROR_NO_PACKAGE+"Pivot Table";if(i=(e=t.getActiveSheet()).getActiveRowIndex(),r=e.getActiveColumnIndex(),!(o=e.pivotTables.all()).length)throw new Error;return(a=e.pivotTables.findPivotTable(i,r)||o[0]).getAIContext(n)}Object.defineProperty(n,"__esModule",{value:!0}),n.uio=n.lio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/agents/util.js"),s=e("PivotTable"),a=e("./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js"),u=new i.Common.ResourceManager(r.SR,"AI"),c=u.getResource.bind(u),n.lio=d,n.uio=h},"./dist/plugins/ai/agents/query/query.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},l=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function f(t,n,e){return c(this,void 0,void 0,(function(){var i,r,o,a;return l(this,(function(c){switch(c.label){case 0:return i=u(),r="".concat(i.Query_Sys," ").concat(d(t)),o="".concat(i.Query_User_Context," ").concat(n,"\n").concat(e,"\n").concat(i.Query_User_Keep_Structure),[4,(0,s.nio)(t,r,o)];case 1:return a=c.sent(),[2,(0,s.eio)(a)]}}))}))}function d(t){var n=t.getAIContext(r.WorkbookContextArgs.sheetNames|r.WorkbookContextArgs.activeSheet),e=t.getActiveSheet();return n+=e.getAIContext(r.WorksheetContextArgs.selections|r.WorksheetContextArgs.axisInfo)}Object.defineProperty(n,"__esModule",{value:!0}),n.fio=void 0,i=e("Common"),r=e("./dist/plugins/ai/interface.js"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/agents/util.js"),a=new i.Common.ResourceManager(o.SR,"AI"),u=a.getResource.bind(a),n.fio=f},"./dist/plugins/ai/agents/textSentiment/text-sentiment.js":function(t,n,e){"use strict";var i,r,o,s,a,u=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},c=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function l(t,n){return u(this,void 0,void 0,(function(){var e,i,r,s;return c(this,(function(u){switch(u.label){case 0:return e=a(),i=e.TextSentiment_Sys,r="".concat(e.TextSentiment_User," ").concat(n),[4,(0,o.nio)(t,i,r)];case 1:return s=u.sent(),[2,(0,o.eio)(s)]}}))}))}Object.defineProperty(n,"__esModule",{value:!0}),n.hio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/agents/util.js"),s=new i.Common.ResourceManager(r.SR,"AI"),a=s.getResource.bind(s),n.hio=l},"./dist/plugins/ai/agents/translate/translate.js":function(t,n,e){"use strict";var i,r,o,s,a,u=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},c=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function l(t,n,e){return u(this,void 0,void 0,(function(){var i,r,s,u;return c(this,(function(c){switch(c.label){case 0:return i=a(),r=i.Translate_Sys,s="".concat(i.Translate_User_Text).concat(n).concat(i.Translate_User_To," ").concat(e),[4,(0,o.nio)(t,r,s)];case 1:return u=c.sent(),[2,(0,o.eio)(u)]}}))}))}Object.defineProperty(n,"__esModule",{value:!0}),n.dio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=e("./dist/plugins/ai/agents/util.js"),s=new i.Common.ResourceManager(r.SR,"AI"),a=s.getResource.bind(s),n.dio=l},"./dist/plugins/ai/agents/util.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h,p,g,v,m,y,b,w,S,A=this&&this.nJr||function(){return A=Object.assign||function(t){var n,e,i,r;for(e=1,i=arguments.length;e<i;e++)for(r in n=arguments[e])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},A.apply(this,arguments)},T=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},j=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function E(t,n){return T(this,void 0,void 0,(function(){return j(this,(function(e){try{if(m(t))return[2,x(t,n)];if(y(t))return[2,R(t,n)];if(v(t))return[2,C(t)];if(b(t))return[2,O(t)];throw new Error(c().ERROR_UNSUPPORTED_TYPE)}catch(t){throw new Error("".concat(c().ERROR_RESPONSE_FAILED).concat(t.message))}}))}))}function _(t,n,e,i){return T(this,void 0,void 0,(function(){return j(this,(function(r){return n+=(0,a.pio)(),[2,t.aiCaller.fetchAI(A({messages:[{role:"system",content:n},{role:"user",content:e}]},i))]}))}))}function C(t){var n=S(t,p);if(n)return n;throw new Error(c().ERROR_NO_CONTENT)}function O(t){var n,e;try{return n=(0,r.parseJSON)(t),(e=S(n,p))||(t.includes(l)?N(t):t)}catch(n){return t}}function x(t,n){return T(this,void 0,void 0,(function(){var e,i;return j(this,(function(r){switch(r.label){case 0:return(e=t.headers.get("content-type")||h).includes(d)?[2,R(t.body,n)]:[4,t.text()];case 1:return[2,O(i=r.sent())]}}))}))}function N(t){var n,e,i,o,s,a,u=h,c=t.split("\n");for(n=0,e=c;n<e.length;n++)if(i=e[n],!w(i)){if((o=i.slice(l.length).trim())===f)break;try{s=(0,r.parseJSON)(o),(a=S(s,g))&&(u+=a)}catch(t){}}return u}function R(t,n){return T(this,void 0,void 0,(function(){var e,i,o,s,a,u,c,d,p,v,m,y,b,A,T;return j(this,(function(j){switch(j.label){case 0:e=h,i=h,o=t.getReader(),s=new TextDecoder,a=!1,j.label=1;case 1:j.trys.push([1,,5,6]),j.label=2;case 2:return a?[3,4]:[4,o.read()];case 3:if(u=j.sent(),c=u.done,d=u.value,c)return[3,4];for(i+=s.decode(d,{stream:!0}),p=i.split("\n"),i=p.pop()||h,v=0,m=p;v<m.length;v++)if(y=m[v],!w(y)){if((b=y.slice(l.length).trim())===f)return[2,e];b&&(A=(0,r.parseJSON)(b),(T=S(A,g))&&(e+=T,a=null==n?void 0:n({deltaData:T,wholeData:e})))}return[3,2];case 4:return i.trim()&&i.startsWith(l)&&I(i,e,n),[2,e];case 5:return o.releaseLock(),[7];case 6:return[2]}}))}))}function I(t,n,e){var i,o,s,a;try{if((i=t.slice(l.length).trim())&&i!==f&&(o=(0,r.parseJSON)(i),s=S(o,g)))return a=n+s,null==e||e({deltaData:s,wholeData:a}),a}catch(t){}return n}function L(t){var n,e,i=document.createElement(o.HTML_CONST.DIV);i.innerHTML=t,document.body.appendChild(i),(n=document.createRange()).selectNodeContents(i),(e=window.getSelection()).removeAllRanges(),e.addRange(n);try{document.execCommand("copy")}catch(t){}e.removeAllRanges(),document.body.removeChild(i)}Object.defineProperty(n,"__esModule",{value:!0}),n.Yio=n.nio=n.eio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai-common.js"),o=e("./dist/plugins/ai/ai-constants.js"),s=e("./dist/plugins/ai/ai.ns.js"),a=e("./dist/plugins/ai/context/util.js"),u=new i.Common.ResourceManager(s.SR,"AI"),c=u.getResource.bind(u),l="data: ",f="[DONE]",d="text/event-stream",h="",p="choices.0.message.content",g="choices.0.delta.content",v=function(t){return"object"==typeof t&&null!==t},m=function(t){return v(t)&&"body"in t&&"headers"in t},y=function(t){return v(t)&&"getReader"in t},b=function(t){return"string"==typeof t},w=function(t){return!t.trim()||!t.startsWith(l)},S=function(t,n){return n.split(".").reduce((function(t,n){return null==t?void 0:t[n]}),t)},n.eio=E,n.nio=_,n.Yio=L},"./dist/plugins/ai/ai-common.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l;function f(t,n,e){var i,o,s,a,u;return void 0===e&&(e=!1),i=r.PT_CONST.BTN_CLASS,o=r.HTML_CONST.DIV,s=r.HTML_CONST.CLASS,a=r.HTML_CONST.TITLE,u=r.COMMON_CONST.ICON_CLASS,"<".concat(o," ").concat(s,'="').concat(e?i+" ":"").concat(u," ").concat(t,'" ').concat(a,'="').concat(n,'"></').concat(o,">")}function d(t){var n=r.COMMON_CONST.LOADING_MASK_CLASS,e=r.COMMON_CONST.LOADING_SPIN_CLASS,i=r.HTML_CONST.DIV,o=r.HTML_CONST.CLASS,s=l.En(i,null,null,n,t);return s.html("\n <".concat(i," ").concat(o,'="').concat(n,'">\n <').concat(i," ").concat(o,'="').concat(e,'"></').concat(i,">\n </").concat(i,">\n ")),function(){s.remove()}}function h(t){var n=r.COMMON_CONST.LOADING_MASK_CLASS,e=l(t).find(".".concat(n));e&&e.remove()}function p(t,n,e){return!!t.includes(c().AI_ERROR)&&(a.ErrorOverlay.show(n,g(e)),!0)}function g(t,n){void 0===n&&(n="TopRight");var e=t.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height,type:n}}function v(t){if(!t)return r.keyword_null;try{return JSON.parse(t)}catch(e){try{if(t.length>r.MAX_JSON_LENGTH)throw new Error("JSON string is too large to process.");var n=t;return n=(n=(n=(n=(n=(n=n.replace(/(['"]?)(\w+)\1(\s*):(\s*)/g,'"$2"$3:$4')).replace(/:(\s*)'([^']*)'/g,(function(t,n,e){return":".concat(n,'"').concat(e,'"')}))).replace(/([{,])(\s*)([a-zA-Z_]\w*)(\s*):/g,'$1$2"$3"$4:')).replace(/,(?=\s*[}\]])/g,"")).replace(/:(\s*)(\w+)(\s*[,}])/g,':"$2"$3')).replace(/(:\s*)(True|False|None)/g,(function(t,n,e){switch(e){case"True":return n+"true";case"False":return n+"false";case"None":return n+"null"}})),JSON.parse(n)}catch(t){throw new Error(t)}}}Object.defineProperty(n,"__esModule",{value:!0}),n.parseJSON=n.getGenerateErrorDialogPosition=n.gio=n.vio=n.mio=n.yio=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai-constants.js"),o=e("Core"),s=e("./dist/plugins/ai/ai.ns.js"),a=e("./dist/plugins/ai/error-overlay.js"),u=new i.Common.ResourceManager(s.SR,"AI"),c=u.getResource.bind(u),l=o.GC$,n.yio=f,n.mio=d,n.vio=h,n.gio=p,n.getGenerateErrorDialogPosition=g,n.parseJSON=v},"./dist/plugins/ai/ai-constants.js":function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.keyword_undefined=n.keyword_null=n.HTML_CONST=n.EVENT_CONST=n.COMMON_CONST=n.FORMULA_CONST=n.PT_CONST=n.MAX_JSON_LENGTH=n.AI_Formula_Panel_NS=n.AI_Pivot_Panel_NS=void 0,n.AI_Pivot_Panel_NS=".pt-ai-panel",n.AI_Formula_Panel_NS=".formula-ai-panel";var e="gc-ai-",i=e+"pt-",r=e+"text-header-",o=e+"formula-generator-",s=e+"formula-explain-",a=e+"formula-header-";n.MAX_JSON_LENGTH=1e4,n.PT_CONST={MAX_DATA_LENGTH:2e3,PANEL_ALL_CLASS:"gc-panel-all",PANEL_ADDON_CLASS:"gc-panel-addon",PANEL_SHOW_RIGHT_CLASS:"gc-panel-show-right",BTN_CLASS:i+"button",CAPSULE_CLASS:i+"capsule",GEN_CLASS:i+"gen",GEN_SPIN_LINE_CLASS:i+"gen-spinner-line",SUG_CONTAINER_CLASS:i+"sug-container",SUG_DROPDOWN_CLASS:i+"sug-dropdown",SUG_DROPDOWN_HEADER_CLASS:i+"sug-dropdown-header",SUG_ITEM_CLASS:i+"sug-item",SUG_ITEM_CONTAINER_CLASS:i+"sug-item-container",ANA_CLASS:i+"ana",ANA_CONTAINER_CLASS:i+"analyze-container",ANA_BUTTONS_CLASS:i+"analyze-buttons",MAX_SUGGESTIONS:5},n.FORMULA_CONST={GENERATOR_CLASS:o,GENERATOR_CONTAINER_CLASS:o+"container",GENERATOR_BUTTON_CONTAINER_CLASS:o+"button-container",EXPLAIN_CLASS:s,EXPLAIN_CONTAINER_CLASS:s+"container",EXPLAIN_CONTENT_CLASS:s+"content",EXPLAIN_CONTENT_CONTAINER_CLASS:s+"content-container",EXPLAIN_BUTTON_CLASS:s+"button",EXPLAIN_BUTTON_CONTAINER_CLASS:s+"button-container",EDITOR_CONTAINER_CLASS:e+"formula-editor-container",ASSISTANT_AREA_CLASS:e+"assistant-area",FORMULA_EDITOR_THEME:e+"formula-editor-theme",OPEN_BUTTON_CLASS:e+"open-button",RESIZE_HANDLE_CLASS:e+"resize-handle",HEADER_CLASS:a,DEFAULT_ASSISTANT_AREA_HEIGHT:200,MIN_EDITOR_CONTAINER_HEIGHT:60,PROMPT_TEXT_COLOR:"gray",INPUT_TEXT_COLOR:"black"},n.COMMON_CONST={ICON_CLASS:e+"icon",ICON_DISABLED_CLASS:e+"icon-disabled",ICON_BACKGROUND_CLASS:e+"icon-background",TEXT_CLASS:e+"text",TEXT_CONTAINER_CLASS:e+"text-container",TEXT_ICON_CLASS:e+"text-container-icons",TEXT_HEADER_CLASS:e+"text-header",TEXT_HEADER_LEFT_CLASS:r+"left",TEXT_HEADER_RIGHT_CLASS:r+"right",TEXT_HEADER_TITLE_CLASS:r+"title",HIDE_CLASS:e+"hide",SEPARATOR_CLASS:e+"separator",LOADING_MASK_CLASS:e+"loading-mask",LOADING_SPIN_CLASS:e+"spinner",GENERATE:e+"generate",ANALYZE:e+"analyze",CLOSE:e+"close",BACK:e+"back",SEND:e+"send",COPY:e+"copy",COPIED:e+"copied",RESET:e+"reset",REFRESH:e+"refresh",ARROW_UP:e+"arrow-up",STOP:e+"stop",AI:e+"ai"},n.EVENT_CONST={CLICK:"click",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEMOVE:"mousemove",INPUT:"input",KEYDOWN:"keydown",FOCUS:"focus",BLUR:"blur",KEYUP:"keyup",TRANSITION:"transition",TRANSITIONEND:"transitionend",PASTE:"paste"},n.HTML_CONST={ACTIVE_CLASS:"active",HEIGHT:"height",LOADING:e+"loading",SCROLL_HEIGHT:"scrollHeight",SCROLL_TOP:"scrollTop",AUTO:"auto",PX:"px",DIV:"div",SPAN:"span",BUTTON:"button",CLASS:"class",TITLE:"title",DISPLAY:"display"},n.keyword_null=null,n.keyword_undefined=void 0},"./dist/plugins/ai/ai-definition.js":function(){},"./dist/plugins/ai/ai-inject.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c=this&&this.$Kr||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?e(t.value):r(t.value).then(s,a)}u((i=i.apply(t,n||[])).next())}))},l=this&&this.tJr||function(t,n){var e={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return u([t,n])}}function u(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(e=0)),e;)try{if(i=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return e.label++,{value:a[1],done:!1};case 5:e.label++,r=a[1],a=[0];continue;case 7:a=e.ops.pop(),e.trys.pop();continue;default:if(!(o=e.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){e=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){e.label=a[1];break}if(6===a[0]&&e.label<o[1]){e.label=o[1],o=a;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(a);break}o[2]&&e.ops.pop(),e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t],r=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty(n,"__esModule",{value:!0}),i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=new i.Common.ResourceManager(o.SR,"AI"),a=s.getResource.bind(s),u=function(){function t(){}return t.prototype.injectAIRequest=function(t){this.aiRequest=t},t.prototype.injectAIEnvs=function(t){var n,e,i=this;if(!(t&&t.model&&t.key&&t.basePath))throw new Error(a().ERROR_NO_AI_INJECT);n=this,e=JSON.parse(JSON.stringify(t)),n.aiRequest=function(t){return c(i,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return t.model=e.model,[4,fetch(e.basePath,{method:"POST",headers:{Authorization:"Bearer ".concat(e.key),"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:if(!(n=i.sent()).ok)throw new Error("".concat(a().ERROR_RESPONSE_FAILED," ").concat(n.status));return[2,n]}}))}))}},t.prototype.fetchAI=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(n){if(!this.aiRequest)throw new Error(a().ERROR_NO_AI_INJECT);return[2,this.aiRequest(t)]}))}))},t.prototype.dispose=function(){this.aiRequest=void 0},t}(),r.Workbook.ch("AI",{init:function(){this.aiCaller=new u}}),r.Workbook.prototype.injectAI=function(t){if("function"==typeof t)this.aiCaller.injectAIRequest(t);else{if("object"!=typeof t)throw new Error(a().ERROR_NO_AI_INJECT);this.aiCaller.injectAIEnvs(t)}},r.Workbook.ch("AI",{dispose:function(){var t;null===(t=this.aiCaller)||void 0===t||t.dispose(),this.aiCaller=void 0}})},"./dist/plugins/ai/ai.entry.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d=this&&this.JKr||(Object.create?function(t,n,e,i){void 0===i&&(i=e);var r=Object.getOwnPropertyDescriptor(n,e);r&&!("get"in r?!n.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return n[e]}}),Object.defineProperty(t,i,r)}:function(t,n,e,i){void 0===i&&(i=e),t[i]=n[e]}),h=this&&this.XKr||function(t,n){for(var e in t)"default"===e||Object.prototype.hasOwnProperty.call(n,e)||d(n,t,e)};Object.defineProperty(n,"__esModule",{value:!0}),n.bio=n.Sio=n.dio=n.hio=n.fio=n.aio=n.cio=n.lio=n.iio=n.sio=void 0,e("./dist/plugins/ai/ai-inject.js"),e("./dist/plugins/ai/context/workbook.js"),e("./dist/plugins/ai/context/worksheet.js"),e("./dist/plugins/ai/context/table.js"),e("./dist/plugins/ai/context/pivot-table.js"),e("./dist/plugins/ai/agents/formula/generate-formula.js"),e("./dist/plugins/ai/agents/formula/explain-formula.js"),e("./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js"),e("./dist/plugins/ai/agents/pivot-table/generate-pivot-layout-suggestion.js"),e("./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js"),e("./dist/plugins/ai/agents/translate/translate.js"),e("./dist/plugins/ai/agents/textSentiment/text-sentiment.js"),e("./dist/plugins/ai/agents/query/query.js"),e("./dist/plugins/ai/functions/translate.js"),e("./dist/plugins/ai/functions/text-sentiment.js"),e("./dist/plugins/ai/functions/query.js"),e("./dist/plugins/ai/functions/function-description.js"),e("./dist/plugins/ai/features/formula/formula-editor-enhance.js"),e("./dist/plugins/ai/features/pivot-table/pivot-panel-enhance.js"),i=e("./dist/plugins/ai/agents/formula/generate-formula.js"),Object.defineProperty(n,"sio",{enumerable:!0,get:function(){return i.sio}}),r=e("./dist/plugins/ai/agents/formula/explain-formula.js"),Object.defineProperty(n,"iio",{enumerable:!0,get:function(){return r.iio}}),o=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js"),Object.defineProperty(n,"lio",{enumerable:!0,get:function(){return o.lio}}),s=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-layout-suggestion.js"),Object.defineProperty(n,"cio",{enumerable:!0,get:function(){return s.cio}}),a=e("./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js"),Object.defineProperty(n,"aio",{enumerable:!0,get:function(){return a.aio}}),u=e("./dist/plugins/ai/agents/query/query.js"),Object.defineProperty(n,"fio",{enumerable:!0,get:function(){return u.fio}}),c=e("./dist/plugins/ai/agents/textSentiment/text-sentiment.js"),Object.defineProperty(n,"hio",{enumerable:!0,get:function(){return c.hio}}),l=e("./dist/plugins/ai/agents/translate/translate.js"),Object.defineProperty(n,"dio",{enumerable:!0,get:function(){return l.dio}}),f=e("./dist/plugins/ai/context/pivot-table.js"),Object.defineProperty(n,"Sio",{enumerable:!0,get:function(){return f.Sio}}),Object.defineProperty(n,"bio",{enumerable:!0,get:function(){return f.bio}}),h(e("./dist/plugins/ai/ai.ns.js"),n),e("./dist/plugins/ai/ai-definition.js")},"./dist/plugins/ai/ai.ns.js":function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.SR=void 0;var i=e("./dist/plugins/ai/ai.res.en.js");n.SR={en:i}},"./dist/plugins/ai/ai.res.en.js":function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.PT_Layout_Exp_Error=n.PT_Layout_Exp_User_REQ=n.PT_Layout_Exp_User=n.PT_Layout_Exp_Sys=n.PT_Layout_Gen_Error=n.PT_Layout_Gen_User=n.PT_Layout_Example=n.PT_Layout_Schema=n.PT_SubtotalType_Schema=n.PT_Layout_Gen_Sys=n.PT_Col_Total=n.PT_Row_Total=n.PT_Data=n.PT_Layout=n.PT_Source_Fields=n.PT_Data_Range=n.PT_Filter_Range=n.PT_Data_Refer=n.PT_Des=n.Table_Data=n.Table_Columns=n.Table_DataRange=n.Table_Range=n.Table_Des=n.Ws_Selection=n.Ws_CurrentFormula=n.Ws_AxisInfo=n.Ws_CustomNames=n.Ws_Des=n.Wb_AcSheet=n.Wb_Sheet_Name=n.Wb_Sheet_Column_Headers=n.Wb_Column_Headers=n.Wb_SheetNames=n.Wb_CustomNames=n.Wb_Des=n.STRICT_ARRAY_HINT=n.STRICT_JSON_ARRAY_HINT=n.STRICT_JSON_ARRAY_HINT_IN_TWO_DIMENSION=n.JSON_CONSTRUCT=n.AI_ERROR=n.RETURN_LANGUAGE=n.ERROR_CANNOT_FIND_PIVOT_TABLE=n.ERROR_NO_PACKAGE=n.ERROR_NO_AI_INJECT=n.ERROR_NO_CONTENT=n.ERROR_RESPONSE_FAILED=n.ERROR_UNSUPPORTED_TYPE=n.REPLACE_MAP=n.WRAP=void 0,n.LanguagePrompt=n.RangeSchema=n.Text_Sentiment_Function_Description=n.TextSentiment_User=n.TextSentiment_Sys=n.Translate_Function_Description=n.Translate_User_To=n.Translate_User_Text=n.Translate_Sys=n.Query_Error=n.Query_Function_Description=n.Query_User_Keep_Structure=n.Query_User_Context=n.Query_Sys=n.Formula_Assistant_Close=n.Formula_Explain_Title=n.Formula_Assistant_Title=n.Generate_Formula=n.Apply_Formula=n.Formula_Exp_Close=n.Formula_Exp_Title=n.Formula_Exp_Error=n.Formula_Exp_User=n.Formula_Exp_Sys=n.Formula_Gen_Error=n.Formula_Gen_Title=n.Formula_Input_Prompt=n.Formula_Gen_User=n.Formula_Gen_Exclude=n.Formula_Gen_Sys=n.Ana_Placeholder=n.Ana_Stop=n.Ana_Send=n.Ana_Copy=n.Ana_Back=n.Gen_Sug=n.GEN_Close=n.Gen_Refresh=n.Gen_ShowSuggestion=n.Gen_Reset=n.Gen_Send=n.Gen_Placeholder=n.DataAnalyze=n.GenerateLayout=n.PT_Layout_Sug_User=n.PT_Layout_Sug_History=n.PT_Layout_Sug_Sys=void 0,n.WRAP="\n",n.REPLACE_MAP={Name:"${Name}",Index:"${Index}",RowCount:"${RowCount}",ColCount:"${ColCount}",ROW:"${ROW}",COL:"${COL}",Selections:"${Selections}",Language:"${Language}",SUG_HISTORY:"${SUG_HISTORY}",HEADER_RANGE:"${HEADER_RANGE}",HEADER_DATA:"${HEADER_DATA}",CONTENT_RANGE:"${CONTENT_RANGE}",CONTENT_DATA:"${CONTENT_DATA}",FORMULA:"${FORMULA}"},n.ERROR_UNSUPPORTED_TYPE="Unsupported Response Body Type",n.ERROR_RESPONSE_FAILED="Failed to Process Response: ",n.ERROR_NO_CONTENT="No Valid Content Found in the JSON Object",n.ERROR_NO_AI_INJECT="The AI request callback or environment variables have not been injected.",n.ERROR_NO_PACKAGE="Package Not Loaded: ",n.ERROR_CANNOT_FIND_PIVOT_TABLE="Cannot Find Pivot Table in the Current Sheet",n.RETURN_LANGUAGE=n.WRAP+"Please answer in the following language: ",n.AI_ERROR="__AI_ERROR__",n.JSON_CONSTRUCT='Construct the response as a structured object, then serialize it to a JSON string, strictly following the expected format.\nIncorrect example (JSON format error, missing closing bracket):\n[ ["foo", [["a", "A"], ["b", "B"]]], ["bar", [["x", "X"]] ]\n\nCorrect example:\n[ ["foo", [["a", "A"], ["b", "B"]]], ["bar", [["x", "X"]]] ]\n',n.STRICT_JSON_ARRAY_HINT_IN_TWO_DIMENSION="The final output must be a valid JSON string or "+n.AI_ERROR+". Do not include any Markdown formatting, explanations, or comments. Do not add ```json or ```. The output must be a two dimension array and start with [[ and end with ]], otherwise it will cause a program error.",n.STRICT_JSON_ARRAY_HINT="The final output must be a valid JSON string or "+n.AI_ERROR+". Do not include any Markdown formatting, explanations, or comments. Do not add ```json or ```. The output must start with [ and end with ], otherwise it will cause a program error.",n.STRICT_ARRAY_HINT="Maintain the original array structure. Do not change the order, length, or dimensions of the array.",n.Wb_Des=n.WRAP+"The following is the workbook context:"+n.WRAP,n.Wb_CustomNames="Custom Names:"+n.WRAP,n.Wb_SheetNames="Sheet Names (sorted by sheet index):"+n.WRAP,n.Wb_Column_Headers="Column Headers: ",n.Wb_Sheet_Column_Headers="Column Headers for Each Sheet: ".concat(n.WRAP,"Schema: [Column Header Name, Absolute Index (0 is the first worksheet column)]").concat(n.WRAP),n.Wb_Sheet_Name="Sheet Name: ",n.Wb_AcSheet="Active Sheet Information: (Name: "+n.REPLACE_MAP.Name+", Index: "+n.REPLACE_MAP.Index+")"+n.WRAP,n.Ws_Des=n.WRAP+'The following is the context for worksheet "'+n.REPLACE_MAP.Name+'":'+n.WRAP,n.Ws_CustomNames="Custom Names:"+n.WRAP,n.Ws_AxisInfo="Row Count: "+n.REPLACE_MAP.RowCount+", Column Count: "+n.REPLACE_MAP.ColCount+n.WRAP,n.Ws_CurrentFormula="The current cell's formula is: "+n.REPLACE_MAP.FORMULA+n.WRAP,n.Ws_Selection="Active Row Index: "+n.REPLACE_MAP.ROW+", Active Column Index: "+n.REPLACE_MAP.COL+", Selections Array: "+n.REPLACE_MAP.Selections+n.WRAP,n.Table_Des=n.WRAP+'The following is the context for table "'+n.REPLACE_MAP.Name+'":'+n.WRAP,n.Table_Range="Table Range: ",n.Table_DataRange="Table Data Range: ",n.Table_Columns="Table Columns: "+n.WRAP+"Schema: [Column Name, Relative Index (0 is the first table column), Absolute Index (0 is the first worksheet column)]"+n.WRAP,n.Table_Data="Table Data: "+n.WRAP,n.PT_Des=n.WRAP+'The following is the context for pivot table "'+n.REPLACE_MAP.Name+'":'+n.WRAP,n.PT_Data_Refer="Data Source: ",n.PT_Filter_Range="Page Filter Area Range: ",n.PT_Data_Range="Data Area Range: ",n.PT_Source_Fields="Source Field Names: ",n.PT_Layout="Current Layout: "+n.WRAP,n.PT_Data="Pivot Table Data: "+n.WRAP,n.PT_Row_Total="\nPivot Table Row Header and Row Total Information.\nRow Header Relative Range:\n".concat(n.REPLACE_MAP.HEADER_RANGE,",\nRow Header Data is:\n").concat(n.REPLACE_MAP.HEADER_DATA,",\nCorresponding Row Total Relative Range:\n").concat(n.REPLACE_MAP.CONTENT_RANGE,",\nRow Total Data is:\n").concat(n.REPLACE_MAP.CONTENT_DATA,"\n\n"),n.PT_Col_Total="\nPivot Table Column Header and Column Total Information.\nColumn Header Relative Range:\n".concat(n.REPLACE_MAP.HEADER_RANGE,",\nColumn Header Data is:\n").concat(n.REPLACE_MAP.HEADER_DATA,",\nCorresponding Column Total Relative Range:\n").concat(n.REPLACE_MAP.CONTENT_RANGE,",\nColumn Total Data is:\n").concat(n.REPLACE_MAP.CONTENT_DATA,"\n"),n.PT_Layout_Gen_Sys="As an Excel pivot table expert, provide the pivot panel layout **schema** (this is important) matching the request.\nIf the user\u2019s requirement is unclear or ambiguous, automatically select and return a layout you consider appropriate, do not return ".concat(n.AI_ERROR," in these cases!\nReturn ").concat(n.AI_ERROR," only when there is missing context or a logical contradiction that makes it **impossible** to provide any valid layout. Note: as long as you have any possible way to fulfill the request, do not return ").concat(n.AI_ERROR,", this is important!\nRefer to the following context data:")+n.WRAP,n.PT_SubtotalType_Schema="SubtotalType: 0=Average, 1=Count, 2=Count Numbers, 3=Max, 4=Min, 5=Product, 6=StdDev (Sample), 7=StdDevP (Population), 8=Sum, 9=Var (Sample), 10=VarP (Population).",n.PT_Layout_Schema="The Pivot Table Layout Schema is a JSON array: `[FilterFields, RowFields, ColFields, ValueFields]`. Each field array contains items, where each item is another array with 2 or 3 elements.\n- `FilterFields`, `RowFields`, `ColFields` items: `[sourceName, displayName]`\n- `ValueFields` items: `[sourceName, displayName, subtotalType]`\nItems within each field array are sorted by index. "+n.PT_SubtotalType_Schema,n.PT_Layout_Example='\nExample:\nSource field names: `["name", "grade", "class", "gender", "score"]`\nRequirement: "Get the sum of scores by gender and class"\nReturn value:\n`[ [], [ ["gender", "gender"], ["class", "class"] ], [], [ ["score", "Sum of score", 8] ] ]`\nIf the request is to update an existing layout, modify the current layout according to the user\'s request instead of creating a new one from scratch.\nRemember: Always return only the JSON array or '.concat(n.AI_ERROR,". Never return anything else. This is the highest priority requirement.\n"),n.PT_Layout_Gen_User="Please generate the pivot panel layout based on the requirement: ",n.PT_Layout_Gen_Error="Sorry, the AI pivot table layout generation failed. Please describe your requirements more specifically, check the current pivot table status, or try generating again.",n.PT_Layout_Exp_Sys="As an Excel pivot table expert, return a data analysis of the pivot panel layout. Return ".concat(n.AI_ERROR," only if, after fully analyzing the context and requirements, no valid solution can be generated. Format the explanation using HTML tags suitable for direct use as `innerHTML` for better readability.\nDo not include any Markdown formatting, explanations, or comments outside the HTML.\nRefer to the following context data:"),n.PT_Layout_Exp_User="Please analyze the data. Keep the analysis concise (ideally under 20 lines). ",n.PT_Layout_Exp_User_REQ="Focus the analysis on the following [key point, main idea, or question]: ",n.PT_Layout_Exp_Error="Sorry, the AI pivot table analysis failed. Please describe your problem more specifically, check the current pivot table status, or try generating again.",n.PT_Layout_Sug_Sys='As an Excel pivot table expert, based on the provided data fields, suggest 3 practical layouts for building a pivot table. Each suggestion must strictly follow this format:\n`[Suggestion description (max 10 words), Layout array]`\nThe overall structure must be a JSON array containing exactly 3 such pairs:\n`[\n ["Suggestion1", [[], [], [], []]],\n ["Suggestion2", [[], [], [], []]],\n ["Suggestion3", [[], [], [], []]]\n]`\nThe second item (Layout array) must contain exactly four arrays: `[FilterFields, RowFields, ColFields, ValueFields]`.\nField item formats:\n- Filter/Row/Column: `[sourceName, displayName]`\n- Value: `[sourceName, displayName, subtotalType]`\n'.concat(n.PT_SubtotalType_Schema,"\n").concat(n.STRICT_JSON_ARRAY_HINT,'\nThe returned result must be a strictly formatted JSON string processable by `JSON.parse`.\nThe top level must be an array containing three `[description, layout]` pairs.\nEach layout must be an array of 4 arrays (no more, no less). The outer array shell for the layout is mandatory.\nIncorrect examples:\n`["Description", [[], [], [], [], []]]`\n`["Description", [], [], [], []]`\n`[["foo", [["a", "A"], ["b", "B"]]], ["bar", [["x", "X"]]]`\nCorrect example (using source fields `["name", "grade", "class", "gender", "score"]`):\n`[\n ["Score sum by gender/class", [ [], [["gender","gender"],["class","class"]], [], [["score","Sum of score",8]] ]],\n ["Average score by grade", [ [], [["grade","grade"]], [], [["score","Average of score",0]] ]],\n ["Student count by class", [ [], [["class","class"]], [], [["name","Count of name",1]] ]]\n]`\nReturn ').concat(n.AI_ERROR," only if no suitable suggestions can be made.\nRefer to the following context data:")+n.WRAP,n.PT_Layout_Sug_History="\n\nAvoid repeating these previous suggestions:\n".concat(n.REPLACE_MAP.SUG_HISTORY,"\n")+n.WRAP,n.PT_Layout_Sug_User="Please provide 3 suggestions for a pivot table layout: ",n.GenerateLayout="Smart Pivot Layout Generation",n.DataAnalyze="Intelligent Data Analysis",n.Gen_Placeholder="Enter your requirement",n.Gen_Send="Send the requirement to AI",n.Gen_Reset="Reset Layout to Initial State",n.Gen_ShowSuggestion="Show Suggestions",n.Gen_Refresh="Refresh Suggestions",n.GEN_Close="Hide Layout Panel",n.Gen_Sug="AI Suggestions",n.Ana_Back="Back to Pivot Panel",n.Ana_Copy="Copy Analysis",n.Ana_Send="Send the question to AI",n.Ana_Stop="Stop Generating",n.Ana_Placeholder="Enter your question",n.Formula_Gen_Sys="As an Excel formula expert, provide **only the formula** (this is important) matching the request. Return ".concat(n.AI_ERROR," only for non-formula requests or if no solution exists.\nRefer to the following context data:")+n.WRAP,n.Formula_Gen_Exclude=n.WRAP+"The formula should not contain the following functions: ARRAYTOTEXT,AVERAGEIPS,CALL,CELL,COUNTIPS,CUBEKPIMEMBER,CUBEMEMBER,CUBEMEMBERPROPERTY,CUBERANKEDMEMBER,CUBESET,CUBESETCOUNT,CUBEVALUE,DETECTLANGUAGE,FILTERXML,FORECAST.ETS,FORECAST.ETS(CONFINT),FORECAST.ETS(SEASONALITY),FORECAST.ETS(STAT),FORECAST.LINEAR,INFO,JIS,NUMBERVALUE,PHONETIC,REGISTER.ID,REST,RTDCLEAR,RTDDATABASE,RTDEXECUTE,RTDREFRESH,RTDSTATUS,SECRET,SQL.REQUEST,STDEV.A,STEVEN,TRANSLATE,VAR.A",n.Formula_Gen_User="Please generate a correct formula based on the requirement: ",n.Formula_Input_Prompt="Describe the formula you need.",n.Formula_Gen_Title="Smart Formula Generation",n.Formula_Gen_Error="Sorry, the AI formula generation failed. Please describe your requirements more specifically (e.g., specify the function type, provide an example, or break down the logic).",n.Formula_Exp_Sys="As an Excel formula expert, explain the provided formula. Return ".concat(n.AI_ERROR," only for non-formula input or if no explanation can be generated.\nFormat the explanation using HTML tags suitable for direct use as `innerHTML` for better readability.\nProvide **only the HTML explanation** (this is important). Do not include any Markdown formatting or other text outside the HTML.\nStructure the explanation logically (e.g., [Overall Meaning, Breakdown, Parameter Details, Contextual Example]).\nRefer to the following context data:")+n.WRAP,n.Formula_Exp_User="Please explain the formula concisely (ideally under 15 lines): ",n.Formula_Exp_Error="Sorry, the AI formula explanation failed due to an unsupported formula structure.",n.Formula_Exp_Title="Formula Explanation",n.Formula_Exp_Close="Close the Explanation Panel",n.Apply_Formula="Apply Formula",n.Generate_Formula="Generate Formula",n.Formula_Assistant_Title="Smart Formula Assistant",n.Formula_Explain_Title="Explain Formula",n.Formula_Assistant_Close="Close the Assistant Panel",n.Query_Sys="As an Excel expert, refer to the following context data:"+n.WRAP,n.Query_User_Context="The Input data is:",n.Query_User_Keep_Structure=" Return **only a JSON string representing a JavaScript array with the same structure as the input**. Do not include explanations. (This is important).\n".concat(n.STRICT_ARRAY_HINT,"\n").concat(n.STRICT_JSON_ARRAY_HINT_IN_TWO_DIMENSION,"\nIf no query item has a solution, return ").concat(n.AI_ERROR,'. If only some items lack solutions, return an empty string `\'\'` for those specific items.\nExample: Get the capital of a country.\nInput: `[["China"], ["India"], ["United States"]]` -> Output: `[["Beijing"], ["New Delhi"], ["Washington DC"]]`\nInput: `[["a"], ["b"]]` -> Output: ').concat(n.AI_ERROR,'\nInput: `[["China"], ["a"]]` -> Output: `[["Beijing"], [""]]`'),n.Query_Function_Description="Returns an AI-generated answer based on the provided text content.",n.Query_Error="Sorry, the AI query failed. Please describe your requirements more specifically.",n.Translate_Sys="You are a language translation assistant. Translate the texts in the provided string array into the specified language.\n".concat(n.STRICT_ARRAY_HINT,"\n").concat(n.STRICT_JSON_ARRAY_HINT_IN_TWO_DIMENSION,'\nThe output must be a JSON array with the exact same structure as the input, containing the translations. Each translated text should correspond to the original text\'s position.\nExample:\nInput: `[["Text1", "Text2"], ["Text3", "Text4"], ...]`\nOutput: `[["Translation1", "Translation2"], ["Translation3", "Translation4"], ...]`\nIf a text item cannot be translated, return an empty string `\'\'` for that item.\nIf *all* text items cannot be translated, return ').concat(n.AI_ERROR,".\n**Crucially:** If *at least one* text item can be translated, you *must* return the full array structure with translations and empty strings `''` for untranslatable items. Returning ").concat(n.AI_ERROR," in this case is strictly forbidden."),n.Translate_User_Text='Please translate these texts: "',n.Translate_User_To='" to ',n.Translate_Function_Description="Translates the provided text into the specified language.",n.TextSentiment_Sys="You are a sentiment analysis expert. Classify the sentiment of each review in the provided array. Provide **only the classification** for each review.\n".concat(n.STRICT_ARRAY_HINT,"\n").concat(n.STRICT_JSON_ARRAY_HINT_IN_TWO_DIMENSION,'\nThe output must be a JSON array with the exact same structure as the input, containing the sentiment classifications.\nExample:\nInput: `[["review 1", "review 2"], ["review 3", "review 4"], ...]`\nOutput: `[["sentiment 1", "sentiment 2"], ["sentiment 3", "sentiment 4"], ...]`\nIf a review cannot be analyzed, return an empty string `\'\'` for that item.\nIf *all* reviews cannot be analyzed, return ').concat(n.AI_ERROR,'. Otherwise, return the full array structure with classifications and empty strings `\'\'`.\nUse "positive" to represent a positive text sentiment.\nUse "negative" to represent a negative text sentiment.\nUse "neutral" to represent a neutral text sentiment.\n'),n.TextSentiment_User="Please classify the sentiment of these reviews: ",n.Text_Sentiment_Function_Description="Classifies the sentiment of the provided text as Positive, Negative, or Neutral.",n.RangeSchema="Range Schema: [Row, Column, Row Count, Column Count]",n.LanguagePrompt=n.WRAP+"Answer in language: "+n.REPLACE_MAP.Language},"./dist/plugins/ai/context/pivot-table.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d=this&&this.iJr||function(t,n,e){if(e||2===arguments.length)for(var i=0,r=n.length,o;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return t.concat(o||Array.prototype.slice.call(n))};function h(t){var n=i.PivotTableFieldType,e=[n.filterField,n.rowField,n.columnField,n.valueField];return e.map((function(e){return t.getFieldsByArea(e).map((function(i){var r=i.fieldName,o=i.sourceName,s=[o,r];return e===n.valueField?d(d([],s,!0),[String(t.subTotalType(r))],!1):s}))}))}function p(t,n){t.dh.Qy.execute({cmd:"ApplyAIPivotLayout",sheetName:t.getHost().name(),cmdOption:{ptId:t.jKe(),layout:n}})}Object.defineProperty(n,"__esModule",{value:!0}),n.bio=n.Sio=void 0,i=e("PivotTable"),r=e("Pivot"),o=e("./dist/plugins/ai/context/util.js"),s=e("Common"),a=e("Core"),u=e("./dist/plugins/ai/interface.js"),c=e("./dist/plugins/ai/ai.ns.js"),(null==i?void 0:i.PivotTable)&&(l=new s.Common.ResourceManager(c.SR,"AI"),f=l.getResource.bind(l),i.PivotTable.prototype.getAIContext=function(t){var n,e,s,c,l,d,p,g,v,m,y,b,w,S,A,T,j,E,_,C,O,x,N,R,I,L,P,M=this;if(void 0===t&&(t=u.PivotTableContextArgs.all),e=(n=f()).WRAP,s=n.REPLACE_MAP,c=(0,o.Vi)(n.PT_Des,[s.Name],[this.name()]),l=this.getRange(),t&u.PivotTableContextArgs.range&&(c+=n.RangeSchema+" ",l.page&&(c+=n.PT_Filter_Range+(0,o.Aio)(l.page)+", "),c+=n.PT_Data_Range+(0,o.Aio)(l.content)+e),t&u.PivotTableContextArgs.source){for(d=this.getHost().getParent(),p=this.dh.L,(g=d.fMt.cut[p]).EYt&&(c+=n.PT_Data_Refer+g.EYt+e),v=g.Pq,m=[],y=0,b=Object.keys(v);y<b.length;y++)S=v[w=b[y]],m.push(S.Zc);c+=n.PT_Source_Fields+JSON.stringify(m)+e}return t&u.PivotTableContextArgs.layout&&(c+=n.PT_Layout_Schema+e+n.PT_Layout+JSON.stringify(h(this))+e),t&u.PivotTableContextArgs.data&&!this.Oy()&&(A=this.getHost(),c+=n.PT_Data+JSON.stringify((0,o.wio)(A,l.content))+e),t&u.PivotTableContextArgs.totalData&&!this.Oy()&&l.content.rowCount>0&&l.content.colCount>0&&(T=this.getHost(),E=(j=this.options.grandTotalPosition)===i.GrandTotalPosition.both||j===i.GrandTotalPosition.row,_=j===i.GrandTotalPosition.both||j===i.GrandTotalPosition.col,C=this.eZt.row,O=this.eZt.col,x=this.rZt.HWt[4].getRange(),N=1,R=1,(I=this.dataPosition()).display&&(L=this.getFieldsByArea(3).length,I.positionType===r.DataPosition.row?N=L:R=L),P=function(t,n,e){var i=M.rZt.HWt[t].getRange(),r=new a.Range(C+i.row,O+i.col,i.rowCount,i.colCount),u=n(x),c=new a.Range(C+u.row,O+u.col,u.rowCount,u.colCount);return(0,o.Vi)(e,[s.HEADER_RANGE,s.HEADER_DATA,s.CONTENT_RANGE,s.CONTENT_DATA],[(0,o.Aio)(i),JSON.stringify((0,o.wio)(T,r)),(0,o.Aio)(u),JSON.stringify((0,o.wio)(T,c))])},E&&(c+=P(3,(function(t){return new a.Range(t.row,t.col+t.colCount-R,t.rowCount,R)}),n.PT_Row_Total)+e),_&&(c+=P(2,(function(t){return new a.Range(t.row+t.rowCount-N,t.col,N,t.colCount)}),n.PT_Col_Total)+e)),c}),n.Sio=h,n.bio=p},"./dist/plugins/ai/context/table.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c;function l(t,n){var e,i,r,o,s,a="",u=t.tables.all().length>0;return u&&(e=t.getViewportTopRow(1),i=t.getViewportLeftColumn(1),r=t.getViewportBottomRow(1)-e+1,o=t.getViewportRightColumn(1)-i+1,(s=t.tables.AB(e,i,r,o)).forEach((function(t){a+=t.getAIContext(n)}))),a}Object.defineProperty(n,"__esModule",{value:!0}),n.oio=void 0,i=e("Common"),r=e("Tables"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/context/util.js"),u=new i.Common.ResourceManager(o.SR,"AI"),c=u.getResource.bind(u),r.Table.prototype.getAIContext=function(t){var n,e,i,r,o,u;return void 0===t&&(t=s.TableContextArgs.all),e=(n=c()).WRAP,i=n.REPLACE_MAP,r=(0,a.Vi)(n.Table_Des,[i.Name],[this.name()]),o=this.range(),u=this.Mf,t&s.TableContextArgs.range&&(r+="".concat(n.RangeSchema," ").concat(n.Table_Range).concat((0,a.Aio)(o),", ").concat(n.Table_DataRange).concat((0,a.Aio)(this.dataRange())).concat(e)),t&s.TableContextArgs.columns&&(r+=n.Table_Columns+this.BSt.map((function(t,n){return"['".concat(t.name(),"',").concat(n,",").concat(n+o.col,"]")})).join(e)+e),t&s.TableContextArgs.data&&(r+=n.Table_Data+JSON.stringify((0,a.wio)(u,o))+e),r},n.oio=l},"./dist/plugins/ai/context/util.js":function(t,n,e){"use strict";var i,r,o,s,a;function u(t,n,e){for(var i=0;i<n.length;i++)t=t.replace(n[i],e[i]);return t}function c(){var t=o.Fe(o.culture());return a().RETURN_LANGUAGE+(t.displayName||"English")}function l(t,n){void 0===n&&(n=!1);var e="[".concat(t.row,",").concat(t.col,",").concat(t.rowCount,",").concat(t.colCount,"]");return n?a().RangeSchema+e:e}function f(t,n){var e=n.row,i=n.col,r=n.rowCount,o=n.colCount;return Array.from({length:r},(function(n,r){return Array.from({length:o},(function(n,o){return t.getText(e+r,i+o)}))}))}function d(t,n,e,i){var r,o,s,a,u,c=null!==(r=t.getRow())&&void 0!==r?r:0,l=null!==(o=t.getColumn())&&void 0!==o?o:0,f="",d=t.getExpression();return d&&(s=void 0,a=void 0,n?(s=e.Lp,a=(u=e.getActiveSheet())?u.Uw():null):(s=null==i?void 0:i.Lp,a=null==i?void 0:i.qgt),s&&(f=s.unparse(a,d,c,l,!1,!0,2))),{name:t.getName(),formula:f,comment:t.getComment()}}Object.defineProperty(n,"__esModule",{value:!0}),n.Tio=n.wio=n.Aio=n.pio=n.Vi=void 0,i=e("Common"),r=e("./dist/plugins/ai/ai.ns.js"),o=i.Common.CultureManager,s=new i.Common.ResourceManager(r.SR,"AI"),a=s.getResource.bind(s),n.Vi=u,n.pio=c,n.Aio=l,n.wio=f,n.Tio=d},"./dist/plugins/ai/context/workbook.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l;Object.defineProperty(n,"__esModule",{value:!0}),i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/context/util.js"),u=new i.Common.ResourceManager(o.SR,"AI"),c=u.getResource.bind(u),l=i.Common.lt.ht,r.Workbook.prototype.getAIContext=function(t){var n,e,i,r,o,u,f=this;return void 0===t&&(t=s.WorkbookContextArgs.all),n=c(),e=n.WRAP,i=n.Wb_Des,t&s.WorkbookContextArgs.names&&(r=this.getCustomNames()).length>0&&(i+=n.Wb_CustomNames+r.map((function(t){return JSON.stringify((0,a.Tio)(t,!0,f))})).join(e)+e),t&s.WorkbookContextArgs.sheetNames&&(o=this.sheets).length>0&&(i+=n.Wb_SheetNames+JSON.stringify(o.map((function(t){return t.name()})))+e),t&s.WorkbookContextArgs.eachSheetColumnHeaders&&(o=this.sheets).length>0&&(i+=n.Wb_Sheet_Column_Headers+o.map((function(t){var i,r,o=n.Wb_Sheet_Name+t.name()+", "+n.Wb_Column_Headers+"["+e,s=t.getColumnCount();for(i=0;i<s;i++)r=t.getValue(0,i),l(r)||(o+="[".concat(r,", ").concat(i,"]").concat(e));return o+="]"+e}))+e),t&s.WorkbookContextArgs.activeSheet&&(u=this.getActiveSheet())&&(i+=(0,a.Vi)(n.Wb_AcSheet,[n.REPLACE_MAP.Name,n.REPLACE_MAP.Index],[u.name(),this.getActiveSheetIndex()+""])),i}},"./dist/plugins/ai/context/worksheet.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c;Object.defineProperty(n,"__esModule",{value:!0}),i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/interface.js"),a=e("./dist/plugins/ai/context/util.js"),u=new i.Common.ResourceManager(o.SR,"AI"),c=u.getResource.bind(u),r.Worksheet.prototype.getAIContext=function(t){var n,e,i,r,o,u,l,f=this;return void 0===t&&(t=s.WorksheetContextArgs.all),e=(n=c()).WRAP,i=n.REPLACE_MAP,r=(0,a.Vi)(n.Ws_Des,[i.Name],[this.name()]),t&s.WorksheetContextArgs.names&&(o=this.getCustomNames()).length>0&&(r+=n.Ws_CustomNames+o.map((function(t){return JSON.stringify((0,a.Tio)(t,!1,void 0,f))})).join(e)+e),t&s.WorksheetContextArgs.selections&&(u="("+n.RangeSchema+"): "+this.getSelections().map((function(t){return(0,a.Aio)(t)})).join(", "),r+=(0,a.Vi)(n.Ws_Selection,[i.ROW,i.COL,i.Selections],[this.getActiveRowIndex()+"",this.getActiveColumnIndex()+"",u])),t&s.WorksheetContextArgs.axisInfo&&(r+=(0,a.Vi)(n.Ws_AxisInfo,[i.RowCount,i.ColCount],[this.getRowCount()+"",this.getColumnCount()+""])),t&s.WorksheetContextArgs.currentFormula&&(l=this.getFormula(this.getActiveRowIndex(),this.getActiveColumnIndex()))&&(r+=(0,a.Vi)(n.Ws_CurrentFormula,[i.FORMULA],[l])),r}},"./dist/plugins/ai/error-overlay.js":function(t,n){"use strict";var e,i;Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorOverlay=void 0,e=10,i=function(){function t(){}return t.show=function(t,n){var e,i;this.cleanup(),this.overlay=document.createElement("div"),this.overlay.className="gc-ai-error-overlay",this.dialog=document.createElement("div"),this.dialog.className="gc-ai-error-dialog",this.dialog.textContent=t,this.overlay.appendChild(this.dialog),this.overlay.addEventListener("click",this.cleanup.bind(this)),document.body.appendChild(this.overlay),e=this.calculateDialogPosition(n,this.dialog.offsetWidth,this.dialog.offsetHeight),i=this.adjustPosition(e,this.dialog.offsetWidth,this.dialog.offsetHeight),this.dialog.style.left=i.left,this.dialog.style.top=i.top},t.adjustPosition=function(t,n,i){var r=parseInt(t.left,10),o=parseInt(t.top,10),s=window.innerWidth||document.documentElement.clientWidth,a=window.innerHeight||document.documentElement.clientHeight,u=function(t,n,e){return Math.min(Math.max(t,n),e)},c=u(r,e,s-n-e),l=u(o,e,a-i-e);return{left:"".concat(c,"px"),top:"".concat(l,"px")}},t.calculateDialogPosition=function(t,n,i){var r,o,s=t.x,a=t.y,u=t.width,c=t.height,l=t.type;switch(l){case"LeftTop":r=s-n-e,o=a;break;case"LeftBottom":r=s-n-e,o=a+c-i;break;case"RightTop":r=s+u+e,o=a;break;case"RightBottom":r=s+u+e,o=a+c-i;break;case"TopLeft":r=s,o=a-i-e;break;case"TopRight":r=s+u-n,o=a-i-e;break;case"BottomLeft":r=s,o=a+c+e;break;case"BottomRight":r=s+u-n,o=a+c+e;break;default:return{left:"calc(50% - ".concat(n/2,"px)"),top:"calc(50% - ".concat(i/2,"px)")}}return{left:"".concat(r,"px"),top:"".concat(o,"px")}},t.cleanup=function(){this.overlay&&(this.overlay.removeEventListener("click",this.cleanup.bind(this)),document.body.removeChild(this.overlay),this.overlay=null,this.dialog=null)},t.overlay=null,t.dialog=null,t}(),n.ErrorOverlay=i},"./dist/plugins/ai/features/formula/explain-formula.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d=this&&this.qKr||(h=function(t,n){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},h(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}h(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),h;function p(t,n){var e,i;function r(t){3===(t=t.replace(/^#/,"")).length&&(t=t.split("").map((function(t){return t+t})).join(""));var n=parseInt(t,16);return[n>>16&255,n>>8&255,255&n]}function o(t){var n=t.match(/\d+/g);if(n)return[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}if(void 0===n&&(n=.98),t.startsWith("#"))e=r(t);else{if(!t.startsWith("rgb"))return t;if(!(e=o(t)))return t}return i=e.map((function(t){return Math.max(0,Math.floor(t*n))})),"rgb(".concat(i.join(", "),")")}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaExplain=void 0,i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/ai-common.js"),a=e("./dist/plugins/ai/agents/formula/explain-formula.js"),u=e("./dist/plugins/ai/ai-constants.js"),c=new i.Common.ResourceManager(o.SR,"AI"),l=c.getResource.bind(c),f=function(t){function n(n,e,i){var r,o=t.call(this)||this;return o.yoe=!1,o.eventElements=[],(r=o).jio=i,r.Eio=n,r._io=e,r.Hc(),o}return d(n,t),n.prototype.Hc=function(){var t,n,e,i=this,r=l(),o=i._io,a=i.Eio,c=u.HTML_CONST.DIV,f=u.HTML_CONST.CLASS,d=u.EVENT_CONST.CLICK,h=u.FORMULA_CONST.EXPLAIN_BUTTON_CLASS,p=u.FORMULA_CONST.EXPLAIN_CONTAINER_CLASS,g=u.FORMULA_CONST.EXPLAIN_CONTENT_CLASS,v=u.FORMULA_CONST.FORMULA_EDITOR_THEME,m=u.COMMON_CONST.TEXT_HEADER_CLASS,y=u.COMMON_CONST.TEXT_HEADER_LEFT_CLASS,b=u.COMMON_CONST.TEXT_HEADER_RIGHT_CLASS,w=u.COMMON_CONST.TEXT_HEADER_TITLE_CLASS,S=u.COMMON_CONST.CLOSE,A=u.COMMON_CONST.AI,T=u.COMMON_CONST.ICON_CLASS,j=u.COMMON_CONST.REFRESH;o.attr("title",r.Formula_Explain_Title),o.html("\n<".concat(c," ").concat(f,'="').concat(h," ").concat(T,'"></').concat(c,">\n<").concat(c," ").concat(f,'="').concat(j," ").concat(T,'"></').concat(c,">\n ")),t=o.find(".".concat(h)),n=o.find(".".concat(j)),t.bind(d+u.AI_Formula_Panel_NS,(function(){i.Oio(),t.removeClass("show"),n.addClass("show")})),t.addClass("show"),n.bind(d+u.AI_Formula_Panel_NS,(function(){i.$io()})),a.addClass(p),a.addClass(v),a.html("\n<".concat(c," ").concat(f,'="').concat(m,'">\n <').concat(c," ").concat(f,'="').concat(y,'">\n ').concat((0,s.yio)(A,""),"\n <").concat(c," ").concat(f,'="').concat(w,'">').concat(r.Formula_Exp_Title,"</").concat(c,">\n </").concat(c,">\n <").concat(c," ").concat(f,'="').concat(b,'">\n ').concat((0,s.yio)(S,r.Formula_Exp_Close),"\n </").concat(c,">\n</").concat(c,">\n<").concat(c," ").concat(f,'="').concat(g,'"></').concat(c,">\n")),(e=a.find(".".concat(T,".").concat(S))).bind(d+u.AI_Formula_Panel_NS,(function(){i.Cio(),t.addClass("show"),n.removeClass("show")})),i.eventElements=[t,n,e],i.Eio=a,i._io=o},n.prototype.setTheme=function(t){var n=this,e=n.Eio,i=e.find(".".concat(u.FORMULA_CONST.EXPLAIN_CONTENT_CLASS));i.css("backgroundColor",p(t.editorContentStyle.backgroundColor))},n.prototype.Oio=function(){var t=this;t.notify("show"),t.Eio.show(),t.$io()},n.prototype.$io=function(){var t,n,e,i,o,s=this,c=l(),f=s.jio,d=s.Eio,h=s._io.find(".".concat(u.COMMON_CONST.REFRESH)),p=s.jio.text().trim();p&&(t=this.Mio=(0,r.generateRandomId)(),h.addClass(u.HTML_CONST.LOADING),n=u.FORMULA_CONST.EXPLAIN_CONTENT_CLASS,e=u.HTML_CONST.SCROLL_TOP,i=u.HTML_CONST.SCROLL_HEIGHT,(o=d.find(".".concat(n))).html(""),(0,a.iio)(f.Vv,p,(function(n){if(s.yoe||s.Mio!==t)return!0;var r=n.wholeData.includes(c.AI_ERROR);return o.html(r?c.Formula_Exp_Error:n.wholeData),o.prop(e,o.prop(i)),!!r||void 0})).then((function(){s.yoe||s.Mio!==t||h.removeClass(u.HTML_CONST.LOADING)})).catch((function(t){var n=(null==t?void 0:t.message)===c.ERROR_NO_AI_INJECT?c.ERROR_NO_AI_INJECT:c.Formula_Exp_Error;o.html(n),h.removeClass(u.HTML_CONST.LOADING)})))},n.prototype.Cio=function(){this.notify("hide"),this.Eio.hide()},n.prototype.show=function(){var t=this;t._io.show(),t.Eio.show()},n.prototype.showExplainButton=function(){this._io.show()},n.prototype.hide=function(){var t=this;t._io.hide(),t.Eio.hide()},n.prototype.destroy=function(){t.prototype.destroy.call(this);var n=this;n.eventElements.forEach((function(t){t.unbind(u.AI_Formula_Panel_NS)})),n.Eio.empty(),n.Eio.remove(),n.Eio=u.keyword_null,n._io.empty(),n._io.remove(),n._io=u.keyword_null,n.eventElements=[],n.jio=u.keyword_null,n.yoe=!0},n}(r.TypedEventNotifier),n.FormulaExplain=f},"./dist/plugins/ai/features/formula/formula-editor-enhance.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h,p;Object.defineProperty(n,"__esModule",{value:!0}),i=e("Common"),r=e("FormulaPanel"),o=e("./dist/plugins/ai/ai-constants.js"),s=e("Core"),a=e("./dist/plugins/ai/features/formula/generate-formula.js"),u=e("./dist/plugins/ai/features/formula/explain-formula.js"),c=e("./dist/plugins/ai/ai.ns.js"),l=s.GC$,f=null,d=new i.Common.ResourceManager(c.SR,"AI"),h=d.getResource.bind(d),p=function(){function t(){this.eventElements=[]}return t.prototype.init=function(t,n){var e,i,r,s,c,d,p,g,v,m=this,y=o.HTML_CONST.DIV,b=o.FORMULA_CONST.EDITOR_CONTAINER_CLASS,w=o.FORMULA_CONST.ASSISTANT_AREA_CLASS,S=o.FORMULA_CONST.OPEN_BUTTON_CLASS,A=o.FORMULA_CONST.RESIZE_HANDLE_CLASS,T=o.FORMULA_CONST.EXPLAIN_CONTENT_CONTAINER_CLASS,j=o.FORMULA_CONST.EXPLAIN_BUTTON_CONTAINER_CLASS,E=o.FORMULA_CONST.GENERATOR_CONTAINER_CLASS,_=o.FORMULA_CONST.DEFAULT_ASSISTANT_AREA_HEIGHT,C=o.FORMULA_CONST.MIN_EDITOR_CONTAINER_HEIGHT,O=o.FORMULA_CONST.FORMULA_EDITOR_THEME,x=o.EVENT_CONST.CLICK,N=o.EVENT_CONST.MOUSEDOWN,R=o.EVENT_CONST.MOUSEUP,I=o.EVENT_CONST.MOUSEMOVE,L=o.EVENT_CONST.TRANSITION,P=o.COMMON_CONST.ICON_CLASS,M=l.En(y,f,f,b,t),D=l.En(y,f,f,"".concat(w," ").concat(O),t),k=l.En(y,f,f,"".concat(P," ").concat(S),M);function F(t){var n,e=t.clientY-p;p=t.clientY,n=Math.min(v-C,Math.max(g-e,_)),D.height(n),M.height(v-n),g=n}function U(){D.css(L,"height 0.3s ease"),M.css(L,"height 0.3s ease"),t.style.cursor="auto",i.css("cursor","grab"),document.removeEventListener(I,F),document.removeEventListener(R,U)}return k.attr("title",h().Formula_Assistant_Title),e=l.En(y,f,f,j,M),i=l.En(y,f,f,A,D),r=l.En(y,f,f,E,D),s=l.En(y,f,f,T,D),m.Wc=t,t.style.overflow="hidden",m.FcV=M,m.Nio=D,m.xio=k,c=m.rir=new a.FormulaGenerator(r,n),d=m.Rio=new u.FormulaExplain(s,e,n),k.bind(x+o.AI_Formula_Panel_NS,(function(){m.show()})),p=0,g=0,v=l(t).height(),i.bind(N+o.AI_Formula_Panel_NS,(function(n){n.preventDefault(),v=l(t).height(),D.css(L,"none"),M.css(L,"none"),p=n.clientY,g=D.height(),t.style.cursor="grabbing",i.css("cursor","grabbing"),document.addEventListener(I,F),document.addEventListener(R,U)})),c.addListener("close",(function(){m.hide()})),d.addListener("show",(function(){r.hide()})),d.addListener("hide",(function(){m.Iio()})),m.hide(),m.eventElements=[k,i],M[0]},t.prototype.Iio=function(){var t=this,n=t.Wc,e=o.HTML_CONST.HEIGHT,i=o.FORMULA_CONST.DEFAULT_ASSISTANT_AREA_HEIGHT,r=l(n).height();t.FcV.css(e,"".concat(r-i,"px")),t.Nio.css(e,i+"px"),t.rir.show()},t.prototype.setTheme=function(t){var n=this,e=t.editorContentStyle,i=o.FORMULA_CONST.FORMULA_EDITOR_THEME,r=document.createElement("style");r.textContent="\n .".concat(i," {\n color: ").concat(e.color,";\n background-color: ").concat(e.backgroundColor,";\n font: ").concat(e.font,";\n }\n "),document.head.appendChild(r),n.Rio.setTheme(t)},t.prototype.show=function(){var t,n=this;n.Iio(),t=o.HTML_CONST.DISPLAY,n.Nio.css(t,"flex"),n.Rio.showExplainButton(),n.xio.hide()},t.prototype.hide=function(){var t=this,n=o.HTML_CONST.HEIGHT;t.Nio.css(n,"0"),t.Nio.hide(),t.FcV.css(n,"100%"),t.rir.hide(),t.Rio.hide(),t.xio.show()},t.prototype.destroy=function(){var t=this;t.eventElements.forEach((function(t){t.unbind(o.AI_Formula_Panel_NS)})),t.rir.destroy(),t.Rio.destroy(),t.xio.remove(),t.Nio.empty(),t.Nio.remove(),t.xio=f,t.Wc=f,t.Nio=f,t.rir=f,t.Rio=f},t}(),r&&r.FormulaEditor&&r.FormulaEditor.ch("AI",{onCreate:function(t){var n=t.container,e=this.Lio=new p;t.container=e.init(n,this)},onDestroy:function(){var t;this.Lio.destroy()},onThemeChange:function(t){var n;this.Lio.setTheme(t)}})},"./dist/plugins/ai/features/formula/generate-formula.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h=this&&this.qKr||(p=function(t,n){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},p(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}p(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),p;function g(t,n,e,i,r){t!==e.Formula_Input_Prompt&&""!==(null==t?void 0:t.trim())&&(i.removeClass("show"),r.addClass("show"),(0,u.sio)(n.Vv,t).then((function(t){i.addClass("show"),r.removeClass("show"),(0,s.gio)(t,e.Formula_Gen_Error,i[0])||(n.text(t),n.format())})).catch((function(t){a.ErrorOverlay.show(t.message,(0,s.getGenerateErrorDialogPosition)(i[0])),i.addClass("show"),r.removeClass("show")})))}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaGenerator=void 0,i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=e("./dist/plugins/ai/ai-common.js"),a=e("./dist/plugins/ai/error-overlay.js"),u=e("./dist/plugins/ai/agents/formula/generate-formula.js"),c=e("./dist/plugins/ai/ai-constants.js"),l=new i.Common.ResourceManager(o.SR,"AI"),f=l.getResource.bind(l),d=function(t){function n(n,e){var i,r=t.call(this)||this;return r.eventElements=[],(i=r).jio=e,i.Wc=n,i.Hc(),r}return h(n,t),n.prototype.Hc=function(){var t,n,e,i,r=this,o=r.Wc,a=f(),u=r.jio,l=c.HTML_CONST.DIV,d=c.HTML_CONST.CLASS,h=c.HTML_CONST.TITLE,p=c.HTML_CONST.LOADING,v=c.EVENT_CONST.CLICK,m=c.EVENT_CONST.KEYDOWN,y=c.EVENT_CONST.PASTE,b=c.COMMON_CONST.TEXT_HEADER_CLASS,w=c.COMMON_CONST.TEXT_HEADER_LEFT_CLASS,S=c.COMMON_CONST.TEXT_HEADER_RIGHT_CLASS,A=c.COMMON_CONST.TEXT_HEADER_TITLE_CLASS,T=c.COMMON_CONST.CLOSE,j=c.COMMON_CONST.AI,E=c.COMMON_CONST.ICON_CLASS,_=c.COMMON_CONST.TEXT_CONTAINER_CLASS,C=c.COMMON_CONST.TEXT_CLASS,O=c.COMMON_CONST.TEXT_ICON_CLASS,x=c.COMMON_CONST.ICON_BACKGROUND_CLASS,N=c.COMMON_CONST.REFRESH;return o.html("\n<".concat(l," ").concat(d,'="').concat(b,'">\n <').concat(l," ").concat(d,'="').concat(w,'">\n ').concat((0,s.yio)(j,""),"\n <").concat(l," ").concat(d,'="').concat(A,'">').concat(a.Formula_Gen_Title,"</").concat(l,">\n </").concat(l,">\n <").concat(l," ").concat(d,'="').concat(S,'">\n ').concat((0,s.yio)(T,a.Formula_Assistant_Close),"\n </").concat(l,">\n</").concat(l,">\n\n<").concat(l," ").concat(d,'="').concat(_,'">\n <').concat(l," ").concat(d,'="').concat(C,'" contenteditable="true" placeholder="').concat(a.Formula_Input_Prompt,'"></').concat(l,">\n <").concat(l," ").concat(d,'="').concat(O,'">\n <').concat(l," ").concat(d,'="').concat(c.FORMULA_CONST.GENERATOR_BUTTON_CONTAINER_CLASS,'">\n <').concat(l," ").concat(d,'="').concat(x," ").concat(E,'" ').concat(h,'="').concat(a.Gen_Send,'"></').concat(l,">\n <").concat(l," ").concat(d,'="').concat(N," ").concat(E," ").concat(p,'" ').concat(h,'="').concat(a.Gen_Send,'"></').concat(l,">\n </").concat(l,">\n </").concat(l,">\n</").concat(l,">")),t=o.find(".".concat(E,".").concat(T)),n=o.find(".".concat(x)),e=o.find(".".concat(C)),i=o.find(".".concat(N)),n.addClass("show"),i.removeClass("show"),t.bind(v+c.AI_Formula_Panel_NS,(function(){r.notify("close")})),n.bind(v+c.AI_Formula_Panel_NS,(function(){g(e.text(),u,a,n,i)})),e.bind(m+c.AI_Formula_Panel_NS,(function(t){"Enter"!==t.key||t.shiftKey?"Escape"===t.key&&(e.text(""),t.stopPropagation()):(t.preventDefault(),g(e.text(),u,a,n,i),t.stopPropagation())})),e.bind(y+c.AI_Formula_Panel_NS,(function(t){var n,e,i,r;t.preventDefault(),n=(t.clipboardData||new DataTransfer).getData("text/plain"),(e=window.getSelection())&&0!==e.rangeCount&&((i=e.getRangeAt(0)).deleteContents(),r=document.createTextNode(n),i.insertNode(r),i.setStartAfter(r),i.setEndAfter(r),e.removeAllRanges(),e.addRange(i))})),r.eventElements=[t,n,e],o},n.prototype.show=function(){this.Wc.show()},n.prototype.hide=function(){this.Wc.hide()},n.prototype.destroy=function(){t.prototype.destroy.call(this);var n=this;n.eventElements.forEach((function(t){t.unbind(c.AI_Formula_Panel_NS)})),n.Wc.empty(),n.Wc.remove(),n.Wc=c.keyword_null,n.jio=c.keyword_null},n}(r.TypedEventNotifier),n.FormulaGenerator=d},"./dist/plugins/ai/features/pivot-table/pivot-panel-enhance.js":function(t,n,e){"use strict";var i,r,o,s,a,u;Object.defineProperty(n,"__esModule",{value:!0}),n.PivotPanel_AI=void 0,r=e("PivotTable"),o=e("./dist/plugins/ai/features/pivot-table/widgets/analyze-container.js"),s=e("./dist/plugins/ai/features/pivot-table/widgets/capsule-container.js"),a=e("./dist/plugins/ai/features/pivot-table/widgets/generate-container.js"),u=function(){function t(t){this.panel=t,this.initUI()}return t.prototype.initUI=function(){var t=this.panel,n=t.GY.Ti,e=n.querySelector(".gc-panel-addon"),i=n.querySelector(".gc-panel-left"),r=n.querySelector(".gc-panel-right");this.capsule=new s.PT_CapsuleContainer(i,t),this.generate=new a.PT_GenerateContainer(e,t),this.analyze=new o.PT_AnalyzeContainer(r,t)},t.prototype.destroy=function(){this.capsule.destroy(),this.generate.destroy(),this.analyze.destroy()},t}(),n.PivotPanel_AI=u,r&&(null===(i=r.PivotPanel)||void 0===i||i.ch("ai",{onAttach:function(){this.Pio&&this.Pio.destroy(),this.Pio=new u(this)},onDestroy:function(){this.Pio.destroy(),delete this.Pio}}))},"./dist/plugins/ai/features/pivot-table/widgets/ai-pt-container-base.js":function(t,n,e){"use strict";var i,r;Object.defineProperty(n,"__esModule",{value:!0}),n.PT_AIContainerBase=void 0,i=e("./dist/plugins/ai/ai-constants.js"),r=function(){function t(t,n){this.yoe=!1,this.hostElement=t,this.ptPanelHost=n.GY.Ti,this.pt=n.z,this.spread=this.pt.getHost().parent,this.initUI(),this.bindEvents()}return t.prototype.initUI=function(){},t.prototype.bindEvents=function(){},t.prototype.unbindEvents=function(){},t.prototype.Dio=function(t,n){n?t.addClass(i.COMMON_CONST.ICON_DISABLED_CLASS):t.removeClass(i.COMMON_CONST.ICON_DISABLED_CLASS)},t.prototype.destroy=function(){this.unbindEvents(),this.hostElement=null,this.ptPanelHost=null,this.yoe=!0},t}(),n.PT_AIContainerBase=r},"./dist/plugins/ai/features/pivot-table/widgets/analyze-container.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h,p,g=this&&this.qKr||(v=function(t,n){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},v(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}v(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),v;Object.defineProperty(n,"__esModule",{value:!0}),n.PT_AnalyzeContainer=void 0,i=e("./dist/plugins/ai/features/pivot-table/widgets/ai-pt-container-base.js"),r=e("Core"),o=e("Common"),s=e("./dist/plugins/ai/ai.ns.js"),a=e("./dist/plugins/ai/ai-constants.js"),u=e("./dist/plugins/ai/ai-common.js"),c=e("./dist/plugins/ai/agents/pivot-table/analyze-pivot-table-data.js"),l=e("./dist/plugins/ai/agents/util.js"),f=r.GC$,d=new o.Common.ResourceManager(s.SR,"AI"),h=d.getResource.bind(d),p=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return g(n,t),n.prototype.initUI=function(){var t=h(),n=a.PT_CONST.ANA_CONTAINER_CLASS,e=a.PT_CONST.ANA_BUTTONS_CLASS,i=a.PT_CONST.ANA_CLASS,r=a.HTML_CONST.DIV,o=a.HTML_CONST.CLASS,s=a.COMMON_CONST.AI,c=a.COMMON_CONST.BACK,l=a.COMMON_CONST.ICON_BACKGROUND_CLASS,d=a.COMMON_CONST.SEND,p=a.COMMON_CONST.COPY,g=a.COMMON_CONST.ICON_DISABLED_CLASS,v=a.COMMON_CONST.TEXT_CONTAINER_CLASS,m=a.COMMON_CONST.TEXT_CLASS,y=a.COMMON_CONST.TEXT_ICON_CLASS,b=a.COMMON_CONST.STOP,w=a.COMMON_CONST.HIDE_CLASS,S=a.COMMON_CONST.TEXT_HEADER_CLASS,A=a.COMMON_CONST.TEXT_HEADER_LEFT_CLASS,T=a.COMMON_CONST.TEXT_HEADER_TITLE_CLASS,j=f.En(r,a.keyword_null,a.keyword_null,i,this.hostElement);j.html("\n<".concat(r," ").concat(o,'="').concat(e,'">\n ').concat((0,u.yio)(c,t.Ana_Back),"\n</").concat(r,">\n<").concat(r," ").concat(o,'="').concat(S,'">\n <').concat(r," ").concat(o,'="').concat(A,'">\n ').concat((0,u.yio)(s,""),"\n <").concat(r," ").concat(o,'="').concat(T,'">').concat(t.DataAnalyze,"</").concat(r,">\n </").concat(r,">\n</").concat(r,">\n<").concat(r," ").concat(o,'="').concat(v,'">\n <').concat(r," ").concat(o,'="').concat(m,'" contenteditable="true" placeholder="').concat(t.Ana_Placeholder,'"></').concat(r,">\n <").concat(r," ").concat(o,'="').concat(y,'">\n <').concat(r," ").concat(o,'="').concat(l," ").concat(d," ").concat(g,'">\n ').concat((0,u.yio)(d,t.Ana_Send),"\n </").concat(r,">\n <").concat(r," ").concat(o,'="').concat(l," ").concat(b," ").concat(w,'">\n ').concat((0,u.yio)(b,t.Ana_Stop),"\n </").concat(r,">\n </").concat(r,">\n</").concat(r,">\n<").concat(r," ").concat(o,'="').concat(n,'">\n <').concat(r," ").concat(o,'="').concat(m,'"></').concat(r,">\n <").concat(r," ").concat(o,'="').concat(y,'">\n <').concat(r," ").concat(o,'="').concat(l,'">\n ').concat((0,u.yio)(p,t.Ana_Copy),"\n </").concat(r,">\n </").concat(r,">\n</").concat(r,">\n")),this.analyzeContainer=j},n.prototype.bindEvents=function(){var t=this,n=a.EVENT_CONST.CLICK,e=a.EVENT_CONST.KEYDOWN,i=a.EVENT_CONST.INPUT,o=a.COMMON_CONST.BACK,s=a.COMMON_CONST.SEND,u=a.COMMON_CONST.STOP,c=a.COMMON_CONST.COPY,d=a.COMMON_CONST.HIDE_CLASS,h=a.COMMON_CONST.ICON_CLASS,p=a.COMMON_CONST.TEXT_CONTAINER_CLASS,g=a.COMMON_CONST.TEXT_CLASS,v=a.COMMON_CONST.ICON_BACKGROUND_CLASS,m=a.COMMON_CONST.COPIED,y=a.PT_CONST.PANEL_ALL_CLASS,b=a.PT_CONST.ANA_CONTAINER_CLASS,w=a.PT_CONST.PANEL_SHOW_RIGHT_CLASS,S=this.analyzeContainer,A=f(this.ptPanelHost),T=S.find(".".concat(p)),j=S.find(".".concat(b)),E=T.find(".".concat(g)),_=j.find(".".concat(g)),C=T.find(".".concat(v,".").concat(s)),O=T.find(".".concat(v,".").concat(u)),x=j.find(".".concat(h,".").concat(c)),N=S.find(".".concat(h,".").concat(o)),R=function(){var n=""===E.text().trim();t.Dio(C,n)},I=function(t){t?(C.removeClass(d),O.addClass(d)):(C.addClass(d),O.removeClass(d)),R()},L=function(n){var e=E.text().trim();e&&(t.Mio=(0,r.generateRandomId)(),t.Gio(e,t.Mio,(function(){I(!0),t.Mio=a.keyword_null})),I(!1)),n.stopPropagation()},P=function(n){t.Mio=a.keyword_null,I(!0),n.stopPropagation()};C.bind(n+a.AI_Pivot_Panel_NS,L),O.bind(n+a.AI_Pivot_Panel_NS,P),E.bind(e+a.AI_Pivot_Panel_NS,(function(t){"Enter"!==t.key||t.shiftKey||(t.preventDefault(),L(t)),"Escape"===t.key&&E.text(""),R()})),T.bind(i+a.AI_Pivot_Panel_NS,R),N.bind(n+a.AI_Pivot_Panel_NS,(function(){A.find(".".concat(y)).removeClass(w)})),x.bind(n+a.AI_Pivot_Panel_NS,(function(){(0,l.Yio)(_.html()),x.removeClass(c).addClass(m),setTimeout((function(){return x.removeClass(m).addClass(c)}),1e3)})),this.eventElements=[C,E,N,x,O,T]},n.prototype.Gio=function(t,n,e){var i=this,r=i.analyzeContainer,o=r.find(".".concat(a.PT_CONST.ANA_CONTAINER_CLASS)),s=o.find(".".concat(a.COMMON_CONST.TEXT_CLASS)),u=h();(0,c.aio)(this.spread,this.pt,t,(function(t){if(i.yoe||i.Mio!==n)return e(),!0;var r=t.deltaData.includes(u.AI_ERROR);return s.html(r?u.PT_Layout_Exp_Error:t.wholeData),r?(e(),!0):void 0})).then((function(t){if(i.yoe||i.Mio!==n)e();else{var r=t.includes(u.AI_ERROR);s.html(r?u.PT_Layout_Exp_Error:t),e()}})).catch((function(t){var n=(null==t?void 0:t.message)===u.ERROR_NO_AI_INJECT?u.ERROR_NO_AI_INJECT:u.Formula_Exp_Error;s.html(n),e()}))},n.prototype.unbindEvents=function(){this.eventElements.forEach((function(t){t.unbind(a.AI_Pivot_Panel_NS)})),this.eventElements=[]},n.prototype.destroy=function(){t.prototype.destroy.call(this),this.analyzeContainer.remove(),this.analyzeContainer=a.keyword_null},n}(i.PT_AIContainerBase),n.PT_AnalyzeContainer=p},"./dist/plugins/ai/features/pivot-table/widgets/capsule-container.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h=this&&this.qKr||(p=function(t,n){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},p(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}p(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),p;function g(t,n){var e,i=a.HTML_CONST.ACTIVE_CLASS,r=a.HTML_CONST.HEIGHT,o=a.HTML_CONST.SCROLL_HEIGHT,s=a.HTML_CONST.AUTO,u=a.HTML_CONST.PX,l=a.EVENT_CONST.TRANSITIONEND;t=c(t),n||(n=t.hasClass(i)),n?(t.css(r,t.prop(o)+u),requestAnimationFrame((function(){return t.css(r,"0")})),t.removeClass(i)):(t.addClass(i),e=t.prop(o),t.css(r,"0"),requestAnimationFrame((function(){return t.css(r,e+u)})),t.bind(l,(function n(){t.hasClass(i)&&t.css(r,s),t.unbind(l,n)})))}Object.defineProperty(n,"__esModule",{value:!0}),n.toggleGenerateContainer=n.PT_CapsuleContainer=void 0,i=e("./dist/plugins/ai/features/pivot-table/widgets/ai-pt-container-base.js"),r=e("Core"),o=e("Common"),s=e("./dist/plugins/ai/ai.ns.js"),a=e("./dist/plugins/ai/ai-constants.js"),u=e("./dist/plugins/ai/ai-common.js"),c=r.GC$,l=new o.Common.ResourceManager(s.SR,"AI"),f=l.getResource.bind(l),d=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return h(n,t),n.prototype.initUI=function(){var t=f(),n=a.PT_CONST.CAPSULE_CLASS,e=a.COMMON_CONST.GENERATE,i=a.COMMON_CONST.ANALYZE;this.aiCapsule=c.En(a.HTML_CONST.DIV,a.keyword_null,a.keyword_null,n,this.hostElement),this.aiCapsule.html("\n ".concat((0,u.yio)(e,t.GenerateLayout,!0),"\n ").concat((0,u.yio)(i,t.DataAnalyze,!0),"\n"))},n.prototype.bindEvents=function(){var t=this,n=c(t.ptPanelHost),e=t.aiCapsule,i=a.PT_CONST.PANEL_SHOW_RIGHT_CLASS,r=a.PT_CONST.PANEL_ALL_CLASS,o=a.PT_CONST.PANEL_ADDON_CLASS,s=a.EVENT_CONST.CLICK,u=a.COMMON_CONST.ICON_CLASS,l=a.COMMON_CONST.GENERATE,f=a.COMMON_CONST.ANALYZE,d=n.find(".".concat(r)),h=n.find(".".concat(o)),p=e.find(".".concat(u,".").concat(l)),v=e.find(".".concat(u,".").concat(f));p.bind(s+a.AI_Pivot_Panel_NS,(function(t){g(h)})),v.bind(s+a.AI_Pivot_Panel_NS,(function(t){d.hasClass(i)?d.removeClass(i):d.addClass(i)}))},n.prototype.unbindEvents=function(){this.aiCapsule.unbind(a.AI_Pivot_Panel_NS)},n.prototype.destroy=function(){t.prototype.destroy.call(this),this.aiCapsule.remove()},n}(i.PT_AIContainerBase),n.PT_CapsuleContainer=d,n.toggleGenerateContainer=g},"./dist/plugins/ai/features/pivot-table/widgets/generate-container.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d,h,p,g,v,m,y,b=this&&this.qKr||(w=function(t,n){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},w(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}w(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),w;function S(t){return!(!y(t)||3!==t.length)&&t.every((function(t){return y(t)&&2===t.length&&A(t[1])}))}function A(t){return!(!y(t)||4!==t.length)&&t.every((function(t,n){return y(t)&&T(t,3===n)}))}function T(t,n){return!!y(t)&&t.every((function(t){return y(t)&&n?3===t.length:2===t.length}))}Object.defineProperty(n,"__esModule",{value:!0}),n.PT_GenerateContainer=void 0,i=e("Core"),r=e("Common"),o=e("./dist/plugins/ai/features/pivot-table/widgets/ai-pt-container-base.js"),s=e("./dist/plugins/ai/features/pivot-table/widgets/capsule-container.js"),a=e("./dist/plugins/ai/ai.ns.js"),u=e("./dist/plugins/ai/ai-common.js"),c=e("./dist/plugins/ai/ai-constants.js"),l=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-table-layout.js"),f=e("./dist/plugins/ai/context/pivot-table.js"),d=e("./dist/plugins/ai/agents/pivot-table/generate-pivot-layout-suggestion.js"),h=e("./dist/plugins/ai/error-overlay.js"),p=i.GC$,g=new r.Common.ResourceManager(a.SR,"AI"),v=g.getResource.bind(g),m=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.Fio=!1,n.kio=!1,n.Uio=!1,n.Hio=[],n.eventElements=[],n.globalEvents=[],n}return b(n,t),n.prototype.initUI=function(){var t=v(),n=c.PT_CONST.GEN_SPIN_LINE_CLASS,e=c.PT_CONST.GEN_CLASS,i=c.PT_CONST.SUG_CONTAINER_CLASS,r=c.PT_CONST.SUG_DROPDOWN_CLASS,o=c.PT_CONST.SUG_DROPDOWN_HEADER_CLASS,s=c.PT_CONST.SUG_ITEM_CONTAINER_CLASS,a=c.HTML_CONST.DIV,l=c.HTML_CONST.CLASS,f=c.COMMON_CONST.REFRESH,d=c.COMMON_CONST.SEND,h=c.COMMON_CONST.RESET,g=c.COMMON_CONST.AI,m=c.COMMON_CONST.CLOSE,y=c.COMMON_CONST.ARROW_UP,b=c.COMMON_CONST.ICON_BACKGROUND_CLASS,w=c.COMMON_CONST.ICON_DISABLED_CLASS,S=c.COMMON_CONST.TEXT_CONTAINER_CLASS,A=c.COMMON_CONST.TEXT_CLASS,T=c.COMMON_CONST.TEXT_ICON_CLASS,j=c.COMMON_CONST.SEPARATOR_CLASS,E=c.COMMON_CONST.TEXT_HEADER_CLASS,_=c.COMMON_CONST.TEXT_HEADER_LEFT_CLASS,C=c.COMMON_CONST.TEXT_HEADER_RIGHT_CLASS,O=c.COMMON_CONST.TEXT_HEADER_TITLE_CLASS,x=p.En(a,c.keyword_null,c.keyword_null,e,this.hostElement);x.html("\n<".concat(a," ").concat(l,'="').concat(n,'"></').concat(a,">\n\n<").concat(a," ").concat(l,'="').concat(E,'">\n <').concat(a," ").concat(l,'="').concat(_,'">\n ').concat((0,u.yio)(g,""),"\n <").concat(a," ").concat(l,'="').concat(O,'">').concat(t.GenerateLayout,"</").concat(a,">\n </").concat(a,">\n <").concat(a," ").concat(l,'="').concat(C,'">\n ').concat((0,u.yio)(m,t.GEN_Close),"\n </").concat(a,">\n</").concat(a,">\n\n<").concat(a," ").concat(l,'="').concat(S,'">\n <').concat(a," ").concat(l,'="').concat(A,'" contenteditable="true" placeholder="').concat(t.Gen_Placeholder,'"></').concat(a,">\n <").concat(a," ").concat(l,'="').concat(T,'">\n ').concat((0,u.yio)(h+" "+w,t.Gen_Reset),"\n <").concat(a," ").concat(l,'="').concat(j,'"></').concat(a,">\n <").concat(a," ").concat(l,'="').concat(b," ").concat(d," ").concat(w,'">\n ').concat((0,u.yio)(d,t.Gen_Send),"\n </").concat(a,">\n </").concat(a,">\n</").concat(a,">\n\n<").concat(a," ").concat(l,'="').concat(i,'">\n <span>').concat(t.Gen_Sug,"</span>\n ").concat((0,u.yio)(y,t.Gen_ShowSuggestion),"\n</").concat(a,">\n\n<").concat(a," ").concat(l,'="').concat(r,'">\n <').concat(a," ").concat(l,'="').concat(o,'"> ').concat((0,u.yio)(f,t.Gen_Refresh)," </").concat(a,">\n <").concat(a," ").concat(l,'="').concat(s,'"></').concat(a,">\n</").concat(a,">\n")),this.genContainer=x},n.prototype.bindEvents=function(){var t,n,e,i,r,o=this,a=this.genContainer,l=p(o.ptPanelHost),f=o.spread,g=o.pt,m=v(),y=c.PT_CONST.SUG_CONTAINER_CLASS,b=c.PT_CONST.SUG_DROPDOWN_CLASS,w=c.PT_CONST.SUG_ITEM_CONTAINER_CLASS,A=c.PT_CONST.SUG_ITEM_CLASS,T=c.PT_CONST.PANEL_ADDON_CLASS,j=c.HTML_CONST.LOADING,E=c.HTML_CONST.DIV,_=c.EVENT_CONST.CLICK,C=c.EVENT_CONST.KEYDOWN,O=c.EVENT_CONST.INPUT,x=c.COMMON_CONST.ICON_CLASS,N=c.COMMON_CONST.REFRESH,R=c.COMMON_CONST.RESET,I=c.COMMON_CONST.SEND,L=c.COMMON_CONST.CLOSE,P=c.COMMON_CONST.TEXT_CONTAINER_CLASS,M=c.COMMON_CONST.TEXT_CLASS,D=c.COMMON_CONST.ICON_BACKGROUND_CLASS,k=l.find(".".concat(T)),F=a.find(".".concat(P)),U=a.find(".".concat(M)),G=a.find(".".concat(y)),H=a.find(".".concat(b)),B=a.find(".".concat(w)),J=a.find(".".concat(x,".").concat(N)),q=function(){B.html(""),J.addClass(j)},X=function(t){B.empty();var n=[];return t.forEach((function(t,n){var e,i=p.En(E,c.keyword_null,c.keyword_null,A);i.attr("data-suggestion",n),i.text(t[0]),e=t[1],i.bind(_+c.AI_Pivot_Panel_NS,(function(t){try{o.qio(e)}catch(t){h.ErrorOverlay.show(m.PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(G[0]))}finally{H.hide(),t.stopPropagation()}})),B.append(i)})),n};function $(){if(!o.Fio){o.Fio=!0,q();var t=o.Hio.length?o.Hio.join("\n"):c.keyword_null;(0,d.cio)(f,g,c.keyword_undefined,t).then((function(t){if(!o.yoe)if(J.removeClass(j),(0,u.gio)(t,m.PT_Layout_Gen_Error,G[0]))H.hide();else try{var n=(0,u.parseJSON)(t);S(n),X(n),o.Jio(n),o.kio=!0}catch(t){h.ErrorOverlay.show(m.PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(G[0])),H.hide()}finally{o.Fio=!1}})).catch((function(t){var n=(null==t?void 0:t.message)===m.ERROR_NO_AI_INJECT?m.ERROR_NO_AI_INJECT:m.PT_Layout_Gen_Error;h.ErrorOverlay.show(n,(0,u.getGenerateErrorDialogPosition)(G[0])),J.removeClass(j),H.hide(),o.Fio=!1}))}}G.bind(_+c.AI_Pivot_Panel_NS,(function(t){H.isVisible()?H.hide():(H.show(),o.Fio||o.kio||$()),t.stopPropagation()})),t=function(t){!H.isVisible()||H[0].contains(t.target)||G[0].contains(t.target)||H.hide()}.bind(this),document.addEventListener(_,t,!0),J.bind(_+c.AI_Pivot_Panel_NS,(function(t){$(),t.stopPropagation()})),n=function(t){if(!o.Uio){var n=U.text();n&&(o.Uio=!0,o.mio(),o.Bio(n)),t.stopPropagation()}},e=a.find(".".concat(x,".").concat(R)),i=a.find(".".concat(D,".").concat(I)),r=a.find(".".concat(x,".").concat(L)),e.bind(_+c.AI_Pivot_Panel_NS,(function(t){o.c5(),t.stopPropagation()})),i.bind(_+c.AI_Pivot_Panel_NS,n),U.bind(C+c.AI_Pivot_Panel_NS,(function(t){"Enter"!==t.key||t.shiftKey||(t.preventDefault(),n(t)),"Escape"===t.key&&(U.text(""),o.Dio(i,!0)),t.stopPropagation()})),U.bind(O+c.AI_Pivot_Panel_NS,(function(t){var n=""===U.text().trim();o.Dio(i,n)})),r.bind(_+c.AI_Pivot_Panel_NS,(function(t){(0,s.toggleGenerateContainer)(k,!1),t.stopPropagation()})),F.bind(_+c.AI_Pivot_Panel_NS,(function(t){U.focus(),t.stopPropagation()})),this.eventElements=[G,H,J,e,i,F,U],this.globalEvents=[t]},n.prototype.Bio=function(t){var n=this,e=n.spread,i=n.pt;(0,l.lio)(e,t,i).then((function(t){var e,i,r,o;if(!n.yoe){e=c.COMMON_CONST.ICON_BACKGROUND_CLASS,i=c.COMMON_CONST.SEND,r=n.genContainer.find(".".concat(e,".").concat(i));try{if(t.includes(v().AI_ERROR))h.ErrorOverlay.show(v().PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(r[0]));else{if(!A(o=(0,u.parseJSON)(t)))return void h.ErrorOverlay.show(v().PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(r[0]));n.qio((0,u.parseJSON)(t))}}catch(t){h.ErrorOverlay.show(v().PT_Layout_Gen_Error,(0,u.getGenerateErrorDialogPosition)(r[0]))}finally{n.Uio=!1,n.vio()}}})).catch((function(t){var e,i,r;n.yoe||(e=c.COMMON_CONST.ICON_BACKGROUND_CLASS,i=c.COMMON_CONST.SEND,r=n.genContainer.find(".".concat(e,".").concat(i)),h.ErrorOverlay.show(t.message,(0,u.getGenerateErrorDialogPosition)(r[0])),n.Uio=!1,n.vio())}))},n.prototype.mio=function(){if(!this.Xio){var t=p(this.ptPanelHost).find("."+c.PT_CONST.PANEL_ALL_CLASS);this.Xio=(0,u.mio)(t)}},n.prototype.vio=function(){this.Xio&&(this.Xio(),delete this.Xio)},n.prototype.qio=function(t){if(!this.zio){this.zio=(0,f.Sio)(this.pt);var n=this.genContainer.find(".".concat(c.COMMON_CONST.ICON_CLASS,".").concat(c.COMMON_CONST.RESET));this.Dio(n,!1)}(0,f.bio)(this.pt,t)},n.prototype.c5=function(){if(this.zio){this.qio(this.zio),delete this.zio;var t=this.genContainer.find(".".concat(c.COMMON_CONST.ICON_CLASS,".").concat(c.COMMON_CONST.RESET));this.Dio(t,!0)}this.Hio=[]},n.prototype.Jio=function(t){var n=this.Hio;t.forEach((function(t){n.push(t[0])})),n.length>c.PT_CONST.MAX_SUGGESTIONS&&(n=n.slice(n.length-c.PT_CONST.MAX_SUGGESTIONS,n.length)),this.Hio=n},n.prototype.unbindEvents=function(){this.eventElements.forEach((function(t){t.unbind(c.AI_Pivot_Panel_NS)})),this.globalEvents.forEach((function(t){document.removeEventListener(c.EVENT_CONST.CLICK,t)})),this.eventElements=[],this.globalEvents=[]},n.prototype.destroy=function(){t.prototype.destroy.call(this),this.vio(),this.genContainer.remove(),this.genContainer=c.keyword_null,this.zio=c.keyword_null,this.Hio=c.keyword_null},n}(o.PT_AIContainerBase),n.PT_GenerateContainer=m,y=Array.isArray},"./dist/plugins/ai/functions/define-ai-function.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c,l,f,d;function h(t,n,e){var i=t.getValue(n,e);return u(i)?"":"object"==typeof i?i instanceof Date?t.getText(n,e):i instanceof r.CalcError?i:"":i}function p(t,n){if(t)return Object.keys(n).forEach((function(e){var i=n[e];Object.keys(i).forEach((function(n){t[e][n]=i[n]}))})),t}function g(t,n,e){var i,o,s,a,u=t.getRowCount(),c=t.getColumnCount(),l=n.getRow(0),f=n.getColumn(0),d=Math.min(n.getRowCount(0),u-l),p=Math.min(n.getColumnCount(0),c-f),g=[],v={};for(i=0;i<d;i++){for(o=[],s=0;s<p;s++)(a=h(e,l+i,f+s))instanceof r.CalcError&&(v[i]||(v[i]={}),v[i][s]=a,a=""),o.push(a);g.push(o)}return{array:JSON.stringify(g),errorMap:v}}function v(t,n,e){var i,r;return h(e,n.getRow(0),n.getColumn(0))}function m(t){var n=t.functionName,e=t.minArgs,i=t.maxArgs,r=t.evaluateFunction,u=t.argsLimit,h=t.defaultValue,p=void 0===h?l:h,g=t.acceptsArray,v=void 0===g?f:g,m=t.acceptsReference,y=void 0===m?d:m,b=t.errorCode,w=void 0===b?a:b,S=t.description,A=new s(n,e,i);A.R9t=u,A.defaultValue=p,A.evaluateAsync=function(){var t,n,e,i,o=Array.from(arguments),s=o[0],a=o[1],u=(null==a?void 0:a.rT)||(null===(t=s.ctx)||void 0===t?void 0:t.source);if(!u)return w;if(e=(n=u.Mf).parent,!n||!e)return w;try{return!1===(i=r(n,o))?w:c}catch(t){}return w},A.acceptsArray=v,A.acceptsReference=y,A.description=S,o.Mmt[n]=A}Object.defineProperty(n,"__esModule",{value:!0}),n.defineAIFunction=n.getTextFromCalcReference=n.getArrayTextFromCalcReference=n.restoreCalcErrors=void 0,i=e("Common"),r=e("CalcEngine"),o=r.Functions,s=o.AsyncFunction,a=r.Errors.Value,u=i.Common.lt.ht,c="#BUSY!",l=function(){return c},f=function(){return!0},d=function(){return!0},n.restoreCalcErrors=p,n.getArrayTextFromCalcReference=g,n.getTextFromCalcReference=v,n.defineAIFunction=m},"./dist/plugins/ai/functions/function-description.js":function(t,n,e){"use strict";var i,r,o,s,a,u=this&&this.iJr||function(t,n,e){if(e||2===arguments.length)for(var i=0,r=n.length,o;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return t.concat(o||Array.prototype.slice.call(n))};function c(){return{name:"SJS.AI.QUERY",isFunc:!0,description:a().Query_Function_Description,parameters:[{name:"prompt"},{name:"value"}]}}function l(){return{name:"SJS.AI.TEXTSENTIMENT",isFunc:!0,description:a().Text_Sentiment_Function_Description,parameters:[{name:"value"},{name:"positive"},{name:"negative"},{name:"neutral",optional:!0}]}}function f(){return{name:"SJS.AI.TRANSLATE",isFunc:!0,description:a().Translate_Function_Description,parameters:[{name:"value"},{name:"language"}]}}Object.defineProperty(n,"__esModule",{value:!0}),n.getAITranslateFunctionDescription=n.getAITextSentimentFunctionDescription=n.getAIQueryFunctionDescription=void 0,i=e("Common"),r=e("Core"),o=e("./dist/plugins/ai/ai.ns.js"),s=new i.Common.ResourceManager(o.SR,"AI"),a=s.getResource.bind(s),r.Worksheet.ch("AI",{getAllFunctions:function(t){t.funcs=u(u([],t.funcs,!0),[c(),l(),f()],!1)}}),n.getAIQueryFunctionDescription=c,n.getAITextSentimentFunctionDescription=l,n.getAITranslateFunctionDescription=f},"./dist/plugins/ai/functions/query.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c;Object.defineProperty(n,"__esModule",{value:!0}),i=e("CalcEngine"),r=e("./dist/plugins/ai/agents/query/query.js"),o=e("./dist/plugins/ai/ai-common.js"),s=e("./dist/plugins/ai/functions/define-ai-function.js"),a=e("./dist/plugins/ai/functions/function-description.js"),u=e("./dist/plugins/ai/functions/utils.js"),c=i.Errors.Value,(0,s.defineAIFunction)({functionName:"SJS.AI.QUERY",minArgs:2,maxArgs:2,evaluateFunction:function(t,n){var e,a,l=t.parent,f=n[0],d=n[1],h=n[2],p={},g=d.rT||(null===(e=f.ctx)||void 0===e?void 0:e.source);return!(d&&d instanceof i.CalcReference&&(d=(0,s.getTextFromCalcReference)(g,d,t))instanceof i.CalcError)&&(h&&(h instanceof i.CalcReference?(h=(a=(0,s.getArrayTextFromCalcReference)(g,h,t)).array,p=a.errorMap):h=(0,u.normalizeArrayValue)(h)),(0,r.fio)(l,h,d).then((function(t){f.setAsyncResult(new i.CalcArray((0,s.restoreCalcErrors)((0,o.parseJSON)(t),p)))})).catch((function(t){f.setAsyncResult(c)})),!0)},errorCode:c,description:a.getAIQueryFunctionDescription})},"./dist/plugins/ai/functions/text-sentiment.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c;function l(t,n,e,i){switch(void 0===i&&(i=""),t=t.toLowerCase()){case"positive":return n;case"negative":return e;case"neutral":return i;default:return t}}Object.defineProperty(n,"__esModule",{value:!0}),i=e("CalcEngine"),r=e("./dist/plugins/ai/agents/textSentiment/text-sentiment.js"),o=e("./dist/plugins/ai/ai-common.js"),s=e("./dist/plugins/ai/functions/define-ai-function.js"),a=e("./dist/plugins/ai/functions/function-description.js"),u=e("./dist/plugins/ai/functions/utils.js"),c=i.Errors.Value,(0,s.defineAIFunction)({functionName:"SJS.AI.TEXTSENTIMENT",minArgs:3,maxArgs:4,evaluateFunction:function(t,n){var e,a,f=t.parent,d=n[0],h=n[1],p=n[2],g=n[3],v=n[4],m={},y=h.rT||(null===(e=d.ctx)||void 0===e?void 0:e.source);return h&&(h instanceof i.CalcReference?(h=(a=(0,s.getArrayTextFromCalcReference)(y,h,t)).array,m=a.errorMap):h=(0,u.normalizeArrayValue)(h)),p&&p instanceof i.CalcReference&&(p=(0,s.getTextFromCalcReference)(y,p,t)),g&&g instanceof i.CalcReference&&(g=(0,s.getTextFromCalcReference)(y,g,t)),v&&v instanceof i.CalcReference&&(v=(0,s.getTextFromCalcReference)(y,v,t)),(0,r.hio)(f,h).then((function(t){var n,e,r,a,u=(0,o.parseJSON)(t)||[],c=[];for(n=0;n<u.length;n++){for(e=u[n],r=[],a=0;a<e.length;a++)r.push(l(e[a],p,g,v));c.push(r)}d.setAsyncResult(new i.CalcArray((0,s.restoreCalcErrors)(c,m)))})).catch((function(t){d.setAsyncResult(c)})),!0},errorCode:c,description:a.getAITextSentimentFunctionDescription})},"./dist/plugins/ai/functions/translate.js":function(t,n,e){"use strict";var i,r,o,s,a,u,c;Object.defineProperty(n,"__esModule",{value:!0}),i=e("CalcEngine"),r=e("./dist/plugins/ai/agents/translate/translate.js"),o=e("./dist/plugins/ai/ai-common.js"),s=e("./dist/plugins/ai/functions/define-ai-function.js"),a=e("./dist/plugins/ai/functions/function-description.js"),u=e("./dist/plugins/ai/functions/utils.js"),c=i.Errors.Value,(0,s.defineAIFunction)({functionName:"SJS.AI.TRANSLATE",minArgs:2,maxArgs:2,evaluateFunction:function(t,n){var e,a,l=t.parent,f=n[0],d=n[1],h=n[2],p={},g=d.rT||(null===(e=f.ctx)||void 0===e?void 0:e.source);return d&&(d instanceof i.CalcReference?(d=(a=(0,s.getArrayTextFromCalcReference)(g,d,t)).array,p=a.errorMap):d=(0,u.normalizeArrayValue)(d)),!(h&&h instanceof i.CalcReference&&(h=(0,s.getTextFromCalcReference)(g,h,t))instanceof i.CalcError)&&((0,r.dio)(l,d,h).then((function(t){f.setAsyncResult(new i.CalcArray((0,s.restoreCalcErrors)((0,o.parseJSON)(t),p)))})).catch((function(t){f.setAsyncResult(c)})),!0)},errorCode:c,description:a.getAITranslateFunctionDescription})},"./dist/plugins/ai/functions/utils.js":function(t,n,e){"use strict";var i,r,o;function s(t){var n,e;return n=r(t)?[[""]]:o(t)?0===t.length?[[""]]:o(t[0])?t.map((function(t){return o(t)?t:[t]})):[t]:[[t]],e=Math.max.apply(Math,n.map((function(t){return t.length}))),n=n.map((function(t){for(;t.length<e;)t.push("");return t})),JSON.stringify(n)}Object.defineProperty(n,"__esModule",{value:!0}),n.normalizeArrayValue=void 0,i=e("Common"),r=i.Common.lt.ht,o=i.Common.lt.Nh,n.normalizeArrayValue=s},"./dist/plugins/ai/interface.js":function(t,n){"use strict";var e,i,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.PivotTableContextArgs=n.TableContextArgs=n.WorksheetContextArgs=n.WorkbookContextArgs=void 0,function(t){t[t.names=1]="names",t[t.sheetNames=2]="sheetNames",t[t.activeSheet=4]="activeSheet",t[t.eachSheetColumnHeaders=8]="eachSheetColumnHeaders",t[t.all=15]="all"}(e=n.WorkbookContextArgs||(n.WorkbookContextArgs={})),function(t){t[t.names=1]="names",t[t.selections=2]="selections",t[t.axisInfo=4]="axisInfo",t[t.currentFormula=8]="currentFormula",t[t.all=15]="all"}(i=n.WorksheetContextArgs||(n.WorksheetContextArgs={})),function(t){t[t.range=1]="range",t[t.columns=2]="columns",t[t.data=4]="data",t[t.all=7]="all"}(r=n.TableContextArgs||(n.TableContextArgs={})),function(t){t[t.range=1]="range",t[t.source=2]="source",t[t.layout=4]="layout",t[t.data=8]="data",t[t.totalData=16]="totalData",t[t.group=32]="group",t[t.filter=64]="filter",t[t.all=111]="all"}(o=n.PivotTableContextArgs||(n.PivotTableContextArgs={}))},CalcEngine:function(n){"use strict";n.exports=t.Spread.CalcEngine},Common:function(n){"use strict";n.exports=t.Spread},Core:function(n){"use strict";n.exports=t.Spread.Sheets},FormulaPanel:function(n){"use strict";n.exports=t.Spread.Sheets.FormulaPanel},Pivot:function(n){"use strict";n.exports=t.Pivot},PivotTable:function(n){"use strict";n.exports=t.Spread.Pivot},Tables:function(n){"use strict";n.exports=t.Spread.Sheets.Tables}},i={};function r(t){var n,o=i[t];return void 0!==o?o.exports:(n=i[t]={exports:{}},e[t].call(n.exports,n,n.exports,r),n.exports)}n=r("./dist/plugins/ai/ai.entry.js"),(((t=void 0===t?{}:t).Spread=t.Spread||{}).Sheets=t.Spread.Sheets||{}).AI=n}()}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mescius/spread-sheets-ai-addon",
|
|
3
|
-
"version": "18.2.
|
|
3
|
+
"version": "18.2.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description":"SpreadJS AI addon",
|
|
6
6
|
"scripts": {},
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"spreadjs"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@mescius/spread-sheets": "18.2.
|
|
18
|
+
"@mescius/spread-sheets": "18.2.2"
|
|
19
19
|
},
|
|
20
20
|
"author": {
|
|
21
21
|
"email": "us.sales@mescius.com",
|