@perses-dev/table-plugin 0.9.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/css/async/3061.d3010b86.css +1 -0
- package/__mf/css/async/5442.d3010b86.css +1 -0
- package/__mf/css/async/7823.d3010b86.css +1 -0
- package/__mf/js/Table.7e37b83d.js +6 -0
- package/__mf/js/async/1432.4dcbe7e3.js +1 -0
- package/__mf/js/async/1490.7aa42bc8.js +22 -0
- package/__mf/js/async/1616.7a74f4ef.js +1 -0
- package/__mf/js/async/2043.fdebf89c.js +2 -0
- package/__mf/js/async/3827.1b39b042.js +38 -0
- package/__mf/js/async/392.c2307fe5.js +2 -0
- package/__mf/js/async/{1964.ad4fb2b0.js → 4121.8e97ef88.js} +2 -2
- package/__mf/js/async/4761.08da9107.js +1 -0
- package/__mf/js/async/{2651.4ede9028.js → 5002.3189d214.js} +1 -1
- package/__mf/js/async/{1640.c1ed5a05.js → 5019.5318688a.js} +1 -1
- package/__mf/js/async/5071.91e1c002.js +1 -0
- package/__mf/js/async/5501.fa3f80e1.js +1 -0
- package/__mf/js/async/{5214.00911b97.js → 5587.f5f2b0cc.js} +1 -1
- package/__mf/js/async/5806.44fbc2a8.js +1 -0
- package/__mf/js/async/6274.14683c28.js +2 -0
- package/__mf/js/async/6283.e044c368.js +2 -0
- package/__mf/js/async/6587.d2b9768c.js +110 -0
- package/__mf/js/async/6753.032ce611.js +1 -0
- package/__mf/js/async/7142.5d923107.js +1 -0
- package/__mf/js/async/7177.356298ae.js +1 -0
- package/__mf/js/async/7192.66c9e3a5.js +1 -0
- package/__mf/js/async/7208.125848cf.js +7 -0
- package/__mf/js/async/7417.86d0bc09.js +1 -0
- package/__mf/js/async/7968.a66bfadb.js +1 -0
- package/__mf/js/async/7978.a19f5a4f.js +1 -0
- package/__mf/js/async/8356.8ae40b6a.js +1 -0
- package/__mf/js/async/8470.1b8b20ff.js +2 -0
- package/__mf/js/async/8728.546704f2.js +1 -0
- package/__mf/js/async/873.a7310675.js +1 -0
- package/__mf/js/async/9235.eee50e10.js +1 -0
- package/__mf/js/async/9355.8b0c6885.js +2 -0
- package/__mf/js/async/941.333875f4.js +2 -0
- package/__mf/js/async/9588.7b021071.js +1 -0
- package/__mf/js/async/__federation_expose_Table.4836d198.js +1 -0
- package/__mf/js/async/lib-router.8fd59130.js +2 -0
- package/__mf/js/main.289caaea.js +6 -0
- package/lib/Table.d.ts +2 -2
- package/lib/Table.d.ts.map +1 -1
- package/lib/Table.js +2 -6
- package/lib/Table.js.map +1 -1
- package/lib/bootstrap.js +1 -1
- package/lib/bootstrap.js.map +1 -1
- package/lib/cjs/Table.js +9 -13
- package/lib/cjs/components/CellsEditor/CellsEditor.js +30 -0
- package/lib/cjs/{CellsEditor → components/CellsEditor}/index.js +0 -1
- package/lib/cjs/components/ColumnsEditor/ColumnEditor.js +241 -0
- package/lib/cjs/{CellsEditor/CellEditor.js → components/ConditionalPanel.js} +167 -197
- package/lib/cjs/components/TablePanel.js +576 -0
- package/lib/cjs/{TableSettingsEditor.js → components/TableSettingsEditor.js} +32 -4
- package/lib/cjs/components/index.js +37 -0
- package/lib/cjs/index-federation.js +12 -12
- package/lib/cjs/index.js +2 -9
- package/lib/cjs/models/index.js +31 -0
- package/lib/cjs/{table-model.js → models/model.js} +1 -12
- package/lib/cjs/models/table-model.js +252 -0
- package/lib/cjs/test/mock-query-results.js +7 -7
- package/lib/{CellsEditor → components/CellsEditor}/CellsEditor.d.ts +1 -1
- package/lib/components/CellsEditor/CellsEditor.d.ts.map +1 -0
- package/lib/components/CellsEditor/CellsEditor.js +22 -0
- package/lib/components/CellsEditor/CellsEditor.js.map +1 -0
- package/lib/components/CellsEditor/index.d.ts +2 -0
- package/lib/components/CellsEditor/index.d.ts.map +1 -0
- package/lib/{CellsEditor → components/CellsEditor}/index.js +0 -1
- package/lib/components/CellsEditor/index.js.map +1 -0
- package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnEditor.d.ts +1 -1
- package/lib/components/ColumnsEditor/ColumnEditor.d.ts.map +1 -0
- package/lib/components/ColumnsEditor/ColumnEditor.js +233 -0
- package/lib/components/ColumnsEditor/ColumnEditor.js.map +1 -0
- package/lib/components/ColumnsEditor/ColumnEditorContainer.d.ts.map +1 -0
- package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnEditorContainer.js +1 -1
- package/lib/components/ColumnsEditor/ColumnEditorContainer.js.map +1 -0
- package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnsEditor.d.ts +1 -1
- package/lib/components/ColumnsEditor/ColumnsEditor.d.ts.map +1 -0
- package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnsEditor.js +1 -1
- package/lib/components/ColumnsEditor/ColumnsEditor.js.map +1 -0
- package/lib/components/ColumnsEditor/index.d.ts.map +1 -0
- package/lib/components/ColumnsEditor/index.js.map +1 -0
- package/lib/components/ConditionalPanel.d.ts +15 -0
- package/lib/components/ConditionalPanel.d.ts.map +1 -0
- package/lib/{CellsEditor/CellEditor.js → components/ConditionalPanel.js} +159 -197
- package/lib/components/ConditionalPanel.js.map +1 -0
- package/lib/components/EmbeddedPanel.d.ts.map +1 -0
- package/lib/components/EmbeddedPanel.js.map +1 -0
- package/lib/{TableCellsEditor.d.ts → components/TableCellsEditor.d.ts} +1 -1
- package/lib/components/TableCellsEditor.d.ts.map +1 -0
- package/lib/components/TableCellsEditor.js.map +1 -0
- package/lib/{TableColumnsEditor.d.ts → components/TableColumnsEditor.d.ts} +1 -1
- package/lib/components/TableColumnsEditor.d.ts.map +1 -0
- package/lib/components/TableColumnsEditor.js.map +1 -0
- package/lib/{TablePanel.d.ts → components/TablePanel.d.ts} +1 -1
- package/lib/components/TablePanel.d.ts.map +1 -0
- package/lib/components/TablePanel.js +560 -0
- package/lib/components/TablePanel.js.map +1 -0
- package/lib/{TableSettingsEditor.d.ts → components/TableSettingsEditor.d.ts} +1 -1
- package/lib/components/TableSettingsEditor.d.ts.map +1 -0
- package/lib/{TableSettingsEditor.js → components/TableSettingsEditor.js} +33 -5
- package/lib/components/TableSettingsEditor.js.map +1 -0
- package/lib/{TableTransformsEditor.d.ts → components/TableTransformsEditor.d.ts} +1 -1
- package/lib/components/TableTransformsEditor.d.ts.map +1 -0
- package/lib/{TableTransformsEditor.js → components/TableTransformsEditor.js} +1 -1
- package/lib/components/TableTransformsEditor.js.map +1 -0
- package/lib/components/index.d.ts +9 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +22 -0
- package/lib/components/index.js.map +1 -0
- package/lib/index.d.ts +2 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -9
- package/lib/index.js.map +1 -1
- package/lib/models/index.d.ts +3 -0
- package/lib/models/index.d.ts.map +1 -0
- package/lib/{table-model.js → models/index.js} +4 -9
- package/lib/models/index.js.map +1 -0
- package/lib/models/model.d.ts.map +1 -0
- package/lib/models/model.js +15 -0
- package/lib/models/model.js.map +1 -0
- package/lib/{table-model.d.ts → models/table-model.d.ts} +24 -1
- package/lib/models/table-model.d.ts.map +1 -0
- package/lib/models/table-model.js +233 -0
- package/lib/models/table-model.js.map +1 -0
- package/mf-manifest.json +44 -45
- package/mf-stats.json +45 -46
- package/package.json +5 -5
- package/__mf/css/async/2341.cbbd94a8.css +0 -1
- package/__mf/css/async/5263.cbbd94a8.css +0 -1
- package/__mf/css/async/6759.cbbd94a8.css +0 -1
- package/__mf/js/Table.09045c91.js +0 -5
- package/__mf/js/async/1143.68727fe6.js +0 -1
- package/__mf/js/async/2292.12f77288.js +0 -2
- package/__mf/js/async/2854.fc0ce4ac.js +0 -110
- package/__mf/js/async/3224.5efdac43.js +0 -1
- package/__mf/js/async/3391.62c7afd4.js +0 -73
- package/__mf/js/async/3863.5ed15409.js +0 -2
- package/__mf/js/async/3960.ad46df53.js +0 -2
- package/__mf/js/async/3980.17fb5371.js +0 -2
- package/__mf/js/async/4075.e2a2c230.js +0 -1
- package/__mf/js/async/4238.ea9515aa.js +0 -1
- package/__mf/js/async/4300.fc319dfb.js +0 -38
- package/__mf/js/async/4368.3e460b07.js +0 -1
- package/__mf/js/async/4483.b6379137.js +0 -1
- package/__mf/js/async/5061.85655462.js +0 -2
- package/__mf/js/async/5377.6522c49a.js +0 -1
- package/__mf/js/async/5409.524589b2.js +0 -1
- package/__mf/js/async/5981.91033d82.js +0 -2
- package/__mf/js/async/6284.5f775177.js +0 -1
- package/__mf/js/async/6292.c204d39b.js +0 -1
- package/__mf/js/async/6770.94607b71.js +0 -1
- package/__mf/js/async/694.20d8be37.js +0 -1
- package/__mf/js/async/738.3929068d.js +0 -1
- package/__mf/js/async/7740.4fee7abb.js +0 -1
- package/__mf/js/async/8313.b86a056a.js +0 -7
- package/__mf/js/async/8488.9f177839.js +0 -1
- package/__mf/js/async/8599.4f1f88c0.js +0 -1
- package/__mf/js/async/9010.aaf984f3.js +0 -1
- package/__mf/js/async/9173.c646dd1e.js +0 -2
- package/__mf/js/async/9509.1c4313e0.js +0 -1
- package/__mf/js/async/9667.211c6bdb.js +0 -1
- package/__mf/js/async/__federation_expose_Table.3668e352.js +0 -1
- package/__mf/js/async/lib-router.f3ef5227.js +0 -2
- package/__mf/js/main.0cb08842.js +0 -5
- package/lib/CellsEditor/CellEditor.d.ts +0 -10
- package/lib/CellsEditor/CellEditor.d.ts.map +0 -1
- package/lib/CellsEditor/CellEditor.js.map +0 -1
- package/lib/CellsEditor/CellsEditor.d.ts.map +0 -1
- package/lib/CellsEditor/CellsEditor.js +0 -123
- package/lib/CellsEditor/CellsEditor.js.map +0 -1
- package/lib/CellsEditor/index.d.ts +0 -3
- package/lib/CellsEditor/index.d.ts.map +0 -1
- package/lib/CellsEditor/index.js.map +0 -1
- package/lib/ColumnsEditor/ColumnEditor.d.ts.map +0 -1
- package/lib/ColumnsEditor/ColumnEditor.js +0 -213
- package/lib/ColumnsEditor/ColumnEditor.js.map +0 -1
- package/lib/ColumnsEditor/ColumnEditorContainer.d.ts.map +0 -1
- package/lib/ColumnsEditor/ColumnEditorContainer.js.map +0 -1
- package/lib/ColumnsEditor/ColumnsEditor.d.ts.map +0 -1
- package/lib/ColumnsEditor/ColumnsEditor.js.map +0 -1
- package/lib/ColumnsEditor/index.d.ts.map +0 -1
- package/lib/ColumnsEditor/index.js.map +0 -1
- package/lib/EmbeddedPanel.d.ts.map +0 -1
- package/lib/EmbeddedPanel.js.map +0 -1
- package/lib/TableCellsEditor.d.ts.map +0 -1
- package/lib/TableCellsEditor.js.map +0 -1
- package/lib/TableColumnsEditor.d.ts.map +0 -1
- package/lib/TableColumnsEditor.js.map +0 -1
- package/lib/TablePanel.d.ts.map +0 -1
- package/lib/TablePanel.js +0 -325
- package/lib/TablePanel.js.map +0 -1
- package/lib/TableSettingsEditor.d.ts.map +0 -1
- package/lib/TableSettingsEditor.js.map +0 -1
- package/lib/TableTransformsEditor.d.ts.map +0 -1
- package/lib/TableTransformsEditor.js.map +0 -1
- package/lib/cjs/CellsEditor/CellsEditor.js +0 -136
- package/lib/cjs/ColumnsEditor/ColumnEditor.js +0 -221
- package/lib/cjs/TablePanel.js +0 -341
- package/lib/cjs/model.js +0 -4
- package/lib/model.d.ts.map +0 -1
- package/lib/model.js +0 -3
- package/lib/model.js.map +0 -1
- package/lib/table-model.d.ts.map +0 -1
- package/lib/table-model.js.map +0 -1
- /package/__mf/js/async/{3391.62c7afd4.js.LICENSE.txt → 1490.7aa42bc8.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2292.12f77288.js.LICENSE.txt → 2043.fdebf89c.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5981.91033d82.js.LICENSE.txt → 392.c2307fe5.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{1964.ad4fb2b0.js.LICENSE.txt → 4121.8e97ef88.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3960.ad46df53.js.LICENSE.txt → 6274.14683c28.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3980.17fb5371.js.LICENSE.txt → 6283.e044c368.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2854.fc0ce4ac.js.LICENSE.txt → 6587.d2b9768c.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8313.b86a056a.js.LICENSE.txt → 7208.125848cf.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{9173.c646dd1e.js.LICENSE.txt → 8470.1b8b20ff.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5061.85655462.js.LICENSE.txt → 9355.8b0c6885.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3863.5ed15409.js.LICENSE.txt → 941.333875f4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.f3ef5227.js.LICENSE.txt → lib-router.8fd59130.js.LICENSE.txt} +0 -0
- /package/lib/cjs/{ColumnsEditor → components/ColumnsEditor}/ColumnEditorContainer.js +0 -0
- /package/lib/cjs/{ColumnsEditor → components/ColumnsEditor}/ColumnsEditor.js +0 -0
- /package/lib/cjs/{ColumnsEditor → components/ColumnsEditor}/index.js +0 -0
- /package/lib/cjs/{EmbeddedPanel.js → components/EmbeddedPanel.js} +0 -0
- /package/lib/cjs/{TableCellsEditor.js → components/TableCellsEditor.js} +0 -0
- /package/lib/cjs/{TableColumnsEditor.js → components/TableColumnsEditor.js} +0 -0
- /package/lib/cjs/{TableTransformsEditor.js → components/TableTransformsEditor.js} +0 -0
- /package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnEditorContainer.d.ts +0 -0
- /package/lib/{ColumnsEditor → components/ColumnsEditor}/index.d.ts +0 -0
- /package/lib/{ColumnsEditor → components/ColumnsEditor}/index.js +0 -0
- /package/lib/{EmbeddedPanel.d.ts → components/EmbeddedPanel.d.ts} +0 -0
- /package/lib/{EmbeddedPanel.js → components/EmbeddedPanel.js} +0 -0
- /package/lib/{TableCellsEditor.js → components/TableCellsEditor.js} +0 -0
- /package/lib/{TableColumnsEditor.js → components/TableColumnsEditor.js} +0 -0
- /package/lib/{model.d.ts → models/model.d.ts} +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 5061.85655462.js.LICENSE.txt */
|
|
2
|
-
(self.chunk_Table=self.chunk_Table||[]).push([["5061"],{97119:function(e,t,r){"use strict";let n;r.r(t),r.d(t,{DEFAULT_CALCULATION:()=>c,KINDS:()=>p,legendModes:()=>g,msToPrometheusDuration:()=>L,isBytesUnit:()=>eH,panelSpecSchema:()=>r6,oauthProvidersSchema:()=>nb,globalSecretSchema:()=>ng,MAX_SIGNIFICANT_DIGITS:()=>eT,buildPanelSpecSchema:()=>r8,useDeepMemo:()=>nG,isUnitWithDecimalPlaces:()=>eJ,roleBindingSpecSchema:()=>nl,shouldShortenValues:()=>J,formatValue:()=>eL,variableListSchema:()=>nS,subjectSchema:()=>nc,variableDisplaySchema:()=>nx,buildVariableSpecSchema:()=>nT,buildVariableListSchema:()=>nE,getCalculations:()=>d,pluginSchema:()=>rH,createRegexFromString:()=>oz,buildPanelDefinitionSchema:()=>nt,getUnitGroupConfig:()=>eq,applyMergeSeriesTransform:()=>oF,MIN_STEP_INTERVAL_MS:()=>oA,isDecimalUnit:()=>eK,fetchJson:()=>nz,isCurrencyUnit:()=>eQ,isRegexPattern:()=>oZ,linkSchema:()=>r7,nativeProviderSchema:()=>nv,userSpecSchema:()=>nw,DURATION_REGEX:()=>Z,getTimeSeriesValues:()=>oT,roundStepInterval:()=>q,secretSchema:()=>nm,variablesSchema:()=>nI,buildVariableDefinitionSchema:()=>nF,datasourceDefinitionSchema:()=>r2,isValidLegendPosition:()=>v,useTransformData:()=>oP,otlptracev1:()=>s,datasourceSpecSchema:()=>rY,FetchError:()=>n$,projectMetadataSchema:()=>rK,UNIT_CONFIG:()=>eB,UserFriendlyError:()=>nB,isDurationString:()=>$,variableSchema:()=>nC,secretsEditorSchema:()=>ny,isValidLegendSize:()=>w,variableDefinitionSchema:()=>nD,buildDatasourceSpecSchema:()=>rX,isProjectMetadata:()=>A,formatDuration:()=>U,legendPositions:()=>m,secretSpecSchema:()=>np,isPercentUnit:()=>eW,limitDecimalPlaces:()=>X,getSuggestedStepMs:()=>G,legendSizes:()=>y,panelDefinitionSchema:()=>ne,roleBindingSchema:()=>nf,buildPanelEditorSchema:()=>nn,getResourceDisplayName:()=>nJ,isTimeSeriesValueTuple:()=>W,isValidTraceId:()=>K,roleSpecSchema:()=>na,rolesEditorSchema:()=>nu,isUnitWithShortValues:()=>eY,CalculationsMap:()=>l,parseDurationString:()=>z,getCommonTimeScale:()=>oC,otlpresourcev1:()=>a,toAbsoluteTimeRange:()=>P,isAbsoluteTimeRange:()=>R,UNIT_GROUP_CONFIG:()=>e$,getUnitConfig:()=>eU,applyValueMapping:()=>o$,durationValidationSchema:()=>r9,useEvent:()=>nP,globalRoleSchema:()=>no,metadataSchema:()=>rW,getLegendSize:()=>M,globalVariableSchema:()=>nj,fetch:()=>nZ,querySpecSchema:()=>r3,isRelativeTimeRange:()=>F,getVariableProject:()=>e0,useMemoized:()=>nq,nameSchema:()=>rG,roleSchema:()=>ns,resolvePanelRef:()=>nW,createPanelRef:()=>nH,otlpcommonv1:()=>i,getPanelKeyFromRef:()=>nK,getMetadataProject:()=>T,roleBindingsEditorSchema:()=>nh,getUnitGroup:()=>eV,userSchema:()=>n_,GLOBAL_SCOPES:()=>I,DEFAULT_LEGEND:()=>_,datasourceSchema:()=>rQ,buildDatasourceDefinitionSchema:()=>r4,ACTIONS:()=>C,hasDecimalPlaces:()=>Y,displaySchema:()=>rJ,variableSpecSchema:()=>nA,intervalToPrometheusDuration:()=>B,PROJECT_SCOPES:()=>j,isEmptyObject:()=>nL,applyMergeColumnsTransform:()=>oI,transformData:()=>oR,CALCULATIONS_CONFIG:()=>f,buildVariableListSpecSchema:()=>nM,applyJoinTransform:()=>oj,isThroughputUnit:()=>eX,getLegendPosition:()=>x,DEFAULT_REFRESH_INTERVAL:()=>u,getCalculation:()=>h,panelEditorSchema:()=>nr,variableTextSpecSchema:()=>nk,DEFAULT_DASHBOARD_DURATION:()=>o,panelDisplaySpec:()=>r5,permissionSchema:()=>ni,DEFAULT_ALL_VALUE:()=>e1,variableTextSchema:()=>nO,TRANSFORM_TEXT:()=>H,getLegendMode:()=>N,isValidQueryPluginType:()=>O,datasourcesSchema:()=>r1,getResourceExtendedDisplayName:()=>nY,isTimeUnit:()=>eG,applyMergeIndexedColumnsTransform:()=>oD,globalDatasourceSchema:()=>r0,globalRoleBindingSchema:()=>nd,isValidLegendMode:()=>b,variableListSpecSchema:()=>nN});var i={};r.r(i);var a={};r.r(a);var s={};r.r(s),r.d(s,{StatusCodeError:()=>k,StatusCodeOk:()=>E,StatusCodeUnset:()=>S});let o="1h",u="0s",c="last",l={first:function(e){return h(e,"first")},last:function(e){return h(e,"last")},"first-number":function(e){return h(e,"first-number")},"last-number":function(e){return h(e,"last-number")},mean:function(e){return h(e,"mean")},sum:function(e){return h(e,"sum")},min:function(e){return h(e,"min")},max:function(e){return h(e,"max")}},f={first:{label:"First",description:"First value"},last:{label:"Last",description:"Last value"},"first-number":{label:"First *",description:"First numeric value"},"last-number":{label:"Last *",description:"Last numeric value"},mean:{label:"Avg",description:"Average value excluding nulls"},sum:{label:"Sum",description:"The sum of all values"},min:{label:"Min",description:"Minimum value"},max:{label:"Max",description:"Maximum value"}};function d(e,t){let r=t.reduce((e,t)=>(e[t]=void 0,e),{}),n=0,i=0;return e.forEach((t,a)=>{let s=t[1];0===a&&"first"in r&&(r.first=s),a===e.length-1&&"last"in r&&(r.last=s),"number"==typeof s&&(n+=1,i+=s,"first-number"in r&&void 0===r["first-number"]&&(r["first-number"]=s),"last-number"in r&&(r["last-number"]=s),"min"in r&&("number"!=typeof r.min?r.min=s:r.min=Math.min(r.min,s)),"max"in r&&("number"!=typeof r.max?r.max=s:r.max=Math.max(r.max,s)))}),n>0&&"sum"in r&&(r.sum=i),n>0&&"mean"in r&&(r.mean=i/n),r}function h(e,t){return d(e,[t])[t]}let p=["Dashboard","Datasource","EphemeralDashboard","Folder","GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","Project","Role","RoleBinding","Secret","User","Variable"],m=["bottom","right"],g=["list","table"],y=["small","medium"];function v(e){return m.includes(e)}function b(e){return g.includes(e)}function w(e){return y.includes(e)}let _={position:"bottom",mode:"list",size:"medium"};function x(e){return void 0===e?_.position:v(e)?e:_.position}function N(e){return e&&b(e)?e:_.mode}function M(e){return e&&w(e)?e:_.size}let S="STATUS_CODE_UNSET",E="STATUS_CODE_OK",k="STATUS_CODE_ERROR";function O(e){return["TimeSeriesQuery","TraceQuery","ProfileQuery"].includes(e)}function A(e){return"project"in e}function T(e){return"project"in e?e.project:void 0}let C=["*","create","read","update","delete"],j=["*","Dashboard","Datasource","EphemeralDashboard","Folder","Project","Role","RoleBinding","Secret","Variable"],I=["GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","User"];var D=r(20461);function F(e){return void 0!==e.pastDuration}function R(e){return void 0!==e.start&&void 0!==e.end}function P(e){let t=e.end??new Date;return{start:(0,D.sub)(t,z(e.pastDuration)),end:t}}let Z=/^(?:(\d+)y)?(?:(\d+)w)?(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;function z(e){let t=Z.exec(e);if(null===t)throw Error(`Invalid duration string '${e}'`);return{years:parseInt(t[1]??"0"),months:0,weeks:parseInt(t[2]??"0"),days:parseInt(t[3]??"0"),hours:parseInt(t[4]??"0"),minutes:parseInt(t[5]??"0"),seconds:parseInt(t[6]??"0")+parseInt(t[7]??"0")/1e3}}function $(e){return""!==e&&Z.test(e)}function B(e){return L(e.end.valueOf()-e.start.valueOf())}function L(e){let t=Math.trunc(e/31536e6);t>0&&(e-=31536e6*t);let r=Math.trunc(e/6048e5);r>0&&(e-=6048e5*r);let n=Math.trunc(e/864e5);n>0&&(e-=864e5*n);let i=Math.trunc(e/36e5);i>0&&(e-=36e5*i);let a=Math.trunc(e/6e4);return a>0&&(e-=6e4*a),{years:t,months:0,weeks:r,days:n,hours:i,minutes:a,seconds:e/1e3}}function U(e){let t=[];if(e.years&&t.push(`${e.years}y`),e.weeks&&t.push(`${e.weeks}w`),e.days&&t.push(`${e.days}d`),e.hours&&t.push(`${e.hours}h`),e.minutes&&t.push(`${e.minutes}m`),e.seconds){let r=Math.trunc(e.seconds);r&&t.push(`${r}s`);let n=Math.round((e.seconds-r)*1e3);n&&t.push(`${n}ms`)}return t.join("")}let V=[{maxMs:15,roundedStepMs:10,display:"0.01s"},{maxMs:35,roundedStepMs:20,display:"0.02s"},{maxMs:75,roundedStepMs:50,display:"0.05s"},{maxMs:150,roundedStepMs:100,display:"0.1s"},{maxMs:350,roundedStepMs:200,display:"0.2s"},{maxMs:750,roundedStepMs:500,display:"0.5s"},{maxMs:1500,roundedStepMs:1e3,display:"1s"},{maxMs:3500,roundedStepMs:2e3,display:"2s"},{maxMs:7500,roundedStepMs:5e3,display:"5s"},{maxMs:12500,roundedStepMs:1e4,display:"10s"},{maxMs:17500,roundedStepMs:15e3,display:"15s"},{maxMs:25e3,roundedStepMs:2e4,display:"20s"},{maxMs:45e3,roundedStepMs:3e4,display:"30s"},{maxMs:9e4,roundedStepMs:6e4,display:"1m"},{maxMs:21e4,roundedStepMs:12e4,display:"2m"},{maxMs:45e4,roundedStepMs:3e5,display:"5m"},{maxMs:75e4,roundedStepMs:6e5,display:"10m"},{maxMs:75e4,roundedStepMs:9e5,display:"15m"},{maxMs:15e5,roundedStepMs:12e5,display:"20m"},{maxMs:27e5,roundedStepMs:18e5,display:"30m"},{maxMs:54e5,roundedStepMs:36e5,display:"1h"},{maxMs:9e6,roundedStepMs:72e5,display:"2h"},{maxMs:162e5,roundedStepMs:108e5,display:"3h"},{maxMs:324e5,roundedStepMs:216e5,display:"6h"},{maxMs:864e5,roundedStepMs:432e5,display:"12h"},{maxMs:6048e5,roundedStepMs:864e5,display:"1d"},{maxMs:18144e5,roundedStepMs:6048e5,display:"1w"},{maxMs:36288e5,roundedStepMs:2592e6,display:"30d"},{maxMs:63072e6,roundedStepMs:31536e6,display:"1y"}];function q(e){for(let{maxMs:t,roundedStepMs:r}of V)if(e<t)return r;return 15e3}function G(e,t){return q(Math.floor((e.end.valueOf()-e.start.valueOf())/t))}function W(e){return 2===e.length}function K(e){return/^[0-9a-fA-F]+$/.test(e)}let H={JoinByColumnValue:"Join by column value",MergeColumns:"Merge columns",MergeIndexedColumns:"Merge indexed columns",MergeSeries:"Merge series"};function J(e){return!1!==e}function Y(e){return"number"==typeof e}function X(e){return e&&(e<0?e=0:e>20&&(e=20)),e}var Q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{};function ee(){if(af)return al;af=1;let e=[{key:"ZiB",factor:11805916207174113e5},{key:"ZB",factor:1e21},{key:"YiB",factor:12089258196146292e8},{key:"YB",factor:1e24},{key:"TiB",factor:0x10000000000},{key:"TB",factor:1e12},{key:"PiB",factor:0x4000000000000},{key:"PB",factor:1e15},{key:"MiB",factor:1048576},{key:"MB",factor:1e6},{key:"KiB",factor:1024},{key:"KB",factor:1e3},{key:"GiB",factor:0x40000000},{key:"GB",factor:1e9},{key:"EiB",factor:0x1000000000000000},{key:"EB",factor:1e18},{key:"B",factor:1}];function t(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}return al={unformat:function(r,n){let i,a=en(),s=a.currentDelimiters(),o=a.currentCurrency().symbol,u=a.currentOrdinal(),c=a.getZeroFormat(),l=a.currentAbbreviations();if("string"==typeof r)if(function(e,t){if(!(e.indexOf(":")&&":"!==t.thousands))return!1;let r=e.split(":");if(3!==r.length)return!1;let n=+r[0],i=+r[1],a=+r[2];return!isNaN(n)&&!isNaN(i)&&!isNaN(a)}(r,s)){let e,t,n;t=+(e=r.split(":"))[0],n=+e[1],i=+e[2]+60*n+3600*t}else i=function(r,n,i="",a,s,o,u){if(""!==r)return r===s?0:function r(n,i,a,s,o,u,c){if(!isNaN(+n))return+n;let l="",f=n.replace(/(^[^(]*)\((.*)\)([^)]*$)/,"$1$2$3");if(f!==n)return -1*r(f,i,a,s,o,u);for(let t=0;t<e.length;t++){let c=e[t];if((l=n.replace(RegExp(`([0-9 ])(${c.key})$`),"$1"))!==n)return r(l,i,a,s,o,u)*c.factor}if((l=n.replace("%",""))!==n)return r(l,i,a,s,o,u)/100;let d=parseFloat(n);if(isNaN(d))return;let h=s(d);if(h&&"."!==h&&(l=n.replace(RegExp(`${t(h)}$`),""))!==n)return r(l,i,a,s,o,u);let p={};Object.keys(u).forEach(e=>{p[u[e]]=e});let m=Object.keys(p).sort().reverse(),g=m.length;for(let e=0;e<g;e++){let t=m[e],c=p[t];if((l=n.replace(t,""))!==n){let e;switch(c){case"thousand":e=1e3;break;case"million":e=1e6;break;case"billion":e=1e9;break;case"trillion":e=1e12}return r(l,i,a,s,o,u)*e}}}(r.replace(i,"").replace(RegExp(`([0-9])${t(n.thousands)}([0-9])`,"g"),"$1$2").replace(n.decimal,"."),n,i,a,s,o)}(r,s,o,u,c,l);else{if("number"!=typeof r)return;i=r}if(void 0!==i)return i}}}function et(){if(ah)return ad;ah=1;let e=ee(),t=/^[a-z]{2,3}(-[a-zA-Z]{4})?(-([A-Z]{2}|[0-9]{3}))?$/,r={output:{type:"string",validValues:["currency","percent","byte","time","ordinal","number"]},base:{type:"string",validValues:["decimal","binary","general"],restriction:(e,t)=>"byte"===t.output,message:"`base` must be provided only when the output is `byte`",mandatory:e=>"byte"===e.output},characteristic:{type:"number",restriction:e=>e>=0,message:"value must be positive"},prefix:"string",postfix:"string",forceAverage:{type:"string",validValues:["trillion","billion","million","thousand"]},average:"boolean",lowPrecision:{type:"boolean",restriction:(e,t)=>!0===t.average,message:"`lowPrecision` must be provided only when the option `average` is set"},currencyPosition:{type:"string",validValues:["prefix","infix","postfix"]},currencySymbol:"string",totalLength:{type:"number",restrictions:[{restriction:e=>e>=0,message:"value must be positive"},{restriction:(e,t)=>!t.exponential,message:"`totalLength` is incompatible with `exponential`"}]},mantissa:{type:"number",restriction:e=>e>=0,message:"value must be positive"},optionalMantissa:"boolean",trimMantissa:"boolean",roundingFunction:"function",optionalCharacteristic:"boolean",thousandSeparated:"boolean",spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",spaceSeparatedAbbreviation:"boolean",abbreviations:{type:"object",children:{thousand:"string",million:"string",billion:"string",trillion:"string"}},negative:{type:"string",validValues:["sign","parenthesis"]},forceSign:"boolean",exponential:{type:"boolean"},prefixSymbol:{type:"boolean",restriction:(e,t)=>"percent"===t.output,message:"`prefixSymbol` can be provided only when the output is `percent`"}},n={languageTag:{type:"string",mandatory:!0,restriction:e=>e.match(t),message:"the language tag must follow the BCP 47 specification (see https://tools.ieft.org/html/bcp47)"},delimiters:{type:"object",children:{thousands:"string",decimal:"string",thousandsSize:"number"},mandatory:!0},abbreviations:{type:"object",children:{thousand:{type:"string",mandatory:!0},million:{type:"string",mandatory:!0},billion:{type:"string",mandatory:!0},trillion:{type:"string",mandatory:!0}},mandatory:!0},spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",ordinal:{type:"function",mandatory:!0},bytes:{type:"object",children:{binarySuffixes:"object",decimalSuffixes:"object"}},currency:{type:"object",children:{symbol:"string",position:"string",code:"string"},mandatory:!0},defaults:"format",ordinalFormat:"format",byteFormat:"format",percentageFormat:"format",currencyFormat:"format",timeDefaults:"format",formats:{type:"object",children:{fourDigits:{type:"format",mandatory:!0},fullWithTwoDecimals:{type:"format",mandatory:!0},fullWithTwoDecimalsNoCurrency:{type:"format",mandatory:!0},fullWithNoDecimals:{type:"format",mandatory:!0}}}};function i(t){return void 0!==e.unformat(t)}function a(e,t,n,i=!1){let s=Object.keys(e).map(i=>{if(!t[i])return console.error(`${n} Invalid key: ${i}`),!1;let s=e[i],o=t[i];if("string"==typeof o&&(o={type:o}),"format"===o.type){if(!a(s,r,`[Validate ${i}]`,!0))return!1}else if(typeof s!==o.type)return console.error(`${n} ${i} type mismatched: "${o.type}" expected, "${typeof s}" provided`),!1;if(o.restrictions&&o.restrictions.length){let t=o.restrictions.length;for(let r=0;r<t;r++){let{restriction:t,message:a}=o.restrictions[r];if(!t(s,e))return console.error(`${n} ${i} invalid value: ${a}`),!1}}return o.restriction&&!o.restriction(s,e)?(console.error(`${n} ${i} invalid value: ${o.message}`),!1):o.validValues&&-1===o.validValues.indexOf(s)?(console.error(`${n} ${i} invalid value: must be among ${JSON.stringify(o.validValues)}, "${s}" provided`),!1):(!o.children||!!a(s,o.children,`[Validate ${i}]`))&&!0});return i||s.push(...Object.keys(t).map(r=>{let i=t[r];if("string"==typeof i&&(i={type:i}),i.mandatory){let t=i.mandatory;if("function"==typeof t&&(t=t(e)),t&&void 0===e[r])return console.error(`${n} Missing mandatory key "${r}"`),!1}return!0})),s.reduce((e,t)=>e&&t,!0)}function s(e){return a(e,r,"[Validate format]")}return ad={validate:function(e,t){let r=i(e),n=s(t);return r&&n},validateFormat:s,validateInput:i,validateLanguage:function(e){return a(e,n,"[Validate language]")}}}var er=function(e,t={}){var r,n,i,a,s,o;let u,c,l,f;if("string"!=typeof e)return e;n=e=(u=(r=e).match(/^{([^}]*)}/))?(t.prefix=u[1],r.slice(u[0].length)):r,function(e,t){if(-1!==e.indexOf("$")){t.output="currency";return}if(-1!==e.indexOf("%")){t.output="percent";return}if(-1!==e.indexOf("bd")){t.output="byte",t.base="general";return}if(-1!==e.indexOf("b")){t.output="byte",t.base="binary";return}if(-1!==e.indexOf("d")){t.output="byte",t.base="decimal";return}if(-1!==e.indexOf(":")){t.output="time";return}-1!==e.indexOf("o")&&(t.output="ordinal")}(e=(c=n.match(/{([^}]*)}$/))?(t.postfix=c[1],n.slice(0,-c[0].length)):n,t),(l=e.match(/[1-9]+[0-9]*/))&&(t.totalLength=+l[0]),(f=e.split(".")[0].match(/0+/))&&(t.characteristic=f[0].length),-1!==(i=e).indexOf(".")&&(t.optionalCharacteristic=-1===i.split(".")[0].indexOf("0")),-1!==e.indexOf("a")&&(t.average=!0),-1!==(a=e).indexOf("K")?t.forceAverage="thousand":-1!==a.indexOf("M")?t.forceAverage="million":-1!==a.indexOf("B")?t.forceAverage="billion":-1!==a.indexOf("T")&&(t.forceAverage="trillion");let d=e.split(".")[1];if(d){let e=d.match(/0+/);e&&(t.mantissa=e[0].length)}(s=e).match(/\[\.]/)?t.optionalMantissa=!0:s.match(/\./)&&(t.optionalMantissa=!1);let h=e.split(".")[1];return h&&(t.trimMantissa=-1!==h.indexOf("[")),-1!==e.indexOf(",")&&(t.thousandSeparated=!0),-1!==e.indexOf(" ")&&(t.spaceSeparated=!0,t.spaceSeparatedCurrency=!0,(t.average||t.forceAverage)&&(t.spaceSeparatedAbbreviation=!0)),(o=e).match(/^\+?\([^)]*\)$/)&&(t.negative="parenthesis"),o.match(/^\+?-/)&&(t.negative="sign"),e.match(/^\+/)&&(t.forceSign=!0),t};function en(){let e;if(am)return ap;am=1;let t=ac?au:(ac=1,au={languageTag:"en-US",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},spaceSeparated:!1,ordinal:function(e){let t=e%10;return 1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},bytes:{binarySuffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],decimalSuffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},currency:{symbol:"$",position:"prefix",code:"USD"},currencyFormat:{thousandSeparated:!0,totalLength:4,spaceSeparated:!0,spaceSeparatedCurrency:!0},formats:{fourDigits:{totalLength:4,spaceSeparated:!0},fullWithTwoDecimals:{output:"currency",thousandSeparated:!0,mantissa:2},fullWithTwoDecimalsNoCurrency:{thousandSeparated:!0,mantissa:2},fullWithNoDecimals:{output:"currency",thousandSeparated:!0,mantissa:0}}}),r=et(),n={},i={},a=null,s={};function o(){return i[e]}return n.languages=()=>Object.assign({},i),n.currentLanguage=()=>e,n.currentBytes=()=>o().bytes||{},n.currentCurrency=()=>o().currency,n.currentAbbreviations=()=>o().abbreviations,n.currentDelimiters=()=>o().delimiters,n.currentOrdinal=()=>o().ordinal,n.currentDefaults=()=>Object.assign({},o().defaults,s),n.currentOrdinalDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().ordinalFormat),n.currentByteDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().byteFormat),n.currentPercentageDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().percentageFormat),n.currentCurrencyDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().currencyFormat),n.currentTimeDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().timeFormat),n.setDefaults=e=>{e=er(e),r.validateFormat(e)&&(s=e)},n.getZeroFormat=()=>a,n.setZeroFormat=e=>a="string"==typeof e?e:null,n.hasZeroFormat=()=>null!==a,n.languageData=e=>{if(e){if(i[e])return i[e];throw Error(`Unknown tag "${e}"`)}return o()},n.registerLanguage=(t,n=!1)=>{if(!r.validateLanguage(t))throw Error("Invalid language data");i[t.languageTag]=t,n&&(e=t.languageTag)},n.setLanguage=(r,n=t.languageTag)=>{if(!i[r]){let t=r.split("-")[0],a=Object.keys(i).find(e=>e.split("-")[0]===t);return i[a]?void(e=a):void(e=n)}e=r},n.registerLanguage(t),e=t.languageTag,ap=n}var ei={exports:{}};(function(e){var t,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,a="[BigNumber Error] ",s=a+"Number primitive has more than 15 significant digits: ",o=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13];function u(e){var t=0|e;return e>0||e===t?t:t-1}function c(e){for(var t,r,n=1,i=e.length,a=e[0]+"";n<i;){for(r=14-(t=e[n++]+"").length;r--;t="0"+t);a+=t}for(i=a.length;48===a.charCodeAt(--i););return a.slice(0,i+1||1)}function l(e,t){var r,n,i=e.c,a=t.c,s=e.s,o=t.s,u=e.e,c=t.e;if(!s||!o)return null;if(r=i&&!i[0],n=a&&!a[0],r||n)return r?n?0:-o:s;if(s!=o)return s;if(r=s<0,n=u==c,!i||!a)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(s=0,o=(u=i.length)<(c=a.length)?u:c;s<o;s++)if(i[s]!=a[s])return i[s]>a[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function f(e,t,r,n){if(e<t||e>r||e!==i(e))throw Error(a+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function d(e){var t=e.c.length-1;return u(e.e/14)==t&&e.c[t]%2!=0}function h(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function p(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(n=e.length,++t>n){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(t=function e(t){var m,g,y,v,b,w,_,x,N,M=Z.prototype={constructor:Z,toString:null,valueOf:null},S=new Z(1),E=20,k=4,O=-7,A=21,T=-1e7,C=1e7,j=!1,I=1,D=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xa0",suffix:""},R="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function Z(e,t){var n,a,o,u,c,l,d,h,p=this;if(!(p instanceof Z))return new Z(e,t);if(null==t){if(e&&!0===e._isBigNumber){p.s=e.s,!e.c||e.e>C?p.c=p.e=null:e.e<T?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice());return}if((l="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,c=e;c>=10;c/=10,u++);u>C?p.c=p.e=null:(p.e=u,p.c=[e]);return}h=String(e)}else{if(!r.test(h=String(e)))return N(p,h,l);p.s=45==h.charCodeAt(0)?(h=h.slice(1),-1):1}(u=h.indexOf("."))>-1&&(h=h.replace(".","")),(c=h.search(/e/i))>0?(u<0&&(u=c),u+=+h.slice(c+1),h=h.substring(0,c)):u<0&&(u=h.length)}else{if(f(t,2,R.length,"Base"),10==t&&P)return L(p=new Z(e),E+p.e+1,k);if(h=String(e),l="number"==typeof e){if(0*e!=0)return N(p,h,l,t);if(p.s=1/e<0?(h=h.slice(1),-1):1,Z.DEBUG&&h.replace(/^0\.0*|\./,"").length>15)throw Error(s+e)}else p.s=45===h.charCodeAt(0)?(h=h.slice(1),-1):1;for(n=R.slice(0,t),u=c=0,d=h.length;c<d;c++)if(0>n.indexOf(a=h.charAt(c))){if("."==a){if(c>u){u=d;continue}}else if(!o&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){o=!0,c=-1,u=0;continue}return N(p,String(e),l,t)}l=!1,(u=(h=x(h,t,10,p.s)).indexOf("."))>-1?h=h.replace(".",""):u=h.length}for(c=0;48===h.charCodeAt(c);c++);for(d=h.length;48===h.charCodeAt(--d););if(h=h.slice(c,++d)){if(d-=c,l&&Z.DEBUG&&d>15&&(e>0x1fffffffffffff||e!==i(e)))throw Error(s+p.s*e);if((u=u-c-1)>C)p.c=p.e=null;else if(u<T)p.c=[p.e=0];else{if(p.e=u,p.c=[],c=(u+1)%14,u<0&&(c+=14),c<d){for(c&&p.c.push(+h.slice(0,c)),d-=14;c<d;)p.c.push(+h.slice(c,c+=14));c=14-(h=h.slice(c)).length}else c-=d;for(;c--;h+="0");p.c.push(+h)}}else p.c=[p.e=0]}function z(e,t,r,n){var i,a,s,o,u;if(null==r?r=k:f(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=c(e.c),u=1==n||2==n&&(s<=O||s>=A)?h(u,s):p(u,s,"0");else if(a=(e=L(new Z(e),t,r)).e,o=(u=c(e.c)).length,1==n||2==n&&(t<=a||a<=O)){for(;o<t;u+="0",o++);u=h(u,a)}else if(t-=s,u=p(u,a,"0"),a+1>o){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=a-o)>0)for(a+1==o&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function $(e,t){for(var r,n,i=1,a=new Z(e[0]);i<e.length;i++)(n=new Z(e[i])).s&&(r=l(a,n))!==t&&(0!==r||a.s!==t)||(a=n);return a}function B(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+14*r-1)>C?e.c=e.e=null:r<T?e.c=[e.e=0]:(e.e=r,e.c=t),e}function L(e,t,r,a){var s,u,c,l,f,d,h,p=e.c;if(p){e:{for(s=1,l=p[0];l>=10;l/=10,s++);if((u=t-s)<0)u+=14,c=t,h=i((f=p[d=0])/o[s-c-1]%10);else if((d=n((u+1)/14))>=p.length)if(a){for(;p.length<=d;p.push(0));f=h=0,s=1,u%=14,c=u-14+1}else break e;else{for(s=1,f=l=p[d];l>=10;l/=10,s++);u%=14,h=(c=u-14+s)<0?0:i(f/o[s-c-1]%10)}if(a=a||t<0||null!=p[d+1]||(c<0?f:f%o[s-c-1]),a=r<4?(h||a)&&(0==r||r==(e.s<0?3:2)):h>5||5==h&&(4==r||a||6==r&&(u>0?c>0?f/o[s-c]:0:p[d-1])%10&1||r==(e.s<0?8:7)),t<1||!p[0])return p.length=0,a?(t-=e.e+1,p[0]=o[(14-t%14)%14],e.e=-t||0):p[0]=e.e=0,e;if(0==u?(p.length=d,l=1,d--):(p.length=d+1,l=o[14-u],p[d]=c>0?i(f/o[s-c]%o[c])*l:0),a)for(;;)if(0==d){for(u=1,c=p[0];c>=10;c/=10,u++);for(c=p[0]+=l,l=1;c>=10;c/=10,l++);u!=l&&(e.e++,1e14==p[0]&&(p[0]=1));break}else{if(p[d]+=l,1e14!=p[d])break;p[d--]=0,l=1}for(u=p.length;0===p[--u];p.pop());}e.e>C?e.c=e.e=null:e.e<T&&(e.c=[e.e=0])}return e}function U(e){var t,r=e.e;return null===r?e.toString():(t=c(e.c),t=r<=O||r>=A?h(t,r):p(t,r,"0"),e.s<0?"-"+t:t)}return Z.clone=e,Z.ROUND_UP=0,Z.ROUND_DOWN=1,Z.ROUND_CEIL=2,Z.ROUND_FLOOR=3,Z.ROUND_HALF_UP=4,Z.ROUND_HALF_DOWN=5,Z.ROUND_HALF_EVEN=6,Z.ROUND_HALF_CEIL=7,Z.ROUND_HALF_FLOOR=8,Z.EUCLID=9,Z.config=Z.set=function(e){var t,r;if(null!=e)if("object"==typeof e){if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(f(r=e[t],0,1e9,t),E=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(f(r=e[t],0,8,t),k=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(f(r[0],-1e9,0,t),f(r[1],0,1e9,t),O=r[0],A=r[1]):(f(r,-1e9,1e9,t),O=-(A=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)f(r[0],-1e9,-1,t),f(r[1],1,1e9,t),T=r[0],C=r[1];else if(f(r,-1e9,1e9,t),r)T=-(C=r<0?-r:r);else throw Error(a+t+" cannot be zero: "+r);if(e.hasOwnProperty(t="CRYPTO"))if(!!(r=e[t])===r)if(r)if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))j=r;else throw j=!r,Error(a+"crypto unavailable");else j=r;else throw Error(a+t+" not true or false: "+r);if(e.hasOwnProperty(t="MODULO_MODE")&&(f(r=e[t],0,9,t),I=r),e.hasOwnProperty(t="POW_PRECISION")&&(f(r=e[t],0,1e9,t),D=r),e.hasOwnProperty(t="FORMAT"))if("object"==typeof(r=e[t]))F=r;else throw Error(a+t+" not an object: "+r);if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(a+t+" invalid: "+r);P="0123456789"==r.slice(0,10),R=r}}else throw Error(a+"Object expected: "+e);return{DECIMAL_PLACES:E,ROUNDING_MODE:k,EXPONENTIAL_AT:[O,A],RANGE:[T,C],CRYPTO:j,MODULO_MODE:I,POW_PRECISION:D,FORMAT:F,ALPHABET:R}},Z.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!Z.DEBUG)return!0;var t,r,n=e.c,s=e.e,o=e.s;e:if("[object Array]"==({}).toString.call(n)){if((1===o||-1===o)&&s>=-1e9&&s<=1e9&&s===i(s)){if(0===n[0]){if(0===s&&1===n.length)return!0;break e}if((t=(s+1)%14)<1&&(t+=14),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=1e14||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===s&&(null===o||1===o||-1===o))return!0;throw Error(a+"Invalid BigNumber: "+e)},Z.maximum=Z.max=function(){return $(arguments,-1)},Z.minimum=Z.min=function(){return $(arguments,1)},m=0x20000000000000*Math.random()&2097151?function(){return i(0x20000000000000*Math.random())}:function(){return(0x40000000*Math.random()|0)*8388608+(8388608*Math.random()|0)},Z.random=function(e){var t,r,s,u,c,l=0,d=[],h=new Z(S);if(null==e?e=E:f(e,0,1e9),u=n(e/14),j)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));l<u;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(d.push(c%1e14),l+=2);l=u/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(u*=7);l<u;)(c=(31&t[l])*0x1000000000000+0x10000000000*t[l+1]+0x100000000*t[l+2]+0x1000000*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(d.push(c%1e14),l+=7);l=u/7}else throw j=!1,Error(a+"crypto unavailable");if(!j)for(;l<u;)(c=m())<9e15&&(d[l++]=c%1e14);for(u=d[--l],e%=14,u&&e&&(c=o[14-e],d[l]=i(u/c)*c);0===d[l];d.pop(),l--);if(l<0)d=[s=0];else{for(s=-1;0===d[0];d.splice(0,1),s-=14);for(l=1,c=d[0];c>=10;c/=10,l++);l<14&&(s-=14-l)}return h.e=s,h.c=d,h},Z.sum=function(){for(var e=1,t=arguments,r=new Z(t[0]);e<t.length;)r=r.plus(t[e++]);return r},x=function(){var e="0123456789";function t(e,t,r,n){for(var i,a,s=[0],o=0,u=e.length;o<u;){for(a=s.length;a--;s[a]*=t);for(s[0]+=n.indexOf(e.charAt(o++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(r,n,i,a,s){var o,u,l,f,d,h,m,g,y=r.indexOf("."),v=E,b=k;for(y>=0&&(f=D,D=0,r=r.replace(".",""),h=(g=new Z(n)).pow(r.length-y),D=f,g.c=t(p(c(h.c),h.e,"0"),10,i,e),g.e=g.c.length),l=f=(m=t(r,n,i,s?(o=R,e):(o=e,R))).length;0==m[--f];m.pop());if(!m[0])return o.charAt(0);if(y<0?--l:(h.c=m,h.e=l,h.s=a,m=(h=_(h,g,v,b,i)).c,d=h.r,l=h.e),y=m[u=l+v+1],f=i/2,d=d||u<0||null!=m[u+1],d=b<4?(null!=y||d)&&(0==b||b==(h.s<0?3:2)):y>f||y==f&&(4==b||d||6==b&&1&m[u-1]||b==(h.s<0?8:7)),u<1||!m[0])r=d?p(o.charAt(1),-v,o.charAt(0)):o.charAt(0);else{if(m.length=u,d)for(--i;++m[--u]>i;)m[u]=0,u||(++l,m=[1].concat(m));for(f=m.length;!m[--f];);for(y=0,r="";y<=f;r+=o.charAt(m[y++]));r=p(r,l,o.charAt(0))}return r}}(),_=function(){function e(e,t,r){var n,i,a,s,o=0,u=e.length,c=t%1e7,l=t/1e7|0;for(e=e.slice();u--;)n=l*(a=e[u]%1e7)+(s=e[u]/1e7|0)*c,o=((i=c*a+n%1e7*1e7+o)/r|0)+(n/1e7|0)+l*s,e[u]=i%r;return o&&(e=[o].concat(e)),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=+(e[r]<t[r]),e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,a,s,o,c){var l,f,d,h,p,m,g,y,v,b,w,_,x,N,M,S,E,k=n.s==a.s?1:-1,O=n.c,A=a.c;if(!O||!O[0]||!A||!A[0])return new Z(!n.s||!a.s||(O?A&&O[0]==A[0]:!A)?NaN:O&&0==O[0]||!A?0*k:k/0);for(v=(y=new Z(k)).c=[],k=s+(f=n.e-a.e)+1,c||(c=1e14,f=u(n.e/14)-u(a.e/14),k=k/14|0),d=0;A[d]==(O[d]||0);d++);if(A[d]>(O[d]||0)&&f--,k<0)v.push(1),h=!0;else{for(N=O.length,S=A.length,d=0,k+=2,(p=i(c/(A[0]+1)))>1&&(A=e(A,p,c),O=e(O,p,c),S=A.length,N=O.length),x=S,w=(b=O.slice(0,S)).length;w<S;b[w++]=0);E=[0].concat(E=A.slice()),M=A[0],A[1]>=c/2&&M++;do{if(p=0,(l=t(A,b,S,w))<0){if(_=b[0],S!=w&&(_=_*c+(b[1]||0)),(p=i(_/M))>1)for(p>=c&&(p=c-1),g=(m=e(A,p,c)).length,w=b.length;1==t(m,b,g,w);)p--,r(m,S<g?E:A,g,c),g=m.length,l=1;else 0==p&&(l=p=1),g=(m=A.slice()).length;if(g<w&&(m=[0].concat(m)),r(b,m,w,c),w=b.length,-1==l)for(;1>t(A,b,S,w);)p++,r(b,S<w?E:A,w,c),w=b.length}else 0===l&&(p++,b=[0]);v[d++]=p,b[0]?b[w++]=O[x]||0:(b=[O[x]],w=1)}while((x++<N||null!=b[0])&&k--);h=null!=b[0],v[0]||v.splice(0,1)}if(1e14==c){for(d=1,k=v[0];k>=10;k/=10,d++);L(y,s+(y.e=d+14*f-1)+1,o,h)}else y.e=f,y.r=+h;return y}}(),g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,v=/^\.([^.]+)$/,b=/^-?(Infinity|NaN)$/,w=/^\s*\+(?=[\w.])|^\s+|\s+$/g,N=function(e,t,r,n){var i,s=r?t:t.replace(w,"");if(b.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(g,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,s=s.replace(y,"$1").replace(v,"0.$1")),t!=s))return new Z(s,i);if(Z.DEBUG)throw Error(a+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},M.absoluteValue=M.abs=function(){var e=new Z(this);return e.s<0&&(e.s=1),e},M.comparedTo=function(e,t){return l(this,new Z(e,t))},M.decimalPlaces=M.dp=function(e,t){var r,n,i;if(null!=e)return f(e,0,1e9),null==t?t=k:f(t,0,8),L(new Z(this),e+this.e+1,t);if(!(r=this.c))return null;if(n=((i=r.length-1)-u(this.e/14))*14,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},M.dividedBy=M.div=function(e,t){return _(this,new Z(e,t),E,k)},M.dividedToIntegerBy=M.idiv=function(e,t){return _(this,new Z(e,t),0,1)},M.exponentiatedBy=M.pow=function(e,t){var r,s,o,u,c,l,f,h,p,m=this;if((e=new Z(e)).c&&!e.isInteger())throw Error(a+"Exponent not an integer: "+U(e));if(null!=t&&(t=new Z(t)),l=e.e>14,!m.c||!m.c[0]||1==m.c[0]&&!m.e&&1==m.c.length||!e.c||!e.c[0])return p=new Z(Math.pow(+U(m),l?e.s*(2-d(e)):+U(e))),t?p.mod(t):p;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new Z(NaN);(s=!f&&m.isInteger()&&t.isInteger())&&(m=m.mod(t))}else{if(e.e>9&&(m.e>0||m.e<-1||(0==m.e?m.c[0]>1||l&&m.c[1]>=24e7:m.c[0]<8e13||l&&m.c[0]<=9999975e7)))return u=m.s<0&&d(e)?-0:0,m.e>-1&&(u=1/u),new Z(f?1/u:u);D&&(u=n(D/14+2))}for(l?(r=new Z(.5),f&&(e.s=1),h=d(e)):h=(o=Math.abs(+U(e)))%2,p=new Z(S);;){if(h){if(!(p=p.times(m)).c)break;u?p.c.length>u&&(p.c.length=u):s&&(p=p.mod(t))}if(o){if(0===(o=i(o/2)))break;h=o%2}else if(L(e=e.times(r),e.e+1,1),e.e>14)h=d(e);else{if(0==(o=+U(e)))break;h=o%2}m=m.times(m),u?m.c&&m.c.length>u&&(m.c.length=u):s&&(m=m.mod(t))}return s?p:(f&&(p=S.div(p)),t?p.mod(t):u?L(p,D,k,c):p)},M.integerValue=function(e){var t=new Z(this);return null==e?e=k:f(e,0,8),L(t,t.e+1,e)},M.isEqualTo=M.eq=function(e,t){return 0===l(this,new Z(e,t))},M.isFinite=function(){return!!this.c},M.isGreaterThan=M.gt=function(e,t){return l(this,new Z(e,t))>0},M.isGreaterThanOrEqualTo=M.gte=function(e,t){return 1===(t=l(this,new Z(e,t)))||0===t},M.isInteger=function(){return!!this.c&&u(this.e/14)>this.c.length-2},M.isLessThan=M.lt=function(e,t){return 0>l(this,new Z(e,t))},M.isLessThanOrEqualTo=M.lte=function(e,t){return -1===(t=l(this,new Z(e,t)))||0===t},M.isNaN=function(){return!this.s},M.isNegative=function(){return this.s<0},M.isPositive=function(){return this.s>0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.minus=function(e,t){var r,n,i,a,s=this.s;if(t=(e=new Z(e,t)).s,!s||!t)return new Z(NaN);if(s!=t)return e.s=-t,this.plus(e);var o=this.e/14,c=e.e/14,l=this.c,f=e.c;if(!o||!c){if(!l||!f)return l?(e.s=-t,e):new Z(f?this:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new Z(l[0]?this:3==k?-0:0)}if(o=u(o),c=u(c),l=l.slice(),s=o-c){for((a=s<0)?(s=-s,i=l):(c=o,i=f),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(a=(s=l.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(l[t]!=f[t]){a=l[t]<f[t];break}if(a&&(i=l,l=f,f=i,e.s=-e.s),(t=(n=f.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=1e14-1;n>s;){if(l[--n]<f[n]){for(r=n;r&&!l[--r];l[r]=t);--l[r],l[n]+=1e14}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?B(e,l,c):(e.s=3==k?-1:1,e.c=[e.e=0],e)},M.modulo=M.mod=function(e,t){var r,n;return(e=new Z(e,t),this.c&&e.s&&(!e.c||e.c[0]))?e.c&&(!this.c||this.c[0])?(9==I?(n=e.s,e.s=1,r=_(this,e,0,3),e.s=n,r.s*=n):r=_(this,e,0,I),(e=this.minus(r.times(e))).c[0]||1!=I||(e.s=this.s),e):new Z(this):new Z(NaN)},M.multipliedBy=M.times=function(e,t){var r,n,i,a,s,o,c,l,f,d,h,p,m,g=this.c,y=(e=new Z(e,t)).c;if(!g||!y||!g[0]||!y[0])return this.s&&e.s&&(!g||g[0]||y)&&(!y||y[0]||g)?(e.s*=this.s,g&&y?(e.c=[0],e.e=0):e.c=e.e=null):e.c=e.e=e.s=null,e;for(n=u(this.e/14)+u(e.e/14),e.s*=this.s,(c=g.length)<(d=y.length)&&(m=g,g=y,y=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(i=d;--i>=0;){for(r=0,h=y[i]%1e7,p=y[i]/1e7|0,a=i+(s=c);a>i;)o=p*(l=g[--s]%1e7)+(f=g[s]/1e7|0)*h,r=((l=h*l+o%1e7*1e7+m[a]+r)/1e14|0)+(o/1e7|0)+p*f,m[a--]=l%1e14;m[a]=r}return r?++n:m.splice(0,1),B(e,m,n)},M.negated=function(){var e=new Z(this);return e.s=-e.s||null,e},M.plus=function(e,t){var r,n=this.s;if(t=(e=new Z(e,t)).s,!n||!t)return new Z(NaN);if(n!=t)return e.s=-t,this.minus(e);var i=this.e/14,a=e.e/14,s=this.c,o=e.c;if(!i||!a){if(!s||!o)return new Z(n/0);if(!s[0]||!o[0])return o[0]?e:new Z(s[0]?this:0*n)}if(i=u(i),a=u(a),s=s.slice(),n=i-a){for(n>0?(a=i,r=o):(n=-n,r=s),r.reverse();n--;r.push(0));r.reverse()}for((n=s.length)-(t=o.length)<0&&(r=o,o=s,s=r,t=n),n=0;t;)n=(s[--t]=s[t]+o[t]+n)/1e14|0,s[t]=1e14===s[t]?0:s[t]%1e14;return n&&(s=[n].concat(s),++a),B(e,s,a)},M.precision=M.sd=function(e,t){var r,n,i;if(null!=e&&!!e!==e)return f(e,1,1e9),null==t?t=k:f(t,0,8),L(new Z(this),e,t);if(!(r=this.c))return null;if(n=14*(i=r.length-1)+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&this.e+1>n&&(n=this.e+1),n},M.shiftedBy=function(e){return f(e,-0x1fffffffffffff,0x1fffffffffffff),this.times("1e"+e)},M.squareRoot=M.sqrt=function(){var e,t,r,n,i,a=this.c,s=this.s,o=this.e,l=E+4,f=new Z("0.5");if(1!==s||!a||!a[0])return new Z(!s||s<0&&(!a||a[0])?NaN:a?this:1/0);if(0==(s=Math.sqrt(+U(this)))||s==1/0?(((t=c(a)).length+o)%2==0&&(t+="0"),s=Math.sqrt(+t),o=u((o+1)/2)-(o<0||o%2),r=new Z(t=s==1/0?"5e"+o:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+o)):r=new Z(s+""),r.c[0]){for((s=(o=r.e)+l)<3&&(s=0);;)if(i=r,r=f.times(i.plus(_(this,i,l,1))),c(i.c).slice(0,s)===(t=c(r.c)).slice(0,s)){if(r.e<o&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(L(r,r.e+E+2,1),e=!r.times(r).eq(this));break}if(!n&&(L(i,i.e+E+2,0),i.times(i).eq(this))){r=i;break}l+=4,s+=4,n=1}}return L(r,r.e+E+1,k,e)},M.toExponential=function(e,t){return null!=e&&(f(e,0,1e9),e++),z(this,e,t,1)},M.toFixed=function(e,t){return null!=e&&(f(e,0,1e9),e=e+this.e+1),z(this,e,t)},M.toFormat=function(e,t,r){var n;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=F;else if("object"!=typeof r)throw Error(a+"Argument not an object: "+r);if(n=this.toFixed(e,t),this.c){var i,s=n.split("."),o=+r.groupSize,u=+r.secondaryGroupSize,c=r.groupSeparator||"",l=s[0],f=s[1],d=this.s<0,h=d?l.slice(1):l,p=h.length;if(u&&(i=o,o=u,u=i,p-=i),o>0&&p>0){for(i=p%o||o,l=h.substr(0,i);i<p;i+=o)l+=c+h.substr(i,o);u>0&&(l+=c+h.slice(i)),d&&(l="-"+l)}n=f?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?f.replace(RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):l}return(r.prefix||"")+n+(r.suffix||"")},M.toFraction=function(e){var t,r,n,i,s,u,l,f,d,h,p,m,g=this.c;if(null!=e&&(!(l=new Z(e)).isInteger()&&(l.c||1!==l.s)||l.lt(S)))throw Error(a+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+U(l));if(!g)return new Z(this);for(t=new Z(S),d=r=new Z(S),n=f=new Z(S),m=c(g),s=t.e=m.length-this.e-1,t.c[0]=o[(u=s%14)<0?14+u:u],e=!e||l.comparedTo(t)>0?s>0?t:d:l,u=C,C=1/0,l=new Z(m),f.c[0]=0;h=_(l,t,0,1),1!=(i=r.plus(h.times(n))).comparedTo(e);)r=n,n=i,d=f.plus(h.times(i=d)),f=i,t=l.minus(h.times(i=t)),l=i;return i=_(e.minus(r),n,0,1),f=f.plus(i.times(d)),r=r.plus(i.times(n)),f.s=d.s=this.s,s*=2,p=1>_(d,n,s,k).minus(this).abs().comparedTo(_(f,r,s,k).minus(this).abs())?[d,n]:[f,r],C=u,p},M.toNumber=function(){return+U(this)},M.toPrecision=function(e,t){return null!=e&&f(e,1,1e9),z(this,e,t,2)},M.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=O||i>=A?h(c(r.c),i):p(c(r.c),i,"0"):10===e&&P?t=p(c((r=L(new Z(r),E+i+1,k)).c),r.e,"0"):(f(e,2,R.length,"Base"),t=x(p(c(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},M.valueOf=M.toJSON=function(){return U(this)},M._isBigNumber=!0,null!=t&&Z.set(t),Z}()).default=t.BigNumber=t,ei.exports?ei.exports=t:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=t)})(Q);var ea=ei.exports;let es=en(),eo=et(),eu={trillion:1e12,billion:1e9,million:1e6,thousand:1e3},ec={totalLength:0,characteristic:0,forceAverage:!1,average:!1,mantissa:-1,optionalMantissa:!0,thousandSeparated:!1,spaceSeparated:!1,negative:"sign",forceSign:!1,roundingFunction:Math.round,spaceSeparatedAbbreviation:!1},{binarySuffixes:el,decimalSuffixes:ef}=es.currentBytes(),ed={scale:1024,suffixes:ef,marker:"bd"},eh={scale:1024,suffixes:el,marker:"b"},ep={scale:1e3,suffixes:ef,marker:"d"};function em(e,t,r){let n=t[0],i=Math.abs(e);if(i>=r){for(let a=1;a<t.length;++a){let s=Math.pow(r,a),o=Math.pow(r,a+1);if(i>=s&&i<o){n=t[a],e/=s;break}}n===t[0]&&(e/=Math.pow(r,t.length-1),n=t[t.length-1])}return{value:e,suffix:n}}function eg(e){let t="";for(let r=0;r<e;r++)t+="0";return t}function ey({instance:e,providedFormat:t,state:r=es,decimalSeparator:n,defaults:i=r.currentDefaults()}){var a,s;let o=e._value;if(0===o&&r.hasZeroFormat())return r.getZeroFormat();if(!isFinite(o))return o.toString();let u=Object.assign({},ec,i,t),c=u.totalLength,l=c?0:u.characteristic,f=u.optionalCharacteristic,d=u.forceAverage,h=u.lowPrecision,p=!!c||!!d||u.average,m=c?-1:p&&void 0===t.mantissa?0:u.mantissa,g=!c&&(void 0===t.optionalMantissa?-1===m:u.optionalMantissa),y=u.trimMantissa,v=u.thousandSeparated,b=u.spaceSeparated,w=u.negative,_=u.forceSign,x=u.exponential,N=u.roundingFunction,M="";if(p){let e=function({value:e,forceAverage:t,lowPrecision:r=!0,abbreviations:n,spaceSeparated:i=!1,totalLength:a=0,roundingFunction:s=Math.round}){let o="",u=Math.abs(e),c=-1;if(t&&n[t]&&eu[t]?(o=n[t],e/=eu[t]):u>=eu.trillion||r&&1===s(u/eu.trillion)?(o=n.trillion,e/=eu.trillion):u<eu.trillion&&u>=eu.billion||r&&1===s(u/eu.billion)?(o=n.billion,e/=eu.billion):u<eu.billion&&u>=eu.million||r&&1===s(u/eu.million)?(o=n.million,e/=eu.million):(u<eu.million&&u>=eu.thousand||r&&1===s(u/eu.thousand))&&(o=n.thousand,e/=eu.thousand),o&&(o=(i?" ":"")+o),a){let t=e<0,r=e.toString().split(".")[0];c=Math.max(a-(t?r.length-1:r.length),0)}return{value:e,abbreviation:o,mantissaPrecision:c}}({value:o,forceAverage:d,lowPrecision:h,abbreviations:r.currentAbbreviations(),spaceSeparated:b,roundingFunction:N,totalLength:c});o=e.value,M+=e.abbreviation,c&&(m=e.mantissaPrecision)}if(x){let e=function({value:e,characteristicPrecision:t}){let[r,n]=e.toExponential().split("e"),i=+r;return t&&1<t&&(i*=Math.pow(10,t-1),n-=t-1,n=n>=0?`+${n}`:n),{value:i,abbreviation:`e${n}`}}({value:o,characteristicPrecision:l});o=e.value,M=e.abbreviation+M}let S=function(e,t,r,n,i,a){if(-1===n)return e;let s=function(e,t,r=Math.round){return -1!==e.toString().indexOf("e")?function(e,t){let r=e.toString(),[n,i]=r.split("e"),[a,s=""]=n.split(".");if(+i>0)r=a+s+eg(i-s.length);else{let e=".";e=0>+a?`-0${e}`:`0${e}`;let n=(eg(-i-1)+Math.abs(a)+s).substr(0,t);n.length<t&&(n+=eg(t-n.length)),r=e+n}return+i>0&&t>0&&(r+=`.${eg(t)}`),r}(e,t):new ea(r(+`${e}e+${t}`)/Math.pow(10,t)).toFixed(t)}(t,n,a),[o,u=""]=s.toString().split(".");if(u.match(/^0+$/)&&(r||i))return o;let c=u.match(/0+$/);return i&&c?`${o}.${u.toString().slice(0,c.index)}`:s.toString()}(o.toString(),o,g,m,y,N);return S=function(e,t,r,n,i){let a=n.currentDelimiters(),s=a.thousands;i=i||a.decimal;let o=a.thousandsSize||3,u=e.toString(),c=u.split(".")[0],l=u.split(".")[1],f=t<0&&0===c.indexOf("-");return r&&(f&&(c=c.slice(1)),(function(e,t){let r=[],n=0;for(let i=e;i>0;i--)n===t&&(r.unshift(i),n=0),n++;return r})(c.length,o).forEach((e,t)=>{c=c.slice(0,e+t)+s+c.slice(e+t)}),f&&(c=`-${c}`)),u=l?c+i+l:c}(S=function(e,t,r,n){let i=e,[a,s]=i.toString().split(".");if(a.match(/^-?0$/)&&r)return s?`${a.replace("0","")}.${s}`:a.replace("0","");let o=t<0&&0===a.indexOf("-");if(o&&(a=a.slice(1),i=i.slice(1)),a.length<n){let e=n-a.length;for(let t=0;t<e;t++)i=`0${i}`}return o&&(i=`-${i}`),i.toString()}(S,o,f,l),o,v,r,n),(p||x)&&(S+=M),(_||o<0)&&(a=S,S=0===(s=o)?a:0==+a?a.replace("-",""):s>0?`+${a}`:"sign"===w?a:`(${a.replace("-","")})`),S}function ev(e,t){if(!e)return t;let r=Object.keys(e);return 1===r.length&&"output"===r[0]?t:e}function eb(e,t,r){let n=new ea(e._value),i=t;return r.isNumbro(t)&&(i=t._value),i=new ea(i),e._value=n.minus(i).toNumber(),e}let ew=en(),e_=et(),ex={loadLanguagesInNode:e=>{e.forEach(e=>{let t;try{t=function(e){throw Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(`../languages/${e}`)}catch(t){console.error(`Unable to load "${e}". No matching language file found.`)}t&&eO.registerLanguage(t)})}},eN=ee(),eM={format:(...e)=>(function(e,t={},r){if("string"==typeof t&&(t=er(t)),!eo.validateFormat(t))return"ERROR: invalid format";let n=t.prefix||"",i=t.postfix||"",a=function(e,t,r){var n,i;switch(t.output){case"currency":return function(e,t,r){let n,i=r.currentCurrency(),a=Object.assign({},t),s=Object.assign({},ec,a),o="",u=!!s.totalLength||!!s.forceAverage||s.average,c=a.currencyPosition||i.position,l=a.currencySymbol||i.symbol,f=void 0!==s.spaceSeparatedCurrency?s.spaceSeparatedCurrency:s.spaceSeparated;void 0===a.lowPrecision&&(a.lowPrecision=!1),f&&(o=" "),"infix"===c&&(n=o+l+o);let d=ey({instance:e,providedFormat:a,state:r,decimalSeparator:n});return"prefix"===c&&(d=e._value<0&&"sign"===s.negative?`-${o}${l}${d.slice(1)}`:e._value>0&&s.forceSign?`+${o}${l}${d.slice(1)}`:l+o+d),c&&"postfix"!==c||(d=d+(o=!s.spaceSeparatedAbbreviation&&u?"":o)+l),d}(e,t=ev(t,es.currentCurrencyDefaultFormat()),es);case"percent":let a,s,o;return n=t=ev(t,es.currentPercentageDefaultFormat()),a=n.prefixSymbol,s=ey({instance:r(100*e._value),providedFormat:n,state:es}),o=Object.assign({},ec,n),a?`%${o.spaceSeparated?" ":""}${s}`:`${s}${o.spaceSeparated?" ":""}%`;case"byte":return function(e,t,r,n){let i=t.base||"binary",a=Object.assign({},ec,t),{binarySuffixes:s,decimalSuffixes:o}=r.currentBytes(),u={general:{scale:1024,suffixes:o||ef,marker:"bd"},binary:{scale:1024,suffixes:s||el,marker:"b"},decimal:{scale:1e3,suffixes:o||ef,marker:"d"}}[i],{value:c,suffix:l}=em(e._value,u.suffixes,u.scale),f=ey({instance:n(c),providedFormat:t,state:r,defaults:r.currentByteDefaultFormat()});return`${f}${a.spaceSeparated?" ":""}${l}`}(e,t=ev(t,es.currentByteDefaultFormat()),es,r);case"time":let u,c,l;return t=ev(t,es.currentTimeDefaultFormat()),u=Math.floor(e._value/60/60),c=Math.floor((e._value-60*u*60)/60),l=Math.round(e._value-60*u*60-60*c),`${u}:${c<10?"0":""}${c}:${l<10?"0":""}${l}`;case"ordinal":let f,d,h,p;return i=t=ev(t,es.currentOrdinalDefaultFormat()),f=es.currentOrdinal(),d=Object.assign({},ec,i),h=ey({instance:e,providedFormat:i,state:es}),p=f(e._value),`${h}${d.spaceSeparated?" ":""}${p}`;default:return ey({instance:e,providedFormat:t,numbro:r})}}(e,t,r);return(a=n+a)+i})(...e,eO),getByteUnit:(...e)=>(function(e){return em(e._value,ed.suffixes,ed.scale).suffix})(...e,eO),getBinaryByteUnit:(...e)=>(function(e){return em(e._value,eh.suffixes,eh.scale).suffix})(...e,eO),getDecimalByteUnit:(...e)=>(function(e){return em(e._value,ep.suffixes,ep.scale).suffix})(...e,eO),formatOrDefault:ev},eS={add:(e,t)=>{let r,n;return r=new ea(e._value),n=t,eO.isNumbro(t)&&(n=t._value),n=new ea(n),e._value=r.plus(n).toNumber(),e},subtract:(e,t)=>eb(e,t,eO),multiply:(e,t)=>{let r,n;return r=new ea(e._value),n=t,eO.isNumbro(t)&&(n=t._value),n=new ea(n),e._value=r.times(n).toNumber(),e},divide:(e,t)=>{let r,n;return r=new ea(e._value),n=t,eO.isNumbro(t)&&(n=t._value),n=new ea(n),e._value=r.dividedBy(n).toNumber(),e},set:(e,t)=>{let r;return r=t,eO.isNumbro(t)&&(r=t._value),e._value=r,e},difference:(e,t)=>{let r;return eb(r=eO(e._value),t,eO),Math.abs(r._value)},BigNumber:ea};class eE{constructor(e){this._value=e}clone(){return eO(this._value)}format(e={}){return eM.format(this,e)}formatCurrency(e){return"string"==typeof e&&(e=er(e)),(e=eM.formatOrDefault(e,ew.currentCurrencyDefaultFormat())).output="currency",eM.format(this,e)}formatTime(e={}){return e.output="time",eM.format(this,e)}binaryByteUnits(){return eM.getBinaryByteUnit(this)}decimalByteUnits(){return eM.getDecimalByteUnit(this)}byteUnits(){return eM.getByteUnit(this)}difference(e){return eS.difference(this,e)}add(e){return eS.add(this,e)}subtract(e){return eS.subtract(this,e)}multiply(e){return eS.multiply(this,e)}divide(e){return eS.divide(this,e)}set(e){return eS.set(this,ek(e))}value(){return this._value}valueOf(){return this._value}}function ek(e){let t=e;return eO.isNumbro(e)?t=e._value:"string"==typeof e?t=eO.unformat(e):isNaN(e)&&(t=NaN),t}function eO(e){return new eE(ek(e))}eO.version="2.5.0",eO.isNumbro=function(e){return e instanceof eE},eO.language=ew.currentLanguage,eO.registerLanguage=ew.registerLanguage,eO.setLanguage=ew.setLanguage,eO.languages=ew.languages,eO.languageData=ew.languageData,eO.zeroFormat=ew.setZeroFormat,eO.defaultFormat=ew.currentDefaults,eO.setDefaults=ew.setDefaults,eO.defaultCurrencyFormat=ew.currentCurrencyDefaultFormat,eO.validate=e_.validate,eO.loadLanguagesInNode=ex.loadLanguagesInNode,eO.unformat=eN.unformat,eO.BigNumber=eS.BigNumber;var eA=eO&&eO.__esModule&&Object.prototype.hasOwnProperty.call(eO,"default")?eO.default:eO;let eT=3;function eC(e,{shortValues:t,decimalPlaces:r}){if(!J(t)||1e3>Math.abs(e)){let n={style:"unit",unit:"byte",unitDisplay:"long",useGrouping:!0};return Y(r)?(n.minimumFractionDigits=X(r),n.maximumFractionDigits=X(r)):J(t)&&(n.maximumSignificantDigits=eT),Intl.NumberFormat("en-US",n).format(e)}return eA(e).format({output:"byte",base:"decimal",spaceSeparated:!0,mantissa:Y(r)?r:2,trimMantissa:!Y(r),optionalMantissa:!Y(r)})}let ej="Percent",eI="Time";var eD=((ai={}).milliseconds="millisecond",ai.seconds="second",ai.minutes="minute",ai.hours="hour",ai.days="day",ai.weeks="week",ai.months="month",ai.years="year",ai);let eF={years:31536e3,months:2592e3,weeks:604800,days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001},eR=["years","months","weeks","days","hours","minutes","seconds","milliseconds"],eP="Throughput";var eZ=r(93098);let ez="Currency",e$={Time:{label:"Time",decimalPlaces:!0},Percent:{label:"percent",decimalPlaces:!0},Decimal:{label:"Decimal",decimalPlaces:!0,shortValues:!0},Bytes:{label:"Bytes",decimalPlaces:!0,shortValues:!0},Throughput:{label:"Throughput",decimalPlaces:!0},Currency:{label:"Currency",decimalPlaces:!0}},eB={milliseconds:{group:eI,label:"Milliseconds"},seconds:{group:eI,label:"Seconds"},minutes:{group:eI,label:"Minutes"},hours:{group:eI,label:"Hours"},days:{group:eI,label:"Days"},weeks:{group:eI,label:"Weeks"},months:{group:eI,label:"Months"},years:{group:eI,label:"Years"},percent:{group:ej,label:"Percent (0-100)"},"percent-decimal":{group:ej,label:"Percent (0.0-1.0)"},"%":{disableSelectorOption:!0,group:ej,label:"%"},decimal:{group:"Decimal",label:"Decimal"},bytes:{group:"Bytes",label:"Bytes"},"bits/sec":{group:eP,label:"Bits/sec"},"bytes/sec":{group:eP,label:"Bytes/sec"},"counts/sec":{group:eP,label:"Counts/sec"},"events/sec":{group:eP,label:"Events/sec"},"messages/sec":{group:eP,label:"Messages/sec"},"ops/sec":{group:eP,label:"Ops/sec"},"packets/sec":{group:eP,label:"Packets/sec"},"reads/sec":{group:eP,label:"Reads/sec"},"requests/sec":{group:eP,label:"Requests/sec"},"records/sec":{group:eP,label:"Records/sec"},"rows/sec":{group:eP,label:"Rows/sec"},"writes/sec":{group:eP,label:"Writes/sec"},aud:{group:ez,label:"Australian Dollar (A$)"},cad:{group:ez,label:"Canadian Dollar (CA$)"},chf:{group:ez,label:"Swiss Franc (CHF)"},cny:{group:ez,label:"Renminbi (CN\xa5)"},eur:{group:ez,label:"Euro (€)"},gbp:{group:ez,label:"Pound (\xa3)"},hkd:{group:ez,label:"Hong Kong Dollar (HK$)"},inr:{group:ez,label:"Indian Rupee (₹)"},jpy:{group:ez,label:"Yen (\xa5)"},krw:{group:ez,label:"South Korean Won (₩)"},nok:{group:ez,label:"Norwegian Krone (NOK)"},nzd:{group:ez,label:"New Zealand Dollar (NZ$)"},sek:{group:ez,label:"Swedish Krona (SEK)"},sgd:{group:ez,label:"Singapore Dollar (S$)"},usd:{group:ez,label:"US Dollar ($)"}};function eL(e,t){if(void 0===t)return e.toString();if(eH(t))return eC(e,t);if(eK(t))return function(e,{shortValues:t,decimalPlaces:r}){let n={style:"decimal",useGrouping:!0};return J(t)&&(n.notation="compact"),Y(r)?(n.minimumFractionDigits=X(r),n.maximumFractionDigits=X(r)):J(t)&&(n.maximumSignificantDigits=eT),Intl.NumberFormat("en-US",n).format(e)}(e,t);if(eW(t))return function(e,{unit:t,decimalPlaces:r}){let n={style:"percent",useGrouping:!0};return Y(r)?(n.minimumFractionDigits=X(r),n.maximumFractionDigits=X(r)):n.maximumSignificantDigits=eT,"percent"===t&&(e/=100),Intl.NumberFormat("en-US",n).format(e)}(e,t);if(eG(t))return function(e,{unit:t,decimalPlaces:r}){var n;if(0===e)return"0s";let i=function(e,t){let r=e*eF[t],n=eR[0]||"years",i=n,a=r/eF[n];for(i of eR)if((a=r/eF[i])>=1)break;return{value:a,unit:i}}(e,t??"seconds"),a={style:"unit",unit:eD[i.unit],unitDisplay:"months"===(n=i.unit)||"years"===n?"long":"narrow"};return Y(r)?(a.minimumFractionDigits=X(r),a.maximumFractionDigits=X(r)):a.maximumSignificantDigits=eT,Intl.NumberFormat("en-US",a).format(i.value)}(e,t);if(eX(t))return function(e,{unit:t,shortValues:r,decimalPlaces:n}){if("bytes/sec"===t){let t=1e3>Math.abs(e)?"sec":"s";return eC(e,{unit:"bytes",shortValues:r,decimalPlaces:n})+"/"+t}let i={style:"decimal",useGrouping:!0};return J(r)&&(i.notation="compact"),Y(n)?(i.minimumFractionDigits=X(n),i.maximumFractionDigits=X(n)):J(r)&&(i.maximumSignificantDigits=eT),Intl.NumberFormat("en-US",i).format(e)+" "+t}(e,t);if(eQ(t))return function(e,{unit:t,decimalPlaces:r}){let n={style:"currency",currency:(0,eZ.toUpper)(t),currencyDisplay:"symbol"};return Y(r)?(n.minimumFractionDigits=X(r),n.maximumFractionDigits=X(r)):n.maximumSignificantDigits=eT,Intl.NumberFormat("en-US",n).format(e)}(e,t);throw Error(`Unknown unit options ${t}`)}function eU(e){return eB[e.unit??"decimal"]}function eV(e){return eU(e).group??"Decimal"}function eq(e){return e$[eU(e).group??"Decimal"]}function eG(e){return"Time"===eV(e)}function eW(e){return"Percent"===eV(e)}function eK(e){return"Decimal"===eV(e)}function eH(e){return"Bytes"===eV(e)}function eJ(e){return!!eq(e).decimalPlaces}function eY(e){return!!eq(e).shortValues}function eX(e){return"Throughput"===eV(e)}function eQ(e){return"Currency"===eV(e)}function e0(e){return"project"in e.metadata?e.metadata.project:void 0}let e1="$__all";(aa=ag||(ag={})).assertEqual=e=>e,aa.assertIs=function(e){},aa.assertNever=function(e){throw Error()},aa.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},aa.getValidEnumValues=e=>{let t=aa.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return aa.objectValues(r)},aa.objectValues=e=>aa.objectKeys(e).map(function(t){return e[t]}),aa.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},aa.find=(e,t)=>{for(let r of e)if(t(r))return r},aa.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,aa.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},aa.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ay||(ay={})).mergeShapes=(e,t)=>({...e,...t});let e2=ag.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),e4=e=>{switch(typeof e){case"undefined":return e2.undefined;case"string":return e2.string;case"number":return isNaN(e)?e2.nan:e2.number;case"boolean":return e2.boolean;case"function":return e2.function;case"bigint":return e2.bigint;case"symbol":return e2.symbol;case"object":if(Array.isArray(e))return e2.array;if(null===e)return e2.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return e2.promise;if("undefined"!=typeof Map&&e instanceof Map)return e2.map;if("undefined"!=typeof Set&&e instanceof Set)return e2.set;if("undefined"!=typeof Date&&e instanceof Date)return e2.date;return e2.object;default:return e2.unknown}},e9=ag.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class e5 extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof e5))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ag.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}e5.create=e=>new e5(e);let e3=(e,t)=>{let r;switch(e.code){case e9.invalid_type:r=e.received===e2.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case e9.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ag.jsonStringifyReplacer)}`;break;case e9.unrecognized_keys:r=`Unrecognized key(s) in object: ${ag.joinValues(e.keys,", ")}`;break;case e9.invalid_union:r="Invalid input";break;case e9.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ag.joinValues(e.options)}`;break;case e9.invalid_enum_value:r=`Invalid enum value. Expected ${ag.joinValues(e.options)}, received '${e.received}'`;break;case e9.invalid_arguments:r="Invalid function arguments";break;case e9.invalid_return_type:r="Invalid function return type";break;case e9.invalid_date:r="Invalid date";break;case e9.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ag.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case e9.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case e9.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case e9.custom:r="Invalid input";break;case e9.invalid_intersection_types:r="Intersection results could not be merged";break;case e9.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case e9.not_finite:r="Number must be finite";break;default:r=t.defaultError,ag.assertNever(e)}return{message:r}},e7=e3;function e6(){return e7}let e8=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],s={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let o="";for(let e of n.filter(e=>!!e).slice().reverse())o=e(s,{data:t,defaultError:o}).message;return{...i,path:a,message:o}};function te(e,t){let r=e6(),n=e8({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===e3?void 0:e3].filter(e=>!!e)});e.common.issues.push(n)}class tt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return tr;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return tt.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return tr;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let tr=Object.freeze({status:"aborted"}),tn=e=>({status:"dirty",value:e}),ti=e=>({status:"valid",value:e}),ta=e=>"aborted"===e.status,ts=e=>"dirty"===e.status,to=e=>"valid"===e.status,tu=e=>"undefined"!=typeof Promise&&e instanceof Promise;function tc(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function tl(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}"function"==typeof SuppressedError&&SuppressedError,(as=av||(av={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},as.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class tf{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let td=(e,t)=>{if(to(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new e5(e.common.issues);return this._error=t,this._error}}};function th(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var a,s;let{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:i.defaultError}:void 0===i.data?{message:null!=(a=null!=o?o:n)?a:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!=(s=null!=o?o:r)?s:i.defaultError}},description:i}}class tp{get description(){return this._def.description}_getType(e){return e4(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:e4(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tt,ctx:{common:e.parent.common,data:e.data,parsedType:e4(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(tu(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:null!=(r=null==t?void 0:t.async)&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e4(e)},i=this._parseSync({data:e,path:n.path,parent:n});return td(n,i)}"~validate"(e){var t,r;let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e4(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:n});return to(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null==(r=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(e=>to(e)?{value:e.value}:{issues:n.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e4(e)},n=this._parse({data:e,path:r.path,parent:r});return td(r,await (tu(n)?n:Promise.resolve(n)))}refine(e,t){return this._refinement((r,n)=>{let i=e(r),a=()=>n.addIssue({code:e9.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new t6({schema:this,typeName:a_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return t8.create(this,this._def)}nullable(){return re.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tq.create(this)}promise(){return t7.create(this,this._def)}or(e){return tW.create([this,e],this._def)}and(e){return tJ.create(this,e,this._def)}transform(e){return new t6({...th(this._def),schema:this,typeName:a_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new rt({...th(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:a_.ZodDefault})}brand(){return new ra({typeName:a_.ZodBranded,type:this,...th(this._def)})}catch(e){return new rr({...th(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:a_.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return rs.create(this,e)}readonly(){return ro.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let tm=/^c[^\s-]{8,}$/i,tg=/^[0-9a-z]+$/,ty=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tv=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tb=/^[a-z0-9_-]{21}$/i,tw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,t_=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tx=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,tS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tO=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tA="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tT=RegExp(`^${tA}$`);function tC(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function tj(e){let t=`${tA}T${tC(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class tI extends tp{_parse(e){var t,r,i,a;let s;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==e2.string){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.string,received:t.parsedType}),tr}let o=new tt;for(let u of this._def.checks)if("min"===u.kind)e.data.length<u.value&&(te(s=this._getOrReturnCtx(e,s),{code:e9.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),o.dirty());else if("max"===u.kind)e.data.length>u.value&&(te(s=this._getOrReturnCtx(e,s),{code:e9.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),o.dirty());else if("length"===u.kind){let t=e.data.length>u.value,r=e.data.length<u.value;(t||r)&&(s=this._getOrReturnCtx(e,s),t?te(s,{code:e9.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):r&&te(s,{code:e9.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),o.dirty())}else if("email"===u.kind)tx.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"email",code:e9.invalid_string,message:u.message}),o.dirty());else if("emoji"===u.kind)n||(n=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),n.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"emoji",code:e9.invalid_string,message:u.message}),o.dirty());else if("uuid"===u.kind)tv.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"uuid",code:e9.invalid_string,message:u.message}),o.dirty());else if("nanoid"===u.kind)tb.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"nanoid",code:e9.invalid_string,message:u.message}),o.dirty());else if("cuid"===u.kind)tm.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"cuid",code:e9.invalid_string,message:u.message}),o.dirty());else if("cuid2"===u.kind)tg.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"cuid2",code:e9.invalid_string,message:u.message}),o.dirty());else if("ulid"===u.kind)ty.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"ulid",code:e9.invalid_string,message:u.message}),o.dirty());else if("url"===u.kind)try{new URL(e.data)}catch(t){te(s=this._getOrReturnCtx(e,s),{validation:"url",code:e9.invalid_string,message:u.message}),o.dirty()}else"regex"===u.kind?(u.regex.lastIndex=0,u.regex.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"regex",code:e9.invalid_string,message:u.message}),o.dirty())):"trim"===u.kind?e.data=e.data.trim():"includes"===u.kind?e.data.includes(u.value,u.position)||(te(s=this._getOrReturnCtx(e,s),{code:e9.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),o.dirty()):"toLowerCase"===u.kind?e.data=e.data.toLowerCase():"toUpperCase"===u.kind?e.data=e.data.toUpperCase():"startsWith"===u.kind?e.data.startsWith(u.value)||(te(s=this._getOrReturnCtx(e,s),{code:e9.invalid_string,validation:{startsWith:u.value},message:u.message}),o.dirty()):"endsWith"===u.kind?e.data.endsWith(u.value)||(te(s=this._getOrReturnCtx(e,s),{code:e9.invalid_string,validation:{endsWith:u.value},message:u.message}),o.dirty()):"datetime"===u.kind?tj(u).test(e.data)||(te(s=this._getOrReturnCtx(e,s),{code:e9.invalid_string,validation:"datetime",message:u.message}),o.dirty()):"date"===u.kind?tT.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{code:e9.invalid_string,validation:"date",message:u.message}),o.dirty()):"time"===u.kind?RegExp(`^${tC(u)}$`).test(e.data)||(te(s=this._getOrReturnCtx(e,s),{code:e9.invalid_string,validation:"time",message:u.message}),o.dirty()):"duration"===u.kind?t_.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"duration",code:e9.invalid_string,message:u.message}),o.dirty()):"ip"===u.kind?(t=e.data,!(("v4"===(r=u.version)||!r)&&tN.test(t)||("v6"===r||!r)&&tS.test(t))&&1&&(te(s=this._getOrReturnCtx(e,s),{validation:"ip",code:e9.invalid_string,message:u.message}),o.dirty())):"jwt"===u.kind?!function(e,t){if(!tw.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if("object"!=typeof i||null===i||!i.typ||!i.alg||t&&i.alg!==t)return!1;return!0}catch(e){return!1}}(e.data,u.alg)&&(te(s=this._getOrReturnCtx(e,s),{validation:"jwt",code:e9.invalid_string,message:u.message}),o.dirty()):"cidr"===u.kind?(i=e.data,!(("v4"===(a=u.version)||!a)&&tM.test(i)||("v6"===a||!a)&&tE.test(i))&&1&&(te(s=this._getOrReturnCtx(e,s),{validation:"cidr",code:e9.invalid_string,message:u.message}),o.dirty())):"base64"===u.kind?tk.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"base64",code:e9.invalid_string,message:u.message}),o.dirty()):"base64url"===u.kind?tO.test(e.data)||(te(s=this._getOrReturnCtx(e,s),{validation:"base64url",code:e9.invalid_string,message:u.message}),o.dirty()):ag.assertNever(u);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:e9.invalid_string,...av.errToObj(r)})}_addCheck(e){return new tI({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...av.errToObj(e)})}url(e){return this._addCheck({kind:"url",...av.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...av.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...av.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...av.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...av.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...av.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...av.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...av.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...av.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...av.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...av.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...av.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(r=null==e?void 0:e.local)&&r,...av.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...av.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...av.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...av.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...av.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...av.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...av.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...av.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...av.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...av.errToObj(t)})}nonempty(e){return this.min(1,av.errToObj(e))}trim(){return new tI({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new tI({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new tI({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}tI.create=e=>{var t;return new tI({checks:[],typeName:a_.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...th(e)})};class tD extends tp{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==e2.number){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.number,received:t.parsedType}),tr}let r=new tt;for(let n of this._def.checks)"int"===n.kind?ag.isInteger(e.data)||(te(t=this._getOrReturnCtx(e,t),{code:e9.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(te(t=this._getOrReturnCtx(e,t),{code:e9.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(te(t=this._getOrReturnCtx(e,t),{code:e9.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,n.value)&&(te(t=this._getOrReturnCtx(e,t),{code:e9.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(te(t=this._getOrReturnCtx(e,t),{code:e9.not_finite,message:n.message}),r.dirty()):ag.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,av.toString(t))}gt(e,t){return this.setLimit("min",e,!1,av.toString(t))}lte(e,t){return this.setLimit("max",e,!0,av.toString(t))}lt(e,t){return this.setLimit("max",e,!1,av.toString(t))}setLimit(e,t,r,n){return new tD({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:av.toString(n)}]})}_addCheck(e){return new tD({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:av.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:av.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:av.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:av.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:av.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:av.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:av.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:av.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:av.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&ag.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}tD.create=e=>new tD({checks:[],typeName:a_.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...th(e)});class tF extends tp{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==e2.bigint)return this._getInvalidInput(e);let r=new tt;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(te(t=this._getOrReturnCtx(e,t),{code:e9.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(te(t=this._getOrReturnCtx(e,t),{code:e9.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(te(t=this._getOrReturnCtx(e,t),{code:e9.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):ag.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.bigint,received:t.parsedType}),tr}gte(e,t){return this.setLimit("min",e,!0,av.toString(t))}gt(e,t){return this.setLimit("min",e,!1,av.toString(t))}lte(e,t){return this.setLimit("max",e,!0,av.toString(t))}lt(e,t){return this.setLimit("max",e,!1,av.toString(t))}setLimit(e,t,r,n){return new tF({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:av.toString(n)}]})}_addCheck(e){return new tF({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:av.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:av.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:av.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:av.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:av.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}tF.create=e=>{var t;return new tF({checks:[],typeName:a_.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...th(e)})};class tR extends tp{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==e2.boolean){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.boolean,received:t.parsedType}),tr}return ti(e.data)}}tR.create=e=>new tR({typeName:a_.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...th(e)});class tP extends tp{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==e2.date){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.date,received:t.parsedType}),tr}if(isNaN(e.data.getTime()))return te(this._getOrReturnCtx(e),{code:e9.invalid_date}),tr;let r=new tt;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(te(t=this._getOrReturnCtx(e,t),{code:e9.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(te(t=this._getOrReturnCtx(e,t),{code:e9.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):ag.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new tP({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:av.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:av.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}tP.create=e=>new tP({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:a_.ZodDate,...th(e)});class tZ extends tp{_parse(e){if(this._getType(e)!==e2.symbol){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.symbol,received:t.parsedType}),tr}return ti(e.data)}}tZ.create=e=>new tZ({typeName:a_.ZodSymbol,...th(e)});class tz extends tp{_parse(e){if(this._getType(e)!==e2.undefined){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.undefined,received:t.parsedType}),tr}return ti(e.data)}}tz.create=e=>new tz({typeName:a_.ZodUndefined,...th(e)});class t$ extends tp{_parse(e){if(this._getType(e)!==e2.null){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.null,received:t.parsedType}),tr}return ti(e.data)}}t$.create=e=>new t$({typeName:a_.ZodNull,...th(e)});class tB extends tp{constructor(){super(...arguments),this._any=!0}_parse(e){return ti(e.data)}}tB.create=e=>new tB({typeName:a_.ZodAny,...th(e)});class tL extends tp{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ti(e.data)}}tL.create=e=>new tL({typeName:a_.ZodUnknown,...th(e)});class tU extends tp{_parse(e){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.never,received:t.parsedType}),tr}}tU.create=e=>new tU({typeName:a_.ZodNever,...th(e)});class tV extends tp{_parse(e){if(this._getType(e)!==e2.undefined){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.void,received:t.parsedType}),tr}return ti(e.data)}}tV.create=e=>new tV({typeName:a_.ZodVoid,...th(e)});class tq extends tp{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==e2.array)return te(t,{code:e9.invalid_type,expected:e2.array,received:t.parsedType}),tr;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(te(t,{code:e?e9.too_big:e9.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(te(t,{code:e9.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(te(t,{code:e9.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new tf(t,e,t.path,r)))).then(e=>tt.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new tf(t,e,t.path,r)));return tt.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new tq({...this._def,minLength:{value:e,message:av.toString(t)}})}max(e,t){return new tq({...this._def,maxLength:{value:e,message:av.toString(t)}})}length(e,t){return new tq({...this._def,exactLength:{value:e,message:av.toString(t)}})}nonempty(e){return this.min(1,e)}}tq.create=(e,t)=>new tq({type:e,minLength:null,maxLength:null,exactLength:null,typeName:a_.ZodArray,...th(t)});class tG extends tp{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=ag.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==e2.object){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.object,received:t.parsedType}),tr}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof tU&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let s=[];for(let e of i){let t=n[e],i=r.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new tf(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof tU){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)s.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(te(r,{code:e9.unrecognized_keys,keys:a}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of a){let n=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new tf(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>tt.mergeObjectSync(t,e)):tt.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return av.errToObj,new tG({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,a,s;let o=null!=(a=null==(i=(n=this._def).errorMap)?void 0:i.call(n,t,r).message)?a:r.defaultError;return"unrecognized_keys"===t.code?{message:null!=(s=av.errToObj(e).message)?s:o}:{message:o}}}:{}})}strip(){return new tG({...this._def,unknownKeys:"strip"})}passthrough(){return new tG({...this._def,unknownKeys:"passthrough"})}extend(e){return new tG({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new tG({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:a_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new tG({...this._def,catchall:e})}pick(e){let t={};return ag.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new tG({...this._def,shape:()=>t})}omit(e){let t={};return ag.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new tG({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof tG){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=t8.create(e(i))}return new tG({...t._def,shape:()=>r})}if(t instanceof tq)return new tq({...t._def,type:e(t.element)});if(t instanceof t8)return t8.create(e(t.unwrap()));if(t instanceof re)return re.create(e(t.unwrap()));if(t instanceof tY)return tY.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};return ag.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new tG({...this._def,shape:()=>t})}required(e){let t={};return ag.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof t8;)e=e._def.innerType;t[r]=e}}),new tG({...this._def,shape:()=>t})}keyof(){return t9(ag.objectKeys(this.shape))}}tG.create=(e,t)=>new tG({shape:()=>e,unknownKeys:"strip",catchall:tU.create(),typeName:a_.ZodObject,...th(t)}),tG.strictCreate=(e,t)=>new tG({shape:()=>e,unknownKeys:"strict",catchall:tU.create(),typeName:a_.ZodObject,...th(t)}),tG.lazycreate=(e,t)=>new tG({shape:e,unknownKeys:"strip",catchall:tU.create(),typeName:a_.ZodObject,...th(t)});class tW extends tp{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new e5(e.ctx.common.issues));return te(t,{code:e9.invalid_union,unionErrors:r}),tr});{let e,n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new e5(e));return te(t,{code:e9.invalid_union,unionErrors:i}),tr}}get options(){return this._def.options}}tW.create=(e,t)=>new tW({options:e,typeName:a_.ZodUnion,...th(t)});let tK=e=>{if(e instanceof t2)return tK(e.schema);if(e instanceof t6)return tK(e.innerType());if(e instanceof t4)return[e.value];if(e instanceof t5)return e.options;if(e instanceof t3)return ag.objectValues(e.enum);else if(e instanceof rt)return tK(e._def.innerType);else if(e instanceof tz)return[void 0];else if(e instanceof t$)return[null];else if(e instanceof t8)return[void 0,...tK(e.unwrap())];else if(e instanceof re)return[null,...tK(e.unwrap())];else if(e instanceof ra)return tK(e.unwrap());else if(e instanceof ro)return tK(e.unwrap());else if(e instanceof rr)return tK(e._def.innerType);else return[]};class tH extends tp{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==e2.object)return te(t,{code:e9.invalid_type,expected:e2.object,received:t.parsedType}),tr;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(te(t,{code:e9.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),tr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=tK(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new tH({typeName:a_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...th(r)})}}class tJ extends tp{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(ta(e)||ta(n))return tr;let i=function e(t,r){let n=e4(t),i=e4(r);if(t===r)return{valid:!0,data:t};if(n===e2.object&&i===e2.object){let n=ag.objectKeys(r),i=ag.objectKeys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};a[n]=i.data}return{valid:!0,data:a}}if(n===e2.array&&i===e2.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}if(n===e2.date&&i===e2.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,n.value);return i.valid?((ts(e)||ts(n))&&t.dirty(),{status:t.value,value:i.data}):(te(r,{code:e9.invalid_intersection_types}),tr)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}tJ.create=(e,t,r)=>new tJ({left:e,right:t,typeName:a_.ZodIntersection,...th(r)});class tY extends tp{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e2.array)return te(r,{code:e9.invalid_type,expected:e2.array,received:r.parsedType}),tr;if(r.data.length<this._def.items.length)return te(r,{code:e9.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),tr;!this._def.rest&&r.data.length>this._def.items.length&&(te(r,{code:e9.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new tf(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>tt.mergeArray(t,e)):tt.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new tY({...this._def,rest:e})}}tY.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new tY({items:e,typeName:a_.ZodTuple,rest:null,...th(t)})};class tX extends tp{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e2.object)return te(r,{code:e9.invalid_type,expected:e2.object,received:r.parsedType}),tr;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new tf(r,e,r.path,e)),value:a._parse(new tf(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?tt.mergeObjectAsync(t,n):tt.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new tX(t instanceof tp?{keyType:e,valueType:t,typeName:a_.ZodRecord,...th(r)}:{keyType:tI.create(),valueType:e,typeName:a_.ZodRecord,...th(t)})}}class tQ extends tp{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e2.map)return te(r,{code:e9.invalid_type,expected:e2.map,received:r.parsedType}),tr;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:n._parse(new tf(r,e,r.path,[a,"key"])),value:i._parse(new tf(r,t,r.path,[a,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of a){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return tr;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of a){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return tr;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}tQ.create=(e,t,r)=>new tQ({valueType:t,keyType:e,typeName:a_.ZodMap,...th(r)});class t0 extends tp{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e2.set)return te(r,{code:e9.invalid_type,expected:e2.set,received:r.parsedType}),tr;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(te(r,{code:e9.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(te(r,{code:e9.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let n of e){if("aborted"===n.status)return tr;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let s=[...r.data.values()].map((e,t)=>i._parse(new tf(r,e,r.path,t)));return r.common.async?Promise.all(s).then(e=>a(e)):a(s)}min(e,t){return new t0({...this._def,minSize:{value:e,message:av.toString(t)}})}max(e,t){return new t0({...this._def,maxSize:{value:e,message:av.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}t0.create=(e,t)=>new t0({valueType:e,minSize:null,maxSize:null,typeName:a_.ZodSet,...th(t)});class t1 extends tp{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==e2.function)return te(t,{code:e9.invalid_type,expected:e2.function,received:t.parsedType}),tr;function r(e,r){return e8({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,e6(),e3].filter(e=>!!e),issueData:{code:e9.invalid_arguments,argumentsError:r}})}function n(e,r){return e8({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,e6(),e3].filter(e=>!!e),issueData:{code:e9.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof t7){let e=this;return ti(async function(...t){let s=new e5([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw s.addIssue(r(t,e)),s}),u=await Reflect.apply(a,this,o);return await e._def.returns._def.type.parseAsync(u,i).catch(e=>{throw s.addIssue(n(u,e)),s})})}{let e=this;return ti(function(...t){let s=e._def.args.safeParse(t,i);if(!s.success)throw new e5([r(t,s.error)]);let o=Reflect.apply(a,this,s.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new e5([n(o,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t1({...this._def,args:tY.create(e).rest(tL.create())})}returns(e){return new t1({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new t1({args:e||tY.create([]).rest(tL.create()),returns:t||tL.create(),typeName:a_.ZodFunction,...th(r)})}}class t2 extends tp{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}t2.create=(e,t)=>new t2({getter:e,typeName:a_.ZodLazy,...th(t)});class t4 extends tp{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return te(t,{received:t.data,code:e9.invalid_literal,expected:this._def.value}),tr}return{status:"valid",value:e.data}}get value(){return this._def.value}}function t9(e,t){return new t5({values:e,typeName:a_.ZodEnum,...th(t)})}t4.create=(e,t)=>new t4({value:e,typeName:a_.ZodLiteral,...th(t)});class t5 extends tp{constructor(){super(...arguments),ab.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return te(t,{expected:ag.joinValues(r),received:t.parsedType,code:e9.invalid_type}),tr}if(tc(this,ab,"f")||tl(this,ab,new Set(this._def.values),"f"),!tc(this,ab,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return te(t,{received:t.data,code:e9.invalid_enum_value,options:r}),tr}return ti(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return t5.create(e,{...this._def,...t})}exclude(e,t=this._def){return t5.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ab=new WeakMap,t5.create=t9;class t3 extends tp{constructor(){super(...arguments),aw.set(this,void 0)}_parse(e){let t=ag.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==e2.string&&r.parsedType!==e2.number){let e=ag.objectValues(t);return te(r,{expected:ag.joinValues(e),received:r.parsedType,code:e9.invalid_type}),tr}if(tc(this,aw,"f")||tl(this,aw,new Set(ag.getValidEnumValues(this._def.values)),"f"),!tc(this,aw,"f").has(e.data)){let e=ag.objectValues(t);return te(r,{received:r.data,code:e9.invalid_enum_value,options:e}),tr}return ti(e.data)}get enum(){return this._def.values}}aw=new WeakMap,t3.create=(e,t)=>new t3({values:e,typeName:a_.ZodNativeEnum,...th(t)});class t7 extends tp{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==e2.promise&&!1===t.common.async?(te(t,{code:e9.invalid_type,expected:e2.promise,received:t.parsedType}),tr):ti((t.parsedType===e2.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}t7.create=(e,t)=>new t7({type:e,typeName:a_.ZodPromise,...th(t)});class t6 extends tp{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===a_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{te(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return tr;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?tr:"dirty"===n.status||"dirty"===t.value?tn(n.value):n});{if("aborted"===t.value)return tr;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?tr:"dirty"===n.status||"dirty"===t.value?tn(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?tr:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?tr:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>to(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!to(e))return e;let a=n.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}ag.assertNever(n)}}t6.create=(e,t,r)=>new t6({schema:e,typeName:a_.ZodEffects,effect:t,...th(r)}),t6.createWithPreprocess=(e,t,r)=>new t6({schema:t,effect:{type:"preprocess",transform:e},typeName:a_.ZodEffects,...th(r)});class t8 extends tp{_parse(e){return this._getType(e)===e2.undefined?ti(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}t8.create=(e,t)=>new t8({innerType:e,typeName:a_.ZodOptional,...th(t)});class re extends tp{_parse(e){return this._getType(e)===e2.null?ti(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}re.create=(e,t)=>new re({innerType:e,typeName:a_.ZodNullable,...th(t)});class rt extends tp{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===e2.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}rt.create=(e,t)=>new rt({innerType:e,typeName:a_.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...th(t)});class rr extends tp{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return tu(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new e5(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new e5(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}rr.create=(e,t)=>new rr({innerType:e,typeName:a_.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...th(t)});class rn extends tp{_parse(e){if(this._getType(e)!==e2.nan){let t=this._getOrReturnCtx(e);return te(t,{code:e9.invalid_type,expected:e2.nan,received:t.parsedType}),tr}return{status:"valid",value:e.data}}}rn.create=e=>new rn({typeName:a_.ZodNaN,...th(e)});let ri=Symbol("zod_brand");class ra extends tp{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class rs extends tp{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?tr:"dirty"===e.status?(t.dirty(),tn(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?tr:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new rs({in:e,out:t,typeName:a_.ZodPipeline})}}class ro extends tp{_parse(e){let t=this._def.innerType._parse(e),r=e=>(to(e)&&(e.value=Object.freeze(e.value)),e);return tu(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function ru(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function rc(e,t={},r){return e?tB.create().superRefine((n,i)=>{var a,s;let o=e(n);if(o instanceof Promise)return o.then(e=>{var a,s;if(!e){let e=ru(t,n),o=null==(s=null!=(a=e.fatal)?a:r)||s;i.addIssue({code:"custom",...e,fatal:o})}});if(!o){let e=ru(t,n),o=null==(s=null!=(a=e.fatal)?a:r)||s;i.addIssue({code:"custom",...e,fatal:o})}}):tB.create()}ro.create=(e,t)=>new ro({innerType:e,typeName:a_.ZodReadonly,...th(t)});let rl={object:tG.lazycreate};(ao=a_||(a_={})).ZodString="ZodString",ao.ZodNumber="ZodNumber",ao.ZodNaN="ZodNaN",ao.ZodBigInt="ZodBigInt",ao.ZodBoolean="ZodBoolean",ao.ZodDate="ZodDate",ao.ZodSymbol="ZodSymbol",ao.ZodUndefined="ZodUndefined",ao.ZodNull="ZodNull",ao.ZodAny="ZodAny",ao.ZodUnknown="ZodUnknown",ao.ZodNever="ZodNever",ao.ZodVoid="ZodVoid",ao.ZodArray="ZodArray",ao.ZodObject="ZodObject",ao.ZodUnion="ZodUnion",ao.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ao.ZodIntersection="ZodIntersection",ao.ZodTuple="ZodTuple",ao.ZodRecord="ZodRecord",ao.ZodMap="ZodMap",ao.ZodSet="ZodSet",ao.ZodFunction="ZodFunction",ao.ZodLazy="ZodLazy",ao.ZodLiteral="ZodLiteral",ao.ZodEnum="ZodEnum",ao.ZodEffects="ZodEffects",ao.ZodNativeEnum="ZodNativeEnum",ao.ZodOptional="ZodOptional",ao.ZodNullable="ZodNullable",ao.ZodDefault="ZodDefault",ao.ZodCatch="ZodCatch",ao.ZodPromise="ZodPromise",ao.ZodBranded="ZodBranded",ao.ZodPipeline="ZodPipeline",ao.ZodReadonly="ZodReadonly";let rf=tI.create,rd=tD.create,rh=rn.create,rp=tF.create,rm=tR.create,rg=tP.create,ry=tZ.create,rv=tz.create,rb=t$.create,rw=tB.create,r_=tL.create,rx=tU.create,rN=tV.create,rM=tq.create,rS=tG.create,rE=tG.strictCreate,rk=tW.create,rO=tH.create,rA=tJ.create,rT=tY.create,rC=tX.create,rj=tQ.create,rI=t0.create,rD=t1.create,rF=t2.create,rR=t4.create,rP=t5.create,rZ=t3.create,rz=t7.create,r$=t6.create,rB=t8.create,rL=re.create,rU=t6.createWithPreprocess,rV=rs.create;var rq=Object.freeze({__proto__:null,defaultErrorMap:e3,setErrorMap:function(e){e7=e},getErrorMap:e6,makeIssue:e8,EMPTY_PATH:[],addIssueToContext:te,ParseStatus:tt,INVALID:tr,DIRTY:tn,OK:ti,isAborted:ta,isDirty:ts,isValid:to,isAsync:tu,get util(){return ag},get objectUtil(){return ay},ZodParsedType:e2,getParsedType:e4,ZodType:tp,datetimeRegex:tj,ZodString:tI,ZodNumber:tD,ZodBigInt:tF,ZodBoolean:tR,ZodDate:tP,ZodSymbol:tZ,ZodUndefined:tz,ZodNull:t$,ZodAny:tB,ZodUnknown:tL,ZodNever:tU,ZodVoid:tV,ZodArray:tq,ZodObject:tG,ZodUnion:tW,ZodDiscriminatedUnion:tH,ZodIntersection:tJ,ZodTuple:tY,ZodRecord:tX,ZodMap:tQ,ZodSet:t0,ZodFunction:t1,ZodLazy:t2,ZodLiteral:t4,ZodEnum:t5,ZodNativeEnum:t3,ZodPromise:t7,ZodEffects:t6,ZodTransformer:t6,ZodOptional:t8,ZodNullable:re,ZodDefault:rt,ZodCatch:rr,ZodNaN:rn,BRAND:ri,ZodBranded:ra,ZodPipeline:rs,ZodReadonly:ro,custom:rc,Schema:tp,ZodSchema:tp,late:rl,get ZodFirstPartyTypeKind(){return a_},coerce:{string:e=>tI.create({...e,coerce:!0}),number:e=>tD.create({...e,coerce:!0}),boolean:e=>tR.create({...e,coerce:!0}),bigint:e=>tF.create({...e,coerce:!0}),date:e=>tP.create({...e,coerce:!0})},any:rw,array:rM,bigint:rp,boolean:rm,date:rg,discriminatedUnion:rO,effect:r$,enum:rP,function:rD,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>rc(t=>t instanceof e,t),intersection:rA,lazy:rF,literal:rR,map:rj,nan:rh,nativeEnum:rZ,never:rx,null:rb,nullable:rL,number:rd,object:rS,oboolean:()=>rm().optional(),onumber:()=>rd().optional(),optional:rB,ostring:()=>rf().optional(),pipeline:rV,preprocess:rU,promise:rz,record:rC,set:rI,strictObject:rE,string:rf,symbol:ry,transformer:r$,tuple:rT,undefined:rv,union:rk,unknown:r_,void:rN,NEVER:tr,ZodIssueCode:e9,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:e5});let rG=rq.string().min(1,"Required").max(75,"Must be 75 or fewer characters long").regex(/^[a-zA-Z0-9_.-]+$/,"Must only contains alphanumerical characters and special characters _ . -"),rW=rq.object({name:rG}),rK=rW.extend({project:rG}),rH=rq.object({kind:rq.string().min(1,"Required"),spec:rq.record(rq.string(),rq.any())}),rJ=rq.object({name:rq.string().optional(),description:rq.string().optional()}),rY=rq.object({display:rJ.optional(),default:rq.boolean(),plugin:rH});function rX(e){return rq.object({display:rJ.optional(),default:rq.boolean(),plugin:e})}let rQ=rq.object({kind:rq.literal("Datasource"),metadata:rK,spec:rY}),r0=rq.object({kind:rq.literal("GlobalDatasource"),metadata:rW,spec:rY}),r1=rq.discriminatedUnion("kind",[rQ,r0]),r2=rq.object({name:rq.string().min(1),spec:rY});function r4(e){return rq.object({name:rq.string().min(1),spec:rX(e)})}let r9=rq.string().min(1,"Required").regex(Z,"Must be a valid duration string"),r5=rq.object({name:rq.string().min(1,{message:"Required"}),description:rq.string().optional()}),r3=rq.object({kind:rq.string().min(1),spec:rq.object({plugin:rH})}),r7=rq.object({name:rq.string().optional(),url:rq.string().min(1),tooltip:rq.string().optional(),renderVariables:rq.boolean().optional(),targetBlank:rq.boolean().optional()}),r6=rq.object({display:r5,plugin:rH,queries:rq.array(r3).optional(),links:rq.array(r7).optional()});function r8(e){return rq.object({display:r5,plugin:e,queries:rq.array(r3).optional(),links:rq.array(r7).optional()})}let ne=rq.object({kind:rq.literal("Panel"),spec:r6});function nt(e){return rq.object({kind:rq.literal("Panel"),spec:r8(e)})}let nr=rq.object({groupId:rq.number(),panelDefinition:ne});function nn(e){return rq.object({groupId:rq.number(),panelDefinition:nt(e)})}let ni=rq.object({actions:rq.array(rq.enum(["*","create","read","update","delete"])).nonempty("Must contains at least 1 action"),scopes:rq.array(rq.enum(["*","Dashboard","Datasource","EphemeralDashboard","Folder","GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","Project","Role","RoleBinding","Secret","User","Variable"])).nonempty("Must contains at least 1 scope")}),na=rq.object({permissions:rq.array(ni)}),ns=rq.object({kind:rq.literal("Role"),metadata:rK,spec:na}),no=rq.object({kind:rq.literal("GlobalRole"),metadata:rW,spec:na}),nu=rq.discriminatedUnion("kind",[ns,no]),nc=rq.object({kind:rq.enum(["User"]),name:rG}),nl=rq.object({role:rG,subjects:rq.array(nc).nonempty()}),nf=rq.object({kind:rq.literal("RoleBinding"),metadata:rK,spec:nl}),nd=rq.object({kind:rq.literal("GlobalRoleBinding"),metadata:rW,spec:nl}),nh=rq.discriminatedUnion("kind",[nf,nd]),np=rq.object({basicAuth:rq.object({username:rq.string().min(1),password:rq.string().optional(),passwordFile:rq.string().optional()}).superRefine((e,t)=>{e.password&&e.password.length>0&&e.passwordFile&&e.passwordFile.length>0&&(t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["password"]}),t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["passwordFile"]}))}).optional(),authorization:rq.object({type:rq.string().optional(),credentials:rq.string().optional(),credentialsFile:rq.string().optional()}).superRefine((e,t)=>{e.credentials&&e.credentials.length>0&&e.credentialsFile&&e.credentialsFile.length>0&&(t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["credentials"]}),t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["credentialsFile"]}))}).optional(),oauth:rq.object({clientID:rq.string().min(1),clientSecret:rq.string().optional(),clientSecretFile:rq.string().optional(),tokenURL:rq.string().min(1),scopes:rq.array(rq.string().nonempty()).default([]),endpointParams:rq.record(rq.string().nonempty(),rq.array(rq.string())).default({}).optional(),authStyle:rq.union([rq.literal(0),rq.literal(1),rq.literal(2)]).optional()}).superRefine((e,t)=>{e.clientSecret&&e.clientSecret.length>0&&e.clientSecretFile&&e.clientSecretFile.length>0&&(t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["clientSecret"]}),t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["clientSecretFile"]}))}).optional(),tlsConfig:rq.object({ca:rq.string().optional(),cert:rq.string().optional(),key:rq.string().optional(),caFile:rq.string().optional(),certFile:rq.string().optional(),keyFile:rq.string().optional(),serverName:rq.string().optional(),insecureSkipVerify:rq.boolean().optional()}).superRefine((e,t)=>{e.ca&&e.ca.length>0&&e.caFile&&e.caFile.length>0&&(t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["ca"]}),t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["caFile"]})),e.cert&&e.cert.length>0&&e.certFile&&e.certFile.length>0&&(t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["cert"]}),t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["certFile"]})),e.key&&e.key.length>0&&e.keyFile&&e.keyFile.length>0&&(t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["key"]}),t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["keyFile"]}))}).optional()}).superRefine((e,t)=>{e.basicAuth&&e.authorization&&e.oauth&&(t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["basicAuth"]}),t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["authorization"]}),t.addIssue({code:rq.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["oauth"]}))}),nm=rq.object({kind:rq.literal("Secret"),metadata:rK,spec:np}),ng=rq.object({kind:rq.literal("GlobalSecret"),metadata:rW,spec:np}),ny=rq.discriminatedUnion("kind",[nm,ng]),nv=rq.object({password:rq.string().optional()}),nb=rq.object({issuer:rq.string().optional(),email:rq.string().optional(),subject:rq.string().optional()}),nw=rq.object({firstName:rq.string().optional(),lastName:rq.string().optional(),nativeProvider:nv.optional(),oauthProviders:rq.array(nb).optional()}),n_=rq.object({kind:rq.literal("User"),metadata:rW,spec:nw}),nx=rq.object({name:rq.string().optional(),description:rq.string().optional(),hidden:rq.boolean().optional()}),nN=rq.object({name:rq.string().min(1),display:nx.optional(),defaultValue:rq.string().or(rq.array(rq.string())).optional(),allowAllValue:rq.boolean(),allowMultiple:rq.boolean(),customAllValue:rq.string().optional(),capturingRegexp:rq.string().optional(),sort:rq.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:rH});function nM(e){return rq.object({name:rq.string().min(1),display:nx.optional(),defaultValue:rq.string().or(rq.array(rq.string())).optional(),allowAllValue:rq.boolean(),allowMultiple:rq.boolean(),customAllValue:rq.string().optional(),capturingRegexp:rq.string().optional(),sort:rq.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:e})}let nS=rq.object({kind:rq.literal("ListVariable"),spec:nN});function nE(e){return rq.object({kind:rq.literal("ListVariable"),spec:nM(e)})}let nk=rq.object({name:rq.string().min(1),display:nx.optional(),value:rq.string(),constant:rq.boolean().optional()}),nO=rq.object({kind:rq.literal("TextVariable"),spec:nk}),nA=rq.discriminatedUnion("kind",[nO,nS]);function nT(e){return rq.union([nO,nE(e)])}let nC=rq.object({kind:rq.literal("Variable"),metadata:rK,spec:nA}),nj=rq.object({kind:rq.literal("GlobalVariable"),metadata:rK,spec:nA}),nI=rq.discriminatedUnion("kind",[nC,nj]),nD=nA;function nF(e){return rq.discriminatedUnion("kind",[rq.object({kind:rq.literal("ListVariable"),spec:nM(e)}),rq.object({kind:rq.literal("TextVariable"),spec:nk})])}var nR=r(54538);function nP(e){let t=(0,nR.useRef)(e);return(0,nR.useLayoutEffect)(()=>{t.current=e}),(0,nR.useCallback)((...e)=>t.current(...e),[])}async function nZ(...e){let t=await r.g.fetch(...e);if(!1===t.ok){let e=t.headers.get("content-type");if(e?.includes("application/json")){let e=await t.clone().json();if(e.error)throw new nB(e.error,t.status);if(e.message)throw new nB(e.message,t.status)}let r=await t.clone().text();if(r)throw new nB(r,t.status);throw new n$(t)}return t}async function nz(...e){let t=await nZ(...e);if(!t.ok)throw new n$(t);return await t.json()}class n$ extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,n$.prototype)}}class nB extends Error{status;constructor(e,t){super(e),this.status=t,Object.setPrototypeOf(this,nB.prototype)}}function nL(e){return 0===Object.getOwnPropertyNames(e).length}var nU=r(56141),nV=r.n(nU);function nq(e,t){let r=(0,nR.useRef)(),n=!0;for(let e=0;e<t.length;e++)if(r.current?.deps[e]!==t[e]){n=!1;break}return(void 0===r.current||!1===n)&&(r.current={value:e(),deps:t}),r.current.value}function nG(e,t){let r=(0,nR.useRef)();return(void 0===r.current||!1===nV()(t,r.current.deps))&&(r.current={value:e(),deps:t}),r.current.value}function nW(e,t){let r=nK(t),n=e.panels[r];if(void 0===n)throw Error(`Could not resolve panels reference ${t.$ref}`);return n}function nK(e){return e.$ref.substring(14)}function nH(e){return{$ref:`#/spec/panels/${e}`}}function nJ(e){return e.spec.spec?.display?.name?e.spec.spec.display.name:e.spec.display?.name?e.spec.display.name:e.metadata.name}function nY(e){return e.spec.spec?.display?.name?`${e.spec.spec.display.name} (ID: ${e.metadata.name})`:e.spec.display?.name?`${e.spec.display.name} (ID: ${e.metadata.name})`:e.metadata.name}var nX=r(70252);function nQ(e){return"number"==typeof e}function n0(e){return!!e&&"object"==typeof e&&"function"==typeof e.constructor&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function n1(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function n2(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function n4(e){return e&&!0===e.constructor.prototype.isUnit||!1}function n9(e){return"string"==typeof e}var n5=Array.isArray;function n3(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function n7(e){return Array.isArray(e)||n3(e)}function n6(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function n8(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function ie(e){return e&&!0===e.constructor.prototype.isRange||!1}function it(e){return e&&!0===e.constructor.prototype.isIndex||!1}function ir(e){return"boolean"==typeof e}function ii(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function ia(e){return e&&!0===e.constructor.prototype.isHelp||!1}function is(e){return"function"==typeof e}function io(e){return e instanceof Date}function iu(e){return e instanceof RegExp}function ic(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!n1(e)&&!n2(e))}function il(e){return null===e}function id(e){return void 0===e}function ih(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function ip(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function im(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function ig(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function iy(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function iv(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function ib(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function iw(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function i_(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function ix(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function iN(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function iM(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function iS(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function iE(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function ik(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function iO(e){return e&&!0===e.constructor.prototype.isChain||!1}function iA(e){var t=typeof e;return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":n0(e)?"BigNumber":n1(e)?"Complex":n2(e)?"Fraction":n3(e)?"Matrix":n4(e)?"Unit":it(e)?"Index":ie(e)?"Range":ii(e)?"ResultSet":ix(e)?e.type:iO(e)?"Chain":ia(e)?"Help":"Object":"function"===t?"Function":t}function iT(e){var t=typeof e;if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return iT(e)});if(e instanceof Date)return new Date(e.valueOf());if(n0(e))return e;if(e instanceof RegExp)throw TypeError("Cannot clone "+e);return iC(e,iT)}function iC(e,t){var r={};for(var n in e)iD(e,n)&&(r[n]=t(e[n]));return r}function ij(e,t){var r,n,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!ij(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(!(e instanceof Object))return e===t;if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!ij(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}function iI(e,t,r){var n,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(n=r(),i=!1),n},set:function(e){n=e,i=!1},configurable:!0,enumerable:!0})}function iD(e,t){return e&&Object.hasOwnProperty.call(e,t)}function iF(e){return Object.keys(e).map(t=>e[t])}var iR=r(8317);function iP(e,t,r,n){function i(n){var i=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],a=e[i];void 0!==a&&(r[i]=a)}return r}(n,t.map(iz));return function(e,t,r){if(!t.filter(e=>{var t;return!((t=e)&&"?"===t[0])}).every(e=>void 0!==r[e])){var n=t.filter(e=>void 0===r[e]);throw Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(n.map(e=>'"'.concat(e,'"')).join(", "),"."))}}(e,t,n),r(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),n&&(i.meta=n),i}function iZ(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function iz(e){return e&&"?"===e[0]?e.slice(1):e}function i$(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function iB(e,t,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!i$(r))throw Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!i$(e))throw Error("Value must be an integer");e<0&&(e+=2**r),n="i".concat(r)}var i="";return e<0&&(e=-e,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[t]).concat(e.toString(t)).concat(n)}function iL(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var r,n,i="auto";if(t&&(t.notation&&(i=t.notation),nQ(t)?r=t:nQ(t.precision)&&(r=t.precision),t.wordSize)&&"number"!=typeof(n=t.wordSize))throw Error('Option "wordSize" must be a number');switch(i){case"fixed":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=iU(e),n="number"==typeof t?iq(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,s=a+(t||0);return i.length<s&&(i=i.concat(iG(s-i.length))),a<0&&(i=iG(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,0===a?"0.":"."),n.sign+i.join("")}(e,r);case"exponential":return iV(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=iq(iU(e),t),n=r.exponent,i=r.coefficients,a=n%3==0?n:n<0?n-3-n%3:n-n%3;if(nQ(t))for(;t>i.length||n-a+1>i.length;)i.push(0);else for(var s=Math.abs(n-a)-(i.length-1),o=0;o<s;o++)i.push(0);for(var u=Math.abs(n-a),c=1;u>0;)c++,u--;var l=i.slice(c).join(""),f=nQ(t)&&l.length||l.match(/[1-9]/)?"."+l:"",d=i.slice(0,c).join("")+f+"e"+(n>=0?"+":"")+a.toString();return r.sign+d}(e,r);case"bin":return iB(e,2,n);case"oct":return iB(e,8,n);case"hex":return iB(e,16,n);case"auto":return(function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,a=iU(e),s=t?iq(a,t):a;if(s.exponent<n||s.exponent>=i)return iV(e,t);var o=s.coefficients,u=s.exponent;o.length<t&&(o=o.concat(iG(t-o.length))),o=o.concat(iG(u-o.length+1+(o.length<t?t-o.length:0))),o=iG(-u).concat(o);var c=u>0?u:0;return c<o.length-1&&o.splice(c+1,0,"."),s.sign+o.join("")})(e,r,t&&t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function iU(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var s=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===s.length&&(s.push(0),i++),{sign:r,coefficients:s,exponent:i}}function iV(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=iU(e),n=t?iq(r,t):r,i=n.coefficients,a=n.exponent;i.length<t&&(i=i.concat(iG(t-i.length)));var s=i.shift();return n.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function iq(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),i--,n[i]++}return r}function iG(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var iW=Number.EPSILON||2220446049250313e-31;function iK(e,t,r){if(null==r)return e===t;if(e===t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var n=Math.abs(e-t);return n<iW||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}function iH(e,t,r){var n=new e.constructor(2),i="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!i$(r))throw Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw Error("Base ".concat(t," not supported "))}}function iJ(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function iY(e,t){var r=function(e,t){var r;if("number"==typeof e)return iL(e,t);if(n0(e))return function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r="auto";if(void 0!==t&&(t.notation&&(r=t.notation),"number"==typeof t?f=t:t.precision&&(f=t.precision),t.wordSize)&&"number"!=typeof(d=t.wordSize))throw Error('Option "wordSize" must be a number');switch(r){case"fixed":return n=e,i=f,n.toFixed(i);case"exponential":return iJ(e,f);case"engineering":return a=e,s=f,u=(o=a.e)%3==0?o:o<0?o-3-o%3:o-o%3,-1!==(l=(c=a.mul(Math.pow(10,-u))).toPrecision(s)).indexOf("e")&&(l=c.toString()),l+"e"+(o>=0?"+":"")+u.toString();case"bin":return iH(e,2,d);case"oct":return iH(e,8,d);case"hex":return iH(e,16,d);case"auto":var n,i,a,s,o,u,c,l,f,d,h=t&&void 0!==t.lowerExp?t.lowerExp:-3,p=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var m=e.toSignificantDigits(f),g=m.e;return(g>=h&&g<p?m.toFixed():iJ(e,f)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t);if((r=e)&&"object"==typeof r&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d)if(!t||"decimal"!==t.fraction)return e.s*e.n+"/"+e.d;else return e.toString();if(Array.isArray(e))return function e(t,r){if(!Array.isArray(t))return iY(t,r);for(var n="[",i=t.length,a=0;a<i;a++)0!==a&&(n+=", "),n+=e(t[a],r);return n+"]"}(e,t);if(n9(e))return'"'+e+'"';if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e)if("function"==typeof e.format)return e.format(t);else return e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(r=>'"'+r+'": '+iY(e[r],t)).join(", ")+"}";return String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function iX(e,t,r){if(!(this instanceof iX))throw SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=Error().stack}function iQ(e,t,r){if(!(this instanceof iQ))throw SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function i0(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function i1(e,t){if(0===t.length){if(Array.isArray(e))throw new iX(e.length,0)}else!function e(t,r,n){var i,a=t.length;if(a!==r[n])throw new iX(a,r[n]);if(n<r.length-1){var s=n+1;for(i=0;i<a;i++){if(!Array.isArray(t[i]))throw new iX(r.length-1,r.length,"<");e(t[i],r,s)}}else for(i=0;i<a;i++)if(Array.isArray(t[i]))throw new iX(r.length+1,r.length,">")}(e,t,0)}function i2(e,t){if(!nQ(e)||!i$(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new iQ(e,t)}function i4(e,t,r){if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!nQ(e)||!i$(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+iY(t)+")")}),function e(t,r,n,i){var a,s,o=t.length,u=r[n],c=Math.min(o,u);if(t.length=u,n<r.length-1){var l=n+1;for(a=0;a<c;a++)Array.isArray(s=t[a])||(s=[s],t[a]=s),e(s,r,l,i);for(a=c;a<u;a++)s=[],t[a]=s,e(s,r,l,i)}else{for(a=0;a<c;a++)for(;Array.isArray(t[a]);)t[a]=t[a][0];for(a=c;a<u;a++)t[a]=i}}(e,t,0,void 0!==r?r:0),e}function i9(e,t){var r=i5(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(t%r==0)n[i]=-t/r;else throw Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);return n}function i5(e){return e.reduce((e,t)=>e*t,1)}function i3(e,t,r,n){var i=n||i0(e);if(r)for(var a=0;a<r;a++)e=[e],i.unshift(1);for(e=function e(t,r,n){var i,a;if(Array.isArray(t)){var s=n+1;for(i=0,a=t.length;i<a;i++)t[i]=e(t[i],r,s)}else for(var o=n;o<r;o++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function i7(e,t){for(var r,n=0,i=0;i<e.length;i++){var a=e[i],s=Array.isArray(a);if(0===i&&s&&(n=a.length),s&&a.length!==n)return;var o=s?i7(a,t):t(a);if(void 0===r)r=o;else if(r!==o)return"mixed"}return r}function i6(e,t){return -1!==e.indexOf(t)}function i8(e,t,r,n){if(!(this instanceof i8))throw SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=Error().stack}iX.prototype=RangeError(),iX.prototype.constructor=RangeError,iX.prototype.name="DimensionError",iX.prototype.isDimensionError=!0,iQ.prototype=RangeError(),iQ.prototype.constructor=RangeError,iQ.prototype.name="IndexError",iQ.prototype.isIndexError=!0,i8.prototype=Error(),i8.prototype.constructor=Error,i8.prototype.name="ArgumentsError",i8.prototype.isArgumentsError=!0;var ae={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},at=["Matrix","Array"],ar=["number","BigNumber","Fraction"];function an(e,t,r){var n;void 0!==e[t]&&(n=e[t],-1===r.indexOf(n))&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map(e=>JSON.stringify(e)).join(", ")+".")}var ai,aa,as,ao,au,ac,al,af,ad,ah,ap,am,ag,ay,av,ab,aw,a_,ax,aN,aM="0123456789abcdef",aS="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",aE="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ak={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},aO=!0,aA="[DecimalError] ",aT=aA+"Invalid argument: ",aC=aA+"Precision limit exceeded",aj=aA+"crypto unavailable",aI="[object Decimal]",aD=Math.floor,aF=Math.pow,aR=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,aP=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,aZ=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,az=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,a$=aS.length-1,aB=aE.length-1,aL={toStringTag:aI};function aU(e){var t,r,n,i=e.length-1,a="",s=e[0];if(i>0){for(a+=s,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(a+=a0(r)),a+=n;(r=7-(n=(s=e[t])+"").length)&&(a+=a0(r))}else if(0===s)return"0";for(;s%10==0;)s/=10;return a+s}function aV(e,t,r){if(e!==~~e||e<t||e>r)throw Error(aT+e)}function aq(e,t,r,n){var i,a,s,o;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),a=aF(10,7-t),o=e[i]%a|0,null==n?t<3?(0==t?o=o/100|0:1==t&&(o=o/10|0),s=r<4&&99999==o||r>3&&49999==o||5e4==o||0==o):s=(r<4&&o+1==a||r>3&&o+1==a/2)&&(e[i+1]/a/100|0)==aF(10,t-2)-1||(o==a/2||0==o)&&(e[i+1]/a/100|0)==0:t<4?(0==t?o=o/1e3|0:1==t?o=o/100|0:2==t&&(o=o/10|0),s=(n||r<4)&&9999==o||!n&&r>3&&4999==o):s=((n||r<4)&&o+1==a||!n&&r>3&&o+1==a/2)&&(e[i+1]/a/1e3|0)==aF(10,t-3)-1,s}function aG(e,t,r){for(var n,i,a=[0],s=0,o=e.length;s<o;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=aM.indexOf(e.charAt(s++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}aL.absoluteValue=aL.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),aK(e)},aL.ceil=function(){return aK(new this.constructor(this),this.e+1,2)},aL.clampedTo=aL.clamp=function(e,t){var r=this.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(aT+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new r(this)},aL.comparedTo=aL.cmp=function(e){var t,r,n,i,a=this.d,s=(e=new this.constructor(e)).d,o=this.s,u=e.s;if(!a||!s)return o&&u?o!==u?o:a===s?0:!a^o<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?o:s[0]?-u:0;if(o!==u)return o;if(this.e!==e.e)return this.e>e.e^o<0?1:-1;for(t=0,r=(n=a.length)<(i=s.length)?n:i;t<r;++t)if(a[t]!==s[t])return a[t]>s[t]^o<0?1:-1;return n===i?0:n>i^o<0?1:-1},aL.cosine=aL.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/a8(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=a6(e,1,t.times(i),new e(1));for(var a=r;a--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=r,t}(n,se(n,r)),n.precision=e,n.rounding=t,aK(2==aN||3==aN?r.neg():r,e,t,!0)):new n(1):new n(NaN)},aL.cubeRoot=aL.cbrt=function(){var e,t,r,n,i,a,s,o,u,c,l=this.constructor;if(!this.isFinite()||this.isZero())return new l(this);for(aO=!1,(a=this.s*aF(this.s*this,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=aU(this.d),(a=((e=this.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=aF(r,1/3),e=aD((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=this.s),s=(e=l.precision)+3;;)if(n=aW((c=(u=(o=n).times(o).times(o)).plus(this)).plus(this).times(o),c.plus(u),s+2,1),aU(o.d).slice(0,s)===(r=aU(n.d)).slice(0,s)){if("9999"!=(r=r.slice(s-3,s+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(aK(n,e+1,1),t=!n.times(n).times(n).eq(this));break}if(!i&&(aK(o,e+1,0),o.times(o).times(o).eq(this))){n=o;break}s+=4,i=1}return aO=!0,aK(n,e,l.rounding,t)},aL.decimalPlaces=aL.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-aD(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},aL.dividedBy=aL.div=function(e){return aW(this,new this.constructor(e))},aL.dividedToIntegerBy=aL.divToInt=function(e){var t=this.constructor;return aK(aW(this,new t(e),0,1,1),t.precision,t.rounding)},aL.equals=aL.eq=function(e){return 0===this.cmp(e)},aL.floor=function(){return aK(new this.constructor(this),this.e+1,3)},aL.greaterThan=aL.gt=function(e){return this.cmp(e)>0},aL.greaterThanOrEqualTo=aL.gte=function(e){var t=this.cmp(e);return 1==t||0===t},aL.hyperbolicCosine=aL.cosh=function(){var e,t,r,n,i,a=this,s=a.constructor,o=new s(1);if(!a.isFinite())return new s(a.s?1/0:NaN);if(a.isZero())return o;r=s.precision,n=s.rounding,s.precision=r+Math.max(a.e,a.sd())+4,s.rounding=1,(i=a.d.length)<32?t=(1/a8(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=a6(s,1,a.times(t),new s(1),!0);for(var u,c=e,l=new s(8);c--;)u=a.times(a),a=o.minus(u.times(l.minus(u.times(l))));return aK(a,s.precision=r,s.rounding=n,!0)},aL.hyperbolicSine=aL.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=a6(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=a6(a,2,i=i.times(1/a8(5,e)),i,!0);for(var s,o=new a(5),u=new a(16),c=new a(20);e--;)s=i.times(i),i=i.times(o.plus(s.times(u.times(s).plus(c))))}return a.precision=t,a.rounding=r,aK(i,t,r,!0)},aL.hyperbolicTangent=aL.tanh=function(){var e,t,r=this.constructor;return this.isFinite()?this.isZero()?new r(this):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,aW(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},aL.inverseCosine=aL.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return -1!==r?0===r?e.isNeg()?aX(t,n,i):new t(0):new t(NaN):e.isZero()?aX(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},aL.inverseHyperbolicCosine=aL.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,aO=!1,r=r.times(r).minus(1).sqrt().plus(r),aO=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},aL.inverseHyperbolicSine=aL.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,aO=!1,r=r.times(r).plus(1).sqrt().plus(r),aO=!0,n.precision=e,n.rounding=t,r.ln())},aL.inverseHyperbolicTangent=aL.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,Math.max(n=i.sd(),e)<-(2*i.e)-1)?aK(new a(i),e,t,!0):(a.precision=r=n-i.e,i=aW(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5)):new a(NaN)},aL.inverseSine=aL.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t)?0===t?((e=aX(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2))},aL.inverseTangent=aL.atan=function(){var e,t,r,n,i,a,s,o,u,c=this,l=c.constructor,f=l.precision,d=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);else if(c.abs().eq(1)&&f+4<=aB)return(s=aX(l,f+4,d).times(.25)).s=c.s,s}else{if(!c.s)return new l(NaN);if(f+4<=aB)return(s=aX(l,f+4,d).times(.5)).s=c.s,s}for(l.precision=o=f+10,l.rounding=1,e=r=Math.min(28,o/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(aO=!1,t=Math.ceil(o/7),n=1,u=c.times(c),s=new l(c),i=c;-1!==e;)if(i=i.times(u),a=s.minus(i.div(n+=2)),i=i.times(u),void 0!==(s=a.plus(i.div(n+=2))).d[t])for(e=t;s.d[e]===a.d[e]&&e--;);return r&&(s=s.times(2<<r-1)),aO=!0,aK(s,l.precision=f,l.rounding=d,!0)},aL.isFinite=function(){return!!this.d},aL.isInteger=aL.isInt=function(){return!!this.d&&aD(this.e/7)>this.d.length-2},aL.isNaN=function(){return!this.s},aL.isNegative=aL.isNeg=function(){return this.s<0},aL.isPositive=aL.isPos=function(){return this.s>0},aL.isZero=function(){return!!this.d&&0===this.d[0]},aL.lessThan=aL.lt=function(e){return 0>this.cmp(e)},aL.lessThanOrEqualTo=aL.lte=function(e){return 1>this.cmp(e)},aL.logarithm=aL.log=function(e){var t,r,n,i,a,s,o,u=this.constructor,c=u.precision,l=u.rounding;if(null==e)e=new u(10),t=!0;else{if(r=(e=new u(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new u(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t)if(r.length>1)i=!0;else{for(n=r[0];n%10==0;)n/=10;i=1!==n}if(aO=!1,aq((o=aW(a=a5(this,s=c+5),t?aY(u,s+10):a5(e,s),s,1)).d,n=c,l))do if(s+=10,o=aW(a=a5(this,s),t?aY(u,s+10):a5(e,s),s,1),!i){+aU(o.d).slice(n+1,n+15)+1==1e14&&(o=aK(o,c+1,0));break}while(aq(o.d,n+=10,l));return aO=!0,aK(o,c,l)},aL.minus=aL.sub=function(e){var t,r,n,i,a,s,o,u,c,l,f,d,h=this.constructor;if(e=new h(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new h(e.d||this.s!==e.s?this:NaN):e=new h(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(c=this.d,d=e.d,o=h.precision,u=h.rounding,!c[0]||!d[0]){if(d[0])e.s=-e.s;else{if(!c[0])return new h(3===u?-0:0);e=new h(this)}return aO?aK(e,o,u):e}if(r=aD(e.e/7),l=aD(this.e/7),c=c.slice(),a=l-r){for((f=a<0)?(t=c,a=-a,s=d.length):(t=d,r=l,s=c.length),a>(n=Math.max(Math.ceil(o/7),s)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((f=(n=c.length)<(s=d.length))&&(s=n),n=0;n<s;n++)if(c[n]!=d[n]){f=c[n]<d[n];break}a=0}for(f&&(t=c,c=d,d=t,e.s=-e.s),s=c.length,n=d.length-s;n>0;--n)c[s++]=0;for(n=d.length;n>a;){if(c[--n]<d[n]){for(i=n;i&&0===c[--i];)c[i]=1e7-1;--c[i],c[n]+=1e7}c[n]-=d[n]}for(;0===c[--s];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=aJ(c,r),aO?aK(e,o,u):e):new h(3===u?-0:0)},aL.modulo=aL.mod=function(e){var t,r=this.constructor;return(e=new r(e),this.d&&e.s&&(!e.d||e.d[0]))?e.d&&(!this.d||this.d[0])?(aO=!1,9==r.modulo?(t=aW(this,e.abs(),0,3,1),t.s*=e.s):t=aW(this,e,0,r.modulo,1),t=t.times(e),aO=!0,this.minus(t)):aK(new r(this),r.precision,r.rounding):new r(NaN)},aL.naturalExponential=aL.exp=function(){return a9(this)},aL.naturalLogarithm=aL.ln=function(){return a5(this)},aL.negated=aL.neg=function(){var e=new this.constructor(this);return e.s=-e.s,aK(e)},aL.plus=aL.add=function(e){var t,r,n,i,a,s,o,u,c,l,f=this.constructor;if(e=new f(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new f(e.d||this.s===e.s?this:NaN)):e=new f(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(c=this.d,l=e.d,o=f.precision,u=f.rounding,!c[0]||!l[0])return l[0]||(e=new f(this)),aO?aK(e,o,u):e;if(a=aD(this.e/7),n=aD(e.e/7),c=c.slice(),i=a-n){for(i<0?(r=c,i=-i,s=l.length):(r=l,n=a,s=c.length),i>(s=(a=Math.ceil(o/7))>s?a+1:s+1)&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((s=c.length)-(i=l.length)<0&&(i=s,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/1e7|0,c[i]%=1e7;for(t&&(c.unshift(t),++n),s=c.length;0==c[--s];)c.pop();return e.d=c,e.e=aJ(c,n),aO?aK(e,o,u):e},aL.precision=aL.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(aT+e);return this.d?(t=aQ(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},aL.round=function(){var e=this.constructor;return aK(new e(this),this.e+1,e.rounding)},aL.sine=aL.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:a6(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=a6(e,2,t=t.times(1/a8(5,r)),t);for(var i,a=new e(5),s=new e(16),o=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(s.times(i).minus(o))));return t}(n,se(n,r)),n.precision=e,n.rounding=t,aK(aN>2?r.neg():r,e,t,!0)):new n(NaN)},aL.squareRoot=aL.sqrt=function(){var e,t,r,n,i,a,s=this.d,o=this.e,u=this.s,c=this.constructor;if(1!==u||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?this:1/0);for(aO=!1,0==(u=Math.sqrt(+this))||u==1/0?(((t=aU(s)).length+o)%2==0&&(t+="0"),u=Math.sqrt(t),o=aD((o+1)/2)-(o<0||o%2),n=new c(t=u==1/0?"5e"+o:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+o)):n=new c(u.toString()),r=(o=c.precision)+3;;)if(n=(a=n).plus(aW(this,a,r+2,1)).times(.5),aU(a.d).slice(0,r)===(t=aU(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(aK(n,o+1,1),e=!n.times(n).eq(this));break}if(!i&&(aK(a,o+1,0),a.times(a).eq(this))){n=a;break}r+=4,i=1}return aO=!0,aK(n,o,c.rounding,e)},aL.tangent=aL.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=aW(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,aK(2==aN||4==aN?r.neg():r,e,t,!0)):new n(NaN)},aL.times=aL.mul=function(e){var t,r,n,i,a,s,o,u,c,l=this.constructor,f=this.d,d=(e=new l(e)).d;if(e.s*=this.s,!f||!f[0]||!d||!d[0])return new l(!e.s||f&&!f[0]&&!d||d&&!d[0]&&!f?NaN:!f||!d?e.s/0:0*e.s);for(r=aD(this.e/7)+aD(e.e/7),(u=f.length)<(c=d.length)&&(a=f,f=d,d=a,s=u,u=c,c=s),a=[],n=s=u+c;n--;)a.push(0);for(n=c;--n>=0;){for(t=0,i=u+n;i>n;)o=a[i]+d[n]*f[i-n-1]+t,a[i--]=o%1e7|0,t=o/1e7|0;a[i]=(a[i]+t)%1e7|0}for(;!a[--s];)a.pop();return t?++r:a.shift(),e.d=a,e.e=aJ(a,r),aO?aK(e,l.precision,l.rounding):e},aL.toBinary=function(e,t){return st(this,2,e,t)},aL.toDecimalPlaces=aL.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(aV(e,0,1e9),void 0===t?t=n.rounding:aV(t,0,8),aK(r,e+r.e+1,t))},aL.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=aH(n,!0):(aV(e,0,1e9),void 0===t?t=i.rounding:aV(t,0,8),r=aH(n=aK(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},aL.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?r=aH(this):(aV(e,0,1e9),void 0===t?t=i.rounding:aV(t,0,8),r=aH(n=aK(new i(this),e+this.e+1,t),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},aL.toFraction=function(e){var t,r,n,i,a,s,o,u,c,l,f,d,h=this.d,p=this.constructor;if(!h)return new p(this);if(c=r=new p(1),n=u=new p(0),s=(a=(t=new p(n)).e=aQ(h)-this.e-1)%7,t.d[0]=aF(10,s<0?7+s:s),null==e)e=a>0?t:c;else{if(!(o=new p(e)).isInt()||o.lt(c))throw Error(aT+o);e=o.gt(t)?a>0?t:c:o}for(aO=!1,o=new p(aU(h)),l=p.precision,p.precision=a=7*h.length*2;f=aW(o,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=c,c=u.plus(f.times(i)),u=i,i=t,t=o.minus(f.times(i)),o=i;return i=aW(e.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=this.s,d=1>aW(c,n,a,1).minus(this).abs().cmp(aW(u,r,a,1).minus(this).abs())?[c,n]:[u,r],p.precision=l,aO=!0,d},aL.toHexadecimal=aL.toHex=function(e,t){return st(this,16,e,t)},aL.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:aV(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(aO=!1,r=aW(r,e,0,t,1).times(e),aO=!0,aK(r)):(e.s=r.s,r=e),r},aL.toNumber=function(){return+this},aL.toOctal=function(e,t){return st(this,8,e,t)},aL.toPower=aL.pow=function(e){var t,r,n,i,a,s,o=this,u=o.constructor,c=+(e=new u(e));if(!o.d||!e.d||!o.d[0]||!e.d[0])return new u(aF(+o,c));if((o=new u(o)).eq(1))return o;if(n=u.precision,a=u.rounding,e.eq(1))return aK(o,n,a);if((t=aD(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=0x1fffffffffffff)return i=a1(u,o,r,n),e.s<0?new u(1).div(i):aK(i,n,a);if((s=o.s)<0){if(t<e.d.length-1)return new u(NaN);if((1&e.d[t])==0&&(s=1),0==o.e&&1==o.d[0]&&1==o.d.length)return o.s=s,o}return(t=0!=(r=aF(+o,c))&&isFinite(r)?new u(r+"").e:aD(c*(Math.log("0."+aU(o.d))/Math.LN10+o.e+1)))>u.maxE+1||t<u.minE-1?new u(t>0?s/0:0):(aO=!1,u.rounding=o.s=1,r=Math.min(12,(t+"").length),(i=a9(e.times(a5(o,n+r)),n)).d&&aq((i=aK(i,n+5,1)).d,n,a)&&(t=n+10,+aU((i=aK(a9(e.times(a5(o,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=aK(i,n+1,0))),i.s=s,aO=!0,u.rounding=a,aK(i,n,a))},aL.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=aH(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(aV(e,1,1e9),void 0===t?t=i.rounding:aV(t,0,8),r=aH(n=aK(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},aL.toSignificantDigits=aL.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(aV(e,1,1e9),void 0===t?t=r.rounding:aV(t,0,8)),aK(new r(this),e,t)},aL.toString=function(){var e=this.constructor,t=aH(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},aL.truncated=aL.trunc=function(){return aK(new this.constructor(this),this.e+1,1)},aL.valueOf=aL.toJSON=function(){var e=this.constructor,t=aH(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var aW=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=+(e[r]<t[r]),e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,s,o,u){var c,l,f,d,h,p,m,g,y,v,b,w,_,x,N,M,S,E,k,O,A=n.constructor,T=n.s==i.s?1:-1,C=n.d,j=i.d;if(!C||!C[0]||!j||!j[0])return new A(!n.s||!i.s||(C?j&&C[0]==j[0]:!j)?NaN:C&&0==C[0]||!j?0*T:T/0);for(u?(h=1,l=n.e-i.e):(u=1e7,h=7,l=aD(n.e/h)-aD(i.e/h)),k=j.length,S=C.length,v=(y=new A(T)).d=[],f=0;j[f]==(C[f]||0);f++);if(j[f]>(C[f]||0)&&l--,null==a?(x=a=A.precision,s=A.rounding):x=o?a+(n.e-i.e)+1:a,x<0)v.push(1),p=!0;else{if(x=x/h+2|0,f=0,1==k){for(d=0,j=j[0],x++;(f<S||d)&&x--;f++)N=d*u+(C[f]||0),v[f]=N/j|0,d=N%j|0;p=d||f<S}else{for((d=u/(j[0]+1)|0)>1&&(j=e(j,d,u),C=e(C,d,u),k=j.length,S=C.length),M=k,w=(b=C.slice(0,k)).length;w<k;)b[w++]=0;(O=j.slice()).unshift(0),E=j[0],j[1]>=u/2&&++E;do d=0,(c=t(j,b,k,w))<0?(_=b[0],k!=w&&(_=_*u+(b[1]||0)),(d=_/E|0)>1?(d>=u&&(d=u-1),g=(m=e(j,d,u)).length,w=b.length,1==(c=t(m,b,g,w))&&(d--,r(m,k<g?O:j,g,u))):(0==d&&(c=d=1),m=j.slice()),(g=m.length)<w&&m.unshift(0),r(b,m,w,u),-1==c&&(w=b.length,(c=t(j,b,k,w))<1&&(d++,r(b,k<w?O:j,w,u))),w=b.length):0===c&&(d++,b=[0]),v[f++]=d,c&&b[0]?b[w++]=C[M]||0:(b=[C[M]],w=1);while((M++<S||void 0!==b[0])&&x--);p=void 0!==b[0]}v[0]||v.shift()}if(1==h)y.e=l,ax=p;else{for(f=1,d=v[0];d>=10;d/=10)f++;y.e=f+l*h-1,aK(y,o?a+y.e+1:a,s,p)}return y}}();function aK(e,t,r,n){var i,a,s,o,u,c,l,f,d,h=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,o=f[0];o>=10;o/=10)i++;if((a=t-i)<0)a+=7,s=t,u=(l=f[d=0])/aF(10,i-s-1)%10|0;else if((d=Math.ceil((a+1)/7))>=(o=f.length))if(n){for(;o++<=d;)f.push(0);l=u=0,i=1,a%=7,s=a-7+1}else break e;else{for(i=1,l=o=f[d];o>=10;o/=10)i++;a%=7,u=(s=a-7+i)<0?0:l/aF(10,i-s-1)%10|0}if(n=n||t<0||void 0!==f[d+1]||(s<0?l:l%aF(10,i-s-1)),c=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(a>0?s>0?l/aF(10,i-s):0:f[d-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=aF(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==a?(f.length=d,o=1,d--):(f.length=d+1,o=aF(10,7-a),f[d]=s>0?(l/aF(10,i-s)%aF(10,s)|0)*o:0),c)for(;;)if(0==d){for(a=1,s=f[0];s>=10;s/=10)a++;for(s=f[0]+=o,o=1;s>=10;s/=10)o++;a!=o&&(e.e++,1e7==f[0]&&(f[0]=1));break}else{if(f[d]+=o,1e7!=f[d])break;f[d--]=0,o=1}for(a=f.length;0===f[--a];)f.pop()}return aO&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e<h.minE&&(e.e=0,e.d=[0])),e}function aH(e,t,r){if(!e.isFinite())return a3(e);var n,i=e.e,a=aU(e.d),s=a.length;return t?(r&&(n=r-s)>0?a=a.charAt(0)+"."+a.slice(1)+a0(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+a0(-i-1)+a,r&&(n=r-s)>0&&(a+=a0(n))):i>=s?(a+=a0(i+1-s),r&&(n=r-i-1)>0&&(a=a+"."+a0(n))):((n=i+1)<s&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(a+="."),a+=a0(n))),a}function aJ(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function aY(e,t,r){if(t>a$)throw aO=!0,r&&(e.precision=r),Error(aC);return aK(new e(aS),t,1,!0)}function aX(e,t,r){if(t>aB)throw Error(aC);return aK(new e(aE),t,r,!0)}function aQ(e){var t=e.length-1,r=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function a0(e){for(var t="";e--;)t+="0";return t}function a1(e,t,r,n){var i,a=new e(1),s=Math.ceil(n/7+4);for(aO=!1;;){if(r%2&&sr((a=a.times(t)).d,s)&&(i=!0),0===(r=aD(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}sr((t=t.times(t)).d,s)}return aO=!0,a}function a2(e){return 1&e.d[e.d.length-1]}function a4(e,t,r){for(var n,i,a=new e(t[0]),s=0;++s<t.length;){if(!(i=new e(t[s])).s){a=i;break}((n=a.cmp(i))===r||0===n&&a.s===r)&&(a=i)}return a}function a9(e,t){var r,n,i,a,s,o,u,c=0,l=0,f=0,d=e.constructor,h=d.rounding,p=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?!e.d[0]?1:e.s<0?0:1/0:e.s?e.s<0?0:e:0/0);for(null==t?(aO=!1,u=p):u=t,o=new d(.03125);e.e>-2;)e=e.times(o),f+=5;for(u+=n=Math.log(aF(2,f))/Math.LN10*2+5|0,r=a=s=new d(1),d.precision=u;;){if(a=aK(a.times(e),u,1),r=r.times(++l),aU((o=s.plus(aW(a,r,u,1))).d).slice(0,u)===aU(s.d).slice(0,u)){for(i=f;i--;)s=aK(s.times(s),u,1);if(null!=t)return d.precision=p,s;if(!(c<3&&aq(s.d,u-n,h,c)))return aK(s,d.precision=p,h,aO=!0);d.precision=u+=10,r=a=o=new d(1),l=0,c++}s=o}}function a5(e,t){var r,n,i,a,s,o,u,c,l,f,d,h=1,p=e,m=p.d,g=p.constructor,y=g.rounding,v=g.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new g(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(aO=!1,l=v):l=t,g.precision=l+=10,n=(r=aU(m)).charAt(0),!(15e14>Math.abs(a=p.e)))return c=aY(g,l+2,v).times(a+""),p=a5(new g(n+"."+r.slice(1)),l-10).plus(c),g.precision=v,null==t?aK(p,v,y,aO=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=aU((p=p.times(e)).d)).charAt(0),h++;for(a=p.e,n>1?(p=new g("0."+r),a++):p=new g(n+"."+r.slice(1)),f=p,u=s=p=aW(p.minus(1),p.plus(1),l,1),d=aK(p.times(p),l,1),i=3;;){if(s=aK(s.times(d),l,1),aU((c=u.plus(aW(s,new g(i),l,1))).d).slice(0,l)===aU(u.d).slice(0,l)){if(u=u.times(2),0!==a&&(u=u.plus(aY(g,l+2,v).times(a+""))),u=aW(u,new g(h),l,1),null!=t)return g.precision=v,u;if(!aq(u.d,l-10,y,o))return aK(u,g.precision=v,y,aO=!0);g.precision=l+=10,c=s=p=aW(f.minus(1),f.plus(1),l,1),d=aK(p.times(p),l,1),i=o=1}u=c,i+=2}}function a3(e){return String(e.s*e.s/0)}function a7(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=7;n<i;)e.d.push(+t.slice(n,n+=7));n=7-(t=t.slice(n)).length}else n-=i;for(;n--;)t+="0";e.d.push(+t),aO&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function a6(e,t,r,n,i){var a,s,o,u,c=e.precision,l=Math.ceil(c/7);for(aO=!1,u=r.times(r),o=new e(n);;){if(s=aW(o.times(u),new e(t++*t++),c,1),o=i?n.plus(s):n.minus(s),n=aW(s.times(u),new e(t++*t++),c,1),void 0!==(s=o.plus(n)).d[l]){for(a=l;s.d[a]===o.d[a]&&a--;);if(-1==a)break}a=o,o=n,n=s,s=a}return aO=!0,s.d.length=l+1,s}function a8(e,t){for(var r=e;--t;)r*=e;return r}function se(e,t){var r,n=t.s<0,i=aX(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return aN=n?4:1,t;if((r=t.divToInt(i)).isZero())aN=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return aN=a2(r)?n?2:3:n?4:1,t;aN=a2(r)?n?1:4:n?3:2}return t.minus(i).abs()}function st(e,t,r,n){var i,a,s,o,u,c,l,f,d,h=e.constructor,p=void 0!==r;if(p?(aV(r,1,1e9),void 0===n?n=h.rounding:aV(n,0,8)):(r=h.precision,n=h.rounding),e.isFinite()){for(s=(l=aH(e)).indexOf("."),p?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,s>=0&&(l=l.replace(".",""),(d=new h(1)).e=l.length-s,d.d=aG(aH(d),10,i),d.e=d.d.length),a=u=(f=aG(l,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(s<0?a--:((e=new h(e)).d=f,e.e=a,f=(e=aW(e,d,r,n,0,i)).d,a=e.e,c=ax),s=f[r],o=i/2,c=c||void 0!==f[r+1],c=n<4?(void 0!==s||c)&&(0===n||n===(e.s<0?3:2)):s>o||s===o&&(4===n||c||6===n&&1&f[r-1]||n===(e.s<0?8:7)),f.length=r,c)for(;++f[--r]>i-1;)f[r]=0,r||(++a,f.unshift(1));for(u=f.length;!f[u-1];--u);for(s=0,l="";s<u;s++)l+=aM.charAt(f[s]);if(p){if(u>1)if(16==t||8==t){for(s=16==t?4:3,--u;u%s;u++)l+="0";for(u=(f=aG(l,i,t)).length;!f[u-1];--u);for(s=1,l="1.";s<u;s++)l+=aM.charAt(f[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)l="0"+l;l="0."+l}else if(++a>u)for(a-=u;a--;)l+="0";else a<u&&(l=l.slice(0,a)+"."+l.slice(a))}else l=p?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=a3(e);return e.s<0?"-"+l:l}function sr(e,t){if(e.length>t)return e.length=t,!0}function sn(e){return new this(e).abs()}function si(e){return new this(e).acos()}function sa(e){return new this(e).acosh()}function ss(e,t){return new this(e).plus(t)}function so(e){return new this(e).asin()}function su(e){return new this(e).asinh()}function sc(e){return new this(e).atan()}function sl(e){return new this(e).atanh()}function sf(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?aX(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=aX(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(aW(e,t,a,1)),t=aX(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(aW(e,t,a,1)):(r=aX(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function sd(e){return new this(e).cbrt()}function sh(e){return aK(e=new this(e),e.e+1,2)}function sp(e,t,r){return new this(e).clamp(t,r)}function sm(e){if(!e||"object"!=typeof e)throw Error(aA+"Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(t=0;t<a.length;t+=3)if(r=a[t],i&&(this[r]=ak[r]),void 0!==(n=e[r]))if(aD(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(aT+r+": "+n);if(r="crypto",i&&(this[r]=ak[r]),void 0!==(n=e[r]))if(!0===n||!1===n||0===n||1===n)if(n)if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(aj);else this[r]=!1;else throw Error(aT+r+": "+n);return this}function sg(e){return new this(e).cos()}function sy(e){return new this(e).cosh()}function sv(e,t){return new this(e).div(t)}function sb(e){return new this(e).exp()}function sw(e){return aK(e=new this(e),e.e+1,3)}function s_(){var e,t,r=new this(0);for(e=0,aO=!1;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return aO=!0,new this(1/0);r=t}return aO=!0,r.sqrt()}function sx(e){return e instanceof sU||e&&e.toStringTag===aI||!1}function sN(e){return new this(e).ln()}function sM(e,t){return new this(e).log(t)}function sS(e){return new this(e).log(2)}function sE(e){return new this(e).log(10)}function sk(){return a4(this,arguments,-1)}function sO(){return a4(this,arguments,1)}function sA(e,t){return new this(e).mod(t)}function sT(e,t){return new this(e).mul(t)}function sC(e,t){return new this(e).pow(t)}function sj(e){var t,r,n,i,a=0,s=new this(1),o=[];if(void 0===e?e=this.precision:aV(e,1,1e9),n=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=t[a])>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:o[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);a<n;)(i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((127&t[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,a):(o.push(i%1e7),a+=4);a=n/4}else throw Error(aj);else for(;a<n;)o[a++]=1e7*Math.random()|0;for(n=o[--a],e%=7,n&&e&&(i=aF(10,7-e),o[a]=(n/i|0)*i);0===o[a];a--)o.pop();if(a<0)r=0,o=[0];else{for(r=-1;0===o[0];r-=7)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return s.e=r,s.d=o,s}function sI(e){return aK(e=new this(e),e.e+1,this.rounding)}function sD(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function sF(e){return new this(e).sin()}function sR(e){return new this(e).sinh()}function sP(e){return new this(e).sqrt()}function sZ(e,t){return new this(e).sub(t)}function sz(){var e=0,t=arguments,r=new this(t[0]);for(aO=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return aO=!0,aK(r,this.precision,this.rounding)}function s$(e){return new this(e).tan()}function sB(e){return new this(e).tanh()}function sL(e){return aK(e=new this(e),e.e+1,1)}aL[Symbol.for("nodejs.util.inspect.custom")]=aL.toString,aL[Symbol.toStringTag]="Decimal";var sU=aL.constructor=function e(t){var r,n,i;function a(e){var t,r,n;if(!(this instanceof a))return new a(e);if(this.constructor=a,sx(e)){this.s=e.s,aO?!e.d||e.e>a.maxE?(this.e=NaN,this.d=null):e.e<a.minE?(this.e=0,this.d=[0]):(this.e=e.e,this.d=e.d.slice()):(this.e=e.e,this.d=e.d?e.d.slice():e.d);return}if("number"==(n=typeof e)){if(0===e){this.s=1/e<0?-1:1,this.e=0,this.d=[0];return}if(e<0?(e=-e,this.s=-1):this.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;aO?t>a.maxE?(this.e=NaN,this.d=null):t<a.minE?(this.e=0,this.d=[0]):(this.e=t,this.d=[e]):(this.e=t,this.d=[e]);return}if(0*e!=0){e||(this.s=NaN),this.e=NaN,this.d=null;return}return a7(this,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),this.s=-1):(43===r&&(e=e.slice(1)),this.s=1),az.test(e)?a7(this,e):function(e,t){var r,n,i,a,s,o,u,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),az.test(t))return a7(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(aP.test(t))r=16,t=t.toLowerCase();else if(aR.test(t))r=2;else if(aZ.test(t))r=8;else throw Error(aT+t);for((a=t.search(/p/i))>0?(u=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),s=(a=t.indexOf("."))>=0,n=e.constructor,s&&(a=(o=(t=t.replace(".","")).length)-a,i=a1(n,new n(r),a,2*a)),a=l=(c=aG(t,r,1e7)).length-1;0===c[a];--a)c.pop();return a<0?new n(0*e.s):(e.e=aJ(c,l),e.d=c,aO=!1,s&&(e=aW(e,i,4*o)),u&&(e=e.times(54>Math.abs(u)?aF(2,u):sU.pow(2,u))),aO=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,a7(this,e.toString());throw Error(aT+e)}if(a.prototype=aL,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=a.set=sm,a.clone=e,a.isDecimal=sx,a.abs=sn,a.acos=si,a.acosh=sa,a.add=ss,a.asin=so,a.asinh=su,a.atan=sc,a.atanh=sl,a.atan2=sf,a.cbrt=sd,a.ceil=sh,a.clamp=sp,a.cos=sg,a.cosh=sy,a.div=sv,a.exp=sb,a.floor=sw,a.hypot=s_,a.ln=sN,a.log=sM,a.log10=sE,a.log2=sS,a.max=sk,a.min=sO,a.mod=sA,a.mul=sT,a.pow=sC,a.random=sj,a.round=sI,a.sign=sD,a.sin=sF,a.sinh=sR,a.sqrt=sP,a.sub=sZ,a.sum=sz,a.tan=s$,a.tanh=sB,a.trunc=sL,void 0===t&&(t={}),t&&!0!==t.defaults)for(r=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return a.config(t),a}(ak);aS=new sU(aS),aE=new sU(aE);var sV={createBigNumberClass:iP("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=sU.clone({precision:r.precision,modulo:sU.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})}),n},{isClass:!0})},sq={createMatrixClass:iP("Matrix",[],()=>{function e(){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0})},sG={MatrixDependencies:sq,createDenseMatrixClass:iP("DenseMatrix",["Matrix"],e=>{var{Matrix:t}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator");if(t&&!n9(t))throw Error("Invalid datatype: "+t);if(n3(e))"DenseMatrix"===e.type?(this._data=iT(e._data),this._size=iT(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&n5(e.data)&&n5(e.size))this._data=e.data,this._size=e.size,i1(this._data,this._size),this._datatype=t||e.datatype;else if(n5(e))this._data=function e(t){for(var r=0,n=t.length;r<n;r++){var i=t[r];n5(i)?t[r]=e(i):i&&!0===i.isMatrix&&(t[r]=e(i.valueOf()))}return t}(e),this._size=i0(this._data),i1(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+iA(e)+")");else this._data=[],this._size=[0],this._datatype=t}function n(e,t,r){if(0===t.length){for(var n=e._data;n5(n);)n=n[0];return n}return e._size=t.slice(0),e._data=i4(e._data,e._size,r),e}function i(e,t,r){for(var i=e._size.slice(0),a=!1;i.length<t.length;)i.push(0),a=!0;for(var s=0,o=t.length;s<o;s++)t[s]>i[s]&&(i[s]=t[s],a=!0);a&&n(e,i,r)}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return i7(this._data,iA)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return function(e,t){if(!it(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var n=t.size();if(n.length!==e._size.length)throw new iX(n.length,e._size.length);for(var i=t.min(),a=t.max(),s=0,o=e._size.length;s<o;s++)i2(i[s],e._size[s]),i2(a[s],e._size[s]);return new r(function e(t,r,n,i){var a=i===n-1,s=r.dimension(i);return a?s.map(function(e){return i2(e,t.length),t[e]}).valueOf():s.map(function(a){return i2(a,t.length),e(t[a],r,n,i+1)}).valueOf()}(e._data,t,n.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var a,s=t.size(),o=t.isScalar();if(n3(r)?(a=r.size(),r=r.valueOf()):a=i0(r),o){if(0!==a.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(s.length<e._size.length)throw new iX(s.length,e._size.length,"<");if(a.length<s.length){for(var u=0,c=0;1===s[u]&&1===a[u];)u++;for(;1===s[u];)c++,u++;r=i3(r,s.length,c,a)}if(!ij(s,a))throw new iX(s,a,">");i(e,t.max().map(function(e){return e+1}),n);var l=s.length;!function e(t,r,n,i,a){var s=a===i-1,o=r.dimension(a);s?o.forEach(function(e,r){i2(e),t[e]=n[r[0]]}):o.forEach(function(s,o){i2(s),e(t[s],r,n[o[0]],i,a+1)})}(e._data,t,r,l,0)}return e}(this,e,t,n);default:throw SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!n5(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new iX(e.length,this._size.length);for(var t=0;t<e.length;t++)i2(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var a=e[n];i2(a,r.length),r=r[a]}return r},r.prototype.set=function(e,t,r){if(!n5(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new iX(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),r);var n,a,s,o=this._data;for(n=0,a=e.length-1;n<a;n++)i2(s=e[n],o.length),o=o[s];return i2(s=e[e.length-1],o.length),o[s]=t,this},r.prototype.resize=function(e,t,r){if(!n7(e))throw TypeError("Array or Matrix expected");var i=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return n(r?this.clone():this,i,t)},r.prototype.reshape=function(e,t){var r=t?this.clone():this;r._data=function(e,t){var r=function(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function e(r){Array.isArray(r)?r.forEach(e):t.push(r)}),t}(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw new iX(0,n,"!=");var i=i5(t=i9(t,n));if(n!==i)throw new iX(i,n,"!=");try{return function(e,t){for(var r,n=e,i=t.length-1;i>0;i--){var a=t[i];r=[];for(var s=n.length/a,o=0;o<s;o++)r.push(n.slice(o*a,(o+1)*a));n=r}return n}(r,t)}catch(e){if(e instanceof iX)throw new iX(i,n,"!=");throw e}}(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=i9(e,n),r},r.prototype.clone=function(){return new r({data:iT(this._data),size:iT(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){var t=this,n=function r(n,i){return n5(n)?n.map(function(e,t){return r(e,i.concat(t))}):e(n,i,t)}(this._data,[]),i=void 0!==this._datatype?i7(n,iA):void 0;return new r(n,i)},r.prototype.forEach=function(e){var t=this;!function r(n,i){n5(n)?n.forEach(function(e,t){r(e,i.concat(t))}):e(n,i,t)}(this._data,[])},r.prototype[Symbol.iterator]=function*(){var e=function* e(t,r){if(n5(t))for(var n=0;n<t.length;n++)yield*e(t[n],r.concat(n));else yield{value:t,index:r}};yield*e(this._data,[])},r.prototype.rows=function(){var e=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var t of this._data)e.push(new r([t],this._datatype));return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(2!==n.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,a=function(n){var a=i.map(e=>[e[n]]);t.push(new r(a,e._datatype))},s=0;s<n[1];s++)a(s);return t},r.prototype.toArray=function(){return iT(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return iY(this._data,e)},r.prototype.toString=function(){return iY(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(n0(e)&&(e=e.toNumber()),!nQ(e)||!i$(e))throw TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,n=e<0?-e:0,i=Math.min(this._size[0]-n,this._size[1]-t),a=[],s=0;s<i;s++)a[s]=this._data[s+n][s+t];return new r({data:a,size:[i],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!n5(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(n0(e)&&(e=e.toNumber()),!nQ(e)||!i$(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if(n0(n)&&(n=n.toNumber()),!nQ(n)||!i$(n))throw TypeError("The parameter k must be an integer number")}else n=0;var a,s=n>0?n:0,o=n<0?-n:0,u=e[0],c=e[1],l=Math.min(u-o,c-s);if(n5(t)){if(t.length!==l)throw Error("Invalid value array length");a=function(e){return t[e]}}else if(n3(t)){var f=t.size();if(1!==f.length||f[0]!==l)throw Error("Invalid matrix length");a=function(e){return t.get([e])}}else a=function(){return t};i||(i=n0(a(0))?a(0).mul(0):0);var d=[];if(e.length>0){d=i4(d,e,i);for(var h=0;h<l;h++)d[h+o][h+s]=a(h)}return new r({data:d,size:[u,c]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!nQ(e)||!i$(e)||!nQ(t)||!i$(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return i2(e,this._size[0]),i2(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},r},{isClass:!0})};let sW=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},sK=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},sH=function(e){let t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;let r=e*e;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/0x144c3b2800)+1/0x1c8cfc00)-1/3628800)+1/40320)-1/720)+1/24)-.5)},sJ=function(e,t){return((e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8)?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},sY=function(){throw SyntaxError("Invalid Param")};function sX(e,t){let r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):.5*Math.log((e*=.5)*e+(t*=.5)*t)+Math.LN2}let sQ={re:0,im:0},s0=function(e,t){if(null==e)sQ.re=sQ.im=0;else if(void 0!==t)sQ.re=e,sQ.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)sQ.re=e.re,sQ.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return s1.INFINITY;sQ.re=e.abs*Math.cos(e.arg),sQ.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return s1.INFINITY;sQ.re=e.r*Math.cos(e.phi),sQ.im=e.r*Math.sin(e.phi)}else 2===e.length?(sQ.re=e[0],sQ.im=e[1]):sY();break;case"string":sQ.im=sQ.re=0;let r=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&sY();for(let e=0;e<r.length;e++){let t=r[e];" "===t||" "===t||"\n"===t||("+"===t?n++:"-"===t?i++:("i"===t||"I"===t?(n+i===0&&sY()," "===r[e+1]||isNaN(r[e+1])?sQ.im+=parseFloat((i%2?"-":"")+"1"):(sQ.im+=parseFloat((i%2?"-":"")+r[e+1]),e++)):((n+i===0||isNaN(t))&&sY(),"i"===r[e+1]||"I"===r[e+1]?(sQ.im+=parseFloat((i%2?"-":"")+t),e++):sQ.re+=parseFloat((i%2?"-":"")+t)),n=i=0))}n+i>0&&sY();break;case"number":sQ.im=0,sQ.re=e;break;default:sY()}return isNaN(sQ.re)||isNaN(sQ.im),sQ};function s1(e,t){if(!(this instanceof s1))return new s1(e,t);let r=s0(e,t);this.re=r.re,this.im=r.im}s1.prototype={re:0,im:0,sign:function(){let e=sJ(this.re,this.im);return new s1(this.re/e,this.im/e)},add:function(e,t){let r=s0(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?s1.NAN:s1.INFINITY:new s1(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=s0(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?s1.NAN:s1.INFINITY:new s1(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=s0(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=0===this.re&&0===this.im,s=0===r.re&&0===r.im;return n&&s||i&&a?s1.NAN:n||i?s1.INFINITY:0===r.im&&0===this.im?new s1(this.re*r.re,0):new s1(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=s0(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=0===this.re&&0===this.im,s=0===r.re&&0===r.im;if(a&&s||n&&i)return s1.NAN;if(s||n)return s1.INFINITY;if(a||i)return s1.ZERO;if(0===r.im)return new s1(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let e=r.re/r.im,t=r.re*e+r.im;return new s1((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{let e=r.im/r.re,t=r.im*e+r.re;return new s1((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let r=s0(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return s1.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new s1(Math.pow(this.re,r.re),0);else if(0===this.re)switch((r.re%4+4)%4){case 0:return new s1(Math.pow(this.im,r.re),0);case 1:return new s1(0,Math.pow(this.im,r.re));case 2:return new s1(-Math.pow(this.im,r.re),0);case 3:return new s1(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return s1.ZERO;let i=Math.atan2(this.im,this.re),a=sX(this.re,this.im),s=Math.exp(r.re*a-r.im*i),o=r.im*a+r.re*i;return new s1(s*Math.cos(o),s*Math.sin(o))},sqrt:function(){let e=this.re,t=this.im;if(0===t)if(e>=0)return new s1(Math.sqrt(e),0);else return new s1(0,Math.sqrt(-e));let r=Math.sqrt(.5*(sJ(e,t)+Math.abs(e))),n=Math.abs(t)/(2*r);return e>=0?new s1(r,t<0?-n:n):new s1(n,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new s1(e,0):new s1(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,t=this.im;return new s1(Math.expm1(e)*Math.cos(t)+sH(t),Math.exp(e)*Math.sin(t))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new s1(Math.log(e),0):new s1(sX(e,t),Math.atan2(t,e))},abs:function(){return sJ(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new s1(Math.sin(e)*sW(t),Math.cos(e)*sK(t))},cos:function(){let e=this.re,t=this.im;return new s1(Math.cos(e)*sW(t),-Math.sin(e)*sK(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+sW(t);return new s1(Math.sin(e)/r,sK(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-sW(t);return new s1(-Math.sin(e)/r,sK(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*sW(2*t)+.5*Math.cos(2*e);return new s1(Math.cos(e)*sW(t)/r,Math.sin(e)*sK(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*sW(2*t)-.5*Math.cos(2*e);return new s1(Math.sin(e)*sW(t)/r,-Math.cos(e)*sK(t)/r)},asin:function(){let e=this.re,t=this.im,r=new s1(t*t-e*e+1,-2*e*t).sqrt(),n=new s1(r.re-t,r.im+e).log();return new s1(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new s1(t*t-e*e+1,-2*e*t).sqrt(),n=new s1(r.re-t,r.im+e).log();return new s1(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new s1(0,1/0);if(-1===t)return new s1(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new s1((1-t*t-e*e)/r,-2*e/r).log();return new s1(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new s1(Math.atan2(1,e),0);let r=e*e+t*t;return 0!==r?new s1(e/r,-t/r).atan():new s1(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new s1(0,1/0);let r=e*e+t*t;return 0!==r?new s1(e/r,-t/r).acos():new s1(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new s1(Math.PI/2,1/0);let r=e*e+t*t;return 0!==r?new s1(e/r,-t/r).asin():new s1(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new s1(sK(e)*Math.cos(t),sW(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new s1(sW(e)*Math.cos(t),sK(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=sW(e)+Math.cos(t);return new s1(sK(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=sW(e)-Math.cos(t);return new s1(sK(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-sW(2*e);return new s1(-2*sK(e)*Math.cos(t)/r,2*sW(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+sW(2*e);return new s1(2*sW(e)*Math.cos(t)/r,-2*sK(e)*Math.sin(t)/r)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;let t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){let e=this.acos();if(e.im<=0){let t=e.re;e.re=-e.im,e.im=t}else{let t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){let e=this.re,t=this.im,r=1-e,n=1+e,i=r*r+t*t,a=0!==i?new s1((n*r-t*t)/i,(t*r+n*t)/i):new s1(-1!==e?e/0:0,0!==t?t/0:0),s=a.re;return a.re=sX(a.re,a.im)/2,a.im=Math.atan2(a.im,s)/2,e>1&&0===t&&(a.im=-a.im),a},acoth:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new s1(0,Math.PI/2);let r=e*e+t*t;return 0!==r?new s1(e/r,-t/r).atanh():new s1(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(0===t)return new s1(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);let r=e*e+t*t;return 0!==r?new s1(e/r,-t/r).asinh():new s1(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return s1.INFINITY;let r=e*e+t*t;return 0!==r?new s1(e/r,-t/r).acosh():new s1(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return s1.INFINITY;if(this.isInfinite())return s1.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new s1(e/r,-t/r)},conjugate:function(){return new s1(this.re,-this.im)},neg:function(){return new s1(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new s1(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new s1(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new s1(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=s0(e,t);return Math.abs(r.re-this.re)<=s1.EPSILON&&Math.abs(r.im-this.im)<=s1.EPSILON},clone:function(){return new s1(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<s1.EPSILON&&(e=0),Math.abs(t)<s1.EPSILON&&(t=0),0===t)?r+e:(0!==e?(r+=e,r+=" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),1!==t&&(r+=t),r+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},s1.ZERO=new s1(0,0),s1.ONE=new s1(1,0),s1.I=new s1(0,1),s1.PI=new s1(Math.PI,0),s1.E=new s1(Math.E,0),s1.INFINITY=new s1(1/0,1/0),s1.NAN=new s1(NaN,NaN),s1.EPSILON=1e-15;var s2=iP("Complex",[],()=>(s1.prototype.type="Complex",s1.prototype.isComplex=!0,s1.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},s1.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},s1.prototype.format=function(e){var t=this.im,r=this.re,n=iL(this.re,e),i=iL(this.im,e),a=nQ(e)?e:e?e.precision:null;if(null!==a){var s=Math.pow(10,-a);Math.abs(r/t)<s&&(r=0),Math.abs(t/r)<s&&(t=0)}return 0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},s1.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return s1(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if(nQ(r)){if(n4(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),nQ(n))return new s1({r,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},s1.prototype.valueOf=s1.prototype.toString,s1.fromJSON=function(e){return new s1(e)},s1.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},s1),{isClass:!0}),s4={s:1,n:0,d:1};function s9(e,t){if(isNaN(e=parseInt(e,10)))throw ot();return e*t}function s5(e,t){if(0===t)throw oe();var r=Object.create(s8.prototype);r.s=e<0?-1:1;var n=s6(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function s3(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var s7=function(e,t){var r,n=0,i=1,a=1,s=0,o=0,u=0,c=1,l=1,f=0,d=1,h=1,p=1;if(null==e);else if(void 0!==t){if(a=(n=e)*(i=t),n%1!=0||i%1!=0)throw or()}else switch(typeof e){case"object":if("d"in e&&"n"in e)n=e.n,i=e.d,"s"in e&&(n*=e.s);else if(0 in e)n=e[0],1 in e&&(i=e[1]);else throw ot();a=n*i;break;case"number":if(e<0&&(a=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(l=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=l);d<=1e7&&p<=1e7;){if(e===(r=(f+h)/(d+p))){d+p<=1e7?(n=f+h,i=d+p):p>d?(n=h,i=p):(n=f,i=d);break}e>r?(f+=h,d+=p):(h+=f,p+=d),d>1e7?(n=h,i=p):(n=f,i=d)}n*=l}else(isNaN(e)||isNaN(t))&&(i=n=NaN);break;case"string":if(null===(d=e.match(/\d+|./g)))throw ot();if("-"===d[f]?(a=-1,f++):"+"===d[f]&&f++,d.length===f+1?o=s9(d[f++],a):"."===d[f+1]||"."===d[f]?("."!==d[f]&&(s=s9(d[f++],a)),(++f+1===d.length||"("===d[f+1]&&")"===d[f+3]||"'"===d[f+1]&&"'"===d[f+3])&&(o=s9(d[f],a),c=Math.pow(10,d[f].length),f++),("("===d[f]&&")"===d[f+2]||"'"===d[f]&&"'"===d[f+2])&&(u=s9(d[f+1],a),l=Math.pow(10,d[f+1].length)-1,f+=3)):"/"===d[f+1]||":"===d[f+1]?(o=s9(d[f],a),c=s9(d[f+2],1),f+=3):"/"===d[f+3]&&" "===d[f+1]&&(s=s9(d[f],a),o=s9(d[f+2],a),c=s9(d[f+4],1),f+=5),d.length<=f){a=n=u+(i=c*l)*s+l*o;break}default:throw ot()}if(0===i)throw oe();s4.s=a<0?-1:1,s4.n=Math.abs(n),s4.d=Math.abs(i)};function s6(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function s8(e,t){if(s7(e,t),!(this instanceof s8))return s5(s4.s*s4.n,s4.d);e=s6(s4.d,s4.n),this.s=s4.s,this.n=s4.n/e,this.d=s4.d/e}var oe=function(){return Error("Division by Zero")},ot=function(){return Error("Invalid argument")},or=function(){return Error("Parameters must be integer")};s8.prototype={s:1,n:0,d:1,abs:function(){return s5(this.n,this.d)},neg:function(){return s5(-this.s*this.n,this.d)},add:function(e,t){return s7(e,t),s5(this.s*this.n*s4.d+s4.s*this.d*s4.n,this.d*s4.d)},sub:function(e,t){return s7(e,t),s5(this.s*this.n*s4.d-s4.s*this.d*s4.n,this.d*s4.d)},mul:function(e,t){return s7(e,t),s5(this.s*s4.s*this.n*s4.n,this.d*s4.d)},div:function(e,t){return s7(e,t),s5(this.s*s4.s*this.n*s4.d,this.d*s4.n)},clone:function(){return s5(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new s8(NaN);if(void 0===e)return s5(this.s*this.n%this.d,1);if(s7(e,t),0===s4.n&&0===this.d)throw oe();return s5(this.s*(s4.d*this.n)%(s4.n*this.d),s4.d*this.d)},gcd:function(e,t){return s7(e,t),s5(s6(s4.n,this.n)*s6(s4.d,this.d),s4.d*this.d)},lcm:function(e,t){return(s7(e,t),0===s4.n&&0===this.n)?s5(0,1):s5(s4.n*this.n,s6(s4.n,this.n)*s6(s4.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new s8(NaN):s5(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new s8(NaN):s5(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new s8(NaN):s5(Math.round(e*this.s*this.n/this.d),e)},roundTo:function(e,t){return s7(e,t),s5(this.s*Math.round(this.n*s4.d/(this.d*s4.n))*s4.n,s4.d)},inverse:function(){return s5(this.s*this.d,this.n)},pow:function(e,t){if(s7(e,t),1===s4.d)if(s4.s<0)return s5(Math.pow(this.s*this.d,s4.n),Math.pow(this.n,s4.n));else return s5(Math.pow(this.s*this.n,s4.n),Math.pow(this.d,s4.n));if(this.s<0)return null;var r=s3(this.n),n=s3(this.d),i=1,a=1;for(var s in r)if("1"!==s){if("0"===s){i=0;break}if(r[s]*=s4.n,r[s]%s4.d!=0)return null;r[s]/=s4.d,i*=Math.pow(s,r[s])}for(var s in n)if("1"!==s){if(n[s]*=s4.n,n[s]%s4.d!=0)return null;n[s]/=s4.d,a*=Math.pow(s,n[s])}return s4.s<0?s5(a,i):s5(i,a)},equals:function(e,t){return s7(e,t),this.s*this.n*s4.d==s4.s*s4.n*this.d},compare:function(e,t){s7(e,t);var r=this.s*this.n*s4.d-s4.s*s4.n*this.d;return(0<r)-(r<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),r=t.toContinued(),n=1;n<r.length;n++){for(var i=s5(r[n-1],1),a=n-2;a>=0;a--)i=i.inverse().add(r[a]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return s7(e,t),!(!(s4.n*this.d)||this.n*s4.d%(s4.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do n.push(Math.floor(t/r)),e=t%r,t=r,r=e;while(1!==t);return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=function(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,n>2e3)return 0;return n}(0,r),i=function(e,t,r){for(var n=1,i=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,r,t),a=0;a<300;a++){if(n===i)return a;n=10*n%t,i=10*i%t}return 0}(0,r,n),a=this.s<0?"-":"";if(a+=t/r|0,t%=r,(t*=10)&&(a+="."),n){for(var s=i;s--;)a+=t/r|0,t%=r,t*=10;a+="(";for(var s=n;s--;)a+=t/r|0,t%=r,t*=10;a+=")"}else for(var s=e;t&&s--;)a+=t/r|0,t%=r,t*=10;return a}};var on=iP("Fraction",[],()=>(s8.prototype.type="Fraction",s8.prototype.isFraction=!0,s8.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},s8.fromJSON=function(e){return new s8(e)},s8),{isClass:!0}),oi=r(27554);function oa(e,t){return!!e&&"object"==typeof e&&(!!iD(oo,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function os(e){return"object"==typeof e&&e&&e.constructor===Object}var oo={length:!0,name:!0},ou={toString:!0,valueOf:!0,toLocaleString:!0};class oc{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){var t,r,n=this.wrappedObject;if(os(n)&&oa(n,e))return n[e];if("function"==typeof n[e]&&(t=n,r=e,!(null==t||"function"!=typeof t[r]||iD(t,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(t))&&(iD(ou,r)||!(r in Object.prototype)&&!(r in Function.prototype))))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}set(e,t){return!function(e,t,r){if(os(e)&&oa(e,t))return e[t]=r;throw Error('No access to property "'+t+'"')}(this.wrappedObject,e,t),this}has(e){return e in this.wrappedObject}}function ol(e){return!!e&&(e instanceof Map||e instanceof oc||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var of=function(){return of=oi.create,oi};function od(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function oh(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function op(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var om={BigNumberDependencies:sV,ComplexDependencies:{createComplexClass:s2},DenseMatrixDependencies:sG,FractionDependencies:{createFractionClass:on},createTyped:iP("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,a=of();return a.types=[{name:"number",test:nQ},{name:"Complex",test:n1},{name:"BigNumber",test:n0},{name:"Fraction",test:n2},{name:"Unit",test:n4},{name:"string",test:n9},{name:"Chain",test:iO},{name:"Array",test:n5},{name:"Matrix",test:n3},{name:"DenseMatrix",test:n6},{name:"SparseMatrix",test:n8},{name:"Range",test:ie},{name:"Index",test:it},{name:"boolean",test:ir},{name:"ResultSet",test:ii},{name:"Help",test:ia},{name:"function",test:is},{name:"Date",test:io},{name:"RegExp",test:iu},{name:"null",test:il},{name:"undefined",test:id},{name:"AccessorNode",test:ih},{name:"ArrayNode",test:ip},{name:"AssignmentNode",test:im},{name:"BlockNode",test:ig},{name:"ConditionalNode",test:iy},{name:"ConstantNode",test:iv},{name:"FunctionNode",test:iw},{name:"FunctionAssignmentNode",test:ib},{name:"IndexNode",test:i_},{name:"Node",test:ix},{name:"ObjectNode",test:iN},{name:"OperatorNode",test:iM},{name:"ParenthesisNode",test:iS},{name:"RangeNode",test:iE},{name:"SymbolNode",test:ik},{name:"Map",test:ol},{name:"Object",test:ic}],a.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(t||od(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return r||oh(e),new r(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return r||oh(e),new r(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return r||oh(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||op(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||od(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||op(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||oh(e);try{return new r(e)}catch(t){throw Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||od(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||op(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}],a})},og="equalScalar",oy=iP(og,["typed","config"],e=>{var{typed:t,config:r}=e;return t(og,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return iK(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||function(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){var n;return n=r.epsilon,iK(e.re,t.re,n)&&iK(e.im,t.im,n)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw Error("Cannot compare units with different base");return this(e.value,t.value)}})});iP(og,["typed","config"],e=>{var{typed:t,config:r}=e;return t(og,{"number, number":function(e,t){return iK(e,t,r.epsilon)}})});var ov={typedDependencies:om,createEqualScalar:oy},ob=iP("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(t&&!n9(t))throw Error("Invalid datatype: "+t);if(n3(e)){var r,n,s;r=this,n=e,s=t,"SparseMatrix"===n.type?(r._values=n._values?iT(n._values):void 0,r._index=iT(n._index),r._ptr=iT(n._ptr),r._size=iT(n._size),r._datatype=s||n._datatype):a(r,n.valueOf(),s||n._datatype)}else if(e&&n5(e.index)&&n5(e.ptr)&&n5(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(n5(e))a(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+iA(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function a(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=n.length,s=0,o=r,u=0;if(n9(i)&&(o=t.find(r,[i,i])||r,u=t.convert(0,i)),a>0){var c=0;do{e._ptr.push(e._index.length);for(var l=0;l<a;l++){var f=n[l];if(n5(f)){if(0===c&&s<f.length&&(s=f.length),c<f.length){var d=f[c];o(d,u)||(e._values.push(d),e._index.push(l))}}else 0===c&&s<1&&(s=1),o(f,u)||(e._values.push(f),e._index.push(l))}c++}while(c<s)}e._ptr.push(e._index.length),e._size=[a,s]}function s(e,t,r,n){if(r-t==0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t}function o(e,t,r,n,i,a,s){i.splice(e,0,n),a.splice(e,0,t);for(var o=r+1;o<s.length;o++)s[o]++}function u(e,n,i,a){var s,o,u,c=a||0,l=r,f=0;n9(e._datatype)&&(l=t.find(r,[e._datatype,e._datatype])||r,f=t.convert(0,e._datatype),c=t.convert(c,e._datatype));var d=!l(c,f),h=e._size[0],p=e._size[1];if(i>p){for(o=p;o<i;o++)if(e._ptr[o]=e._values.length,d)for(s=0;s<h;s++)e._values.push(c),e._index.push(s);e._ptr[i]=e._values.length}else i<p&&(e._ptr.splice(i+1,p-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(p=i,n>h){if(d){var m=0;for(o=0;o<p;o++){e._ptr[o]=e._ptr[o]+m,u=e._ptr[o+1]+m;var g=0;for(s=h;s<n;s++,g++)e._values.splice(u+g,0,c),e._index.splice(u+g,0,s),m++}e._ptr[p]=e._values.length}}else if(n<h){var y=0;for(o=0;o<p;o++){e._ptr[o]=e._ptr[o]-y;var v=e._ptr[o],b=e._ptr[o+1]-y;for(u=v;u<b;u++)(s=e._index[u])>n-1&&(e._values.splice(u,1),e._index.splice(u,1),y++)}e._ptr[o]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function c(e,t,r,n,i){var a,s,o=n[0],u=n[1],c=[];for(a=0;a<o;a++)for(s=0,c[a]=[];s<u;s++)c[a][s]=0;for(s=0;s<u;s++)for(var l=r[s],f=r[s+1],d=l;d<f;d++)c[a=t[d]][s]=e?i?iT(e[d]):e[d]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return i7(this._values,iA)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,r){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!it(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r,n,a,s,o=t.size();if(o.length!==e._size.length)throw new iX(o.length,e._size.length);var u=t.min(),c=t.max();for(r=0,n=e._size.length;r<n;r++)i2(u[r],e._size[r]),i2(c[r],e._size[r]);var l=e._values,f=e._index,d=e._ptr,h=t.dimension(0),p=t.dimension(1),m=[],g=[];h.forEach(function(e,t){g[e]=t[0],m[e]=!0});var y=l?[]:void 0,v=[],b=[];return p.forEach(function(e){for(b.push(v.length),a=d[e],s=d[e+1];a<s;a++)!0===m[r=f[a]]&&(v.push(g[r]),y&&y.push(l[a]))}),b.push(v.length),new i({values:y,index:v,ptr:b,size:o,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var i,a=t.size(),s=t.isScalar();if(n3(r)?(i=r.size(),r=r.toArray()):i=i0(r),s){if(0!==i.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==a.length&&2!==a.length)throw new iX(a.length,e._size.length,"<");if(i.length<a.length){for(var o=0,u=0;1===a[o]&&1===i[o];)o++;for(;1===a[o];)u++,o++;r=i3(r,a.length,u,i)}if(!ij(a,i))throw new iX(a,i,">");if(1===a.length)t.dimension(0).forEach(function(t,i){i2(t),e.set([t,0],r[i[0]],n)});else{var c=t.dimension(0),l=t.dimension(1);c.forEach(function(t,i){i2(t),l.forEach(function(a,s){i2(a),e.set([t,a],r[i[0]][s[0]],n)})})}}return e}(this,e,t,r);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!n5(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new iX(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var t=e[0],r=e[1];i2(t,this._size[0]),i2(r,this._size[1]);var n=s(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},i.prototype.set=function(e,n,i){if(!n5(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new iX(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var a=e[0],c=e[1],l=this._size[0],f=this._size[1],d=r,h=0;n9(this._datatype)&&(d=t.find(r,[this._datatype,this._datatype])||r,h=t.convert(0,this._datatype)),(a>l-1||c>f-1)&&(u(this,Math.max(a+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),i2(a,l),i2(c,f);var p=s(a,this._ptr[c],this._ptr[c+1],this._index);return p<this._ptr[c+1]&&this._index[p]===a?d(n,h)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var a=t+1;a<i.length;a++)i[a]--}(p,c,this._values,this._index,this._ptr):this._values[p]=n:o(p,a,c,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!n7(e))throw TypeError("Array or Matrix expected");var n=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(e){if(!nQ(e)||!i$(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+iY(n)+")")}),u(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!n5(e))throw TypeError("Array expected");if(2!==e.length)throw Error("Sparse matrices can only be reshaped in two dimensions");e.forEach(function(t){if(!nQ(t)||!i$(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+iY(e)+")")});var r=this._size[0]*this._size[1],n=(e=i9(e,r))[0]*e[1];if(r!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return i;for(var a=[],u=0;u<i._ptr.length;u++)for(var c=0;c<i._ptr[u+1]-i._ptr[u];c++)a.push(u);for(var l=i._values.slice(),f=i._index.slice(),d=0;d<i._index.length;d++){var h=f[d],p=a[d],m=h*i._size[1]+p;a[d]=m%e[1],f[d]=Math.floor(m/e[1])}i._values.length=0,i._index.length=0,i._ptr.length=e[1]+1,i._size=e.slice();for(var g=0;g<i._ptr.length;g++)i._ptr[g]=0;for(var y=0;y<l.length;y++){var v=f[y],b=a[y],w=l[y];o(s(v,i._ptr[b],i._ptr[b+1],i._index),v,b,w,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?iT(this._values):void 0,index:iT(this._index),ptr:iT(this._ptr),size:iT(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var a=this;return function(e,n,a,s,o,u,c){var l=[],f=[],d=[],h=r,p=0;n9(e._datatype)&&(h=t.find(r,[e._datatype,e._datatype])||r,p=t.convert(0,e._datatype));for(var m=function(e,t,r){e=u(e,t,r),h(e,p)||(l.push(e),f.push(t))},g=0;g<=o;g++){d.push(l.length);var y=e._ptr[g],v=e._ptr[g+1];if(c)for(var b=y;b<v;b++){var w=e._index[b];w>=0&&w<=a&&m(e._values[b],w-n,g-s)}else{for(var _={},x=y;x<v;x++)_[e._index[x]]=e._values[x];for(var N=n;N<=a;N++)m(N in _?_[N]:0,N-n,g-s)}}return d.push(l.length),new i({values:l,index:f,ptr:d,size:[a-n+1,o-s+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(t,r,n){return e(t,[r,n],a)},n)},i.prototype.forEach=function(e,t){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var a=this._ptr[i],s=this._ptr[i+1];if(t)for(var o=a;o<s;o++){var u=this._index[o];e(this._values[o],[u,i],this)}else{for(var c={},l=a;l<s;l++)c[this._index[l]]=this._values[l];for(var f=0;f<r;f++)e(f in c?c[f]:0,[f,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],t=0;t<e;t++)for(var r=this._ptr[t],n=this._ptr[t+1],i=r;i<n;i++){var a=this._index[i];yield{value:this._values[i],index:[a,t]}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+iY(t,e)+" x "+iY(r,e)+"] density: "+iY(n,e)+"\n",a=0;a<r;a++)for(var s=this._ptr[a],o=this._ptr[a+1],u=s;u<o;u++)i+="\n ("+iY(this._index[u],e)+", "+iY(a,e)+") ==> "+(this._values?iY(this._values[u],e):"X");return i},i.prototype.toString=function(){return iY(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(n0(e)&&(e=e.toNumber()),!nQ(e)||!i$(e))throw TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],a=this._size[1],s=Math.min(n-r,a-t),o=[],u=[],c=[];c[0]=0;for(var l=t;l<a&&o.length<s;l++)for(var f=this._ptr[l],d=this._ptr[l+1],h=f;h<d;h++){var p=this._index[h];if(p===l-t+r){o.push(this._values[h]),u[o.length-1]=p-r;break}}return c.push(o.length),new i({values:o,index:u,ptr:c,size:[s,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,a,s,o){if(!n5(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(n0(e)&&(e=e.toNumber()),!nQ(e)||!i$(e)||e<1)throw Error("Size values must be positive integers");return e}),a){if(n0(a)&&(a=a.toNumber()),!nQ(a)||!i$(a))throw TypeError("The parameter k must be an integer number")}else a=0;var u,c=r,l=0;n9(o)&&(c=t.find(r,[o,o])||r,l=t.convert(0,o));var f=a>0?a:0,d=a<0?-a:0,h=e[0],p=e[1],m=Math.min(h-d,p-f);if(n5(n)){if(n.length!==m)throw Error("Invalid value array length");u=function(e){return n[e]}}else if(n3(n)){var g=n.size();if(1!==g.length||g[0]!==m)throw Error("Invalid matrix length");u=function(e){return n.get([e])}}else u=function(){return n};for(var y=[],v=[],b=[],w=0;w<p;w++){b.push(y.length);var _=w-f;if(_>=0&&_<m){var x=u(_);c(x,l)||(v.push(_+d),y.push(x))}}return b.push(y.length),new i({values:y,index:v,ptr:b,size:[h,p]})},i.prototype.swapRows=function(e,t){if(!nQ(e)||!i$(e)||!nQ(t)||!i$(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return i2(e,this._size[0]),i2(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,r,n,i){for(var a=n[e],s=n[e+1],o=a;o<s;o++)i(r[o],t[o])},i._swapRows=function(e,t,r,n,i,a){for(var o=0;o<r;o++){var u=a[o],c=a[o+1],l=s(e,u,c,i),f=s(t,u,c,i);if(l<c&&f<c&&i[l]===e&&i[f]===t){if(n){var d=n[l];n[l]=n[f],n[f]=d}continue}if(l<c&&i[l]===e&&(f>=c||i[f]!==t)){var h=n?n[l]:void 0;i.splice(f,0,t),n&&n.splice(f,0,h),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1);continue}if(f<c&&i[f]===t&&(l>=c||i[l]!==e)){var p=n?n[f]:void 0;i.splice(l,0,e),n&&n.splice(l,0,p),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}}},i},{isClass:!0}),ow="matrix",o_=iP(ow,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(ow,{"":function(){return a([])},string:function(e){return a([],e)},"string, string":function(e,t){return a([],e,t)},Array:function(e){return a(e)},Matrix:function(e){return a(e,e.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw TypeError("Unknown matrix type "+JSON.stringify(t)+".")}}),ox=iP("algorithm01",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var a,s,o=e._data,u=e._size,c=e._datatype,l=r._values,f=r._index,d=r._ptr,h=r._size,p=r._datatype;if(u.length!==h.length)throw new iX(u.length,h.length);if(u[0]!==h[0]||u[1]!==h[1])throw RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+h+")");if(!l)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=u[0],g=u[1],y="string"==typeof c&&c===p?c:void 0,v=y?t.find(n,[y,y]):n,b=[];for(a=0;a<m;a++)b[a]=[];var w=[],_=[];for(s=0;s<g;s++){for(var x=s+1,N=d[s],M=d[s+1],S=N;S<M;S++)w[a=f[S]]=i?v(l[S],o[a][s]):v(o[a][s],l[S]),_[a]=x;for(a=0;a<m;a++)_[a]===x?b[a][s]=w[a]:b[a][s]=o[a][s]}return e.createDenseMatrix({data:b,size:[m,g],datatype:y})}}),oN=iP("algorithm04",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i){var a,s,o,u,c,l,f=e._values,d=e._index,h=e._ptr,p=e._size,m=e._datatype,g=n._values,y=n._index,v=n._ptr,b=n._size,w=n._datatype;if(p.length!==b.length)throw new iX(p.length,b.length);if(p[0]!==b[0]||p[1]!==b[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+b+")");var _=p[0],x=p[1],N=r,M=0,S=i;"string"==typeof m&&m===w&&(a=m,N=t.find(r,[a,a]),M=t.convert(0,a),S=t.find(i,[a,a]));var E=f&&g?[]:void 0,k=[],O=[],A=f&&g?[]:void 0,T=f&&g?[]:void 0,C=[],j=[];for(o=0;o<x;o++){O[o]=k.length;var I=o+1;for(c=h[o],l=h[o+1],u=c;u<l;u++)s=d[u],k.push(s),C[s]=I,A&&(A[s]=f[u]);for(c=v[o],l=v[o+1],u=c;u<l;u++)if(C[s=y[u]]===I){if(A){var D=S(A[s],g[u]);N(D,M)?C[s]=null:A[s]=D}}else k.push(s),j[s]=I,T&&(T[s]=g[u]);if(A&&T)for(u=O[o];u<k.length;)C[s=k[u]]===I?(E[u]=A[s],u++):j[s]===I?(E[u]=T[s],u++):k.splice(u,1)}return O[x]=k.length,e.createSparseMatrix({values:E,index:k,ptr:O,size:[_,x],datatype:a})}}),oM=iP("algorithm10",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:r}=e;return function(e,n,i,a){var s,o=e._values,u=e._index,c=e._ptr,l=e._size,f=e._datatype;if(!o)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=l[0],h=l[1],p=i;"string"==typeof f&&(s=f,n=t.convert(n,s),p=t.find(i,[s,s]));for(var m=[],g=[],y=[],v=0;v<h;v++){for(var b=v+1,w=c[v],_=c[v+1],x=w;x<_;x++){var N=u[x];g[N]=o[x],y[N]=b}for(var M=0;M<d;M++)0===v&&(m[M]=[]),y[M]===b?m[M][v]=a?p(n,g[M]):p(g[M],n):m[M][v]=n}return new r({data:m,size:[d,h],datatype:s})}}),oS=iP("algorithm13",["typed"],e=>{var{typed:t}=e;return function(e,r,n){var i,a=e._data,s=e._size,o=e._datatype,u=r._data,c=r._size,l=r._datatype,f=[];if(s.length!==c.length)throw new iX(s.length,c.length);for(var d=0;d<s.length;d++){if(s[d]!==c[d])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+c+")");f[d]=s[d]}var h=n;"string"==typeof o&&o===l&&(i=o,h=t.find(n,[i,i]));var p=f.length>0?function e(t,r,n,i,a,s){var o=[];if(r===n.length-1)for(var u=0;u<i;u++)o[u]=t(a[u],s[u]);else for(var c=0;c<i;c++)o[c]=e(t,r+1,n,n[r+1],a[c],s[c]);return o}(h,0,f,f[0],a,u):[];return e.createDenseMatrix({data:p,size:f,datatype:i})}}),oE=iP("algorithm14",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var a,s=e._data,o=e._size,u=e._datatype,c=n;"string"==typeof u&&(a=u,r=t.convert(r,a),c=t.find(n,[a,a]));var l=o.length>0?function e(t,r,n,i,a,s,o){var u=[];if(r===n.length-1)for(var c=0;c<i;c++)u[c]=o?t(s,a[c]):t(a[c],s);else for(var l=0;l<i;l++)u[l]=e(t,r+1,n,n[r+1],a[l],s,o);return u}(c,0,o,o[0],s,r,i):[];return e.createDenseMatrix({data:l,size:iT(o),datatype:a})}});function ok(e,t){var r;if(!i$(e)||!i$(t))throw Error("Parameters in function gcd must be integer numbers");for(;0!==t;)r=e%t,e=t,t=r;return e<0?-e:e}ok.signature="number, number";let{gcd:oO}=function e(t,r){var n,i,a,s=(0,nX.Z)({},ae,r);if("function"!=typeof Object.create)throw Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var o=((n={isNumber:nQ,isComplex:n1,isBigNumber:n0,isFraction:n2,isUnit:n4,isString:n9,isArray:n5,isMatrix:n3,isCollection:n7,isDenseMatrix:n6,isSparseMatrix:n8,isRange:ie,isIndex:it,isBoolean:ir,isResultSet:ii,isHelp:ia,isFunction:is,isDate:io,isRegExp:iu,isObject:ic,isNull:il,isUndefined:id,isAccessorNode:ih,isArrayNode:ip,isAssignmentNode:im,isBlockNode:ig,isConditionalNode:iy,isConstantNode:iv,isFunctionAssignmentNode:ib,isFunctionNode:iw,isIndexNode:i_,isNode:ix,isObjectNode:iN,isOperatorNode:iM,isParenthesisNode:iS,isRangeNode:iE,isSymbolNode:ik,isChain:iO}).on=(i=new iR).on.bind(i),n.off=i.off.bind(i),n.once=i.once.bind(i),n.emit=i.emit.bind(i),n);o.config=function(e,t){function r(r){if(!r)return iC(e,iT);var n=iC(e,iT);an(r,"matrix",at),an(r,"number",ar),function e(t,r){if(Array.isArray(r))throw TypeError("Arrays are not supported by deepExtend");for(var n in r)if(iD(r,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(r[n]&&r[n].constructor===Object)void 0===t[n]&&(t[n]={}),t[n]&&t[n].constructor===Object?e(t[n],r[n]):t[n]=r[n];else if(Array.isArray(r[n]))throw TypeError("Arrays are not supported by deepExtend");else t[n]=r[n];return t}(e,r);var i=iC(e,iT);return t("config",i,n,iC(r,iT)),i}return r.MATRIX_OPTIONS=at,r.NUMBER_OPTIONS=ar,Object.keys(ae).forEach(t=>{Object.defineProperty(r,t,{get:()=>e[t],enumerable:!0,configurable:!0})}),r}(s,o.emit),o.expression={transform:{},mathWithTransform:{config:o.config}};var u={},c=function(e,t,r,n){function i(e,t){t&&"function"==typeof t.transform?(r.expression.transform[e]=t.transform,iD(o,e)||(r.expression.mathWithTransform[e]=t.transform)):(delete r.expression.transform[e],iD(o,e)||(r.expression.mathWithTransform[e]=t))}function a(e){return"function"==typeof e&&"object"==typeof e.signatures}function s(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction}var o={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(t,u){var c=arguments.length;if(1!==c&&2!==c)throw new i8("import",c,1,2);u||(u={});var l={};for(var f in!function e(t,r,n){if(Array.isArray(r))r.forEach(r=>e(t,r));else if("object"==typeof r)for(var i in r)iD(r,i)&&e(t,r[i],i);else if(iZ(r)||void 0!==n){var a=iZ(r)?s(r)?r.fn+".transform":r.fn:n;if(iD(t,a)&&t[a]!==r&&!u.silent)throw Error('Cannot import "'+a+'" twice');t[a]=r}else if(!u.silent)throw TypeError("Factory, Object, or Array expected")}(l,t),l)if(iD(l,f)){var d,h=l[f];if(iZ(h))!function(t,i){var u,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if(i6(c,"."))throw Error("Factory name should not contain a nested path. Name: "+JSON.stringify(c));var l=s(t)?r.expression.transform:r,f=c in r.expression.transform,d=iD(l,c)?l[c]:void 0,h=function(){var n={};t.dependencies.map(iz).forEach(e=>{if(i6(e,"."))throw Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?n.math=r:"mathWithTransform"===e?n.mathWithTransform=r.expression.mathWithTransform:"classes"===e?n.classes=r:n[e]=r[e]});var s=t(n);if(s&&"function"==typeof s.transform)throw Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===d||i.override)return s;if(a(d)&&a(s))return e(d,s);if(i.silent)return d;throw Error('Cannot import "'+c+'": already exists')};t.meta&&!1===t.meta.lazy?l[c]=h():iI(l,c,h),d&&f?function(e){delete r.expression.transform[e],iD(o,e)?delete r.expression.mathWithTransform[e]:r.expression.mathWithTransform[e]=r[e]}(c):!s(t)&&(-1!==(u=t).fn.indexOf(".")||iD(o,u.fn)||u.meta&&u.meta.isClass)||iI(r.expression.mathWithTransform,c,()=>l[c]),n[c]=t,r.emit("import",c,h)}(h,u);else{if("function"==typeof(d=h)||"number"==typeof d||"string"==typeof d||"boolean"==typeof d||null===d||n4(d)||n1(d)||n0(d)||n2(d)||n3(d)||Array.isArray(d))!function(t,s,o){var u;if(o.wrap&&"function"==typeof s&&(s=function(e){var t=function(){for(var t=[],n=0,i=arguments.length;n<i;n++){var a=arguments[n];t[n]=a&&a.valueOf()}return e.apply(r,t)};return e.transform&&(t.transform=e.transform),t}(s)),"function"==typeof(u=s)&&"string"==typeof u.signature&&(s=e(t,{[s.signature]:s})),a(r[t])&&a(s)){s=o.override?e(t,s.signatures):e(r[t],s),r[t]=s,delete n[t],i(t,s),r.emit("import",t,function(){return s});return}if(void 0===r[t]||o.override){r[t]=s,delete n[t],i(t,s),r.emit("import",t,function(){return s});return}if(!o.silent)throw Error('Cannot import "'+t+'": already exists')}(f,h,u);else if(!u.silent)throw TypeError("Factory, Object, or Array expected")}}}}(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.typed.apply(o.typed,t)},0,o,u);return o.import=c,o.on("config",()=>{iF(u).forEach(e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&c(e,{override:!0})})}),o.create=e.bind(null,t),o.factory=iP,o.import(iF((function e(t,r){for(var n in t)if(iD(t,n)){var i=t[n];"object"==typeof i&&null!==i?e(i,r):r[n]=i}}(t,a={}),a))),o.ArgumentsError=i8,o.DimensionError=iX,o.IndexError=iQ,o}({gcdDependencies:{BigNumberDependencies:sV,DenseMatrixDependencies:sG,equalScalarDependencies:ov,matrixDependencies:{DenseMatrixDependencies:sG,MatrixDependencies:sq,SparseMatrixDependencies:{MatrixDependencies:sq,equalScalarDependencies:ov,typedDependencies:om,createSparseMatrixClass:ob},typedDependencies:om,createMatrix:o_},typedDependencies:om,createGcd:iP("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a}=e,s=ox({typed:t}),o=oN({typed:t,equalScalar:n}),u=oM({typed:t,DenseMatrix:a}),c=oS({typed:t}),l=oE({typed:t});return t("gcd",{"number, number":ok,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var r=new i(0);!t.isZero();){var n=e.mod(t);e=t,t=n}return e.lt(r)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return s(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return u(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return l(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return u(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return l(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return l(r(e),t,this,!1).valueOf()},"number | BigNumber, Array":function(e,t){return l(r(t),e,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,r){for(var n=this(e,t),i=0;i<r.length;i++)n=this(n,r[i]);return n}})})}}),oA=10;function oT(e,t){let r=t.startMs,n=e.values,i=[];for(let e of n){for(;r<e[0];)i.push([r,null]),r+=t.stepMs;i.push([r,e[1]]),r+=t.stepMs}for(;r<=t.endMs;)i.push([r,null]),r+=t.stepMs;return i}function oC(e){let t,r,n=[];for(let t of e)if(t&&"timeRange"in t){if(void 0===t||void 0===t.timeRange||void 0===t.stepMs)continue;if(n.push(t.stepMs),void 0===r){r=t.timeRange;continue}t.timeRange.start<r.start&&(r.start=t.timeRange.start),t.timeRange.end>r.end&&(r.end=t.timeRange.end)}else if(t&&"values"in t){for(let e=0;e<t.values.length;e++){let n=t.values[e];if(void 0===n)continue;let[i]=n,a=new Date(i),s=new Date(i);if(void 0===r){r={start:a,end:s};continue}a<r.start&&(r.start=a),s>r.end&&(r.end=s)}if(void 0===r)return;let e=r.start.valueOf(),n=r.end.valueOf(),i=n-e;return{startMs:e,endMs:n,rangeMs:i,stepMs:oA}}if(void 0===r)return;if(1===n.length)t=n[0];else{let e=oO(...n);t=e<oA?oA:e}let i=r.start.valueOf(),a=r.end.valueOf();return{startMs:i,endMs:a,stepMs:t,rangeMs:a-i}}function oj(e,t){if(0===t.length)return e;let r={};for(let n of e){let e=Object.keys(n).filter(e=>t.includes(e)).map(e=>n[e]).join("|"),i=r[e];i?r[e]={...i,...n}:r[e]={...n}}return Object.values(r)}function oI(e,t,r){let n=[];for(let i of e){let e=Object.keys(i).filter(e=>t.includes(e)),a={};for(let t of e)a[t]=i[t],delete i[t];for(let t of e)n.push({...i,[r]:a[t]});0===e.length&&n.push(i)}return n}function oD(e,t){let r=[];for(let n of e){let e=Object.keys(n).filter(e=>RegExp("^(("+t+" #\\d+)|("+t+"))$").test(e)),i={};for(let t of e)i[t]=n[t],delete n[t];for(let a of e)r.push({...n,[t]:i[a]});0===e.length&&r.push(n)}return r}function oF(e){let t=[...e],r=Array.from(new Set(e.flatMap(Object.keys).map(e=>e.replace(/ #\d+/,"")).filter(e=>"value"!==e)));for(let e of r)t=oD(t,e);return oj(t,r)}function oR(e,t){let r=e;for(let e of t??[])if(!e.spec.disabled)switch(e.kind){case"JoinByColumnValue":e.spec.columns&&e.spec.columns.length>0&&(r=oj(r,e.spec.columns));break;case"MergeIndexedColumns":e.spec.column&&(r=oD(r,e.spec.column));break;case"MergeColumns":e.spec.columns&&e.spec.columns.length>0&&e.spec.name&&(r=oI(r,e.spec.columns,e.spec.name));break;case"MergeSeries":r=oF(r)}return r.map(e=>Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}))}function oP(e,t){return(0,nR.useMemo)(()=>oR(e,t),[e,t])}function oZ(e){return!!e?.startsWith("/")}function oz(e){if(!e)throw Error("Input string cannot be empty");if(!oZ(e))return RegExp(`^${e}$`);let t=e.match(/^\/(.+)\/([gimy]*)$/);if(!t)throw Error(`Invalid regular expression format: ${e}`);let[,r="",n=""]=t;try{return new RegExp(r,n)}catch(e){throw Error(`Failed to create RegExp ${e}`)}}function o$(e,t=[]){if(!t.length)return{value:e};let r={value:e};return t.forEach(t=>{switch(t.kind){case"Value":{let n=t.spec;String(n.value)===String(e)&&(r.value=n.result.value||r.value,r.color=n.result.color);break}case"Range":{let n=t.spec;if(void 0===n.from&&void 0===n.to)break;let i=void 0!==n.from?n.from:-1/0,a=void 0!==n.to?n.to:1/0;e>=i&&e<=a&&(r.value=n.result.value||r.value,r.color=n.result.color);break}case"Regex":{let n=t.spec,i=e.toString();if(!n.pattern)break;let a=oz(n.pattern);i.match(a)&&null!==n.result.value&&(r.value=i.replace(a,n.result.value.toString()||"")||r.value,r.color=n.result.color);break}case"Misc":{let n=t.spec;(function(e,t){switch(e){case"empty":return""===t;case"null":return null==t;case"NaN":return Number.isNaN(t);case"true":return!0===t;case"false":return!1===t;default:return!1}})(n.value,e)&&(r.value=n.result.value||r.value,r.color=n.result.color)}}}),r}},8317:function(e){function t(){}t.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var a=0,s=n.length;a<s;a++)n[a].fn!==t&&n[a].fn._!==t&&i.push(n[a]);return i.length?r[e]=i:delete r[e],this}},e.exports=t,e.exports.TinyEmitter=t},27554:function(e){"use strict";var t;t=function(){function e(){return!0}function t(){return!1}function r(){}return function n(){var i=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:function(e){return"object"==typeof e&&null!==e&&e.constructor===Object}},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],a={name:"any",test:e},s=[],o=[],u={types:i,conversions:o,ignore:s};function c(e){var t=R(u.types,function(t){return t.name===e});if(t)return t;if("any"===e)return a;var r=R(u.types,function(t){return t.name.toLowerCase()===e.toLowerCase()});throw TypeError('Unknown type "'+e+'"'+(r?'. Did you mean "'+r.name+'"?':""))}function l(e){return e===a?999:u.types.indexOf(e)}function f(e){var t=R(u.types,function(t){return t.test(e)});if(t)return t.name;throw TypeError("Value has unknown type. Value: "+e)}function d(e){return e.map(function(e){var t=e.types.map(v);return(e.restParam?"...":"")+t.join("|")}).join(",")}function h(e){var t=D(e);return!!t&&t.restParam}function p(e){return e.types.some(function(e){return null!=e.conversion})}function m(t){if(!t||0===t.types.length)return e;if(1===t.types.length)return c(t.types[0].name).test;if(2===t.types.length){var r=c(t.types[0].name).test,n=c(t.types[1].name).test;return function(e){return r(e)||n(e)}}var i=t.types.map(function(e){return c(e.name).test});return function(e){for(var t=0;t<i.length;t++)if(i[t](e))return!0;return!1}}function g(e,t){return t<e.params.length?e.params[t]:h(e.params)?D(e.params):null}function y(e,t,r){var n=g(e,t);return(n?r?n.types.filter(b):n.types:[]).map(v)}function v(e){return e.name}function b(e){return null===e.conversion||void 0===e.conversion}function w(e,t){var r=function(e){for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;return Object.keys(t)}(P(e,function(e){return y(e,t,!1)}));return -1!==r.indexOf("any")?["any"]:r}function _(e,t,r){var n,i,a,s=e||"unnamed",o=r;for(a=0;a<t.length;a++){var u=o.filter(function(e){var r=m(g(e,a));return(a<e.params.length||h(e.params))&&r(t[a])});if(0===u.length){if((i=w(o,a)).length>0){var c=f(t[a]);return(n=TypeError("Unexpected type of argument in function "+s+" (expected: "+i.join(" or ")+", actual: "+c+", index: "+a+")")).data={category:"wrongType",fn:s,index:a,actual:c,expected:i},n}}else o=u}var l=o.map(function(e){return h(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,l))return(n=TypeError("Too few arguments in function "+s+" (expected: "+(i=w(o,a)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:s,index:t.length,expected:i},n;var d=Math.max.apply(null,l);return t.length>d?(n=TypeError("Too many arguments in function "+s+" (expected: "+d+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:s,index:t.length,expectedLength:d}:(n=TypeError('Arguments of type "'+t.join(", ")+'" do not match any of the defined signatures of function '+s+".")).data={category:"mismatch",actual:t.map(f)},n}function x(e){for(var t=999,r=0;r<e.types.length;r++)b(e.types[r])&&(t=Math.min(t,e.types[r].typeIndex));return t}function N(e){for(var t=999,r=0;r<e.types.length;r++)b(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function M(e,t){var r,n,i=Math.min(e.params.length,t.params.length);if(0!=(n=e.params.some(p)-t.params.some(p)))return n;for(r=0;r<i;r++)if(0!=(n=p(e.params[r])-p(t.params[r])))return n;for(r=0;r<i;r++)if(0!==(n=function(e,t){var r;return 0!=(r=e.restParam-t.restParam)||0!=(r=p(e)-p(t))||0!=(r=x(e)-x(t))?r:N(e)-N(t)}(e.params[r],t.params[r])))return n;return e.params.length-t.params.length}function S(e){var t,r,n,i,a=[],s=[];switch(e.types.forEach(function(e){e.conversion&&(a.push(c(e.conversion.from).test),s.push(e.conversion.convert))}),s.length){case 0:return function(e){return e};case 1:return t=a[0],n=s[0],function(e){return t(e)?n(e):e};case 2:return t=a[0],r=a[1],n=s[0],i=s[1],function(e){return t(e)?n(e):r(e)?i(e):e};default:return function(e){for(var t=0;t<s.length;t++)if(a[t](e))return s[t](e);return e}}}function E(e,t){return function e(r,n,i){if(!(n<r.length))return[i.map(function(e,t){return{types:e,restParam:t===r.length-1&&h(r)}})];var a,s=r[n],o=t?s.types.filter(b):s.types;if(s.restParam){var u=o.filter(b);a=u.length<o.length?[u,o]:[o]}else a=o.map(function(e){return[e]});return P(a,function(t){return e(r,n+1,i.concat([t]))})}(e,0,[])}function k(e,n){if(0===Object.keys(n).length)throw SyntaxError("No signatures provided");var i,a=[];Object.keys(n).map(function(e){var t,r,i;return t=n[e],r=u.conversions,i=[],(""!==e.trim()&&(i=e.split(",").map(T).map(function(e,t,n){var i,a,s,o,u,f,d,h,p=(i=r,a=u=((o=0===e.indexOf("..."))?e.length>3?e.slice(3):"any":e).split("|").map(T).filter(C).filter(A),s={},i.forEach(function(e){-1!==a.indexOf(e.from)||-1===a.indexOf(e.to)||s[e.from]||(s[e.from]=e)}),f=Object.keys(s).map(function(e){return s[e]}),d=u.map(function(e){var t=c(e);return{name:e,typeIndex:l(t),test:t.test,conversion:null,conversionIndex:-1}}),h=f.map(function(e){var t=c(e.from);return{name:e.from,typeIndex:l(t),test:t.test,conversion:e,conversionIndex:r.indexOf(e)}}),{types:d.concat(h),restParam:o});if(p.restParam&&t!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+e+'": only allowed for the last parameter');return p})),i.some(I))?null:{params:i,fn:t}}).filter(j).forEach(function(e){var t=R(a,function(t){return function(e,t){for(var r=Math.max(e.params.length,t.params.length),n=0;n<r;n++)if(!function(e,t){for(var r,n=0;n<e.length;n++)if(r=e[n],-1!==t.indexOf(r))return!0;return!1}(y(e,n,!0),y(t,n,!0)))return!1;var i=e.params.length,a=t.params.length,s=h(e.params),o=h(t.params);return s?o?i===a:a>=i:o?i>=a:i===a}(t,e)});if(t)throw TypeError('Conflicting signatures "'+d(t.params)+'" and "'+d(e.params)+'".');a.push(e)});var s=P(a,function(e){return(e?E(e.params,!1):[]).map(function(t){return{params:t,fn:e.fn}})}).filter(j);s.sort(M);var o=s[0]&&s[0].params.length<=2&&!h(s[0].params),f=s[1]&&s[1].params.length<=2&&!h(s[1].params),g=s[2]&&s[2].params.length<=2&&!h(s[2].params),v=s[3]&&s[3].params.length<=2&&!h(s[3].params),b=s[4]&&s[4].params.length<=2&&!h(s[4].params),w=s[5]&&s[5].params.length<=2&&!h(s[5].params),_=s.map(function(e){return function(e){var t,r,n;if(h(e)){var i,a=(t=(i=e).slice(0,i.length-1).map(m)).length,s=m(D(e)),o=function(e){for(var t=a;t<e.length;t++)if(!s(e[t]))return!1;return!0};return function(e){for(var r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return o(e)&&e.length>=a+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=m(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=m(e[0]),n=m(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(m),function(e){for(var r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}(e.params)}),x=o?m(s[0].params[0]):t,N=f?m(s[1].params[0]):t,k=g?m(s[2].params[0]):t,O=v?m(s[3].params[0]):t,Z=b?m(s[4].params[0]):t,z=w?m(s[5].params[0]):t,$=o?m(s[0].params[1]):t,B=f?m(s[1].params[1]):t,L=g?m(s[2].params[1]):t,U=v?m(s[3].params[1]):t,V=b?m(s[4].params[1]):t,q=w?m(s[5].params[1]):t,G=s.map(function(e){return function(e,t){var r=t;if(e.some(p)){var n=h(e),i=e.map(S);r=function(){for(var e=[],r=n?arguments.length-1:arguments.length,a=0;a<r;a++)e[a]=i[a](arguments[a]);return n&&(e[r]=arguments[r].map(i[r])),t.apply(this,e)}}var a=r;if(h(e)){var s=e.length-1;a=function(){return r.apply(this,F(arguments,0,s).concat([F(arguments,s)]))}}return a}(e.params,e.fn)}),W=o?G[0]:r,K=f?G[1]:r,H=g?G[2]:r,J=v?G[3]:r,Y=b?G[4]:r,X=w?G[5]:r,Q=o?s[0].params.length:-1,ee=f?s[1].params.length:-1,et=g?s[2].params.length:-1,er=v?s[3].params.length:-1,en=b?s[4].params.length:-1,ei=w?s[5].params.length:-1,ea=6*!!(o&&f&&g&&v&&b&&w),es=s.length,eo=function(){for(var t=ea;t<es;t++)if(_[t](arguments))return G[t].apply(this,arguments);return u.onMismatch(e,arguments,s)},eu=function e(t,r){return arguments.length===Q&&x(t)&&$(r)?W.apply(e,arguments):arguments.length===ee&&N(t)&&B(r)?K.apply(e,arguments):arguments.length===et&&k(t)&&L(r)?H.apply(e,arguments):arguments.length===er&&O(t)&&U(r)?J.apply(e,arguments):arguments.length===en&&Z(t)&&V(r)?Y.apply(e,arguments):arguments.length===ei&&z(t)&&q(r)?X.apply(e,arguments):eo.apply(e,arguments)};try{Object.defineProperty(eu,"name",{value:e})}catch(e){}return i={},s.forEach(function(e){e.params.some(p)||E(e.params,!0).forEach(function(t){i[d(t)]=e.fn})}),eu.signatures=i,eu}function O(e,t,r){throw _(e,t,r)}function A(e){return -1===u.ignore.indexOf(e)}function T(e){return e.trim()}function C(e){return!!e}function j(e){return null!==e}function I(e){return 0===e.types.length}function D(e){return e[e.length-1]}function F(e,t,r){return Array.prototype.slice.call(e,t,r)}function R(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}function P(e,t){return Array.prototype.concat.apply([],e.map(t))}function Z(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(("object"==typeof n.signatures||"string"==typeof n.signature)&&""!==n.name){if(""===t)t=n.name;else if(t!==n.name){var i=Error("Function names do not match (expected: "+t+", actual: "+n.name+")");throw i.data={actual:n.name,expected:t},i}}}return t}function z(e){var t,r={};function n(e,n){if(r.hasOwnProperty(e)&&n!==r[e])throw(t=Error('Signature "'+e+'" is defined twice')).data={signature:e},t}for(var i=0;i<e.length;i++){var a=e[i];if("object"==typeof a.signatures)for(var s in a.signatures)a.signatures.hasOwnProperty(s)&&(n(s,a.signatures[s]),r[s]=a.signatures[s]);else if("string"==typeof a.signature)n(a.signature,a),r[a.signature]=a;else throw(t=TypeError("Function is no typed-function (index: "+i+")")).data={index:i},t}return r}return(u=k("typed",{"string, Object":k,Object:function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return k(Z(t),e)},"...Function":function(e){return k(Z(e),z(e))},"string, ...Function":function(e,t){return k(e,z(t))}})).create=n,u.types=i,u.conversions=o,u.ignore=s,u.onMismatch=O,u.throwMismatchError=O,u.createError=_,u.convert=function(e,t){var r=f(e);if(t===r)return e;for(var n=0;n<u.conversions.length;n++){var i=u.conversions[n];if(i.from===r&&i.to===t)return i.convert(e)}throw Error("Cannot convert from "+r+" to "+t)},u.find=function(e,t){if(!e.signatures)throw TypeError("Function is no typed-function");if("string"==typeof t){r=t.split(",");for(var r,n=0;n<r.length;n++)r[n]=r[n].trim()}else if(Array.isArray(t))r=t;else throw TypeError("String array or a comma separated string expected");var i=r.join(","),a=e.signatures[i];if(a)return a;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+r.join(", ")+"))")},u.addType=function(e,t){if(!e||"string"!=typeof e.name||"function"!=typeof e.test)throw TypeError("Object with properties {name: string, test: function} expected");if(!1!==t){for(var r=0;r<u.types.length;r++)if("Object"===u.types[r].name)return void u.types.splice(r,0,e)}u.types.push(e)},u.addConversion=function(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");u.conversions.push(e)},u}()},"function"==typeof define&&define.amd?define([],t):e.exports=t()}}]);
|