!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require,exports):"function"==typeof define&&define.amd&&define(["require","exports","tslib","../../Validation","../../forms/utils","../../TemplateUtils"],e)}(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=e("tslib"),c=e("../../Validation"),m=e("../../forms/utils"),f=o.__importStar(e("../../TemplateUtils")),e=(l.prototype._isLabelFieldName=function(e,t){return void 0!==(t&&0<t.length?t[0][e]:void 0)},l.prototype._getTokenValues=function(e,t){for(var o={},l=0,i=e;l<i.length;l++){var a,n=i[l].token;o.hasOwnProperty(n)||(a=t[n],a=f.getTokenValueString(n,a),o[n]=m.text.escapeTextForMarkdown(a))}return o},l.prototype.execute=function(e,t){for(var o=e.labelFieldName||void 0,l=c.validation.array("collection",e.collection,c.validation.never),i={},a=this._isLabelFieldName(o,l),n=a?[]:f.findTokenInstances(o),r=0;r<l.length;++r){var s=l[r],u=void 0;null==(u=a?s[e.labelFieldName]:o?(d=this._getTokenValues(n,s),f.replacePlaceholders(o,n,d)):s)&&(u="");var d={};e.valueFieldName?d.value=s[e.valueFieldName]:d.value={refValueType:"data",type:"object",data:s},m.text.isMarkdown(u)?d.label=u:d.label=u.toString(),i[r]=d}return{items:i}},l.action="gcx:wf:forms::GetFormElementItemsFromCollection",l.suite="gcx:wf:builtin",l);function l(){}t.GetFormElementItemsFromCollection=e});