@nebula.js/sn-action-button 1.27.0 → 1.28.0

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.
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "name": "@nebula.js/sn-action-button:properties",
5
5
  "description": "Action button generic object definition",
6
- "version": "1.27.0",
6
+ "version": "1.28.0",
7
7
  "license": "MIT",
8
8
  "stability": "stable",
9
9
  "x-qlik-visibility": "public"
@@ -223,7 +223,13 @@
223
223
  "type": "boolean"
224
224
  },
225
225
  "automation": {
226
- "description": "ID of the automation. Required for type 'setVariable'",
226
+ "description": "Item ID of the automation (the id field returned from /api/v1/items?resourceType=automations)",
227
+ "optional": true,
228
+ "defaultValue": "''",
229
+ "type": "string"
230
+ },
231
+ "automationId": {
232
+ "description": "ID of the automation (the id field from /api/v1/automations OR the id field from /api/v1/automations)",
227
233
  "optional": true,
228
234
  "defaultValue": "''",
229
235
  "type": "string"
@@ -233,6 +239,54 @@
233
239
  "optional": true,
234
240
  "defaultValue": false,
235
241
  "type": "boolean"
242
+ },
243
+ "automationShowTriggered": {
244
+ "description": "Set to true when the selected automation is capable of have a triggered run mode",
245
+ "optional": true,
246
+ "defaultValue": false,
247
+ "type": "boolean"
248
+ },
249
+ "automationTriggered": {
250
+ "description": "Set to true when the automation should use the triggered run mode. Defaults to false",
251
+ "optional": true,
252
+ "defaultValue": false,
253
+ "type": "boolean"
254
+ },
255
+ "automationTriggeredText": {
256
+ "description": "Helper text when using the triggered run mode",
257
+ "optional": true,
258
+ "defaultValue": "''",
259
+ "type": "string"
260
+ },
261
+ "automationExecutionToken": {
262
+ "description": "Token used when using the triggered run mode",
263
+ "optional": true,
264
+ "defaultValue": "''",
265
+ "type": "string"
266
+ },
267
+ "automationShowNotification": {
268
+ "description": "Set to true when an automation should return a notification when finished running. Defaults to false",
269
+ "optional": true,
270
+ "defaultValue": false,
271
+ "type": "boolean"
272
+ },
273
+ "automationNotificationDuration": {
274
+ "description": "The amount of time in seconds that a notification should remain visible after running an automation",
275
+ "optional": true,
276
+ "defaultValue": "''",
277
+ "type": "string"
278
+ },
279
+ "automationNotificationDurationHelp": {
280
+ "description": "Helper text when enabling notifications",
281
+ "optional": true,
282
+ "defaultValue": "''",
283
+ "type": "string"
284
+ },
285
+ "automationOpenLinkSameWindow": {
286
+ "description": "Set to true if you want links from notifications to be opened in the same tab",
287
+ "optional": true,
288
+ "defaultValue": false,
289
+ "type": "boolean"
236
290
  }
237
291
  }
238
292
  },
@@ -435,6 +489,12 @@
435
489
  "Font": {
436
490
  "kind": "object",
437
491
  "entries": {
492
+ "fontFamily": {
493
+ "description": "Font Family of the label",
494
+ "optional": true,
495
+ "defaultValue": "'Source Sans Pro'",
496
+ "type": "string"
497
+ },
438
498
  "useColorExpression": {
439
499
  "description": "Set to true to use color expression",
440
500
  "optional": true,
package/core/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * @nebula.js/sn-action-button v1.27.0
3
- * Copyright (c) 2022 QlikTech International AB
2
+ * @nebula.js/sn-action-button v1.28.0
3
+ * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
6
6
 
7
- import{useElement as e,useTheme as t,useMemo as o,useStaleLayout as a,useApp as n,useConstraints as l,useEffect as i,useImperativeHandle as r}from"@nebula.js/stardust";var s={LABEL:"Button",FONT_SIZE:.5,COLOR:{index:-1,color:null},FONT_STYLE:{bold:!0,italic:!1,underline:!1},TEXT_ALIGN:"center",BACKGROUND_SIZE:"auto",BACKGROUND_POSITION:"centerCenter",BORDER_RADIUS:0,BORDER_WIDTH:0,ICON_POSITION:"left"};const c={version:"1.27.0",showTitles:!0,title:"",subtitle:"",footnote:"",useEnabledCondition:!1,enabledCondition:1,actions:[],navigation:{action:"none"},style:{label:s.LABEL,font:{useColorExpression:!1,color:s.COLOR,colorExpression:"",size:s.FONT_SIZE,style:s.FONT_STYLE,align:s.TEXT_ALIGN},background:{useColorExpression:!1,color:s.COLOR,colorExpression:"",useImage:!1,url:{qStaticContentUrlDef:{qUrl:""}},size:s.BACKGROUND_SIZE,position:s.BACKGROUND_POSITION},border:{useColorExpression:!1,color:s.COLOR,colorExpression:"",useBorder:!1,radius:s.BORDER_RADIUS,width:s.BORDER_WIDTH},icon:{useIcon:!1,iconType:"",position:s.ICON_POSITION}}};var u={targets:[]};const p=[{value:"applyBookmark",translation:"Object.ActionButton.ApplyBookmark",group:"bookmark",hide:({isUnsupportedFeature:e})=>null==e?void 0:e("bookmarks"),getActionCall:({app:e,bookmark:t})=>async()=>{const o=(await e.getBookmarkList()).find((e=>e.qData.title===t));t&&await e.applyBookmark(o&&o.qInfo&&o.qInfo.qId||t)},requiredInput:["bookmark"]},{value:"back",translation:"Object.ActionButton.MoveBackward",group:"selection",getActionCall:({app:e})=>async()=>{await e.back()},requiredInput:[]},{value:"forward",translation:"Object.ActionButton.MoveForward",group:"selection",getActionCall:({app:e})=>async()=>{await e.forward()},requiredInput:[]},{value:"clearAll",translation:"Object.ActionButton.ClearAll",group:"selection",getActionCall:({app:e,softLock:t})=>async()=>{await e.clearAll(t)},requiredInput:["softLock"]},{value:"clearAllButThis",translation:"Object.ActionButton.ClearAllButThis",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.clearAllButThis(a)}},requiredInput:["field","softLock"]},{value:"clearField",translation:"Object.ActionButton.ClearSelectionInField",group:"selection",getActionCall:({app:e,qStateName:t,field:o})=>async()=>{if(o){const a=await e.getField(o,t);await a.clear()}},requiredInput:["field"]},{value:"selectAll",translation:"Object.ActionButton.SelectAllInField",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.selectAll(a)}},requiredInput:["field","softLock"]},{value:"selectValues",translation:"Object.ActionButton.SelectValuesInField",group:"selection",getActionCall:({app:e,qStateName:t,field:o,value:a,softLock:n})=>async()=>{if(o&&a){const l=await e.getField(o,t),i=await e.getFieldDescription(o),r=await(async(e,t,o)=>{let a=t.split(";");if(o){let t="";a.forEach((e=>{t+=`Num('${e}')&';'&`})),a=(await e.evaluate(t.slice(0,-5))).split(";")}return a.map((e=>Number.isNaN(+e)?{qText:e}:{qIsNumeric:!0,qNumber:Number(e)}))})(e,a,i.qTags.includes("$date"));await l.selectValues(r,!1,n)}},requiredInput:["field","value","softLock"]},{value:"selectMatchingValues",translation:"Object.ActionButton.SelectMatchingValues",group:"selection",getActionCall:({app:e,qStateName:t,field:o,value:a,softLock:n})=>async()=>{if(o&&a){const l=await e.getField(o,t);await l.select(a,!1,n)}},requiredInput:["field","value","softLock"]},{value:"selectAlternative",translation:"Object.ActionButton.SelectAlternatives",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.selectAlternative(a)}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field","softLock"]},{value:"selectExcluded",translation:"Object.ActionButton.SelectExcluded",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.selectExcluded(a)}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field","softLock"]},{value:"selectPossible",translation:"Object.ActionButton.SelectPossibleValues",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.selectPossible(a)}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field","softLock"]},{value:"toggleSelect",translation:"Object.ActionButton.ToggleFieldSelection",group:"selection",getActionCall:({app:e,qStateName:t,field:o,value:a,softLock:n})=>async()=>{if(o&&a){const l=await e.getField(o,t);await l.toggleSelect(a,n)}},requiredInput:["field","value","softLock"]},{value:"lockAll",translation:"Object.ActionButton.LockAllSelections",group:"selection",getActionCall:({app:e})=>async()=>{await e.lockAll()},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:[]},{value:"lockField",translation:"Object.ActionButton.LockField",group:"selection",getActionCall:({app:e,qStateName:t,field:o})=>async()=>{if(o){const a=await e.getField(o,t);await a.lock()}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field"]},{value:"unlockAll",translation:"Object.ActionButton.UnlockAllSelections",group:"selection",getActionCall:({app:e})=>async()=>{await e.unlockAll()},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:[]},{value:"unlockField",translation:"Object.ActionButton.UnlockAField",group:"selection",getActionCall:({app:e,qStateName:t,field:o})=>async()=>{if(o){const a=await e.getField(o,t);await a.unlock()}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field"]},{value:"setVariable",translation:"Object.ActionButton.SetVariable",group:"variables",getActionCall:({app:e,variable:t,value:o})=>async()=>{if(t&&o)try{const a=await e.getVariableByName(t);await a.setStringValue(o)}catch(e){}},requiredInput:["variable","value"]},{value:"doReload",translation:"Object.ActionButton.DoReload",group:"reload",hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("reloadData"),getActionCall:({app:e,partial:t})=>async()=>{await e.doReload(0,!!t,!1)&&await e.doSave()},requiredInput:["partial"]},{translation:"Object.ActionButton.ExecuteAutomation",value:"executeAutomation",getActionCall:({app:e,automation:t,automationPostData:o})=>async()=>{if(void 0!==t)try{t=encodeURIComponent(t);const a=await fetch(`../api/v1/items/${t}`).then((e=>e.json())),n=await fetch(`../api/v1/automations/${a.resourceId}`).then((e=>e.json()));let l=`../api/v1/automations/${n.id}/actions/execute?X-Execution-Token=${n.executionToken}`;if(o){const o=await fetch(`../api/v1/automations/${a.resourceId}/blocks`).then((e=>e.json())).then((e=>{let t=[];for(let o=0;o<e.blocks.length;o++)if("FormBlock"===e.blocks[o].type){t=e.blocks[o].form;break}return t}));if(o.length>0){const a=new Date,n={qProp:{qInfo:{qId:`automation_${e.id}_${t}_${a.getTime()}`,qType:"bookmark"},qMetaDef:{title:`Generated automation bookmark on ${a.toISOString()}`,description:"Generated to provide target automation with bookmark to get current selection state",_createdBy:"sn-action-button",_createdFor:"automation",_createdOn:`${a.toISOString()}`,_id:`automation_${encodeURIComponent(e.id)}_${t}_${a.getTime()}`}}},i=await e.createBookmark(n).then((e=>e.getLayout())).then((e=>e.qInfo.qId));await e.saveObjects(),l=`${l}&${o[0].label.toLowerCase()}=${encodeURIComponent(e.id)}&${o[1].label.toLowerCase()}=${i}`}}await fetch(l).then((e=>e.json()))}catch(e){}},requiredInput:["automation"],hide:({isEnabled:e})=>!(null!=e&&e("ACTION_BUTTON_AUTOMATIONS"))},{value:"refreshDynamicViews",translation:"Object.ActionButton.RefreshDynamicViews",group:"dynamicViews",getActionCall:({senseNavigation:e})=>async()=>{"function"==typeof e.refreshDynamicViews&&await e.refreshDynamicViews()},requiredInput:[]}],d=e=>p.filter((t=>{var o;return!(null!==(o=t.hide)&&void 0!==o&&o.call(t,e))}));function b(e,t){const o=p.find((t=>e.actionType===t.value));return o&&o.requiredInput&&-1!==o.requiredInput.indexOf(t)}var g={evaluateCondition:function(e){if(e&&e.length>=2&&"/"===e[0]&&"/"===e[1])return!0;const t=e?+e:-1;return Number.isNaN(+t)?"true"===e.toLowerCase():0!==t}};const m=/(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g,v=/(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g,h=()=>{try{return window.self!==window.top}catch(e){return!0}},f=async e=>(await e.getSheetList()).filter((e=>g.evaluateCondition(e.qData.showCondition))).sort(((e,t)=>e.qData.rank-t.qData.rank)),y=[{translation:"Object.ActionButton.NoNavigation",value:"none"},{translation:"Object.ActionButton.GoToNextSheet",value:"nextSheet",navigationCall:async({senseNavigation:e})=>{await e.nextSheet()},requiredInput:[]},{translation:"Object.ActionButton.GoToPreviousSheet",value:"prevSheet",navigationCall:async({senseNavigation:e})=>{await e.prevSheet()},requiredInput:[]},{translation:"Object.ActionButton.GoToLastSheet",value:"lastSheet",navigationCall:async({app:e,senseNavigation:t})=>{const o=await f(e);await t.goToSheet(o[o.length-1].qInfo.qId)},requiredInput:[]},{translation:"Object.ActionButton.GoToFirstSheet",value:"firstSheet",navigationCall:async({app:e,senseNavigation:t})=>{const o=await f(e);await t.goToSheet(o[0].qInfo.qId)},requiredInput:[]},{translation:"Object.ActionButton.GoToASheet",value:"goToSheet",navigationCall:async({senseNavigation:e,sheet:t})=>{t&&await e.goToSheet(t)},requiredInput:["sheet"]},{translation:"Object.ActionButton.GoToSheetById",value:"goToSheetById",navigationCall:async({senseNavigation:e,sheet:t})=>{t&&await e.goToSheet(t)},requiredInput:["sheetId"]},{translation:"Object.ActionButton.GoToStory",hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("storytelling"),value:"goToStory",navigationCall:async({senseNavigation:e,story:t})=>{t&&await e.goToStory(t)},requiredInput:["story"]},{translation:"Object.ActionButton.OpenWebsiteEmail",value:"openWebsite",navigationCall:async({websiteUrl:e,sameWindow:t})=>{try{if(e){const a=(o=e).startsWith("http://")?"http://":o.startsWith("https://")?"https://":o.startsWith("mailto:")?"mailto:":"http://",n=(e=>{let t=e;return e.startsWith("http://")&&(t=e.slice("http://".length)),e.startsWith("https://")&&(t=e.slice("https://".length)),t})(e),l=(e=>{let t;try{t=new URL(e)}catch(e){return!1}return"mailto:"===t.protocol})(n);let i="";if(l&&window.open(n,i),t&&(i=h()?"_parent":"_self",window.open(`${a}${n}`,i)),!l&&!t){const e=(e=>String(e).replace(v,"$1�$2").replace(m,encodeURI))(n);window.open(`${a}${e}`,i)}}}catch(e){}var o},requiredInput:["websiteUrl","sameWindow"]},{translation:"Object.ActionButton.DocumentChain",value:"openChainedApp",hide:({isEnabled:e,isUnsupportedFeature:t})=>!(null!=e&&e("ACTION_BUTTON_DOCUMENT_CHAINING"))||(null==t?void 0:t("bookmarks")),navigationCall:async({app:e,sameWindow:t,appId:o,sheet:a})=>{const n=e.storeTempSelectionState&&await e.storeTempSelectionState();let l="";t&&(l=h()?"_parent":"_self");const i=`../sense/app/${encodeURIComponent(o)}/sheet/${encodeURIComponent(a)}/tempselectionstate/${encodeURIComponent(n)}`;window.open(i,l)},requiredInput:["sameWindow","appId","sheetId"]},{translation:"Object.ActionButton.SelectOdagApp",value:"odagLink",navigationCall:async({app:e,senseNavigation:t,odagLink:o,element:a})=>{"function"==typeof t.openOdagPopup&&o&&o.length>0&&await t.openOdagPopup(e,o,a)},requiredInput:["odagLink"]}],w=e=>y.filter((t=>{var o;return!(null!==(o=t.hide)&&void 0!==o&&o.call(t,e))})),k=(e,t)=>{const o=y.find((t=>e.navigation.action===t.value));return o&&o.requiredInput&&-1!==o.requiredInput.indexOf(t)};var S={getValue:function(e,t,o){const a=t.split(".");let n;if(void 0===e)return o;for(n=0;n<a.length;++n){if(void 0===e[a[n]])return o;e=e[a[n]]}return e}};function C(e){switch(e){case"gotoSheet":return"goToSheet";case"gotoSheetById":return"goToSheetById";case"gotoStory":return"goToStory";case"switchToEdit":return"none";default:return e}}const A=(e,t)=>{const o={qChildren:[]},a={actions:[],props:{useEnabledCondition:null,fullWidth:"auto"},qLayoutExclude:{disabled:{}},...t};return e&&"qlik-button-for-navigation"===e.properties.visualization&&Object.keys(e.properties).forEach((t=>{let o;switch(t){case"props":o=e.properties[t],a.style.label=o.buttonLabel,a.style.icon.useIcon=o.buttonShowIcon,a.style.icon.iconType=o.buttonIconLui,a.style.font.align=o.buttonTextAlign,a.useEnabledCondition=o.useEnabledCondition,a.enabledCondition=o.enabledCondition,o.actionItems&&o.actionItems.forEach((e=>{!function(e,t){const o={actionType:e.actionType,bookmark:e.selectedBookmark,field:e.selectedField,variable:e.variable,value:e.value,softLock:e.softLock,cId:e.cId};switch(e.actionType){case"clearOther":o.actionType="clearAllButThis";break;case"unlockAllAndClearAll":o.actionType="clearAll",o.softLock=!0;break;case"selectField":o.actionType="selectMatchingValues";break;case"selectAndLockField":t.actions.push({...o,cId:null,actionType:"selectMatchingValues"}),o.actionType="lockField"}t.actions.push(o)}(e,a)})),a.navigation={action:C(o.navigationAction),sheet:"gotoSheetById"===o.navigationAction?o.sheetId:o.selectedSheet,story:o.selectedStory,websiteUrl:o.websiteUrl,sameWindow:o.sameWindow};break;case"qStateName":case"showTitles":case"title":case"subtitle":case"footnote":a[t]=e.properties[t]}})),o.qProperty=a,o};var I=[{value:"image",icon:"image",label:"Image"},{value:"back",icon:"back",label:"Back"},{value:"forward",icon:"forward",label:"Forward"},{value:"history",icon:"history",label:"History"},{value:"help",icon:"help",label:"Help"},{value:"info",icon:"info",label:"Info"},{value:"text",icon:"text",label:"Text"},{value:"group",icon:"group",label:"Group"},{value:"search",icon:"search",label:"Search"},{value:"zoom-in",icon:"zoom-in",label:"Zoom in"},{value:"zoom-out",icon:"zoom-out",label:"Zoom out"},{value:"export",icon:"export",label:"Export"},{value:"import",icon:"import",label:"Import"},{value:"field",icon:"field",label:"Field"},{value:"lock",icon:"lock",label:"Lock"},{value:"unlock",icon:"unlock",label:"Unlock"},{value:"database",icon:"database",label:"Database"},{value:"calendar",icon:"calendar",label:"Calendar"},{value:"bookmark",icon:"bookmark",label:"Bookmark"},{value:"library",icon:"library",label:"Library"},{value:"star",icon:"star",label:"Star"},{value:"print",icon:"print",label:"Print"},{value:"remove",icon:"remove",label:"Remove"},{value:"handle",icon:"handle",label:"Handle"},{value:"handle-horizontal",icon:"handle-horizontal",label:"Handle horizontal"},{value:"menu",icon:"menu",label:"Menu"},{value:"list",icon:"list",label:"List"},{value:"unordered-list",icon:"unordered-list",label:"Unordered list"},{value:"clock",icon:"clock",label:"Clock"},{value:"puzzle",icon:"puzzle",label:"Puzzle"},{value:"filterpane",icon:"filterpane",label:"Filterpane"},{value:"plus",icon:"plus",label:"Plus"},{value:"minus",icon:"minus",label:"Minus"},{value:"triangle-top",icon:"triangle-top",label:"Triangle top"},{value:"triangle-bottom",icon:"triangle-bottom",label:"Triangle bottom"},{value:"triangle-left",icon:"triangle-left",label:"Triangle left"},{value:"triangle-right",icon:"triangle-right",label:"Triangle right"},{value:"tick",icon:"tick",label:"Tick"},{value:"cogwheel",icon:"cogwheel",label:"Cogwheel"},{value:"settings",icon:"settings",label:"Settings"},{value:"cut",icon:"cut",label:"Cut"},{value:"copy",icon:"copy",label:"Copy"},{value:"paste",icon:"paste",label:"Paste"},{value:"camera",icon:"camera",label:"Camera"},{value:"slide-show",icon:"slide-show",label:"Slide show"},{value:"palette",icon:"palette",label:"Palette"},{value:"shapes",icon:"shapes",label:"Shapes"},{value:"effects",icon:"effects",label:"Effects"},{value:"file",icon:"file",label:"File"},{value:"expand",icon:"expand",label:"Expand"},{value:"collapse",icon:"collapse",label:"Collapse"},{value:"bin",icon:"bin",label:"Bin"},{value:"link",icon:"link",label:"Link"},{value:"pivot",icon:"pivot",label:"Pivot"},{value:"reload",icon:"reload",label:"Reload"},{value:"add",icon:"add",label:"Add"},{value:"edit",icon:"edit",label:"Edit"},{value:"key",icon:"key",label:"Key"},{value:"box",icon:"box",label:"Box"},{value:"home",icon:"home",label:"Home"},{value:"person",icon:"person",label:"Person"},{value:"grid",icon:"grid",label:"Grid"},{value:"cloud",icon:"cloud",label:"Cloud"},{value:"more",icon:"more",label:"More"},{value:"folder",icon:"folder",label:"Folder"},{value:"drop",icon:"drop",label:"Drop"},{value:"play",icon:"play",label:"Play"},{value:"tag",icon:"tag",label:"Tag"},{value:"close",icon:"close",label:"Close"},{value:"warning",icon:"warning",label:"Warning"},{value:"warning-triangle",icon:"warning-triangle",label:"Warning triangle"},{value:"share",icon:"share",label:"Share"},{value:"top",icon:"top",label:"Top"},{value:"low-resolution",icon:"low-resolution",label:"Low resolution"},{value:"high-resolution",icon:"high-resolution",label:"High resolution"},{value:"view",icon:"view",label:"View"},{value:"control",icon:"control",label:"Control"},{value:"code",icon:"code",label:"Code"},{value:"upload",icon:"upload",label:"Upload"},{value:"repair",icon:"repair",label:"Repair"},{value:"split",icon:"split",label:"Split"},{value:"up-down",icon:"up-down",label:"Up down"},{value:"disconnect",icon:"disconnect",label:"Disconnect"},{value:"photo-library",icon:"photo-library",label:"Photo library"},{value:"application",icon:"application",label:"Application"},{value:"new-tab",icon:"new-tab",label:"New tab"},{value:"ascending",icon:"ascending",label:"Ascending"},{value:"descending",icon:"descending",label:"Descending"},{value:"arrow-up",icon:"arrow-up",label:"Arrow up"},{value:"arrow-down",icon:"arrow-down",label:"Arrow down"},{value:"arrow-right",icon:"arrow-right",label:"Arrow right"},{value:"arrow-left",icon:"arrow-left",label:"Arrow left"},{value:"sync",icon:"sync",label:"Sync"},{value:"draggable",icon:"draggable",label:"Draggable"},{value:"book",icon:"book",label:"Book"},{value:"measure",icon:"measure",label:"Measure"},{value:"download",icon:"download",label:"Download"},{value:"more-rounded",icon:"more-rounded",label:"More rounded"},{value:"align-object-left",icon:"align-object-left",label:"Align object-left"},{value:"align-object-center",icon:"align-object-center",label:"Align object-center"},{value:"align-object-right",icon:"align-object-right",label:"Align object-right"},{value:"submit",icon:"submit",label:"Submit"},{value:"operators",icon:"operators",label:"Operators"},{value:"general-data-class",icon:"general-data-class",label:"General data-class"},{value:"building",icon:"building",label:"Building"},{value:"bell",icon:"bell",label:"Bell"},{value:"unlink",icon:"unlink",label:"Unlink"},{value:"lightbulb",icon:"lightbulb",label:"Lightbulb"},{value:"log-in",icon:"log-in",label:"Log in"},{value:"log-out",icon:"log-out",label:"Log out"},{value:"previous",icon:"previous",label:"Previous"},{value:"goto",icon:"goto",label:"Goto"},{value:"save",icon:"save",label:"Save"},{value:"pause",icon:"pause",label:"Pause"},{value:"stop",icon:"stop",label:"Stop"},{value:"step-in",icon:"step-in",label:"Step in"},{value:"comment",icon:"comment",label:"Comment"},{value:"indent",icon:"indent",label:"Indent"},{value:"undent",icon:"undent",label:"Undent"},{value:"filter",icon:"filter",label:"Filter"},{value:"clear-filter",icon:"clear-filter",label:"Clear filter"},{value:"insert",icon:"insert",label:"Insert"},{value:"direction-left",icon:"direction-left",label:"Direction left"},{value:"swap",icon:"swap",label:"Swap"},{value:"bubbles",icon:"bubbles",label:"Bubbles"},{value:"sheet",icon:"sheet",label:"Sheet"},{value:"object",icon:"object",label:"Object"},{value:"clear-selections",icon:"clear-selections",label:"Clear selections"},{value:"selections-tool",icon:"selections-tool",label:"Selections tool"},{value:"selections-reload",icon:"selections-reload",label:"Selections reload"},{value:"selections-back",icon:"selections-back",label:"Selections back"},{value:"selections-forward",icon:"selections-forward",label:"Selections forward"},{value:"expression",icon:"expression",label:"Expression"},{value:"select-alternative",icon:"select-alternative",label:"Select alternative"},{value:"select-possible",icon:"select-possible",label:"Select possible"},{value:"select-excluded",icon:"select-excluded",label:"Select excluded"},{value:"select-all",icon:"select-all",label:"Select all"},{value:"bar-chart",icon:"bar-chart",label:"Bar chart"},{value:"bar-chart-horizontal",icon:"bar-chart-horizontal",label:"Bar chart-horizontal"},{value:"line-chart",icon:"line-chart",label:"Line chart"},{value:"pie-chart",icon:"pie-chart",label:"Pie chart"},{value:"gauge-chart",icon:"gauge-chart",label:"Gauge chart"},{value:"kpi",icon:"kpi",label:"Kpi"},{value:"scatter-chart",icon:"scatter-chart",label:"Scatter chart"},{value:"map",icon:"map",label:"Map"},{value:"table",icon:"table",label:"Table"},{value:"pivot-table",icon:"pivot-table",label:"Pivot table"},{value:"treemap",icon:"treemap",label:"Treemap"},{value:"combo-chart",icon:"combo-chart",label:"Combo chart"},{value:"boxplot",icon:"boxplot",label:"Boxplot"},{value:"distributionplot",icon:"distributionplot",label:"Distributionplot"},{value:"histogram",icon:"histogram",label:"Histogram"},{value:"direct-discovery",icon:"direct-discovery",label:"Direct discovery"},{value:"data-model",icon:"data-model",label:"Data model"},{value:"script",icon:"script",label:"Script"},{value:"script-ok",icon:"script-ok",label:"Script ok"},{value:"debug",icon:"debug",label:"Debug"},{value:"auto-layout",icon:"auto-layout",label:"Auto layout"}];const x=[{value:!1,translation:"properties.colorMode.primary"},{value:!0,translation:"properties.colorMode.byExpression"}],O=[{value:!0,translation:"properties.on"},{value:!1,translation:"properties.off"}];function B({translator:e,shouldHide:t,senseNavigation:o}){return{definition:{type:"items",component:"accordion",items:{actions:{type:"items",translation:"Object.ActionButton.ActionsAndNavigation",grouped:!0,items:{actions:{type:"array",translation:"Object.ActionButton.Actions",ref:"actions",itemTitleRef:t=>{if(t.actionLabel)return t.actionLabel;const o=t.actionType?"Object.ActionButton.InvalidAction":"Object.ActionButton.NewAction",a=p.find((e=>t.actionType===e.value));return e.get(a&&a.translation||o)},allowAdd:!0,allowRemove:!0,allowMove:!0,addTranslation:"Object.ActionButton.AddAction",items:{label:{component:"string",ref:"actionLabel",translation:"Common.Label",expression:"optional",defaultValue:""},actionType:{type:"string",ref:"actionType",component:"expression-with-dropdown",translation:"Object.ActionButton.Action",defaultValue:"",options:d(t),dropdownOnly:!0},bookmark:{type:"string",ref:"bookmark",component:"expression-with-dropdown",translation:"ExpressionEditor.SetExpresions.Bookmark",defaultValue:"",dropdownOnly:!0,options:async(e,t)=>(await t.app.getBookmarkList()).map((e=>({label:e.qData.title,value:e.qInfo.qId}))),show:e=>b(e,"bookmark")},field:{type:"string",ref:"field",component:"expression-with-dropdown",translation:"Common.Field",defaultValue:"",dropdownOnly:!0,options:async(e,t)=>(await t.app.getFieldList()).map((e=>({label:e.qName,value:e.qName}))),show:e=>b(e,"field")},variable:{type:"string",ref:"variable",component:"expression-with-dropdown",translation:"Common.Variable",defaultValue:"",expressionType:"StringExpression",options:async(e,t)=>(await t.app.getVariableList()).filter((t=>!t.qIsReserved||t.qIsReserved&&e.showSystemVariables)).map((e=>({label:e.qName,value:e.qName}))),show:e=>b(e,"variable")},showSystemVariables:{type:"boolean",ref:"showSystemVariables",translation:"ExpressionEditor.SystemVariables",defaultValue:!1,show:e=>b(e,"variable")},softLock:{type:"boolean",ref:"softLock",translation:"Object.ActionButton.Softlock",defaultValue:!1,show:e=>b(e,"softLock")},value:{type:"string",ref:"value",component:"string",translation:"properties.value",expression:"optional",show:e=>b(e,"value")},partial:{type:"boolean",ref:"partial",translation:"Object.ActionButton.Partial",defaultValue:!1,show:e=>b(e,"partial")},automation:{type:"string",component:"expression-with-dropdown",translation:"Object.ActionButton.Automation",ref:"automation",dropdownOnly:!0,options:async()=>(await fetch("../api/v1/items?resourceType=automation&limit=100").then((e=>e.json()))).data.map((e=>({value:e.id,label:e.name}))),show:e=>b(e,"automation")},automationPostData:{type:"boolean",ref:"automationPostData",translation:"Object.ActionButton.Automation.SendSelections",show:e=>b(e,"automation"),defaultValue:!1}}},navigation:{translation:"Object.ActionButton.Navigation",type:"items",items:{action:{ref:"navigation.action",translation:"Object.ActionButton.Navigation",component:"expression-with-dropdown",defaultValue:null,options:w(t),dropdownOnly:!0},appId:{type:"string",expression:"optional",ref:"navigation.appId",translation:"properties.appId",show:e=>k(e,"appId")},sheetId:{type:"string",ref:"navigation.sheet",translation:"properties.sheet",expression:"optional",show:e=>k(e,"sheetId")},sheet:{type:"string",ref:"navigation.sheet",translation:"properties.sheet",component:"expression-with-dropdown",expressionType:"StringExpression",show:e=>k(e,"sheet"),options:async(e,t)=>(await t.app.getSheetList()).map((e=>({value:e.qInfo.qId,label:e.qMeta.title,showCondition:e.qData.showCondition})))},story:{type:"string",ref:"navigation.story",translation:"properties.story",component:"expression-with-dropdown",expressionType:"StringExpression",show:e=>k(e,"story"),options:async(e,t)=>(await t.app.getStoryList()).map((e=>({value:e.qInfo.qId,label:e.qMeta.title})))},websiteUrl:{type:"string",expression:"optional",ref:"navigation.websiteUrl",translation:"properties.website",show:e=>k(e,"websiteUrl")},sameWindow:{type:"boolean",ref:"navigation.sameWindow",translation:"properties.sameWindow",show:e=>k(e,"sameWindow"),defaultValue:!1},odagLink:{type:"string",ref:"navigation.odagLink",component:"dropdown",translation:"ExpressionEditor.SetExpresions.OdagAppLinks",options:async(e,t)=>(await o.getOdagLinks(t.app)).filter((e=>"odaglink"===e.properties.type)).map((e=>({label:e.properties.data.name,value:e.properties.data.id}))),show:e=>k(e,"odagLink")}}}}},enableCondition:{type:"items",translation:"properties.enableConditionSection",items:{useCondition:{type:"boolean",component:"switch",translation:"properties.enableToggle",ref:"useEnabledCondition",options:[{value:!0,translation:"properties.on"},{value:!1,translation:"properties.off"}]},condition:{ref:"enabledCondition",translation:"properties.enableCondition",type:"integer",expression:"optional",show:e=>e.useEnabledCondition}}},settings:{component:"expandable-items",translation:"Common.Appearance",uses:"settings",items:{general:{type:"items",translation:"properties.general",items:{showTitles:{},details:{show:!1},cellNavMenu:{show:!1},label:{component:"string",ref:"style.label",translation:"Common.Label",expression:"optional"}}},font:{grouped:!0,type:"items",translation:"properties.font",items:{sizeAndColor:{type:"items",items:{fontSize:{component:"slider",type:"number",ref:"style.font.size",translation:"properties.fontSize",min:.2,max:1,step:.01},useFontColorExpression:{ref:"style.font.useColorExpression",type:"boolean",translation:"properties.fontColor",component:"dropdown",options:x},colorPicker:{component:"color-picker",type:"object",ref:"style.font.color",translation:"properties.color",dualOutput:!0,show:e=>!S.getValue(e,"style.font.useColorExpression")},colorExpression:{component:"string",type:"string",ref:"style.font.colorExpression",translation:"Common.Expression",expression:"optional",show:e=>S.getValue(e,"style.font.useColorExpression")}}},stylingAndAlign:{type:"items",items:{fontStyling:{component:"item-selection-list",type:"string",ref:"style.font.style",translation:"properties.textStyle",horizontal:!0,multipleSelect:!0,items:[{component:"icon-item",icon:"bold",value:"bold",translation:"Common.bold",labelPlacement:"bottom"},{component:"icon-item",icon:"italic",value:"italic",translation:"Common.italic",labelPlacement:"bottom"},{component:"icon-item",icon:"underline",value:"underline",translation:"Common.underline",labelPlacement:"bottom"}]},textAlign:{component:"item-selection-list",type:"string",ref:"style.font.align",translation:"properties.Alignment",horizontal:!0,items:[{component:"icon-item",icon:"align_left",value:"left",translation:"properties.dock.left",labelPlacement:"bottom"},{component:"icon-item",icon:"align_center",value:"center",translation:"Common.Center",labelPlacement:"bottom"},{component:"icon-item",icon:"align_right",value:"right",translation:"properties.dock.right",labelPlacement:"bottom"}]}}}}},background:{grouped:!0,type:"items",translation:"properties.background",items:{backgroundColor:{type:"items",items:{useColorExpression:{ref:"style.background.useColorExpression",type:"boolean",translation:"AppDetails.SheetBackgroundColor",component:"dropdown",options:x},colorPicker:{component:"color-picker",type:"object",ref:"style.background.color",translation:"properties.color",dualOutput:!0,show:e=>!S.getValue(e,"style.background.useColorExpression")},colorExpression:{component:"string",type:"string",ref:"style.background.colorExpression",translation:"Common.Expression",expression:"optional",show:e=>S.getValue(e,"style.background.useColorExpression")}}},backgroundImage:{type:"items",items:{useBackgroundImage:{ref:"style.background.useImage",type:"boolean",translation:"properties.backgroundImage.use",component:"switch",options:O},backgroundUrl:{ref:"style.background.url.qStaticContentUrlDef.qUrl",layoutRef:"style.background.url.qStaticContentUrl.qUrl",schemaIgnore:!0,translation:"Common.Image",tooltip:{select:"properties.media.select",remove:"properties.media.removeBackground"},type:"string",component:"media",show:e=>S.getValue(e,"style.background.useImage")},backgroundSize:{ref:"style.background.size",translation:"properties.backgroundImage.size",type:"string",component:"dropdown",options:[{value:"auto",translation:"properties.backgroundImage.originalSize"},{value:"alwaysFit",translation:"properties.backgroundImage.sizeAlwaysFit"},{value:"fitWidth",translation:"properties.backgroundImage.sizeFitWidth"},{value:"fitHeight",translation:"properties.backgroundImage.sizeFitHeight"},{value:"fill",translation:"properties.backgroundImage.sizeStretch"},{value:"alwaysFill",translation:"properties.backgroundImage.sizeAlwaysFill"}],show:e=>S.getValue(e,"style.background.useImage")&&!!S.getValue(e,"style.background.url.qStaticContentUrlDef.qUrl")},backgroundPosition:{ref:"style.background.position",translation:"Common.Position",type:"string",component:"align-matrix",show:e=>S.getValue(e,"style.background.useImage")&&S.getValue(e,"style.background.url.qStaticContentUrlDef.qUrl")&&"fill"!==S.getValue(e,"style.background.size"),currentSize:e=>S.getValue(e,"style.background.size")}}}}},border:{type:"items",grouped:!0,translation:"properties.border",items:{borderSettings:{type:"items",items:{useBorder:{ref:"style.border.useBorder",type:"boolean",translation:"properties.border.use",component:"switch",options:O},borderRadius:{component:"slider",show:e=>S.getValue(e,"style.border.useBorder"),translation:"properties.border.radius",type:"number",ref:"style.border.radius",min:0,max:1,step:.01},borderWidth:{component:"slider",show:e=>S.getValue(e,"style.border.useBorder"),type:"number",ref:"style.border.width",translation:"properties.border.width",min:0,max:.5,step:.005},colorDropdown:{type:"string",show:e=>S.getValue(e,"style.border.useBorder"),component:"dropdown",translation:"properties.border.color",ref:"style.border.useColorExpression",options:x},colorPicker:{component:"color-picker",type:"object",ref:"style.border.color",translation:"properties.color",dualOutput:!0,show:e=>S.getValue(e,"style.border.useBorder")&&!S.getValue(e,"style.border.useColorExpression")},colorExpression:{component:"string",type:"string",ref:"style.border.colorExpression",translation:"Common.Expression",show:e=>S.getValue(e,"style.border.useBorder")&&S.getValue(e,"style.border.useColorExpression"),expression:"optional"}}}}},icon:{type:"items",grouped:!0,translation:"properties.icon",items:{iconSettings:{type:"items",items:{useIcon:{ref:"style.icon.useIcon",type:"boolean",translation:"properties.icon.use",component:"switch",options:O},iconType:{ref:"style.icon.iconType",component:"expression-with-dropdown",translation:"properties.icon",defaultValue:"",options:I,expressionType:"StringExpression",show:e=>S.getValue(e,"style.icon.useIcon")},iconPosition:{ref:"style.icon.position",component:"dropdown",translation:"Common.Position",options:[{translation:"properties.dock.left",value:"left"},{translation:"properties.dock.right",value:"right"}],show:e=>S.getValue(e,"style.icon.useIcon")}}}}}}}}},importProperties:A,exportProperties:null,support:{export:!1,exportData:!1,snapshot:!1,viewData:!1,quickMobile:!0}}}const q={aliceblue:{r:240,g:248,b:255},antiquewhite:{r:250,g:235,b:215},aqua:{r:0,g:255,b:255},aquamarine:{r:127,g:255,b:212},azure:{r:240,g:255,b:255},beige:{r:245,g:245,b:220},bisque:{r:255,g:228,b:196},black:{r:0,g:0,b:0},blanchedalmond:{r:255,g:235,b:205},blue:{r:0,g:0,b:255},blueviolet:{r:138,g:43,b:226},brown:{r:165,g:42,b:42},burlywood:{r:222,g:184,b:135},cadetblue:{r:95,g:158,b:160},chartreuse:{r:127,g:255,b:0},chocolate:{r:210,g:105,b:30},coral:{r:255,g:127,b:80},cornflowerblue:{r:100,g:149,b:237},cornsilk:{r:255,g:248,b:220},crimson:{r:220,g:20,b:60},cyan:{r:0,g:255,b:255},darkblue:{r:0,g:0,b:139},darkcyan:{r:0,g:139,b:139},darkgoldenrod:{r:184,g:134,b:11},darkgray:{r:169,g:169,b:169},darkgreen:{r:0,g:100,b:0},darkgrey:{r:169,g:169,b:169},darkkhaki:{r:189,g:183,b:107},darkmagenta:{r:139,g:0,b:139},darkolivegreen:{r:85,g:107,b:47},darkorange:{r:255,g:140,b:0},darkorchid:{r:153,g:50,b:204},darkred:{r:139,g:0,b:0},darksalmon:{r:233,g:150,b:122},darkseagreen:{r:143,g:188,b:143},darkslateblue:{r:72,g:61,b:139},darkslategray:{r:47,g:79,b:79},darkslategrey:{r:47,g:79,b:79},darkturquoise:{r:0,g:206,b:209},darkviolet:{r:148,g:0,b:211},deeppink:{r:255,g:20,b:147},deepskyblue:{r:0,g:191,b:255},dimgray:{r:105,g:105,b:105},dimgrey:{r:105,g:105,b:105},dodgerblue:{r:30,g:144,b:255},firebrick:{r:178,g:34,b:34},floralwhite:{r:255,g:250,b:240},forestgreen:{r:34,g:139,b:34},fuchsia:{r:255,g:0,b:255},gainsboro:{r:220,g:220,b:220},ghostwhite:{r:248,g:248,b:255},gold:{r:255,g:215,b:0},goldenrod:{r:218,g:165,b:32},gray:{r:128,g:128,b:128},green:{r:0,g:128,b:0},greenyellow:{r:173,g:255,b:47},grey:{r:128,g:128,b:128},honeydew:{r:240,g:255,b:240},hotpink:{r:255,g:105,b:180},indianred:{r:205,g:92,b:92},indigo:{r:75,g:0,b:130},ivory:{r:255,g:255,b:240},khaki:{r:240,g:230,b:140},lavender:{r:230,g:230,b:250},lavenderblush:{r:255,g:240,b:245},lawngreen:{r:124,g:252,b:0},lemonchiffon:{r:255,g:250,b:205},lightblue:{r:173,g:216,b:230},lightcoral:{r:240,g:128,b:128},lightcyan:{r:224,g:255,b:255},lightgoldenrodyellow:{r:250,g:250,b:210},lightgray:{r:211,g:211,b:211},lightgreen:{r:144,g:238,b:144},lightgrey:{r:211,g:211,b:211},lightpink:{r:255,g:182,b:193},lightsalmon:{r:255,g:160,b:122},lightseagreen:{r:32,g:178,b:170},lightskyblue:{r:135,g:206,b:250},lightslategray:{r:119,g:136,b:153},lightslategrey:{r:119,g:136,b:153},lightsteelblue:{r:176,g:196,b:222},lightyellow:{r:255,g:255,b:224},lime:{r:0,g:255,b:0},limegreen:{r:50,g:205,b:50},linen:{r:250,g:240,b:230},magenta:{r:255,g:0,b:255},maroon:{r:128,g:0,b:0},mediumaquamarine:{r:102,g:205,b:170},mediumblue:{r:0,g:0,b:205},mediumorchid:{r:186,g:85,b:211},mediumpurple:{r:147,g:112,b:219},mediumseagreen:{r:60,g:179,b:113},mediumslateblue:{r:123,g:104,b:238},mediumspringgreen:{r:0,g:250,b:154},mediumturquoise:{r:72,g:209,b:204},mediumvioletred:{r:199,g:21,b:133},midnightblue:{r:25,g:25,b:112},mintcream:{r:245,g:255,b:250},mistyrose:{r:255,g:228,b:225},moccasin:{r:255,g:228,b:181},navajowhite:{r:255,g:222,b:173},navy:{r:0,g:0,b:128},oldlace:{r:253,g:245,b:230},olive:{r:128,g:128,b:0},olivedrab:{r:107,g:142,b:35},orange:{r:255,g:165,b:0},orangered:{r:255,g:69,b:0},orchid:{r:218,g:112,b:214},palegoldenrod:{r:238,g:232,b:170},palegreen:{r:152,g:251,b:152},paleturquoise:{r:175,g:238,b:238},palevioletred:{r:219,g:112,b:147},papayawhip:{r:255,g:239,b:213},peachpuff:{r:255,g:218,b:185},peru:{r:205,g:133,b:63},pink:{r:255,g:192,b:203},plum:{r:221,g:160,b:221},powderblue:{r:176,g:224,b:230},purple:{r:128,g:0,b:128},rebeccapurple:{r:102,g:51,b:153},red:{r:255,g:0,b:0},rosybrown:{r:188,g:143,b:143},royalblue:{r:65,g:105,b:225},saddlebrown:{r:139,g:69,b:19},salmon:{r:250,g:128,b:114},sandybrown:{r:244,g:164,b:96},seagreen:{r:46,g:139,b:87},seashell:{r:255,g:245,b:238},sienna:{r:160,g:82,b:45},silver:{r:192,g:192,b:192},skyblue:{r:135,g:206,b:235},slateblue:{r:106,g:90,b:205},slategray:{r:112,g:128,b:144},slategrey:{r:112,g:128,b:144},snow:{r:255,g:250,b:250},springgreen:{r:0,g:255,b:127},steelblue:{r:70,g:130,b:180},tan:{r:210,g:180,b:140},teal:{r:0,g:128,b:128},thistle:{r:216,g:191,b:216},tomato:{r:255,g:99,b:71},transparent:{r:255,g:255,b:255,a:0},turquoise:{r:64,g:224,b:208},violet:{r:238,g:130,b:238},wheat:{r:245,g:222,b:179},white:{r:255,g:255,b:255},whitesmoke:{r:245,g:245,b:245},yellow:{r:255,g:255,b:0},yellowgreen:{r:154,g:205,b:50}},T={resolveExpression:e=>{let t=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(e);if(t)return`rgb(${t[1]},${t[2]},${t[3]})`;if(t=/^argb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(e),t){const e=Math.round(t[1]/255*100)/100;return`rgba(${t[2]},${t[3]},${t[4]},${e})`}if(t=/^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i.exec(e),t)return e;const o=e&&q[e.toLowerCase()];if(o){const e=void 0!==o.a?o.a:1;return`rgba(${o.r},${o.g},${o.b},${e})`}return"none"},getFadedColor(e){const t=.15;let o,a,n,l;if(e.length>7){o=e.split(",");const i=-1!==o[0].indexOf("a");return a=i?parseInt(o[0].slice(5),10):parseInt(o[0].slice(4),10),l=parseInt(o[1],10),n=parseInt(o[2],10),`${(i?"rgba(":"rgb(")+(Math.round((0-a)*t)+a)},${Math.round((0-l)*t)+l},${Math.round((0-n)*t)+n}${i?`,${o[3]}`:")"}`}return o=parseInt(e.slice(1),16),a=o>>16,l=o>>8&255,n=255&o,`#${(16777216+65536*(Math.round((0-a)*t)+a)+256*(Math.round((0-l)*t)+l)+(Math.round((0-n)*t)+n)).toString(16).slice(1)}`}};function E(e){var t;let o,a,n,l;if(null!=e&&null!==(t=e.session)&&void 0!==t&&t.config){o=e.session.config,a=new URL(o.url);const t=function(e){const t=String(e).split(e.host)[1].split("/");return"app"===t[1]?"":`/${t[1]}`}(a);return l="wss:"===a.protocol,n=l?"https://":"http://",n+a.host+t}}var L=(e,t)=>{e.replace(/^\.\.\//i,"/"),e=(e=e.replace(/"/g,'\\"')).replace(/'/g,"\\'");return e=`${E(t)}/`+("/"===e[0]?e.substr(1):e)};const F={auto:"auto auto",alwaysFit:"contain",fitWidth:"100% auto",fitHeight:"auto 100%",fill:"100% 100%",alwaysFill:"cover"},N={topLeft:"0% 0%",centerLeft:"50% 0%",bottomLeft:"100% 0%",topCenter:"0% 50%",centerCenter:"50% 50%",bottomCenter:"100% 50%",topRight:"0% 100%",centerRight:"50% 100%",bottomRight:"100% 100%"},j=(e,t)=>`${e}: ${t};`,D=({useColorExpression:e=!1,colorExpression:t="",color:o=s.COLOR},a,n)=>{let l;return e?l=T.resolveExpression(t):"string"==typeof o?l=o:o&&(l=n.getColorPickerColor(o)),l&&"none"!==l?l:a};var $={getStyles({style:e={},disabled:t,theme:o,element:a,app:n}){let l="width: 100%;height: 100%;transition: transform .1s ease-in-out;position: absolute;bottom: 0;left: 0; top: 0;right: 0;margin: auto;";const{font:i={},background:r={},border:c={}}=e,u=o.getDataColorSpecials().primary;l+=t?j("opacity",.4):j("cursor","pointer"),l+=j("color",D(i,"#ffffff",o));const p=i.style||s.FONT_STYLE;p.bold&&(l+=j("font-weight","bold")),p.italic&&(l+=j("font-style","italic"));const d=D(r,u,o);if(l+=j("background-color",d),r.useImage&&r.url.qStaticContentUrl){let e=r.url.qStaticContentUrl.qUrl;e&&(e=L(e,n),l+=j("background-image",`url('${e}')`),l+=j("background-size",F[r.size||s.BACKGROUND_SIZE]),l+=j("background-position",N[r.position||s.BACKGROUND_POSITION]),l+=j("background-repeat","no-repeat"))}if(c.useBorder){const e=Math.min(a.offsetWidth,a.offsetHeight),t=D(c,T.getFadedColor(d),o),n=(c.width||s.BORDER_WIDTH)*e/2;l+=j("border",`${n}px solid ${t}`),l+=j("border-radius",(c.radius||s.BORDER_RADIUS)*e/2+"px")}else l+="border: none;";return l},createLabelAndIcon({button:e,theme:t,style:o={},isSense:a}){const{icon:n={},font:l={},label:i=s.LABEL}=o,r=document.createElement("text");r.style.whiteSpace="nowrap",r.style.fontFamily=t.getStyle("","","fontFamily");const c=document.createElement("span");c.textContent=i,c.style.whiteSpace="nowrap",c.style.textOverflow="ellipsis",c.style.overflow="visible",l.style&&l.style.underline&&(c.style.textDecoration="underline"),r.appendChild(c);const u=a&&n.useIcon&&""!==n.iconType;if(u){const e=document.createElement("span"),t=I.find((e=>e.label===n.iconType||e.value===n.iconType));e.style.textDecoration="none",e.style.fontSize="inherit",e.setAttribute("class",`lui-icon lui-icon--${t?t.value:""}`),"right"===n.position?r.appendChild(e):r.insertBefore(e,c)}e.innerHTML="",e.appendChild(r),r.style.fontSize=`${e.clientHeight}px`;let p=e.clientHeight/r.offsetHeight*e.clientHeight;r.style.fontSize=`${p}px`,r.offsetWidth>e.clientWidth&&(p*=e.clientWidth/r.offsetWidth);const d=l.size||s.FONT_SIZE;l.style&&l.style.italic?u?(r.style.fontSize=`${Math.max(p*d*.84,8)}px`,r.children[0].style.marginRight=.04*r.offsetWidth+"px",r.children[1].style.marginRight=.04*r.offsetWidth+"px"):(r.style.fontSize=`${Math.max(p*d*.9,8)}px`,r.children[0].style.marginRight=.02*r.offsetWidth+"px"):u?(r.style.fontSize=`${Math.max(p*d*.88,8)}px`,r.children[0].style.marginRight=.04*r.offsetWidth+"px"):r.style.fontSize=`${Math.max(p*d*.92,8)}px`,"8px"===r.style.fontSize&&r.children.forEach((e=>{e.style.overflow="hidden"})),r.style.margin="0 3%",r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="left"===l.align?"flex-start":"right"===l.align?"flex-end":"center"}};function V(s){var d,b;const{sense:g,translator:m,flags:{isEnabled:v},anything:h}=s,f={isEnabled:v,isFeatureBlacklisted:null===(d=h.sense)||void 0===d?void 0:d.isFeatureBlacklisted,isUnsupportedFeature:null===(b=h.sense)||void 0===b?void 0:b.isUnsupportedFeature},w=null==g?void 0:g.navigation;return c.style.label=g?m.get("Object.ActionButton"):"Button",{qae:{properties:c,data:u},component(){const s=e(),c=t();o((()=>{const e=document.createElement("button");e.appendChild(document.createElement("text")),s.appendChild(e)}),[]);const u=a(),d=n(),b=l(),g=(({layout:e,theme:t,app:o,constraints:a,senseNavigation:n,element:l})=>{const i=!!n,r=l.firstElementChild,{style:s,qStateName:c,navigation:u}=e,d=e.useEnabledCondition&&0===e.enabledCondition,b=!d&&!a.active,g=$.getStyles({style:s,disabled:d,theme:t,element:l,app:o});r.setAttribute("style",g),r.setAttribute("tabindex","-1"),$.createLabelAndIcon({button:r,theme:t,style:s,isSense:i}),r.onclick=async()=>{if(b){const t=[],{actions:a}=e;if(a.forEach((e=>{const a=p.find((t=>t.value===e.actionType));a&&t.push(a.getActionCall({app:o,qStateName:c,...e,senseNavigation:n}))})),r.setAttribute("disabled",!0),await(async e=>{for(let t=0;t<e.length;t++)await e[t]()})(t),n&&!n.getCurrentStoryId()){const e=u&&y.find((e=>e.value===u.action));n&&e&&"function"==typeof e.navigationCall&&await e.navigationCall({app:o,senseNavigation:n,...u,element:l})}r.removeAttribute("disabled")}};const m=()=>{if(b){const{offsetWidth:e,offsetHeight:t}=r;r.style.transform=t>e?`scale(0.98, ${1-e/t*.02})`:`scale(${1-t/e*.02}, 0.98)`}},v=()=>{const{transform:e}=r.style;b&&""!==e&&"scale(1)"!==e&&(r.style.transform="scale(1)")};return r.onmousedown=e=>{0===e.button&&m()},r.onmouseup=v,r.onmouseleave=v,r.ontouchstart=m,r.ontouchend=v,r.ontouchcancel=v,()=>{r.onclick=void 0,r.onmousedown=void 0,r.onmouseup=void 0,r.onmouseleave=void 0,r.ontouchstart=void 0,r.ontouchend=void 0,r.ontouchcancel=void 0}})({element:s,layout:u,constraints:b,theme:c,app:d,senseNavigation:w});i((()=>()=>{g()}),[s]),r((()=>({focus(){s.firstElementChild.onclick()}})),[s])},ext:B({translator:m,shouldHide:f,senseNavigation:w})}}export{V as default};
7
+ import{useElement as e,useTheme as t,useMemo as o,useStaleLayout as n,useApp as a,useConstraints as i,useEffect as l,useImperativeHandle as r}from"@nebula.js/stardust";var s={LABEL:"Button",FONT_SIZE:.5,COLOR:{index:-1,color:null},FONT_STYLE:{bold:!0,italic:!1,underline:!1},FONT_FAMILY:"Source Sans Pro",TEXT_ALIGN:"center",BACKGROUND_SIZE:"auto",BACKGROUND_POSITION:"centerCenter",BORDER_RADIUS:0,BORDER_WIDTH:0,ICON_POSITION:"left"};const c={version:"1.28.0",showTitles:!0,title:"",subtitle:"",footnote:"",useEnabledCondition:!1,enabledCondition:1,actions:[],navigation:{action:"none"},disableNavMenu:!0,showDetails:!1,style:{label:s.LABEL,font:{fontFamily:s.FONT_FAMILY,useColorExpression:!1,color:s.COLOR,colorExpression:"",size:s.FONT_SIZE,style:s.FONT_STYLE,align:s.TEXT_ALIGN},background:{useColorExpression:!1,color:s.COLOR,colorExpression:"",useImage:!1,url:{qStaticContentUrlDef:{qUrl:""}},size:s.BACKGROUND_SIZE,position:s.BACKGROUND_POSITION},border:{useColorExpression:!1,color:s.COLOR,colorExpression:"",useBorder:!1,radius:s.BORDER_RADIUS,width:s.BORDER_WIDTH},icon:{useIcon:!1,iconType:"",position:s.ICON_POSITION}}};var u={targets:[]};function p(e){var t;let o,n,a,i;if(null!=e&&null!==(t=e.session)&&void 0!==t&&t.config){o=e.session.config,n=new URL(o.url);const t=function(e){const t=String(e).split(e.host)[1].split("/");return"app"===t[1]?"":`/${t[1]}`}(n);return i="wss:"===n.protocol,a=i?"https://":"http://",a+n.host+t}}const d=()=>{try{return window.self!==window.top}catch(e){return!0}},b="http://",g="https://",m="mailto:",f=e=>e.startsWith(b)?b:e.startsWith(g)?g:e.startsWith(m)?m:b,h=e=>{let t=e;return e.startsWith(b)&&(t=e.slice(b.length)),e.startsWith(g)&&(t=e.slice(g.length)),t},v=/(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g,y=/(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g,w=e=>String(e).replace(y,"$1�$2").replace(v,encodeURI),k=async()=>(await fetch("../api/v1/csrf-token")).headers.get("qlik-csrf-token"),A=async(e,t)=>{const o=await e.getObject(t);return(await o.getParent()).id},S=async e=>{var t;const o=await fetch(`../api/v1/apps/${e}`),n=await o.json();return(null==n||null===(t=n.attributes)||void 0===t?void 0:t.spaceId)||"personal"},x=async e=>{if(e.length>2){return(await fetch(`../api/v1/automations/${e}`)).json()}return null},C=(e,t,o)=>{const n=e.get(t);return n===t?o:n},I=(e,t)=>{const o={message:C(t,"Object.ActionButton.Automation.DefaultAutomationMsg","Automation finished")};if(void 0!==e){if("object"==typeof e)return Array.isArray(e)?(null==e?void 0:e.length)>0?{message:e.join(" ")}:o:Object.keys(e).includes("message")?e:o;try{const t=JSON.parse(e);return Object.keys(t).includes("message")?t:o}catch(t){return""===e?o:"string"==typeof e||"number"==typeof e?{message:e}:o}}return o},T=async(e,t,o,n=0)=>{const a=C(o,"Object.ActionButton.Automation.DefaultAutomationMsg","Automation finished"),i=await(async(e,t)=>(await fetch(`../api/v1/automations/${e}/runs/${t}`)).json())(e,t),{status:l}=i;if(!["queued","running","not started","starting"].includes(l)){let e;switch(i.status){case"finished":var r;(null===(r=i.title)||void 0===r?void 0:r.length)>0?(e=I(i.title,o),e.ok=!0):e={message:a,ok:!0};break;case"failed":var s;(null===(s=i.title)||void 0===s?void 0:s.length)>0?(e=I(i.title,o),e.ok=!1):e={message:C(o,"Object.ActionButton.Automation.AutomationError","Automation error"),ok:!0};break;case"finished with warnings":var c;(null===(c=i.title)||void 0===c?void 0:c.length)>0?(e=I(i.title,o),e.ok=!1):e={message:a,ok:!0};break;case"must stop":case"stopped":var u;(null===(u=i.title)||void 0===u?void 0:u.length)>0?(e=I(i.title,o),e.ok=!1):e={message:C(o,"Object.ActionButton.Automation.DefaultAutomationMsg","Unknown error"),ok:!0};break;default:var p;(null===(p=i.title)||void 0===p?void 0:p.length)>0?(e=I(i.title,o),e.ok=!0):e={message:a,ok:!0}}return e}if(n>6e5)return{ok:!1,message:C(o,"geo.findLocation.error.timeout","Timeout")};setTimeout(T(e,t,o,n+100),100)},O=(e,t)=>{null!=e&&Object.keys(t).forEach((o=>{e.style[o]=t[o]}))},B=e=>{O(e,{opacity:0}),setTimeout((()=>{e.remove()}),1e3)},E=(e,t)=>{const{message:o,url:n,urlText:a}=e,i=document.createElement("div"),l=`sn-action-button-snackbar-${(Math.random()+1).toString(36).substring(7)}`;i.setAttribute("id",l);const r=document.querySelectorAll(".sn-action-button-snackbar"),s=24+5*((null==r?void 0:r.length)||0);O(i,{width:"400px",height:"35px","background-color":"#FFFFFF",position:"fixed",left:"calc(50% - 200px)",right:"auto",bottom:`${s}px`,"box-shadow":"0px 1px 2px 0px rgb(0 0 0 / 15%)",padding:"6px 16px","border-radius":"3px","z-index":1e3,opacity:0,transition:"visibility 0ms, opacity 400ms linear"});const c=`<div class="sn-action-button-snackbar" style="display: flex; justify-content: space-between; height: 100%; align-items: center;">\n <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" height="16px"\n fill="currentColor" aria-hidden="true" role="img" data-testid="status-indicator__valid">\n <defs>\n <path id="tick_svg__tick-a" d="m6 10 7-7 2 2-7 7-2 2-5-5 2-2 3 3Z"></path>\n </defs>\n <use xlink:href="#tick_svg__tick-a" fill-rule="evenodd"></use>\n </svg>\n <span class="sn-action-button-snackbar-text"\n style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">${o}${n?`<a href="${(e=>{const t=f(e),o=h(e);return`${t}${w(o)}`})(n)}" style="margin-left: 6px;" target="${u=t,u?d()?"_parent":"_self":"_blank"}">${a||"Open"}</a>`:""}</span>\n <span style="cursor: pointer;">\n <svg class="sn-action-button-snackbar-close" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"\n viewBox="0 0 16 16" fill="currentColor">\n <path\n d="M9.34535242,8 L13.3273238,11.9819714 C13.6988326,12.3534802 13.6988326,12.955815 13.3273238,13.3273238 C12.955815,13.6988326 12.3534802,13.6988326 11.9819714,13.3273238 L8,9.34535242 L4.01802863,13.3273238 C3.64651982,13.6988326 3.04418502,13.6988326 2.67267621,13.3273238 C2.3011674,12.955815 2.3011674,12.3534802 2.67267621,11.9819714 L6.65464758,8 L2.67267621,4.01802863 C2.3011674,3.64651982 2.3011674,3.04418502 2.67267621,2.67267621 C3.04418502,2.3011674 3.64651982,2.3011674 4.01802863,2.67267621 L8,6.65464758 L11.9819714,2.67267621 C12.3534802,2.3011674 12.955815,2.3011674 13.3273238,2.67267621 C13.6988326,3.04418502 13.6988326,3.64651982 13.3273238,4.01802863 L9.34535242,8 Z">\n </path>\n </svg>\n </span>\n </div>`;var u;return i.innerHTML=c,i},q=async(e,t,o)=>{const n=E(e,o);n.querySelector(".sn-action-button-snackbar-close").addEventListener("click",(()=>{B(n)}));document.querySelector("body").appendChild(n),O(n,{opacity:1}),setTimeout((()=>{B(n)}),Math.max(1e3*t-400,1))},L=async(e,t,o,n)=>{const a=await(async()=>{const e=await fetch("../api/v1/users/me");return await e.json()})();return{id:o,inputs:{app:e.id,bookmark:n,sheet:await A(e,t),user:a.subject,space:await S(e.id),tenant:a.tenantId,time:new Date},context:"qsbutton"}},N=[{value:"applyBookmark",translation:"Object.ActionButton.ApplyBookmark",group:"bookmark",hide:({isUnsupportedFeature:e})=>null==e?void 0:e("bookmarks"),getActionCall:({app:e,bookmark:t})=>async()=>{const o=(await e.getBookmarkList()).find((e=>e.qData.title===t));t&&await e.applyBookmark(o&&o.qInfo&&o.qInfo.qId||t)},requiredInput:["bookmark"]},{value:"back",translation:"Object.ActionButton.MoveBackward",group:"selection",getActionCall:({app:e})=>async()=>{await e.back()},requiredInput:[]},{value:"forward",translation:"Object.ActionButton.MoveForward",group:"selection",getActionCall:({app:e})=>async()=>{await e.forward()},requiredInput:[]},{value:"clearAll",translation:"Object.ActionButton.ClearAll",group:"selection",getActionCall:({app:e,softLock:t})=>async()=>{await e.clearAll(t)},requiredInput:["softLock"]},{value:"clearAllButThis",translation:"Object.ActionButton.ClearAllButThis",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:n})=>async()=>{if(o){const a=await e.getField(o,t);await a.clearAllButThis(n)}},requiredInput:["field","softLock"]},{value:"clearField",translation:"Object.ActionButton.ClearSelectionInField",group:"selection",getActionCall:({app:e,qStateName:t,field:o})=>async()=>{if(o){const n=await e.getField(o,t);await n.clear()}},requiredInput:["field"]},{value:"selectAll",translation:"Object.ActionButton.SelectAllInField",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:n})=>async()=>{if(o){const a=await e.getField(o,t);await a.selectAll(n)}},requiredInput:["field","softLock"]},{value:"selectValues",translation:"Object.ActionButton.SelectValuesInField",group:"selection",getActionCall:({app:e,qStateName:t,field:o,value:n,softLock:a})=>async()=>{if(o&&n){const i=await e.getField(o,t),l=await e.getFieldDescription(o),r=await(async(e,t,o)=>{let n=t.split(";");if(o){let t="";n.forEach((e=>{t+=`Num('${e}')&';'&`})),n=(await e.evaluate(t.slice(0,-5))).split(";")}return n.map((e=>Number.isNaN(+e)?{qText:e}:{qIsNumeric:!0,qNumber:Number(e)}))})(e,n,l.qTags.includes("$date"));await i.selectValues(r,!1,a)}},requiredInput:["field","value","softLock"]},{value:"selectMatchingValues",translation:"Object.ActionButton.SelectMatchingValues",group:"selection",getActionCall:({app:e,qStateName:t,field:o,value:n,softLock:a})=>async()=>{if(o&&n){const i=await e.getField(o,t);await i.select(n,!1,a)}},requiredInput:["field","value","softLock"]},{value:"selectAlternative",translation:"Object.ActionButton.SelectAlternatives",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:n})=>async()=>{if(o){const a=await e.getField(o,t);await a.selectAlternative(n)}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field","softLock"]},{value:"selectExcluded",translation:"Object.ActionButton.SelectExcluded",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:n})=>async()=>{if(o){const a=await e.getField(o,t);await a.selectExcluded(n)}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field","softLock"]},{value:"selectPossible",translation:"Object.ActionButton.SelectPossibleValues",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:n})=>async()=>{if(o){const a=await e.getField(o,t);await a.selectPossible(n)}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field","softLock"]},{value:"toggleSelect",translation:"Object.ActionButton.ToggleFieldSelection",group:"selection",getActionCall:({app:e,qStateName:t,field:o,value:n,softLock:a})=>async()=>{if(o&&n){const i=await e.getField(o,t);await i.toggleSelect(n,a)}},requiredInput:["field","value","softLock"]},{value:"lockAll",translation:"Object.ActionButton.LockAllSelections",group:"selection",getActionCall:({app:e})=>async()=>{await e.lockAll()},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:[]},{value:"lockField",translation:"Object.ActionButton.LockField",group:"selection",getActionCall:({app:e,qStateName:t,field:o})=>async()=>{if(o){const n=await e.getField(o,t);await n.lock()}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field"]},{value:"unlockAll",translation:"Object.ActionButton.UnlockAllSelections",group:"selection",getActionCall:({app:e})=>async()=>{await e.unlockAll()},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:[]},{value:"unlockField",translation:"Object.ActionButton.UnlockAField",group:"selection",getActionCall:({app:e,qStateName:t,field:o})=>async()=>{if(o){const n=await e.getField(o,t);await n.unlock()}},hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("advancedSelectionOptions"),requiredInput:["field"]},{value:"setVariable",translation:"Object.ActionButton.SetVariable",group:"variables",getActionCall:({app:e,variable:t,value:o})=>async()=>{if(t&&o)try{const n=await e.getVariableByName(t);await n.setStringValue(o)}catch(e){}},requiredInput:["variable","value"]},{value:"doReload",translation:"Object.ActionButton.DoReload",group:"reload",hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("reloadData"),getActionCall:({app:e,partial:t})=>async()=>{await e.doReload(0,!!t,!1)&&await e.doSave()},requiredInput:["partial"]},{translation:"Object.ActionButton.ExecuteAutomation",value:"executeAutomation",getActionCall:({app:e,automation:t,automationId:o,automationTriggered:n,automationExecutionToken:a,automationPostData:i,automationShowNotification:l,automationNotificationDuration:r,buttonId:s,automationOpenLinkSameWindow:c,multiUserAutomation:u,translator:p})=>async()=>{if(q({message:"myText"},100),u&&o.length)try{let t,u;if(!(void 0!==o&&o.length>1))return;t=((e,t,o)=>t?`../api/v1/automations/${e}/actions/execute?X-Execution-Token=${o}`:`../api/v1/automations/${e}/runs`)(o,n,a),i&&(u=await(async e=>e.createTemporaryBookmark({qOptions:{qIncludeVariables:!0,qIncludeAllPatches:!0}}))(e));const d=await L(e,s,o,u),b=await(async(e,t,o)=>{const n={"Content-Type":"application/json","qlik-csrf-token":await k()};return e&&(n["X-Execution-Token"]=t),{method:"POST",headers:n,body:JSON.stringify(e?o.inputs:o)}})(n,a,d),g=await fetch(t,b);if(l){const e=await(async(e,t,o,n)=>{let a;switch(o.status){case 200:case 201:{const i=await o.json(),{status:l,guid:r,id:s}=i;t&&"queued"!==l?(a=I(i,n),a.ok=!0):a=T(e,void 0===s?r:s,n);break}case 400:a={message:C(n,"Object.ActionButton.Automation.BadRequest","Bad request"),ok:!1};break;case 401:case 403:a={message:C(n,"Object.ActionButton.Automation.NotAuthorized","You are not authorized to run this automation"),ok:!1};break;case 404:a={message:C(n,"Object.ActionButton.Automation.AutomationNotFound","Automation not found"),ok:!1};break;case 500:case 503:a={message:C(n,"Object.ActionButton.Automation.AutomationError","Automation error"),ok:!1};break;default:a={message:C(n,"Object.ActionButton.Automation.UnkownError","Unknown error"),ok:!1}}return a})(o,n,g,p);q(e,r,c)}}catch(e){}else void 0!==t&&(async(e,t,o)=>{try{e=encodeURIComponent(e);const n=await fetch(`../api/v1/items/${e}`).then((e=>e.json())),a=await fetch(`../api/v1/automations/${n.resourceId}`).then((e=>e.json()));let i=`../api/v1/automations/${a.id}/actions/execute?X-Execution-Token=${a.executionToken}`;if(t){const t=await fetch(`../api/v1/automations/${n.resourceId}/blocks`).then((e=>e.json())).then((e=>{let t=[];for(let o=0;o<e.blocks.length;o++)if("FormBlock"===e.blocks[o].type){t=e.blocks[o].form;break}return t}));if(t.length>0){const n=new Date,a={qProp:{qInfo:{qId:`automation_${o.id}_${e}_${n.getTime()}`,qType:"bookmark"},qMetaDef:{title:`Generated automation bookmark on ${n.toISOString()}`,description:"Generated to provide target automation with bookmark to get current selection state",_createdBy:"sn-action-button",_createdFor:"automation",_createdOn:`${n.toISOString()}`,_id:`automation_${encodeURIComponent(o.id)}_${e}_${n.getTime()}`}}},l=await o.createBookmark(a).then((e=>e.getLayout())).then((e=>e.qInfo.qId));await o.saveObjects(),i=`${i}&${t[0].label.toLowerCase()}=${encodeURIComponent(o.id)}&${t[1].label.toLowerCase()}=${l}`}}await fetch(i).then((e=>e.json()))}catch(e){}})(t,i,e)},requiredInput:["automation"],hide:({isEnabled:e})=>!(null!=e&&e("ACTION_BUTTON_AUTOMATIONS"))},{value:"refreshDynamicViews",translation:"Object.ActionButton.RefreshDynamicViews",group:"dynamicViews",getActionCall:({senseNavigation:e})=>async()=>{"function"==typeof e.refreshDynamicViews&&await e.refreshDynamicViews()},requiredInput:[]}],F=e=>N.filter((t=>{var o;return!(null!==(o=t.hide)&&void 0!==o&&o.call(t,e))}));function j(e,t){const o=N.find((t=>e.actionType===t.value));return o&&o.requiredInput&&-1!==o.requiredInput.indexOf(t)}const D=async e=>(await e.getSheetList()).filter((e=>function(e){if(e&&e.length>=2&&"/"===e[0]&&"/"===e[1])return!0;const t=e?+e:-1;return Number.isNaN(+t)?"true"===e.toLowerCase():0!==t}(e.qData.showCondition))).sort(((e,t)=>e.qData.rank-t.qData.rank)),$=[{translation:"Object.ActionButton.NoNavigation",value:"none"},{translation:"Object.ActionButton.GoToNextSheet",value:"nextSheet",navigationCall:async({senseNavigation:e})=>{await e.nextSheet()},requiredInput:[]},{translation:"Object.ActionButton.GoToPreviousSheet",value:"prevSheet",navigationCall:async({senseNavigation:e})=>{await e.prevSheet()},requiredInput:[]},{translation:"Object.ActionButton.GoToLastSheet",value:"lastSheet",navigationCall:async({app:e,senseNavigation:t})=>{const o=await D(e);await t.goToSheet(o[o.length-1].qInfo.qId)},requiredInput:[]},{translation:"Object.ActionButton.GoToFirstSheet",value:"firstSheet",navigationCall:async({app:e,senseNavigation:t})=>{const o=await D(e);await t.goToSheet(o[0].qInfo.qId)},requiredInput:[]},{translation:"Object.ActionButton.GoToASheet",value:"goToSheet",navigationCall:async({senseNavigation:e,sheet:t})=>{t&&await e.goToSheet(t)},requiredInput:["sheet"]},{translation:"Object.ActionButton.GoToSheetById",value:"goToSheetById",navigationCall:async({senseNavigation:e,sheet:t})=>{t&&await e.goToSheet(t)},requiredInput:["sheetId"]},{translation:"Object.ActionButton.GoToStory",hide:({isFeatureBlacklisted:e})=>null==e?void 0:e("storytelling"),value:"goToStory",navigationCall:async({senseNavigation:e,story:t})=>{t&&await e.goToStory(t)},requiredInput:["story"]},{translation:"Object.ActionButton.OpenWebsiteEmail",value:"openWebsite",navigationCall:async({websiteUrl:e,sameWindow:t})=>{try{if(e){const o=f(e),n=h(e),a=(e=>{let t;try{t=new URL(e)}catch(e){return!1}return t.protocol===m})(n);let i="";if(a&&window.open(n,i),t&&(i=d()?"_parent":"_self",window.open(`${o}${n}`,i)),!a&&!t){const e=w(n);window.open(`${o}${e}`,i)}}}catch(e){}},requiredInput:["websiteUrl","sameWindow"]},{translation:"Object.ActionButton.DocumentChain",value:"openChainedApp",hide:({isEnabled:e,isUnsupportedFeature:t})=>!(null!=e&&e("ACTION_BUTTON_DOCUMENT_CHAINING"))||(null==t?void 0:t("bookmarks")),navigationCall:async({app:e,sameWindow:t,appId:o,sheet:n})=>{const a=e.storeTempSelectionState&&await e.storeTempSelectionState();let i="";t&&(i=d()?"_parent":"_self");const l=`../sense/app/${encodeURIComponent(o)}/sheet/${encodeURIComponent(n)}/tempselectionstate/${encodeURIComponent(a)}`;window.open(l,i)},requiredInput:["sameWindow","appId","sheetId"]},{translation:"Object.ActionButton.SelectOdagApp",value:"odagLink",navigationCall:async({app:e,senseNavigation:t,odagLink:o,element:n})=>{"function"==typeof t.openOdagPopup&&o&&o.length>0&&await t.openOdagPopup(e,o,n)},requiredInput:["odagLink"]}],_=e=>$.filter((t=>{var o;return!(null!==(o=t.hide)&&void 0!==o&&o.call(t,e))})),V=(e,t)=>{const o=$.find((t=>e.navigation.action===t.value));return o&&o.requiredInput&&-1!==o.requiredInput.indexOf(t)};var U={getValue:function(e,t,o){const n=t.split(".");let a;if(void 0===e)return o;for(a=0;a<n.length;++a){if(void 0===e[n[a]])return o;e=e[n[a]]}return e}};const R=[{value:!1,translation:"properties.colorMode.primary"},{value:!0,translation:"properties.colorMode.byExpression"}],M=[{value:!0,translation:"properties.on"},{value:!1,translation:"properties.off"}],P=["American Typewriter, serif","Andalé Mono, monospace","Arial Black, sans-serif","Arial, sans-serif","Bradley Hand, cursive","Brush Script MT, cursive","Comic Sans MS, cursive","Courier, monospace","Didot, serif","Georgia, serif","Impact, sans-serif","Lucida Console, monospace","Luminari, fantasy","Monaco, monospace","QlikView Sans, sans-serif","Source Sans Pro, sans-serif","Tahoma, sans-serif","Times New Roman, serif","Trebuchet MS, sans-serif","Verdana, sans-serif"].map((e=>{return{value:e,label:(t=e,t.split(",")[0])};var t})),z=e=>({type:"items",grouped:!1,translation:"properties.presentation",items:{styleEditor:{component:"styling-panel",chartTitle:"Object.ActionButton",translation:"LayerStyleEditor.component.styling",subtitle:"LayerStyleEditor.component.styling",ref:"components",useGeneral:!0,useBackground:e,items:{labelSection:{component:"panel-section",translation:"Common.Label",items:{labelItem:{items:{fontFamily:{component:"dropdown",ref:"style.font.fontFamily",options:P,defaultValue:s.FONT_FAMILY},fontWrapper:{component:"inline-wrapper",type:"items",grouped:!0,items:{fontStyle:{type:"array",component:"font-style-buttons",width:!1,ref:"style.font.style",defaultValue:["bold"]},textAlign:{component:"text-align-buttons",ref:"style.font.align",defaultValue:s.TEXT_ALIGN}}},fontSize:{component:"slider",type:"number",ref:"style.font.size",translation:"properties.fontSize",min:.2,max:1,step:.01,defaultValue:.5},fontColor:{items:{useFontColorExpression:{ref:"style.font.useColorExpression",type:"boolean",translation:"properties.fontColor",component:"dropdown",width:14,options:R},colorPicker:{component:"color-picker",type:"object",ref:"style.font.color",translation:"properties.color",width:12,show:e=>!U.getValue(e,"style.font.useColorExpression")},colorExpression:{type:"string",component:"input-field-expression",ref:"style.font.colorExpression",translation:"Common.Expression",expression:"optional",show:e=>U.getValue(e,"style.font.useColorExpression")}}}}}}}}}}});function W(e){switch(e){case"gotoSheet":return"goToSheet";case"gotoSheetById":return"goToSheetById";case"gotoStory":return"goToStory";case"switchToEdit":return"none";default:return e}}const G=(e,t)=>{const o={qChildren:[]},n={actions:[],props:{useEnabledCondition:null,fullWidth:"auto"},qLayoutExclude:{disabled:{}},...t};return e&&"qlik-button-for-navigation"===e.properties.visualization&&Object.keys(e.properties).forEach((t=>{let o;switch(t){case"props":o=e.properties[t],n.style.label=o.buttonLabel,n.style.icon.useIcon=o.buttonShowIcon,n.style.icon.iconType=o.buttonIconLui,n.style.font.align=o.buttonTextAlign,n.useEnabledCondition=o.useEnabledCondition,n.enabledCondition=o.enabledCondition,o.actionItems&&o.actionItems.forEach((e=>{!function(e,t){const o={actionType:e.actionType,bookmark:e.selectedBookmark,field:e.selectedField,variable:e.variable,value:e.value,softLock:e.softLock,cId:e.cId};switch(e.actionType){case"clearOther":o.actionType="clearAllButThis";break;case"unlockAllAndClearAll":o.actionType="clearAll",o.softLock=!0;break;case"selectField":o.actionType="selectMatchingValues";break;case"selectAndLockField":t.actions.push({...o,cId:null,actionType:"selectMatchingValues"}),o.actionType="lockField"}t.actions.push(o)}(e,n)})),n.navigation={action:W(o.navigationAction),sheet:"gotoSheetById"===o.navigationAction?o.sheetId:o.selectedSheet,story:o.selectedStory,websiteUrl:o.websiteUrl,sameWindow:o.sameWindow};break;case"qStateName":case"showTitles":case"title":case"subtitle":case"footnote":n[t]=e.properties[t]}})),o.qProperty=n,o};var H=[{value:"image",icon:"image",label:"Image"},{value:"back",icon:"back",label:"Back"},{value:"forward",icon:"forward",label:"Forward"},{value:"history",icon:"history",label:"History"},{value:"help",icon:"help",label:"Help"},{value:"info",icon:"info",label:"Info"},{value:"text",icon:"text",label:"Text"},{value:"group",icon:"group",label:"Group"},{value:"search",icon:"search",label:"Search"},{value:"zoom-in",icon:"zoom-in",label:"Zoom in"},{value:"zoom-out",icon:"zoom-out",label:"Zoom out"},{value:"export",icon:"export",label:"Export"},{value:"import",icon:"import",label:"Import"},{value:"field",icon:"field",label:"Field"},{value:"lock",icon:"lock",label:"Lock"},{value:"unlock",icon:"unlock",label:"Unlock"},{value:"database",icon:"database",label:"Database"},{value:"calendar",icon:"calendar",label:"Calendar"},{value:"bookmark",icon:"bookmark",label:"Bookmark"},{value:"library",icon:"library",label:"Library"},{value:"star",icon:"star",label:"Star"},{value:"print",icon:"print",label:"Print"},{value:"remove",icon:"remove",label:"Remove"},{value:"handle",icon:"handle",label:"Handle"},{value:"handle-horizontal",icon:"handle-horizontal",label:"Handle horizontal"},{value:"menu",icon:"menu",label:"Menu"},{value:"list",icon:"list",label:"List"},{value:"unordered-list",icon:"unordered-list",label:"Unordered list"},{value:"clock",icon:"clock",label:"Clock"},{value:"puzzle",icon:"puzzle",label:"Puzzle"},{value:"filterpane",icon:"filterpane",label:"Filterpane"},{value:"plus",icon:"plus",label:"Plus"},{value:"minus",icon:"minus",label:"Minus"},{value:"triangle-top",icon:"triangle-top",label:"Triangle top"},{value:"triangle-bottom",icon:"triangle-bottom",label:"Triangle bottom"},{value:"triangle-left",icon:"triangle-left",label:"Triangle left"},{value:"triangle-right",icon:"triangle-right",label:"Triangle right"},{value:"tick",icon:"tick",label:"Tick"},{value:"cogwheel",icon:"cogwheel",label:"Cogwheel"},{value:"settings",icon:"settings",label:"Settings"},{value:"cut",icon:"cut",label:"Cut"},{value:"copy",icon:"copy",label:"Copy"},{value:"paste",icon:"paste",label:"Paste"},{value:"camera",icon:"camera",label:"Camera"},{value:"slide-show",icon:"slide-show",label:"Slide show"},{value:"palette",icon:"palette",label:"Palette"},{value:"shapes",icon:"shapes",label:"Shapes"},{value:"effects",icon:"effects",label:"Effects"},{value:"file",icon:"file",label:"File"},{value:"expand",icon:"expand",label:"Expand"},{value:"collapse",icon:"collapse",label:"Collapse"},{value:"bin",icon:"bin",label:"Bin"},{value:"link",icon:"link",label:"Link"},{value:"pivot",icon:"pivot",label:"Pivot"},{value:"reload",icon:"reload",label:"Reload"},{value:"add",icon:"add",label:"Add"},{value:"edit",icon:"edit",label:"Edit"},{value:"key",icon:"key",label:"Key"},{value:"box",icon:"box",label:"Box"},{value:"home",icon:"home",label:"Home"},{value:"person",icon:"person",label:"Person"},{value:"grid",icon:"grid",label:"Grid"},{value:"cloud",icon:"cloud",label:"Cloud"},{value:"more",icon:"more",label:"More"},{value:"folder",icon:"folder",label:"Folder"},{value:"drop",icon:"drop",label:"Drop"},{value:"play",icon:"play",label:"Play"},{value:"tag",icon:"tag",label:"Tag"},{value:"close",icon:"close",label:"Close"},{value:"warning",icon:"warning",label:"Warning"},{value:"warning-triangle",icon:"warning-triangle",label:"Warning triangle"},{value:"share",icon:"share",label:"Share"},{value:"top",icon:"top",label:"Top"},{value:"low-resolution",icon:"low-resolution",label:"Low resolution"},{value:"high-resolution",icon:"high-resolution",label:"High resolution"},{value:"view",icon:"view",label:"View"},{value:"control",icon:"control",label:"Control"},{value:"code",icon:"code",label:"Code"},{value:"upload",icon:"upload",label:"Upload"},{value:"repair",icon:"repair",label:"Repair"},{value:"split",icon:"split",label:"Split"},{value:"up-down",icon:"up-down",label:"Up down"},{value:"disconnect",icon:"disconnect",label:"Disconnect"},{value:"photo-library",icon:"photo-library",label:"Photo library"},{value:"application",icon:"application",label:"Application"},{value:"new-tab",icon:"new-tab",label:"New tab"},{value:"ascending",icon:"ascending",label:"Ascending"},{value:"descending",icon:"descending",label:"Descending"},{value:"arrow-up",icon:"arrow-up",label:"Arrow up"},{value:"arrow-down",icon:"arrow-down",label:"Arrow down"},{value:"arrow-right",icon:"arrow-right",label:"Arrow right"},{value:"arrow-left",icon:"arrow-left",label:"Arrow left"},{value:"sync",icon:"sync",label:"Sync"},{value:"draggable",icon:"draggable",label:"Draggable"},{value:"book",icon:"book",label:"Book"},{value:"measure",icon:"measure",label:"Measure"},{value:"download",icon:"download",label:"Download"},{value:"more-rounded",icon:"more-rounded",label:"More rounded"},{value:"align-object-left",icon:"align-object-left",label:"Align object-left"},{value:"align-object-center",icon:"align-object-center",label:"Align object-center"},{value:"align-object-right",icon:"align-object-right",label:"Align object-right"},{value:"submit",icon:"submit",label:"Submit"},{value:"operators",icon:"operators",label:"Operators"},{value:"general-data-class",icon:"general-data-class",label:"General data-class"},{value:"building",icon:"building",label:"Building"},{value:"bell",icon:"bell",label:"Bell"},{value:"unlink",icon:"unlink",label:"Unlink"},{value:"lightbulb",icon:"lightbulb",label:"Lightbulb"},{value:"log-in",icon:"log-in",label:"Log in"},{value:"log-out",icon:"log-out",label:"Log out"},{value:"previous",icon:"previous",label:"Previous"},{value:"goto",icon:"goto",label:"Goto"},{value:"save",icon:"save",label:"Save"},{value:"pause",icon:"pause",label:"Pause"},{value:"stop",icon:"stop",label:"Stop"},{value:"step-in",icon:"step-in",label:"Step in"},{value:"comment",icon:"comment",label:"Comment"},{value:"indent",icon:"indent",label:"Indent"},{value:"undent",icon:"undent",label:"Undent"},{value:"filter",icon:"filter",label:"Filter"},{value:"clear-filter",icon:"clear-filter",label:"Clear filter"},{value:"insert",icon:"insert",label:"Insert"},{value:"direction-left",icon:"direction-left",label:"Direction left"},{value:"swap",icon:"swap",label:"Swap"},{value:"bubbles",icon:"bubbles",label:"Bubbles"},{value:"sheet",icon:"sheet",label:"Sheet"},{value:"object",icon:"object",label:"Object"},{value:"clear-selections",icon:"clear-selections",label:"Clear selections"},{value:"selections-tool",icon:"selections-tool",label:"Selections tool"},{value:"selections-reload",icon:"selections-reload",label:"Selections reload"},{value:"selections-back",icon:"selections-back",label:"Selections back"},{value:"selections-forward",icon:"selections-forward",label:"Selections forward"},{value:"expression",icon:"expression",label:"Expression"},{value:"select-alternative",icon:"select-alternative",label:"Select alternative"},{value:"select-possible",icon:"select-possible",label:"Select possible"},{value:"select-excluded",icon:"select-excluded",label:"Select excluded"},{value:"select-all",icon:"select-all",label:"Select all"},{value:"bar-chart",icon:"bar-chart",label:"Bar chart"},{value:"bar-chart-horizontal",icon:"bar-chart-horizontal",label:"Bar chart-horizontal"},{value:"line-chart",icon:"line-chart",label:"Line chart"},{value:"pie-chart",icon:"pie-chart",label:"Pie chart"},{value:"gauge-chart",icon:"gauge-chart",label:"Gauge chart"},{value:"kpi",icon:"kpi",label:"Kpi"},{value:"scatter-chart",icon:"scatter-chart",label:"Scatter chart"},{value:"map",icon:"map",label:"Map"},{value:"table",icon:"table",label:"Table"},{value:"pivot-table",icon:"pivot-table",label:"Pivot table"},{value:"treemap",icon:"treemap",label:"Treemap"},{value:"combo-chart",icon:"combo-chart",label:"Combo chart"},{value:"boxplot",icon:"boxplot",label:"Boxplot"},{value:"distributionplot",icon:"distributionplot",label:"Distributionplot"},{value:"histogram",icon:"histogram",label:"Histogram"},{value:"direct-discovery",icon:"direct-discovery",label:"Direct discovery"},{value:"data-model",icon:"data-model",label:"Data model"},{value:"script",icon:"script",label:"Script"},{value:"script-ok",icon:"script-ok",label:"Script ok"},{value:"debug",icon:"debug",label:"Debug"},{value:"auto-layout",icon:"auto-layout",label:"Auto layout"}];const Y=(e,t)=>({automation:{type:"string",component:"expression-with-dropdown",translation:"Object.ActionButton.Automation",ref:"automation",dropdownOnly:!0,options:async()=>{const e=await fetch("../api/v1/items?resourceType=automation&limit=100");return(await e.json()).data.map((e=>({value:e.id,label:e.name})))},show:()=>!e},automationId:{type:"string",component:"expression-with-dropdown",translation:"Object.ActionButton.Automation",ref:"automationId",dropdownOnly:!1,options:async()=>t(),show:()=>e,change:async e=>{const t=await x(e.automationId);e.automationShowTriggered="triggered"===t.runMode,e.automationTriggered?e.automationExecutionToken=t.executionToken:e.automationExecutionToken=""}},automationLink:{translation:"Object.ActionButton.Automation.Link",component:"link",url:e=>`/automations/editor/${e.automationId}`,show:t=>t.automationId.length>1&&e},automationPostData:{type:"boolean",ref:"automationPostData",translation:"Object.ActionButton.Automation.SendSelections",defaultValue:!1},includeSelectionsText:{translation:"Object.ActionButton.Automation.SendSelectionsHelp",component:"text",show:t=>t.automationPostData&&e},automationTriggered:{type:"boolean",ref:"automationTriggered",translation:"Object.ActionButton.Automation.RunModeTriggered",show:t=>e&&t.automationShowTriggered,defaultValue:!1,change:async e=>{const t=await x(e.automationId);e.automationTriggered?e.automationExecutionToken=t.executionToken:e.automationExecutionToken=""}},automationTriggeredText:{label:"Object.ActionButton.Automation.RunModeTriggeredHelp",component:"text",show:t=>e&&t.automationShowTriggered&&t.automationTriggered},automationShowNotification:{ref:"automationShowNotification",type:"boolean",translation:"Object.ActionButton.Automation.ShowNotification",component:"switch",options:[{value:!0,translation:"properties.on"},{value:!1,translation:"properties.off"}],defaultValue:!1,show:()=>e},automationNotificationDuration:{type:"number",ref:"automationNotificationDuration",translation:"Object.ActionButton.Automation.NotificationDuration",defaultValue:4,expression:"optional",show:t=>t.automationShowNotification&&e},automationNotificationDurationHelp:{translation:"Object.ActionButton.Automation.NotificationDurationHelp",component:"text",show:t=>t.automationShowNotification&&e},automationOpenLinkSameWindow:{ref:"automationOpenLinkSameWindow",type:"boolean",translation:"Object.ActionButton.Automation.OpenLinkInSameWindow",component:"switch",options:[{value:!0,translation:"properties.on"},{value:!1,translation:"properties.off"}],defaultValue:!1,show:t=>t.automationShowNotification&&e},copyBlock:{component:"button",translation:"Object.ActionButton.Automation.CopyInputBlock",action(e){navigator.clipboard.writeText(JSON.stringify((e=>{const t={blocks:[{id:"EB6A372B-3312-4E90-8E8F-88F2A889B4CF",type:"FormBlock",disabled:!1,name:"inputs",displayName:"Inputs",comment:"Inputs received from button",childId:e?"1D55D049-33EB-41CD-9EEC-3CACE5898C86":null,inputs:[],settings:[{id:"persist_data",value:"no",type:"select",structure:{}}],collapsed:[{name:"loop",isCollapsed:!1}],x:291.0010678361308,y:40.99957876441722,form:[{id:"inputs-input-0",label:"app",helpText:"null",type:"input",values:null,isRequired:!1,options:{},order:0},{id:"inputs-input-1",label:"bookmark",helpText:null,type:"input",values:null,isRequired:!1,options:{},order:1},{id:"inputs-input-2",label:"sheet",helpText:null,type:"input",values:null,isRequired:!1,options:{},order:2},{id:"inputs-input-3",label:"user",helpText:null,type:"input",values:null,isRequired:!1,options:{},order:3},{id:"inputs-input-4",label:"space",helpText:null,type:"input",values:null,isRequired:!1,options:{},order:4},{id:"inputs-input-5",label:"tenant",helpText:null,type:"input",values:null,isRequired:!1,options:{},order:5},{id:"inputs-input-6",label:"time",helpText:null,type:"input",values:null,isRequired:!1,options:{},order:6}],persistData:"no"}],variables:[]};return e&&t.blocks.push({id:"1D55D049-33EB-41CD-9EEC-3CACE5898C86",type:"SnippetBlock",disabled:!1,name:"applyBookmark",displayName:"Qlik Cloud Services - Apply Bookmark",comment:'Apply bookmark from button. To get selections or variables use the "Get Expression Value" block',childId:null,inputs:[{id:"d41ae430-073a-11ec-bdef-bb104839c843",value:"{$.inputs.app}",type:"string",structure:[]},{id:"fab02320-9270-11ed-a391-739edffdb33c",value:"{$.inputs.bookmark}",type:"string",structure:[]},{id:"f478e320-9270-11ed-b551-d73ebe8e14ad",value:"Yes",type:"select",displayValue:"Yes",structure:[]}],settings:[{id:"blendr_on_error",value:"stop",type:"select",structure:[]}],collapsed:[{name:"loop",isCollapsed:!1}],x:142,y:296,datasourcetype_guid:"61a87510-c7a3-11ea-95da-0fb0c241e75c",snippet_guid:"d41632d0-073a-11ec-a6ac-d34723268fbc"}),t})(e.automationPostData)))},show:()=>e}});let Z=null;const K=async()=>{if(!Z){const e=await fetch("../api/v1/automations?limit=100"),t=await e.json();Z=t.data.map((e=>({value:e.id,label:e.name})))}return Z};function X({translator:e,shouldHide:t,senseNavigation:o}){const n=t.isEnabled&&t.isEnabled("SENSECLIENT_IM_1855_AUTOMATIONS_MULTI_USER"),a=t.isEnabled&&t.isEnabled("SENSECLIENT_IM_1525_STYLINGPANEL_BUTTON"),i=t.isEnabled&&t.isEnabled("SENSECLIENT_IM_1525_BTN_BG");return{definition:{type:"items",component:"accordion",items:{actions:{type:"items",translation:"Object.ActionButton.ActionsAndNavigation",grouped:!0,items:{actions:{type:"array",translation:"Object.ActionButton.Actions",ref:"actions",itemTitleRef:t=>{if(t.actionLabel)return t.actionLabel;const o=t.actionType?"Object.ActionButton.InvalidAction":"Object.ActionButton.NewAction",n=N.find((e=>t.actionType===e.value));return e.get(n&&n.translation||o)},allowAdd:!0,allowRemove:!0,allowMove:!0,addTranslation:"Object.ActionButton.AddAction",items:{label:{component:"string",ref:"actionLabel",translation:"Common.Label",expression:"optional",defaultValue:""},actionType:{type:"string",ref:"actionType",component:"expression-with-dropdown",translation:"Object.ActionButton.Action",defaultValue:"",options:F(t),dropdownOnly:!0},bookmark:{type:"string",ref:"bookmark",component:"expression-with-dropdown",translation:"ExpressionEditor.SetExpresions.Bookmark",defaultValue:"",dropdownOnly:!0,options:async(e,t)=>(await t.app.getBookmarkList()).map((e=>({label:e.qData.title,value:e.qInfo.qId}))),show:e=>j(e,"bookmark")},field:{type:"string",ref:"field",component:"expression-with-dropdown",translation:"Common.Field",defaultValue:"",dropdownOnly:!0,options:async(e,t)=>(await t.app.getFieldList()).map((e=>({label:e.qName,value:e.qName}))),show:e=>j(e,"field")},variable:{type:"string",ref:"variable",component:"expression-with-dropdown",translation:"Common.Variable",defaultValue:"",expressionType:"StringExpression",options:async(e,t)=>(await t.app.getVariableList()).filter((t=>!t.qIsReserved||t.qIsReserved&&e.showSystemVariables)).map((e=>({label:e.qName,value:e.qName}))),show:e=>j(e,"variable")},showSystemVariables:{type:"boolean",ref:"showSystemVariables",translation:"ExpressionEditor.SystemVariables",defaultValue:!1,show:e=>j(e,"variable")},softLock:{type:"boolean",ref:"softLock",translation:"Object.ActionButton.Softlock",defaultValue:!1,show:e=>j(e,"softLock")},value:{type:"string",ref:"value",component:"string",translation:"properties.value",expression:"optional",show:e=>j(e,"value")},partial:{type:"boolean",ref:"partial",translation:"Object.ActionButton.Partial",defaultValue:!1,show:e=>j(e,"partial")},automationProps:{type:"items",grouped:!1,items:Y(n,K),show:e=>j(e,"automation")}}},navigation:{translation:"Object.ActionButton.Navigation",type:"items",items:{action:{ref:"navigation.action",translation:"Object.ActionButton.Navigation",component:"expression-with-dropdown",defaultValue:null,options:_(t),dropdownOnly:!0},appId:{type:"string",expression:"optional",ref:"navigation.appId",translation:"properties.appId",show:e=>V(e,"appId")},sheetId:{type:"string",ref:"navigation.sheet",translation:"properties.sheet",expression:"optional",show:e=>V(e,"sheetId")},sheet:{type:"string",ref:"navigation.sheet",translation:"properties.sheet",component:"expression-with-dropdown",expressionType:"StringExpression",show:e=>V(e,"sheet"),options:async(e,t)=>(await t.app.getSheetList()).map((e=>({value:e.qInfo.qId,label:e.qMeta.title,showCondition:e.qData.showCondition})))},story:{type:"string",ref:"navigation.story",translation:"properties.story",component:"expression-with-dropdown",expressionType:"StringExpression",show:e=>V(e,"story"),options:async(e,t)=>(await t.app.getStoryList()).map((e=>({value:e.qInfo.qId,label:e.qMeta.title})))},websiteUrl:{type:"string",expression:"optional",ref:"navigation.websiteUrl",translation:"properties.website",show:e=>V(e,"websiteUrl")},sameWindow:{type:"boolean",ref:"navigation.sameWindow",translation:"properties.sameWindow",show:e=>V(e,"sameWindow"),defaultValue:!1},odagLink:{type:"string",ref:"navigation.odagLink",component:"dropdown",translation:"ExpressionEditor.SetExpresions.OdagAppLinks",options:async(e,t)=>(await o.getOdagLinks(t.app)).filter((e=>"odaglink"===e.properties.type)).map((e=>({label:e.properties.data.name,value:e.properties.data.id}))),show:e=>V(e,"odagLink")}}}}},enableCondition:{type:"items",translation:"properties.enableConditionSection",items:{useCondition:{type:"boolean",component:"switch",translation:"properties.enableToggle",ref:"useEnabledCondition",options:[{value:!0,translation:"properties.on"},{value:!1,translation:"properties.off"}]},condition:{ref:"enabledCondition",translation:"properties.enableCondition",type:"integer",expression:"optional",show:e=>e.useEnabledCondition}}},settings:{component:"expandable-items",translation:"Common.Appearance",uses:"settings",items:{general:{type:"items",translation:"properties.general",items:{showTitles:{},details:{show:!1},cellNavMenu:{show:!1},label:{component:"string",ref:"style.label",translation:"Common.Label",expression:"optional"}}},font:{grouped:!0,type:"items",translation:"properties.font",items:{sizeAndColor:{type:"items",items:{fontSize:{component:"slider",type:"number",ref:"style.font.size",translation:"properties.fontSize",min:.2,max:1,step:.01},useFontColorExpression:{ref:"style.font.useColorExpression",type:"boolean",translation:"properties.fontColor",component:"dropdown",options:R},colorPicker:{component:"color-picker",type:"object",ref:"style.font.color",translation:"properties.color",dualOutput:!0,show:e=>!U.getValue(e,"style.font.useColorExpression")},colorExpression:{component:"string",type:"string",ref:"style.font.colorExpression",translation:"Common.Expression",expression:"optional",show:e=>U.getValue(e,"style.font.useColorExpression")}}},stylingAndAlign:{type:"items",items:{fontStyling:{component:"item-selection-list",type:"string",ref:"style.font.style",translation:"properties.textStyle",horizontal:!0,multipleSelect:!0,items:[{component:"icon-item",icon:"bold",value:"bold",translation:"Common.bold",labelPlacement:"bottom"},{component:"icon-item",icon:"italic",value:"italic",translation:"Common.italic",labelPlacement:"bottom"},{component:"icon-item",icon:"underline",value:"underline",translation:"Common.underline",labelPlacement:"bottom"}]},textAlign:{component:"item-selection-list",type:"string",ref:"style.font.align",translation:"properties.Alignment",horizontal:!0,items:[{component:"icon-item",icon:"align_left",value:"left",translation:"properties.dock.left",labelPlacement:"bottom"},{component:"icon-item",icon:"align_center",value:"center",translation:"Common.Center",labelPlacement:"bottom"},{component:"icon-item",icon:"align_right",value:"right",translation:"properties.dock.right",labelPlacement:"bottom"}]}}}},show:!a},background:{grouped:!0,type:"items",translation:"properties.background",items:{backgroundColor:{type:"items",items:{useColorExpression:{ref:"style.background.useColorExpression",type:"boolean",translation:"AppDetails.SheetBackgroundColor",component:"dropdown",options:R},colorPicker:{component:"color-picker",type:"object",ref:"style.background.color",translation:"properties.color",dualOutput:!0,show:e=>!U.getValue(e,"style.background.useColorExpression")},colorExpression:{component:"string",type:"string",ref:"style.background.colorExpression",translation:"Common.Expression",expression:"optional",show:e=>U.getValue(e,"style.background.useColorExpression")}}},backgroundImage:{type:"items",items:{useBackgroundImage:{ref:"style.background.useImage",type:"boolean",translation:"properties.backgroundImage.use",component:"switch",options:M},backgroundUrl:{ref:"style.background.url.qStaticContentUrlDef.qUrl",layoutRef:"style.background.url.qStaticContentUrl.qUrl",schemaIgnore:!0,translation:"Common.Image",tooltip:{select:"properties.media.select",remove:"properties.media.removeBackground"},type:"string",component:"media",show:e=>U.getValue(e,"style.background.useImage")},backgroundSize:{ref:"style.background.size",translation:"properties.backgroundImage.size",type:"string",component:"dropdown",options:[{value:"auto",translation:"properties.backgroundImage.originalSize"},{value:"alwaysFit",translation:"properties.backgroundImage.sizeAlwaysFit"},{value:"fitWidth",translation:"properties.backgroundImage.sizeFitWidth"},{value:"fitHeight",translation:"properties.backgroundImage.sizeFitHeight"},{value:"fill",translation:"properties.backgroundImage.sizeStretch"},{value:"alwaysFill",translation:"properties.backgroundImage.sizeAlwaysFill"}],show:e=>U.getValue(e,"style.background.useImage")&&!!U.getValue(e,"style.background.url.qStaticContentUrlDef.qUrl")},backgroundPosition:{ref:"style.background.position",translation:"Common.Position",type:"string",component:"align-matrix",show:e=>U.getValue(e,"style.background.useImage")&&U.getValue(e,"style.background.url.qStaticContentUrlDef.qUrl")&&"fill"!==U.getValue(e,"style.background.size"),currentSize:e=>U.getValue(e,"style.background.size")}}}}},border:{type:"items",grouped:!0,translation:"properties.border",items:{borderSettings:{type:"items",items:{useBorder:{ref:"style.border.useBorder",type:"boolean",translation:"properties.border.use",component:"switch",options:M},borderRadius:{component:"slider",show:e=>U.getValue(e,"style.border.useBorder"),translation:"properties.border.radius",type:"number",ref:"style.border.radius",min:0,max:1,step:.01},borderWidth:{component:"slider",show:e=>U.getValue(e,"style.border.useBorder"),type:"number",ref:"style.border.width",translation:"properties.border.width",min:0,max:.5,step:.005},colorDropdown:{type:"string",show:e=>U.getValue(e,"style.border.useBorder"),component:"dropdown",translation:"properties.border.color",ref:"style.border.useColorExpression",options:R},colorPicker:{component:"color-picker",type:"object",ref:"style.border.color",translation:"properties.color",dualOutput:!0,show:e=>U.getValue(e,"style.border.useBorder")&&!U.getValue(e,"style.border.useColorExpression")},colorExpression:{component:"string",type:"string",ref:"style.border.colorExpression",translation:"Common.Expression",show:e=>U.getValue(e,"style.border.useBorder")&&U.getValue(e,"style.border.useColorExpression"),expression:"optional"}}}}},icon:{type:"items",grouped:!0,translation:"properties.icon",items:{iconSettings:{type:"items",items:{useIcon:{ref:"style.icon.useIcon",type:"boolean",translation:"properties.icon.use",component:"switch",options:M},iconType:{ref:"style.icon.iconType",component:"expression-with-dropdown",translation:"properties.icon",defaultValue:"",options:H,expressionType:"StringExpression",show:e=>U.getValue(e,"style.icon.useIcon")},iconPosition:{ref:"style.icon.position",component:"dropdown",translation:"Common.Position",options:[{translation:"properties.dock.left",value:"left"},{translation:"properties.dock.right",value:"right"}],show:e=>U.getValue(e,"style.icon.useIcon")}}}}},presentation:a?z(i):void 0}}}},importProperties:G,exportProperties:null,support:{export:!1,exportData:!1,snapshot:!1,viewData:!1,quickMobile:!0}}}const J={aliceblue:{r:240,g:248,b:255},antiquewhite:{r:250,g:235,b:215},aqua:{r:0,g:255,b:255},aquamarine:{r:127,g:255,b:212},azure:{r:240,g:255,b:255},beige:{r:245,g:245,b:220},bisque:{r:255,g:228,b:196},black:{r:0,g:0,b:0},blanchedalmond:{r:255,g:235,b:205},blue:{r:0,g:0,b:255},blueviolet:{r:138,g:43,b:226},brown:{r:165,g:42,b:42},burlywood:{r:222,g:184,b:135},cadetblue:{r:95,g:158,b:160},chartreuse:{r:127,g:255,b:0},chocolate:{r:210,g:105,b:30},coral:{r:255,g:127,b:80},cornflowerblue:{r:100,g:149,b:237},cornsilk:{r:255,g:248,b:220},crimson:{r:220,g:20,b:60},cyan:{r:0,g:255,b:255},darkblue:{r:0,g:0,b:139},darkcyan:{r:0,g:139,b:139},darkgoldenrod:{r:184,g:134,b:11},darkgray:{r:169,g:169,b:169},darkgreen:{r:0,g:100,b:0},darkgrey:{r:169,g:169,b:169},darkkhaki:{r:189,g:183,b:107},darkmagenta:{r:139,g:0,b:139},darkolivegreen:{r:85,g:107,b:47},darkorange:{r:255,g:140,b:0},darkorchid:{r:153,g:50,b:204},darkred:{r:139,g:0,b:0},darksalmon:{r:233,g:150,b:122},darkseagreen:{r:143,g:188,b:143},darkslateblue:{r:72,g:61,b:139},darkslategray:{r:47,g:79,b:79},darkslategrey:{r:47,g:79,b:79},darkturquoise:{r:0,g:206,b:209},darkviolet:{r:148,g:0,b:211},deeppink:{r:255,g:20,b:147},deepskyblue:{r:0,g:191,b:255},dimgray:{r:105,g:105,b:105},dimgrey:{r:105,g:105,b:105},dodgerblue:{r:30,g:144,b:255},firebrick:{r:178,g:34,b:34},floralwhite:{r:255,g:250,b:240},forestgreen:{r:34,g:139,b:34},fuchsia:{r:255,g:0,b:255},gainsboro:{r:220,g:220,b:220},ghostwhite:{r:248,g:248,b:255},gold:{r:255,g:215,b:0},goldenrod:{r:218,g:165,b:32},gray:{r:128,g:128,b:128},green:{r:0,g:128,b:0},greenyellow:{r:173,g:255,b:47},grey:{r:128,g:128,b:128},honeydew:{r:240,g:255,b:240},hotpink:{r:255,g:105,b:180},indianred:{r:205,g:92,b:92},indigo:{r:75,g:0,b:130},ivory:{r:255,g:255,b:240},khaki:{r:240,g:230,b:140},lavender:{r:230,g:230,b:250},lavenderblush:{r:255,g:240,b:245},lawngreen:{r:124,g:252,b:0},lemonchiffon:{r:255,g:250,b:205},lightblue:{r:173,g:216,b:230},lightcoral:{r:240,g:128,b:128},lightcyan:{r:224,g:255,b:255},lightgoldenrodyellow:{r:250,g:250,b:210},lightgray:{r:211,g:211,b:211},lightgreen:{r:144,g:238,b:144},lightgrey:{r:211,g:211,b:211},lightpink:{r:255,g:182,b:193},lightsalmon:{r:255,g:160,b:122},lightseagreen:{r:32,g:178,b:170},lightskyblue:{r:135,g:206,b:250},lightslategray:{r:119,g:136,b:153},lightslategrey:{r:119,g:136,b:153},lightsteelblue:{r:176,g:196,b:222},lightyellow:{r:255,g:255,b:224},lime:{r:0,g:255,b:0},limegreen:{r:50,g:205,b:50},linen:{r:250,g:240,b:230},magenta:{r:255,g:0,b:255},maroon:{r:128,g:0,b:0},mediumaquamarine:{r:102,g:205,b:170},mediumblue:{r:0,g:0,b:205},mediumorchid:{r:186,g:85,b:211},mediumpurple:{r:147,g:112,b:219},mediumseagreen:{r:60,g:179,b:113},mediumslateblue:{r:123,g:104,b:238},mediumspringgreen:{r:0,g:250,b:154},mediumturquoise:{r:72,g:209,b:204},mediumvioletred:{r:199,g:21,b:133},midnightblue:{r:25,g:25,b:112},mintcream:{r:245,g:255,b:250},mistyrose:{r:255,g:228,b:225},moccasin:{r:255,g:228,b:181},navajowhite:{r:255,g:222,b:173},navy:{r:0,g:0,b:128},oldlace:{r:253,g:245,b:230},olive:{r:128,g:128,b:0},olivedrab:{r:107,g:142,b:35},orange:{r:255,g:165,b:0},orangered:{r:255,g:69,b:0},orchid:{r:218,g:112,b:214},palegoldenrod:{r:238,g:232,b:170},palegreen:{r:152,g:251,b:152},paleturquoise:{r:175,g:238,b:238},palevioletred:{r:219,g:112,b:147},papayawhip:{r:255,g:239,b:213},peachpuff:{r:255,g:218,b:185},peru:{r:205,g:133,b:63},pink:{r:255,g:192,b:203},plum:{r:221,g:160,b:221},powderblue:{r:176,g:224,b:230},purple:{r:128,g:0,b:128},rebeccapurple:{r:102,g:51,b:153},red:{r:255,g:0,b:0},rosybrown:{r:188,g:143,b:143},royalblue:{r:65,g:105,b:225},saddlebrown:{r:139,g:69,b:19},salmon:{r:250,g:128,b:114},sandybrown:{r:244,g:164,b:96},seagreen:{r:46,g:139,b:87},seashell:{r:255,g:245,b:238},sienna:{r:160,g:82,b:45},silver:{r:192,g:192,b:192},skyblue:{r:135,g:206,b:235},slateblue:{r:106,g:90,b:205},slategray:{r:112,g:128,b:144},slategrey:{r:112,g:128,b:144},snow:{r:255,g:250,b:250},springgreen:{r:0,g:255,b:127},steelblue:{r:70,g:130,b:180},tan:{r:210,g:180,b:140},teal:{r:0,g:128,b:128},thistle:{r:216,g:191,b:216},tomato:{r:255,g:99,b:71},transparent:{r:255,g:255,b:255,a:0},turquoise:{r:64,g:224,b:208},violet:{r:238,g:130,b:238},wheat:{r:245,g:222,b:179},white:{r:255,g:255,b:255},whitesmoke:{r:245,g:245,b:245},yellow:{r:255,g:255,b:0},yellowgreen:{r:154,g:205,b:50}},Q={resolveExpression:e=>{let t=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(e);if(t)return`rgb(${t[1]},${t[2]},${t[3]})`;if(t=/^argb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(e),t){const e=Math.round(t[1]/255*100)/100;return`rgba(${t[2]},${t[3]},${t[4]},${e})`}if(t=/^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i.exec(e),t)return e;const o=e&&J[e.toLowerCase()];if(o){const e=void 0!==o.a?o.a:1;return`rgba(${o.r},${o.g},${o.b},${e})`}return"none"},getFadedColor(e){const t=.15;let o,n,a,i;if(e.length>7){o=e.split(",");const l=-1!==o[0].indexOf("a");return n=l?parseInt(o[0].slice(5),10):parseInt(o[0].slice(4),10),i=parseInt(o[1],10),a=parseInt(o[2],10),`${(l?"rgba(":"rgb(")+(Math.round((0-n)*t)+n)},${Math.round((0-i)*t)+i},${Math.round((0-a)*t)+a}${l?`,${o[3]}`:")"}`}return o=parseInt(e.slice(1),16),n=o>>16,i=o>>8&255,a=255&o,`#${(16777216+65536*(Math.round((0-n)*t)+n)+256*(Math.round((0-i)*t)+i)+(Math.round((0-a)*t)+a)).toString(16).slice(1)}`}},ee={auto:"auto auto",alwaysFit:"contain",fitWidth:"100% auto",fitHeight:"auto 100%",fill:"100% 100%",alwaysFill:"cover"},te={topLeft:"0% 0%",centerLeft:"50% 0%",bottomLeft:"100% 0%",topCenter:"0% 50%",centerCenter:"50% 50%",bottomCenter:"100% 50%",topRight:"0% 100%",centerRight:"50% 100%",bottomRight:"100% 100%"},oe=(e,t)=>`${e}: ${t};`,ne=({useColorExpression:e=!1,colorExpression:t="",color:o=s.COLOR},n,a)=>{let i;return e?i=Q.resolveExpression(t):"string"==typeof o?i=o:o&&(i=a.getColorPickerColor(o)),i&&"none"!==i?i:n};var ae={getStyles({style:e={},disabled:t,theme:o,element:n,app:a}){let i="width: 100%;height: 100%;transition: transform .1s ease-in-out;position: absolute;bottom: 0;left: 0; top: 0;right: 0;margin: auto;";const{font:l={},background:r={},border:c={}}=e,u=o.getDataColorSpecials().primary;i+=t?oe("opacity",.4):oe("cursor","pointer");const d=ne(r,u,o);i+=oe("color",ne(l,"#ffffff",o));const b=l.style||s.FONT_STYLE;if(b.bold&&(i+=oe("font-weight","bold")),b.italic&&(i+=oe("font-style","italic")),i+=oe("background-color",d),r.useImage&&r.url.qStaticContentUrl){let e=r.url.qStaticContentUrl.qUrl;e&&(e=((e,t)=>(e.replace(/^\.\.\//i,"/"),e=(e=e.replace(/"/g,'\\"')).replace(/'/g,"\\'"),e=`${p(t)}/`+("/"===e[0]?e.substr(1):e)))(e,a),i+=oe("background-image",`url('${e}')`),i+=oe("background-size",ee[r.size||s.BACKGROUND_SIZE]),i+=oe("background-position",te[r.position||s.BACKGROUND_POSITION]),i+=oe("background-repeat","no-repeat"))}if(c.useBorder){const e=Math.min(n.offsetWidth,n.offsetHeight),t=ne(c,Q.getFadedColor(d),o),a=(c.width||s.BORDER_WIDTH)*e/2;i+=oe("border",`${a}px solid ${t}`),i+=oe("border-radius",(c.radius||s.BORDER_RADIUS)*e/2+"px")}else i+="border: none;";return i},createLabelAndIcon({button:e,theme:t,style:o={},isSense:n}){const{icon:a={},font:i={},label:l=s.LABEL}=o,r=document.createElement("text");r.style.whiteSpace="nowrap",r.style.fontFamily=o.font.fontFamily||t.getStyle("","","fontFamily")||s.FONT_FAMILY;const c=document.createElement("span");c.textContent=l,c.style.whiteSpace="nowrap",c.style.textOverflow="ellipsis",c.style.overflow="visible",i.style&&i.style.underline&&(c.style.textDecoration="underline"),r.appendChild(c);const u=n&&a.useIcon&&""!==a.iconType;if(u){const e=document.createElement("span"),t=H.find((e=>e.label===a.iconType||e.value===a.iconType));e.style.textDecoration="none",e.style.fontSize="inherit",e.setAttribute("class",`lui-icon lui-icon--${t?t.value:""}`),"right"===a.position?r.appendChild(e):r.insertBefore(e,c)}e.innerHTML="",e.appendChild(r),r.style.fontSize=`${e.clientHeight}px`;let p=e.clientHeight/r.offsetHeight*e.clientHeight;r.style.fontSize=`${p}px`,r.offsetWidth>e.clientWidth&&(p*=e.clientWidth/r.offsetWidth);const d=i.size||s.FONT_SIZE;i.style&&i.style.italic?u?(r.style.fontSize=`${Math.max(p*d*.84,8)}px`,r.children[0].style.marginRight=.04*r.offsetWidth+"px",r.children[1].style.marginRight=.04*r.offsetWidth+"px"):(r.style.fontSize=`${Math.max(p*d*.9,8)}px`,r.children[0].style.marginRight=.02*r.offsetWidth+"px"):u?(r.style.fontSize=`${Math.max(p*d*.88,8)}px`,r.children[0].style.marginRight=.04*r.offsetWidth+"px"):r.style.fontSize=`${Math.max(p*d*.92,8)}px`,"8px"===r.style.fontSize&&r.children.forEach((e=>{e.style.overflow="hidden"})),r.style.margin="0 3%",r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="left"===i.align?"flex-start":"right"===i.align?"flex-end":"center"}};function ie(s){var p,d;const{sense:b,translator:g,flags:{isEnabled:m},anything:f}=s,h={isEnabled:m,isFeatureBlacklisted:null===(p=f.sense)||void 0===p?void 0:p.isFeatureBlacklisted,isUnsupportedFeature:null===(d=f.sense)||void 0===d?void 0:d.isUnsupportedFeature},v=null==m?void 0:m("SENSECLIENT_IM_1855_AUTOMATIONS_MULTI_USER"),y=null==b?void 0:b.navigation;return c.style.label=b?g.get("Object.ActionButton"):"Button",{qae:{properties:c,data:u},component(){const s=e(),c=t();o((()=>{const e=document.createElement("button");e.appendChild(document.createElement("text")),s.appendChild(e)}),[]);const u=n(),p=a(),d=i(),b=(({layout:e,theme:t,app:o,constraints:n,senseNavigation:a,element:i,multiUserAutomation:l,translator:r})=>{const s=!!a,c=i.firstElementChild,{style:u,qStateName:p,navigation:d}=e,b=e.qInfo.qId,g=e.useEnabledCondition&&0===e.enabledCondition,m=!g&&!n.active,f=ae.getStyles({style:u,disabled:g,theme:t,element:i,app:o});c.setAttribute("style",f),c.setAttribute("tabindex","-1"),ae.createLabelAndIcon({button:c,theme:t,style:u,isSense:s}),c.onclick=async()=>{if(m){const t=[],{actions:n}=e;if(n.forEach((e=>{const n=N.find((t=>t.value===e.actionType));n&&t.push(n.getActionCall({app:o,qStateName:p,...e,senseNavigation:a,buttonId:b,multiUserAutomation:l,translator:r}))})),c.setAttribute("disabled",!0),await(async e=>{for(let t=0;t<e.length;t++)await e[t]()})(t),a&&!a.getCurrentStoryId()){const e=d&&$.find((e=>e.value===d.action));a&&e&&"function"==typeof e.navigationCall&&await e.navigationCall({app:o,senseNavigation:a,...d,element:i})}c.removeAttribute("disabled")}};const h=()=>{if(m){const{offsetWidth:e,offsetHeight:t}=c;c.style.transform=t>e?`scale(0.98, ${1-e/t*.02})`:`scale(${1-t/e*.02}, 0.98)`}},v=()=>{const{transform:e}=c.style;m&&""!==e&&"scale(1)"!==e&&(c.style.transform="scale(1)")};return c.onmousedown=e=>{0===e.button&&h()},c.onmouseup=v,c.onmouseleave=v,c.ontouchstart=h,c.ontouchend=v,c.ontouchcancel=v,()=>{c.onclick=void 0,c.onmousedown=void 0,c.onmouseup=void 0,c.onmouseleave=void 0,c.ontouchstart=void 0,c.ontouchend=void 0,c.ontouchcancel=void 0}})({element:s,layout:u,constraints:d,theme:c,app:p,senseNavigation:y,multiUserAutomation:v,translator:g});l((()=>()=>{b()}),[s]),r((()=>({focus(){s.firstElementChild.onclick()}})),[s])},ext:X({translator:g,shouldHide:h,senseNavigation:y})}}export{ie as default};